-
Notifications
You must be signed in to change notification settings - Fork 13
Amend specification to use 'd' flag for indices. #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is missing an entry in “RegExp.prototype.flags”
@ljharb I've made your requested changes. Can you take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending the one comment
@ljharb I've made the final change you proposed as well as unconditionally creating |
One more change, the extra |
Why didn't we choose |
Primarily to reduce spec and implementation churn, and given that there are no web compat concerns with the name |
We've already hit the "implementations require spec changes" requirement for changes in Stage 3. If we're changing the spec at Stage 3, let's fix it entirely. Using |
We'd already discussed this here: #47 (comment). I discussed both |
I had read the other threads, but hadn't seen |
This CL implements the upcoming spec change: tc39/proposal-regexp-match-indices#49 A new JSRegExpResultWithIndices subclass is introduced with a separate map and an extra slot for storing the indices. If /d is passed, exec() constructs a JSRegExpResultWithIndices and eagerly builds indices. The existing re-execution logic is removed. Bug: v8:9548 Change-Id: Ic11853e7521017af5e8bd583c7b82bb672821132 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2616873 Commit-Queue: Shu-yu Guo <[email protected]> Reviewed-by: Jakob Gruber <[email protected]> Reviewed-by: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/master@{#72306}
This changes the proposal to only include
indices
if ad
flag is present in the RegExp as a performance mitigation.NOTE: We have not yet decided as to whether this is the final approach we will take, but this will give us an outline of the specification text we might use to achieve the mitigation.
Preview can be found here: https://tc39.es/proposal-regexp-match-indices/pr/49/index.html
Fixes #46
Fixes #47