mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1896505 - Track Type IV Subclassing in RegExp r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D211458
This commit is contained in:
parent
b40d7d5990
commit
66ce46fdce
@ -79,6 +79,7 @@ custom JS_subclassing_typedarray_type_3 TypedArray is Type III subclassed
|
||||
custom JS_subclassing_arraybuffer_type_3 ArrayBuffer is Type III subclassed
|
||||
custom JS_subclassing_sharedarraybuffer_type_3 SharedArrayBuffer is Type III subclassed
|
||||
custom JS_subclassing_regexp_type_3 RegExp is Type III subclassed
|
||||
custom JS_subclassing_regexp_type_4 RegExp is Type IV subclassed
|
||||
|
||||
// Console API
|
||||
method console.assert
|
||||
|
@ -107,8 +107,8 @@ use.counter:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
# Total of 2327 use counter metrics (excludes denominators).
|
||||
# Total of 363 'page' use counters.
|
||||
# Total of 2329 use counter metrics (excludes denominators).
|
||||
# Total of 364 'page' use counters.
|
||||
use.counter.page:
|
||||
svgsvgelement_getelementbyid:
|
||||
type: counter
|
||||
@ -688,6 +688,23 @@ use.counter.page:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
js_subclassing_regexp_type_4:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page RegExp is Type IV subclassed.
|
||||
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
|
||||
|
||||
console_assert:
|
||||
type: counter
|
||||
description: >
|
||||
@ -6281,7 +6298,7 @@ use.counter.page:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
# Total of 363 'document' use counters.
|
||||
# Total of 364 'document' use counters.
|
||||
use.counter.doc:
|
||||
svgsvgelement_getelementbyid:
|
||||
type: counter
|
||||
@ -6861,6 +6878,23 @@ use.counter.doc:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
js_subclassing_regexp_type_4:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document RegExp is Type IV subclassed.
|
||||
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
|
||||
|
||||
console_assert:
|
||||
type: counter
|
||||
description: >
|
||||
|
@ -97,7 +97,8 @@ extern JS_PUBLIC_API void JS_SetAccumulateTelemetryCallback(
|
||||
_(SUBCLASSING_ARRAYBUFFER_TYPE_III, SubclassingArrayBufferTypeIII) \
|
||||
_(SUBCLASSING_SHAREDARRAYBUFFER_TYPE_III, \
|
||||
SubclassingSharedArrayBufferTypeIII) \
|
||||
_(SUBCLASSING_REGEXP_TYPE_III, SubclassingRegExpTypeIII)
|
||||
_(SUBCLASSING_REGEXP_TYPE_III, SubclassingRegExpTypeIII) \
|
||||
_(SUBCLASSING_REGEXP_TYPE_IV, SubclassingRegExpTypeIV)
|
||||
|
||||
/*
|
||||
* Use counter names passed to the accumulate use counter callback.
|
||||
|
@ -1907,6 +1907,7 @@ bool js::RegExpExec(JSContext* cx, Handle<JSObject*> regexp,
|
||||
return cx->compartment()->wrap(cx, rval);
|
||||
}
|
||||
|
||||
ReportUsageCounter(cx, nullptr, SUBCLASSING_REGEXP, SUBCLASSING_TYPE_IV);
|
||||
// Step 2.a.
|
||||
Rooted<Value> thisv(cx, ObjectValue(*regexp));
|
||||
FixedInvokeArgs<1> args(cx);
|
||||
|
@ -161,5 +161,7 @@
|
||||
|
||||
#define SUBCLASS_REGEXP_TYPE_III \
|
||||
((SUBCLASSING_REGEXP << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_III)
|
||||
#define SUBCLASS_REGEXP_TYPE_IV \
|
||||
((SUBCLASSING_REGEXP << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_IV)
|
||||
|
||||
#endif
|
||||
|
@ -67,3 +67,21 @@ function test_regexp_split_type_iii() {
|
||||
|
||||
test_function_for_use_counter_integration(test_regexp_split, "SubclassingRegExpTypeIII", false)
|
||||
test_function_for_use_counter_integration(test_regexp_split_type_iii, "SubclassingRegExpTypeIII", true)
|
||||
|
||||
function test_regexp_exec() {
|
||||
let r = /r/;
|
||||
"s".match(r);
|
||||
}
|
||||
|
||||
function test_regexp_exec_type_iv() {
|
||||
class R extends RegExp {
|
||||
exec() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
"s".match(new R("s"));
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(test_regexp_exec, "SubclassingRegExpTypeIV", false)
|
||||
test_function_for_use_counter_integration(test_regexp_exec_type_iv, "SubclassingRegExpTypeIV", true)
|
||||
|
||||
|
@ -3111,6 +3111,10 @@ bool js::ReportUsageCounter(JSContext* cx, HandleObject constructorArg,
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_REGEXP_TYPE_III);
|
||||
return true;
|
||||
case SUBCLASSING_TYPE_IV:
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_REGEXP_TYPE_IV);
|
||||
return true;
|
||||
default:
|
||||
MOZ_CRASH("Unexpected RegExp Subclassing Type");
|
||||
}
|
||||
|
@ -2672,6 +2672,10 @@ static void SetUseCounterCallback(JSObject* obj, JSUseCounter counter) {
|
||||
SetUseCounter(obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_regexp_type_3);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_REGEXP_TYPE_IV:
|
||||
SetUseCounter(obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_regexp_type_4);
|
||||
return;
|
||||
case JSUseCounter::COUNT:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user