Commit 9e8887b9 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

Plumb through V8 use counter for matchAll with non-g RegExp

Per the July TC39 meeting consensus, we'd like to make the
upcoming String.prototype.replaceAll proposal throw for
non-global RegExp searchValues. However,
String.prototype.matchAll currently does not throw in this
case, causing consistency concerns.

This patch adds a use counter for String.prototype.matchAll
with a non-global RegExp as the searchValue. Hopefully, this
pattern isn't too common in real-world code today, in which case
we can both a) change matchAll and b) proceed with the desired
replaceAll semantics.

https://github.com/tc39/proposal-string-replaceall/issues/16

V8 CL: https://chromium-review.googlesource.com/c/v8/v8/+/1718145
Chromium CL: https://chromium-review.googlesource.com/c/chromium/src/+/1718367

BUG=v8:9551

Change-Id: I6b4895e87bb498c0284d2852f1d9f0cafbc087d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1718367
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681918}
parent 8c5dbbac
......@@ -2359,6 +2359,7 @@ enum WebFeature {
kAutoplayDynamicDelegation = 2977,
kToggleEventHandlerDuringParsing = 2978,
kFragmentDoubleHash = 2979,
kV8RegExpMatchAllWithNonGlobalRegExp = 2980,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -234,6 +234,9 @@ void UseCounterCallback(v8::Isolate* isolate,
case v8::Isolate::kCallSiteAPIGetThisSloppyCall:
blink_feature = WebFeature::kV8CallSiteAPIGetThisSloppyCall;
break;
case v8::Isolate::kRegExpMatchAllWithNonGlobalRegExp:
blink_feature = WebFeature::kV8RegExpMatchAllWithNonGlobalRegExp;
break;
default:
// This can happen if V8 has added counters that this version of Blink
// does not know about. It's harmless.
......
......@@ -24148,6 +24148,7 @@ Called by update_net_error_codes.py.-->
<int value="2977" label="AutoplayDynamicDelegation"/>
<int value="2978" label="ToggleEventHandlerDuringParsing"/>
<int value="2979" label="FragmentDoubleHash"/>
<int value="2980" label="V8RegExpMatchAllWithNonGlobalRegExp"/>
</enum>
<enum name="FeaturePolicyAllowlistType">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment