WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
155177
[ES6] Implement RegExp sticky flag and related functionality
https://bugs.webkit.org/show_bug.cgi?id=155177
Summary
[ES6] Implement RegExp sticky flag and related functionality
Michael Saboff
Reported
2016-03-08 11:04:25 PST
Implement the sticky flag, 'y', and the behavior described in the ES6 spec.
Attachments
Patch
(56.78 KB, patch)
2016-03-09 10:41 PST
,
Michael Saboff
saam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-03-08 11:04:52 PST
<
rdar://problem/25038274
>
Michael Saboff
Comment 2
2016-03-09 10:41:27 PST
Created
attachment 273443
[details]
Patch
WebKit Commit Bot
Comment 3
2016-03-09 10:42:37 PST
Attachment 273443
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/yarr/YarrPattern.h:305: The parameter name "flags" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 26 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 4
2016-03-09 10:48:38 PST
Comment on
attachment 273443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=273443&action=review
> Source/JavaScriptCore/ChangeLog:15 > + Changed both the Yarr interpreter and jit to no loop to the next character for sticky RegExp's.
typo: "to no loop" ==> "to not loop"?
Mark Lam
Comment 5
2016-03-09 10:59:05 PST
Comment on
attachment 273443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=273443&action=review
> Source/JavaScriptCore/runtime/RegExpPrototype.cpp:179 > + if (exec->hadException()) > + return string; > + JSValue stickyValue = regexp->get(exec, exec->propertyNames().sticky); > + if (exec->hadException()) > + return string;
Perhaps take this opportunity to cache "VM& vm = exec->vm();" up top and use "vm.exception()" in all these tests?
Saam Barati
Comment 6
2016-03-09 11:23:57 PST
Comment on
attachment 273443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=273443&action=review
r=me
> Source/JavaScriptCore/runtime/RegExpPrototype.cpp:179 > + if (exec->hadException()) > + return string;
All the exception checks in this function would be better off if they cached the VM at the top and checked vm.exception()
> Source/JavaScriptCore/yarr/YarrJIT.cpp:1848 > + // If the pattern size is not fixed, then store the start index, for use if we match.
second comma not needed.
> Source/JavaScriptCore/yarr/YarrJIT.cpp:1898 > + removeCallFrame(); > + move(TrustedImmPtr((void*)WTF::notFound), returnRegister); > + move(TrustedImm32(0), returnRegister2); > + generateReturn();
This code is repeated in a couple other places. Might be worth a helper.
> LayoutTests/js/script-tests/regexp-sticky.js:56 > + for (var iter = 0; iter < expected.length; iter++) { > + let lastIndexStart = re.lastIndex; > + > + let result = str.match(re); > + let correctResult = false; > + if (expected[iter] === null || result === null) > + correctResult = (expected[iter] === result); > + else if (result.length == expected[iter].length) { > + correctResult = true; > + for (let i = 0; i < result.length; i++) { > + if (result[i] != expected[iter][i]) > + correctResult = false; > + } > + }
Style: Indentation is off here.
Michael Saboff
Comment 7
2016-03-09 12:11:33 PST
Committed
r197869
: <
http://trac.webkit.org/changeset/197869
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug