-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read global and sticky from [[OriginalFlags]] in RegExpBuiltinExec #494
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
littledan
force-pushed
the
regexp-original-flags
branch
from
March 26, 2016 00:59
00696f4
to
3bb8214
Compare
This closes tc39#489. RegExpBuiltinExec reads other flags from [[OriginalFlags]], based on the fact that it is operating on a RegExp instance. In ES2015, however, it accessed 'global' and 'sticky' via property accesses. This patch changes RegExpBuiltinExec to access those flags via [[OriginalFlags]] as well.
littledan
force-pushed
the
regexp-original-flags
branch
from
March 28, 2016 22:42
3bb8214
to
05ba4c8
Compare
kisg
pushed a commit
to paul99/v8mips
that referenced
this pull request
Apr 4, 2016
- RegExp.prototype.toString() doesn't have any special handling of RegExp instances and simply calls the source and flags getters - Use the original values of global and sticky, rather than based on the current flag getters, as specified in tc39/ecma262#494 [email protected],adamk LOG=Y BUG=v8:4602 Review URL: https://codereview.chromium.org/1846303002 Cr-Commit-Position: refs/heads/master@{#35225}
jugglinmike
added a commit
to bocoup/es6draft
that referenced
this pull request
May 3, 2016
The ES2016 draft modifies the semantics of RegExpBuiltinExec to infer "global" and "sticky" using the regular expression object's [[OriginalFlags]] internal slot [1]. Update the algorithm accordingly. This change removes two observable operations. An existing regression test relied on one of these operations (accessing the `global` property) during the evaluation of `RegExp.prototype[@@replace]`. Update the regression test to use a different mechanism to assert the same semantics. [1] tc39/ecma262#494
jugglinmike
added a commit
to bocoup/test262
that referenced
this pull request
May 3, 2016
The RegExpBuiltinExec internal operation was modified in March of 2016 [1]: instead of referencing the `global` and `sticky` properties of the "this" value, the algorithm now infers those values from the object's [[OriginalFlags]] internal slot. This change invalidated a number of tests. In cases where the change resulted in an observable behavior, update the tests to assert the latest specification text. In cases where the change removed a previously-observable behavior, remove the files completely. Specification text change set: > 1. Assert: Type(_S_) is String. > 1. Let _length_ be the number of code units in _S_. > 1. Let _lastIndex_ be ? ToLength(? Get(_R_, `"lastIndex"`)). > - 1. Let _global_ be ToBoolean(? Get(_R_, `"global"`)). > - 1. Let _sticky_ be ToBoolean(? Get(_R_, `"sticky"`)). > + 1. Let _flags_ be the value of _R_'s [[OriginalFlags]] internal slot. > + 1. If _flags_ contains `"g"`, let _global_ be *true*, else let _global_ be *false*. > + 1. If _flags_ contains `"y"`, let _sticky_ be *true*, else let _sticky_ be *false*. > 1. If _global_ is *false* and _sticky_ is *false*, let _lastIndex_ be 0. > 1. Let _matcher_ be the value of _R_'s [[RegExpMatcher]] internal slot. > - 1. Let _flags_ be the value of _R_'s [[OriginalFlags]] internal slot. > 1. If _flags_ contains `"u"`, let _fullUnicode_ be *true*, else let _fullUnicode_ be *false*. > 1. Let _matchSucceeded_ be *false*. > 1. Repeat, while _matchSucceeded_ is *false* [1] tc39/ecma262#494
jugglinmike
added a commit
to jugglinmike/es6draft
that referenced
this pull request
May 3, 2016
The ES2016 draft modifies the semantics of RegExpBuiltinExec to infer "global" and "sticky" using the regular expression object's [[OriginalFlags]] internal slot [1]. Update the algorithm accordingly. This change removes two observable operations. An existing regression test relied on one of these operations (accessing the `global` property) during the evaluation of `RegExp.prototype[@@replace]`. Update the regression test to use a different mechanism to assert the same semantics. [1] tc39/ecma262#494
leobalter
pushed a commit
to tc39/test262
that referenced
this pull request
May 9, 2016
The RegExpBuiltinExec internal operation was modified in March of 2016 [1]: instead of referencing the `global` and `sticky` properties of the "this" value, the algorithm now infers those values from the object's [[OriginalFlags]] internal slot. This change invalidated a number of tests. In cases where the change resulted in an observable behavior, update the tests to assert the latest specification text. In cases where the change removed a previously-observable behavior, remove the files completely. Specification text change set: > 1. Assert: Type(_S_) is String. > 1. Let _length_ be the number of code units in _S_. > 1. Let _lastIndex_ be ? ToLength(? Get(_R_, `"lastIndex"`)). > - 1. Let _global_ be ToBoolean(? Get(_R_, `"global"`)). > - 1. Let _sticky_ be ToBoolean(? Get(_R_, `"sticky"`)). > + 1. Let _flags_ be the value of _R_'s [[OriginalFlags]] internal slot. > + 1. If _flags_ contains `"g"`, let _global_ be *true*, else let _global_ be *false*. > + 1. If _flags_ contains `"y"`, let _sticky_ be *true*, else let _sticky_ be *false*. > 1. If _global_ is *false* and _sticky_ is *false*, let _lastIndex_ be 0. > 1. Let _matcher_ be the value of _R_'s [[RegExpMatcher]] internal slot. > - 1. Let _flags_ be the value of _R_'s [[OriginalFlags]] internal slot. > 1. If _flags_ contains `"u"`, let _fullUnicode_ be *true*, else let _fullUnicode_ be *false*. > 1. Let _matchSucceeded_ be *false*. > 1. Repeat, while _matchSucceeded_ is *false* [1] tc39/ecma262#494
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This closes #489. RegExpBuiltinExec reads other flags from
[[OriginalFlags]], based on the fact that it is operating on a RegExp
instance. In ES2015, however, it accessed 'global' and 'sticky' via
property accesses. This patch changes RegExpBuiltinExec to access
those flags via [[OriginalFlags]] as well.