commit 308fa93df32b39923d2541215d3712f5debf3d68
parent a6cac184cf434c0324f8e22994c923547b98cbcf
Author: Daniel Minor <dminor@mozilla.com>
Date: Tue, 25 Nov 2025 19:12:07 +0000
Bug 1998177 - Remove JS_regexp_symbol_protocol_on_primitive use counter; r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D273155
Diffstat:
6 files changed, 21 insertions(+), 135 deletions(-)
diff --git a/dom/base/UseCounters.conf b/dom/base/UseCounters.conf
@@ -80,7 +80,6 @@ custom JS_ic_stub_too_large tried to create an IC stub that was too large
custom JS_ic_stub_oom OOMed while creating IC stub
custom JS_dateparse called Date.parse
custom JS_dateparse_impl_def call to Date.parse used implementation defined behaviour
-custom JS_regexp_symbol_protocol_on_primitive passed a primitive with a custom implementation of the regexp protocol symbols to one of the String methods that accept a regexp
custom JS_large_oom_reported reported a large oom
custom JS_small_oom_reported reported a small oom
custom JS_large_oom_recovered recovered a large oom
diff --git a/dom/base/use_counter_metrics.yaml b/dom/base/use_counter_metrics.yaml
@@ -108,8 +108,8 @@ use.counter:
send_in_pings:
- use-counters
-# Total of 2382 use counter metrics (excludes denominators).
-# Total of 357 'page' use counters.
+# Total of 2380 use counter metrics (excludes denominators).
+# Total of 356 'page' use counters.
use.counter.page:
svgsvgelement_getelementbyid:
type: counter
@@ -740,23 +740,6 @@ use.counter.page:
send_in_pings:
- use-counters
- js_regexp_symbol_protocol_on_primitive:
- type: counter
- description: >
- Whether a page passed a primitive with a custom implementation of the regexp protocol symbols to one of the String methods that accept a regexp.
- Compare against `use.counter.top_level_content_documents_destroyed`
- to calculate the rate.
- bugs:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
- data_reviews:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
- notification_emails:
- - dom-core@mozilla.com
- - emilio@mozilla.com
- expires: never
- send_in_pings:
- - use-counters
-
js_large_oom_reported:
type: counter
description: >
@@ -6180,7 +6163,7 @@ use.counter.page:
send_in_pings:
- use-counters
-# Total of 357 'document' use counters.
+# Total of 356 'document' use counters.
use.counter.doc:
svgsvgelement_getelementbyid:
type: counter
@@ -6811,23 +6794,6 @@ use.counter.doc:
send_in_pings:
- use-counters
- js_regexp_symbol_protocol_on_primitive:
- type: counter
- description: >
- Whether a document passed a primitive with a custom implementation of the regexp protocol symbols to one of the String methods that accept a regexp.
- Compare against `use.counter.content_documents_destroyed`
- to calculate the rate.
- bugs:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
- data_reviews:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
- notification_emails:
- - dom-core@mozilla.com
- - emilio@mozilla.com
- expires: never
- send_in_pings:
- - use-counters
-
js_large_oom_reported:
type: counter
description: >
diff --git a/js/public/friend/UsageStatistics.h b/js/public/friend/UsageStatistics.h
@@ -81,25 +81,24 @@ using JSAccumulateTelemetryDataCallback = void (*)(JSMetric, uint32_t);
extern JS_PUBLIC_API void JS_SetAccumulateTelemetryCallback(
JSContext* cx, JSAccumulateTelemetryDataCallback callback);
-#define FOR_EACH_JS_USE_COUNTER(_) \
- _(ASMJS, AsmJS) \
- _(USE_ASM, UseAsm) \
- _(WASM, Wasm) \
- _(WASM_LEGACY_EXCEPTIONS, WasmLegacyExceptions) \
- _(ISHTMLDDA_FUSE, IsHTMLDDAFuse) \
- _(OPTIMIZE_GET_ITERATOR_FUSE, OptimizeGetIteratorFuse) \
- _(THENABLE_USE, ThenableUse) \
- _(THENABLE_USE_PROTO, ThenableUseProto) \
- _(THENABLE_USE_STANDARD_PROTO, ThenableUseStandardProto) \
- _(THENABLE_USE_OBJECT_PROTO, ThenableUseObjectProto) \
- _(LEGACY_LANG_SUBTAG, LegacyLangSubtag) \
- _(IC_STUB_TOO_LARGE, ICStubTooLarge) \
- _(IC_STUB_OOM, ICStubOOM) \
- _(DATEPARSE, DateParse) \
- _(DATEPARSE_IMPL_DEF, DateParseImplDef) \
- _(OPTIMIZE_ARRAY_SPECIES_FUSE, OptimizeArraySpeciesFuse) \
- _(OPTIMIZE_PROMISE_LOOKUP_FUSE, OptimizePromiseLookupFuse) \
- _(REGEXP_SYMBOL_PROTOCOL_ON_PRIMITIVE, RegExpSymbolProtocolOnPrimitive)
+#define FOR_EACH_JS_USE_COUNTER(_) \
+ _(ASMJS, AsmJS) \
+ _(USE_ASM, UseAsm) \
+ _(WASM, Wasm) \
+ _(WASM_LEGACY_EXCEPTIONS, WasmLegacyExceptions) \
+ _(ISHTMLDDA_FUSE, IsHTMLDDAFuse) \
+ _(OPTIMIZE_GET_ITERATOR_FUSE, OptimizeGetIteratorFuse) \
+ _(THENABLE_USE, ThenableUse) \
+ _(THENABLE_USE_PROTO, ThenableUseProto) \
+ _(THENABLE_USE_STANDARD_PROTO, ThenableUseStandardProto) \
+ _(THENABLE_USE_OBJECT_PROTO, ThenableUseObjectProto) \
+ _(LEGACY_LANG_SUBTAG, LegacyLangSubtag) \
+ _(IC_STUB_TOO_LARGE, ICStubTooLarge) \
+ _(IC_STUB_OOM, ICStubOOM) \
+ _(DATEPARSE, DateParse) \
+ _(DATEPARSE_IMPL_DEF, DateParseImplDef) \
+ _(OPTIMIZE_ARRAY_SPECIES_FUSE, OptimizeArraySpeciesFuse) \
+ _(OPTIMIZE_PROMISE_LOOKUP_FUSE, OptimizePromiseLookupFuse)
/*
* Use counter names passed to the accumulate use counter callback.
diff --git a/js/src/jit-test/tests/string-methods-regexp-symbols-telemetry.js b/js/src/jit-test/tests/string-methods-regexp-symbols-telemetry.js
@@ -1,62 +0,0 @@
-// Test the telemetry added in Bug 1950211
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 0);
-
-"abc".match(/b/);
-"abc".match({ [Symbol.match]: () => [] });
-"abc".match("b");
-"abc".match(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 0);
-Number.prototype[Symbol.match] = () => [];
-"abc".match(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 1);
-delete Number.prototype[Symbol.match];
-
-"abc".matchAll(/b/g);
-"abc".matchAll({ [Symbol.matchAll]: () => [] });
-"abc".matchAll("b");
-"abc".matchAll(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 1);
-Number.prototype[Symbol.matchAll] = () => [];
-"abc".matchAll(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 2);
-delete Number.prototype[Symbol.matchAll];
-
-"abc".replace(/b/, "d");
-"abc".replace({ [Symbol.replace]: () => "" });
-"abc".replace("b", "d");
-"abc".replace(42, "d");
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 2);
-Number.prototype[Symbol.replace] = () => "";
-"abc".replace(42, "d");
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 3);
-delete Number.prototype[Symbol.replace];
-
-"abc".replaceAll(/b/g, "d");
-"abc".replaceAll({ [Symbol.replace]: () => "" });
-"abc".replaceAll("b", "d");
-"abc".replaceAll(42, "d");
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 3);
-Number.prototype[Symbol.replace] = () => "";
-"abc".replaceAll(42, "d");
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 4);
-delete Number.prototype[Symbol.replace];
-
-"abc".search(/b/);
-"abc".search({ [Symbol.search]: () => -1 });
-"abc".search("b");
-"abc".search(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 4);
-Number.prototype[Symbol.search] = () => -1;
-"abc".search(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 5);
-delete Number.prototype[Symbol.search];
-
-"abc".split(/b/);
-"abc".split({ [Symbol.split]: () => [] });
-"abc".split("b");
-"abc".split(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 5);
-Number.prototype[Symbol.split] = () => [];
-"abc".split(42);
-assertEq(getUseCounterResults().RegExpSymbolProtocolOnPrimitive, 6);
-delete Number.prototype[Symbol.split];
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp
@@ -1096,16 +1096,6 @@ static bool intrinsic_StringReplaceString(JSContext* cx, unsigned argc,
return true;
}
-static bool intrinsic_RegExpSymbolProtocolOnPrimitiveCounter(JSContext* cx,
- unsigned argc,
- Value* vp) {
- // This telemetry is to assess compatibility for tc39/ecma262#3009 and
- // can later be removed (Bug 1953619).
- cx->runtime()->setUseCounter(
- cx->global(), JSUseCounter::REGEXP_SYMBOL_PROTOCOL_ON_PRIMITIVE);
- return true;
-}
-
static bool intrinsic_StringReplaceAllString(JSContext* cx, unsigned argc,
Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
@@ -1810,8 +1800,6 @@ static const JSFunctionSpec intrinsic_functions[] = {
JS_INLINABLE_FN("RegExpSearcher", RegExpSearcher, 3, 0, RegExpSearcher),
JS_INLINABLE_FN("RegExpSearcherLastLimit", RegExpSearcherLastLimit, 0, 0,
RegExpSearcherLastLimit),
- JS_FN("RegExpSymbolProtocolOnPrimitiveCounter",
- intrinsic_RegExpSymbolProtocolOnPrimitiveCounter, 0, 0),
JS_INLINABLE_FN("SameValue", js::obj_is, 2, 0, ObjectIs),
JS_FN("SetCopy", SetObject::copy, 1, 0),
JS_FN("StringReplaceAllString", intrinsic_StringReplaceAllString, 3, 0),
diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2902,10 +2902,6 @@ static void SetUseCounterCallback(JSObject* obj, JSUseCounter counter) {
case JSUseCounter::DATEPARSE_IMPL_DEF:
SetUseCounter(obj, eUseCounter_custom_JS_dateparse_impl_def);
return;
- case JSUseCounter::REGEXP_SYMBOL_PROTOCOL_ON_PRIMITIVE:
- SetUseCounter(obj,
- eUseCounter_custom_JS_regexp_symbol_protocol_on_primitive);
- return;
case JSUseCounter::COUNT:
break;
}