forked from mirrors/gecko-dev
Backed out 13 changesets (bug 1896505, bug 1896595) typo a bug number CLOSED TREE
Backed out changeset 574facb67f7f (bug 1896505) Backed out changeset 814dae6f62e7 (bug 1896595) Backed out changeset 2fe78e44afcd (bug 1896595) Backed out changeset 2887f4f28f09 (bug 1896505) Backed out changeset 9d3c1db7d808 (bug 1896505) Backed out changeset 51507968e1ae (bug 1896505) Backed out changeset 8928f4e3e470 (bug 1896505) Backed out changeset c83e6896006d (bug 1896505) Backed out changeset dd8c51e513f4 (bug 1896505) Backed out changeset 0705dd0789c1 (bug 1896505) Backed out changeset 1b6d47b2fddc (bug 1896505) Backed out changeset 3de07420b464 (bug 1896505) Backed out changeset 430d4667cdfe (bug 1896505)
This commit is contained in:
parent
38994ed5ee
commit
97a961c8b2
25 changed files with 27 additions and 1256 deletions
|
|
@ -70,16 +70,6 @@ custom onunderflow sets an element onunderflow event listener
|
|||
custom JS_asmjs uses asm.js
|
||||
custom JS_wasm uses WebAssembly
|
||||
custom JS_wasm_legacy_exceptions uses WebAssembly legacy exception-handling
|
||||
custom JS_subclassing_array_type_2 Array is Type II subclassed
|
||||
custom JS_subclassing_array_type_3 Array is Type III subclassed
|
||||
custom JS_subclassing_promise_type_2 Promise is Type II subclassed
|
||||
custom JS_subclassing_promise_type_3 Promise is Type III subclassed
|
||||
custom JS_subclassing_typedarray_type_2 TypedArray is Type II subclassed
|
||||
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 2329 use counter metrics (excludes denominators).
|
||||
# Total of 364 'page' use counters.
|
||||
# Total of 2309 use counter metrics (excludes denominators).
|
||||
# Total of 354 'page' use counters.
|
||||
use.counter.page:
|
||||
svgsvgelement_getelementbyid:
|
||||
type: counter
|
||||
|
|
@ -535,176 +535,6 @@ use.counter.page:
|
|||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
js_subclassing_array_type_2:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page Array is Type II 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
|
||||
|
||||
js_subclassing_array_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page Array is Type III 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
|
||||
|
||||
js_subclassing_promise_type_2:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page Promise is Type II 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
|
||||
|
||||
js_subclassing_promise_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page Promise is Type III 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
|
||||
|
||||
js_subclassing_typedarray_type_2:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page TypedArray is Type II 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
|
||||
|
||||
js_subclassing_typedarray_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page TypedArray is Type III 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
|
||||
|
||||
js_subclassing_arraybuffer_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page ArrayBuffer is Type III 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
|
||||
|
||||
js_subclassing_sharedarraybuffer_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page SharedArrayBuffer is Type III 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
|
||||
|
||||
js_subclassing_regexp_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page RegExp is Type III 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
|
||||
|
||||
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: >
|
||||
|
|
@ -6298,7 +6128,7 @@ use.counter.page:
|
|||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
# Total of 364 'document' use counters.
|
||||
# Total of 354 'document' use counters.
|
||||
use.counter.doc:
|
||||
svgsvgelement_getelementbyid:
|
||||
type: counter
|
||||
|
|
@ -6725,176 +6555,6 @@ use.counter.doc:
|
|||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
js_subclassing_array_type_2:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document Array is Type II 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
|
||||
|
||||
js_subclassing_array_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document Array is Type III 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
|
||||
|
||||
js_subclassing_promise_type_2:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document Promise is Type II 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
|
||||
|
||||
js_subclassing_promise_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document Promise is Type III 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
|
||||
|
||||
js_subclassing_typedarray_type_2:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document TypedArray is Type II 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
|
||||
|
||||
js_subclassing_typedarray_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document TypedArray is Type III 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
|
||||
|
||||
js_subclassing_arraybuffer_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document ArrayBuffer is Type III 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
|
||||
|
||||
js_subclassing_sharedarraybuffer_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document SharedArrayBuffer is Type III 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
|
||||
|
||||
js_subclassing_regexp_type_3:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document RegExp is Type III 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
|
||||
|
||||
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: >
|
||||
|
|
@ -39718,4 +39378,3 @@ use.counter.css.doc:
|
|||
expires: never
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
|
|
|
|||
|
|
@ -84,22 +84,6 @@ 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) \
|
||||
_(WASM, Wasm) \
|
||||
_(WASM_LEGACY_EXCEPTIONS, WasmLegacyExceptions) \
|
||||
_(SUBCLASSING_ARRAY_TYPE_II, SubclassingArrayTypeII) \
|
||||
_(SUBCLASSING_ARRAY_TYPE_III, SubclassingArrayTypeIII) \
|
||||
_(SUBCLASSING_PROMISE_TYPE_II, SubclassingPromiseTypeII) \
|
||||
_(SUBCLASSING_PROMISE_TYPE_III, SubclassingPromiseTypeIII) \
|
||||
_(SUBCLASSING_TYPEDARRAY_TYPE_II, SubclassingTypedArrayTypeII) \
|
||||
_(SUBCLASSING_TYPEDARRAY_TYPE_III, SubclassingTypedArrayTypeIII) \
|
||||
_(SUBCLASSING_ARRAYBUFFER_TYPE_III, SubclassingArrayBufferTypeIII) \
|
||||
_(SUBCLASSING_SHAREDARRAYBUFFER_TYPE_III, \
|
||||
SubclassingSharedArrayBufferTypeIII) \
|
||||
_(SUBCLASSING_REGEXP_TYPE_III, SubclassingRegExpTypeIII) \
|
||||
_(SUBCLASSING_REGEXP_TYPE_IV, SubclassingRegExpTypeIV)
|
||||
|
||||
/*
|
||||
* Use counter names passed to the accumulate use counter callback.
|
||||
*
|
||||
|
|
@ -107,9 +91,7 @@ extern JS_PUBLIC_API void JS_SetAccumulateTelemetryCallback(
|
|||
* fixed member of the mozilla::UseCounter enum by the callback.
|
||||
*/
|
||||
|
||||
#define ENUM_DEF(NAME, _) NAME,
|
||||
enum class JSUseCounter { FOR_EACH_JS_USE_COUNTER(ENUM_DEF) COUNT };
|
||||
#undef ENUM_DEF
|
||||
enum class JSUseCounter { ASMJS, WASM, WASM_LEGACY_EXCEPTIONS };
|
||||
|
||||
using JSSetUseCounterCallback = void (*)(JSObject*, JSUseCounter);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "jsnum.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "builtin/SelfHostingDefines.h"
|
||||
#include "ds/Sort.h"
|
||||
#include "jit/InlinableNatives.h"
|
||||
#include "jit/TrampolineNatives.h"
|
||||
|
|
@ -959,7 +958,7 @@ static SharedShape* AddLengthProperty(JSContext* cx,
|
|||
map, mapLength, objectFlags);
|
||||
}
|
||||
|
||||
bool js::IsArrayConstructor(const JSObject* obj) {
|
||||
static bool IsArrayConstructor(const JSObject* obj) {
|
||||
// Note: this also returns true for cross-realm Array constructors in the
|
||||
// same compartment.
|
||||
return IsNativeFunction(obj, ArrayConstructor);
|
||||
|
|
@ -984,11 +983,6 @@ bool js::IsCrossRealmArrayConstructor(JSContext* cx, JSObject* obj,
|
|||
return true;
|
||||
}
|
||||
|
||||
// Returns true iff we know for -sure- that it is definitely safe to use the
|
||||
// realm's array constructor.
|
||||
//
|
||||
// This function is conservative as it may return false for cases which
|
||||
// ultimately do use the array constructor.
|
||||
static MOZ_ALWAYS_INLINE bool IsArraySpecies(JSContext* cx,
|
||||
HandleObject origArray) {
|
||||
if (MOZ_UNLIKELY(origArray->is<ProxyObject>())) {
|
||||
|
|
@ -4250,11 +4244,6 @@ static bool array_of(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return ArrayFromCallArgs(cx, args);
|
||||
}
|
||||
|
||||
if (!ReportUsageCounter(cx, nullptr, SUBCLASSING_ARRAY,
|
||||
SUBCLASSING_TYPE_II)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 4.
|
||||
RootedObject obj(cx);
|
||||
{
|
||||
|
|
|
|||
|
|
@ -257,8 +257,6 @@ class MOZ_NON_TEMPORARY_CLASS ArraySpeciesLookup final {
|
|||
}
|
||||
};
|
||||
|
||||
bool IsArrayConstructor(const JSObject* obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* builtin_Array_h */
|
||||
|
|
|
|||
|
|
@ -681,8 +681,7 @@ function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
|
|||
// Step 3.e.i. Let A be ? Construct(C).
|
||||
// Step 3.f. Else,
|
||||
// Step 3.f.i. Let A be ! ArrayCreate(0).
|
||||
var A = IsConstructor(C) ?
|
||||
(ReportUsageCounter(C, SUBCLASS_ARRAY_TYPE_II), constructContentFunction(C, C)) : [];
|
||||
var A = IsConstructor(C) ? constructContentFunction(C, C) : [];
|
||||
|
||||
|
||||
// Step 3.j.i. Let k be 0.
|
||||
|
|
@ -751,7 +750,7 @@ function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
|
|||
// Step 3.k.iv.1. Let A be ? Construct(C, « 𝔽(len) »).
|
||||
// Step 3.k.v. Else,
|
||||
// Step 3.k.v.1. Let A be ? ArrayCreate(len).
|
||||
var A = IsConstructor(C) ? (ReportUsageCounter(C, SUBCLASS_ARRAY_TYPE_II), constructContentFunction(C, C, len)) : std_Array(len);
|
||||
var A = IsConstructor(C) ? constructContentFunction(C, C, len) : std_Array(len);
|
||||
|
||||
// Step 3.k.vi. Let k be 0.
|
||||
var k = 0;
|
||||
|
|
@ -815,7 +814,7 @@ function ArrayFrom(items, mapfn = undefined, thisArg = undefined) {
|
|||
}
|
||||
|
||||
// Steps 5.a-b.
|
||||
var A = IsConstructor(C) ? (ReportUsageCounter(C, SUBCLASS_ARRAY_TYPE_II), constructContentFunction(C, C)) : [];
|
||||
var A = IsConstructor(C) ? constructContentFunction(C, C) : [];
|
||||
|
||||
// Step 5.d.
|
||||
var k = 0;
|
||||
|
|
@ -858,7 +857,7 @@ function ArrayFrom(items, mapfn = undefined, thisArg = undefined) {
|
|||
|
||||
// Steps 12-14.
|
||||
var A = IsConstructor(C)
|
||||
? (ReportUsageCounter(C, SUBCLASS_ARRAY_TYPE_II), constructContentFunction(C, C, len))
|
||||
? constructContentFunction(C, C, len)
|
||||
: std_Array(len);
|
||||
|
||||
// Steps 15-16.
|
||||
|
|
@ -1017,7 +1016,6 @@ function ArraySpeciesCreate(originalArray, length) {
|
|||
if (C === null) {
|
||||
return std_Array(length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Step 6.
|
||||
|
|
@ -1031,7 +1029,6 @@ function ArraySpeciesCreate(originalArray, length) {
|
|||
}
|
||||
|
||||
// Step 8.
|
||||
ReportUsageCounter(C, SUBCLASS_ARRAY_TYPE_III);
|
||||
return constructContentFunction(C, C, length);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1802,9 +1802,6 @@ CreatePromiseObjectWithoutResolutionFunctions(JSContext* cx) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// At this point this is effectively subclassing;
|
||||
ReportUsageCounter(cx, C, SUBCLASSING_PROMISE, SUBCLASSING_TYPE_II);
|
||||
|
||||
// Step 4. Let executorClosure be a new Abstract Closure with parameters
|
||||
// (resolve, reject) that captures promiseCapability and performs the
|
||||
// following steps when called:
|
||||
|
|
@ -2794,12 +2791,6 @@ static bool PromiseConstructor(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool js::IsPromiseConstructor(const JSObject* obj) {
|
||||
// Note: this also returns true for cross-realm Promise constructors in the
|
||||
// same compartment.
|
||||
return IsNativeFunction(obj, PromiseConstructor);
|
||||
}
|
||||
|
||||
/**
|
||||
* ES2022 draft rev d03c1ec6e235a5180fa772b6178727c17974cb14
|
||||
*
|
||||
|
|
|
|||
|
|
@ -263,7 +263,6 @@ bool IsPromiseWithDefaultResolvingFunction(PromiseObject* promise);
|
|||
void SetAlreadyResolvedPromiseWithDefaultResolvingFunction(
|
||||
PromiseObject* promise);
|
||||
|
||||
bool IsPromiseConstructor(const JSObject* obj);
|
||||
} // namespace js
|
||||
|
||||
#endif // builtin_Promise_h
|
||||
|
|
|
|||
|
|
@ -1907,7 +1907,6 @@ 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);
|
||||
|
|
|
|||
|
|
@ -128,40 +128,4 @@
|
|||
|
||||
#define ASYNC_ITERATOR_HELPER_GENERATOR_SLOT 0
|
||||
|
||||
// Support for usage counters around subclassing:
|
||||
#define SUBCLASSING_DETERMINE_THROUGH_CONSTRUCTOR 0
|
||||
#define SUBCLASSING_ARRAY 1
|
||||
#define SUBCLASSING_PROMISE 2
|
||||
#define SUBCLASSING_TYPEDARRAY 3
|
||||
#define SUBCLASSING_ARRAYBUFFER 4
|
||||
#define SUBCLASSING_SHAREDARRAYBUFFER 5
|
||||
#define SUBCLASSING_REGEXP 6
|
||||
#define SUBCLASSING_LAST_BUILTIN 7
|
||||
|
||||
#define SUBCLASSING_TYPE_II 2
|
||||
#define SUBCLASSING_TYPE_III 3
|
||||
#define SUBCLASSING_TYPE_IV 4
|
||||
|
||||
#define SUBCLASSING_TYPE_MASK 0xf
|
||||
|
||||
#define SUBCLASSING_BUILTIN_SHIFT 16
|
||||
#define SUBCLASS_ARRAY_TYPE_II \
|
||||
((SUBCLASSING_ARRAY << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_II)
|
||||
#define SUBCLASS_PROMISE_TYPE_II \
|
||||
((SUBCLASSING_PROMISE << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_II)
|
||||
#define SUBCLASS_TYPEDARRAY_TYPE_II \
|
||||
((SUBCLASSING_TYPEDARRAY << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_II)
|
||||
|
||||
#define SUBCLASS_ARRAY_TYPE_III \
|
||||
((SUBCLASSING_ARRAY << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_III)
|
||||
#define SUBCLASS_TYPEDARRAY_TYPE_III \
|
||||
((SUBCLASSING_TYPEDARRAY << SUBCLASSING_BUILTIN_SHIFT) | SUBCLASSING_TYPE_III)
|
||||
|
||||
#define SUBCLASSING_DETERMINE_THROUGH_CONSTRUCTOR_TYPE_III SUBCLASSING_TYPE_III
|
||||
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ function TypedArraySpeciesConstructor(obj) {
|
|||
|
||||
// Step 7.
|
||||
if (IsConstructor(s)) {
|
||||
ReportUsageCounter(s, SUBCLASS_TYPEDARRAY_TYPE_III)
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
@ -1593,9 +1592,6 @@ function TypedArrayStaticFrom(source, mapfn = undefined, thisArg = undefined) {
|
|||
var len = values.length;
|
||||
|
||||
// Step 7.c.
|
||||
if (!IsTypedArrayConstructor(C)) {
|
||||
ReportUsageCounter(C, SUBCLASS_TYPEDARRAY_TYPE_II);
|
||||
}
|
||||
var targetObj = TypedArrayCreateWithLength(C, len);
|
||||
|
||||
// Steps 7.d-e.
|
||||
|
|
@ -1631,7 +1627,6 @@ function TypedArrayStaticFrom(source, mapfn = undefined, thisArg = undefined) {
|
|||
var len = ToLength(arrayLike.length);
|
||||
|
||||
// Step 11.
|
||||
ReportUsageCounter(C, SUBCLASS_TYPEDARRAY_TYPE_II);
|
||||
var targetObj = TypedArrayCreateWithLength(C, len);
|
||||
|
||||
// Steps 12-13.
|
||||
|
|
|
|||
|
|
@ -114,9 +114,6 @@ function SpeciesConstructor(obj, defaultConstructor) {
|
|||
|
||||
// Step 7.
|
||||
if (IsConstructor(s)) {
|
||||
if (ctor !== defaultConstructor) {
|
||||
ReportUsageCounter(defaultConstructor, SUBCLASSING_DETERMINE_THROUGH_CONSTRUCTOR_TYPE_III);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
function test_function_for_use_counter_integration(fn, counter, expected_growth = true) {
|
||||
let before = getUseCounterResults();
|
||||
assertEq(counter in before, true);
|
||||
|
||||
fn();
|
||||
|
||||
let after = getUseCounterResults();
|
||||
if (expected_growth) {
|
||||
console.log("Yes Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] > before[counter], true);
|
||||
} else {
|
||||
console.log("No Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] == before[counter], true);
|
||||
}
|
||||
}
|
||||
|
||||
class MyArray extends Array { }
|
||||
|
||||
function array_from() {
|
||||
let r = Array.from([1, 2, 3]);
|
||||
assertEq(r instanceof Array, true);
|
||||
}
|
||||
|
||||
function array_from_subclassing_type_ii() {
|
||||
assertEq(MyArray.from([1, 2, 3]) instanceof MyArray, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(array_from, "SubclassingArrayTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(array_from_subclassing_type_ii, "SubclassingArrayTypeII", /* expected_growth = */ true);
|
||||
|
||||
function array_of() {
|
||||
let r = Array.of([1, 2, 3]);
|
||||
assertEq(r instanceof Array, true);
|
||||
}
|
||||
|
||||
function array_of_subclassing_type_ii() {
|
||||
assertEq(MyArray.of([1, 2, 3]) instanceof MyArray, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(array_of, "SubclassingArrayTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(array_of_subclassing_type_ii, "SubclassingArrayTypeII", /* expected_growth = */ true);
|
||||
|
||||
|
||||
// Array.fromAsync
|
||||
function array_fromAsync() {
|
||||
let r = Array.fromAsync([1, 2, 3]);
|
||||
r.then((x) => assertEq(x instanceof Array, true));
|
||||
}
|
||||
|
||||
function array_fromAsync_subclassing_type_ii() {
|
||||
MyArray.fromAsync([1, 2, 3]).then((x) => assertEq(x instanceof MyArray, true));
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(array_fromAsync, "SubclassingArrayTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(array_fromAsync_subclassing_type_ii, "SubclassingArrayTypeII", /* expected_growth = */ true);
|
||||
|
||||
// Since all the Array methods go through ArraySpeciesCreate, only testing concat below, but
|
||||
// it should work for all classes. Testing will be hard in one file however due to the
|
||||
// CacheIR optimization.
|
||||
class Sentinel { };
|
||||
|
||||
class MyArray2 extends Array {
|
||||
static get [Symbol.species]() {
|
||||
return Sentinel;
|
||||
}
|
||||
}
|
||||
|
||||
function array_concat() {
|
||||
let x = Array.from([1, 2]);
|
||||
let y = Array.from([3, 4]);
|
||||
let concat = x.concat(y);
|
||||
assertEq(concat instanceof Array, true);
|
||||
}
|
||||
|
||||
function array_concat_subclassing_type_iii() {
|
||||
let x = MyArray2.from([1, 2]);
|
||||
let y = MyArray2.from([3, 4]);
|
||||
let concat = x.concat(y);
|
||||
assertEq(concat instanceof Sentinel, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(array_concat, "SubclassingArrayTypeIII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(array_concat_subclassing_type_iii, "SubclassingArrayTypeIII", /* expected_growth = */ true);
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
function test_function_for_use_counter_integration(fn, counter, expected_growth = true) {
|
||||
let before = getUseCounterResults();
|
||||
assertEq(counter in before, true);
|
||||
|
||||
fn();
|
||||
|
||||
let after = getUseCounterResults();
|
||||
if (expected_growth) {
|
||||
printErr("Yes Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] > before[counter], true);
|
||||
} else {
|
||||
printErr("No Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] == before[counter], true);
|
||||
}
|
||||
}
|
||||
|
||||
class Sentinel extends ArrayBuffer { }
|
||||
class SharedSentinel extends SharedArrayBuffer { }
|
||||
|
||||
class MyArrayBuffer extends ArrayBuffer {
|
||||
static get [Symbol.species]() {
|
||||
return Sentinel;
|
||||
}
|
||||
}
|
||||
|
||||
class MySharedArrayBuffer extends SharedArrayBuffer {
|
||||
static get [Symbol.species]() {
|
||||
return SharedSentinel;
|
||||
}
|
||||
}
|
||||
|
||||
function array_buffer_slice() {
|
||||
let ab = new ArrayBuffer(16)
|
||||
let res = ab.slice(4, 12);
|
||||
assertEq(res instanceof ArrayBuffer, true);
|
||||
}
|
||||
|
||||
function array_buffer_slice_type_iii() {
|
||||
let ab = new MyArrayBuffer(16)
|
||||
let res = ab.slice(4, 12);
|
||||
assertEq(res instanceof Sentinel, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(array_buffer_slice, "SubclassingArrayBufferTypeIII", false);
|
||||
test_function_for_use_counter_integration(array_buffer_slice_type_iii, "SubclassingArrayBufferTypeIII", true);
|
||||
|
||||
function shared_array_buffer_slice() {
|
||||
let ab = new SharedArrayBuffer(16)
|
||||
let res = ab.slice(4, 12);
|
||||
assertEq(res instanceof SharedArrayBuffer, true);
|
||||
}
|
||||
|
||||
function shared_array_buffer_slice_type_iii() {
|
||||
let ab = new MySharedArrayBuffer(16)
|
||||
let res = ab.slice(4, 12);
|
||||
assertEq(res instanceof SharedSentinel, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(shared_array_buffer_slice, "SubclassingSharedArrayBufferTypeIII", false);
|
||||
test_function_for_use_counter_integration(shared_array_buffer_slice_type_iii, "SubclassingSharedArrayBufferTypeIII", true);
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
let countersBefore = getUseCounterResults();
|
||||
|
||||
class MyArray extends Array { }
|
||||
|
||||
function f() { return MyArray.from([1, 2, 3]) };
|
||||
assertEq(f() instanceof MyArray, true);
|
||||
for (var i = 0; i < 100; i++) { f(); }
|
||||
|
||||
let countersAfter = getUseCounterResults();
|
||||
|
||||
// The above code should have tripped the subclassing detection.
|
||||
assertEq(countersAfter.SubclassingArrayTypeII > countersBefore.SubclassingArrayTypeII, true);
|
||||
|
||||
function f2() {
|
||||
return Array.from([1, 2, 3]);
|
||||
}
|
||||
f2();
|
||||
|
||||
let countersAfterNoChange = getUseCounterResults();
|
||||
assertEq(countersAfter.SubclassingArrayTypeII, countersAfterNoChange.SubclassingArrayTypeII);
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
function test_function_for_use_counter_integration(fn, counter, expected_growth = true) {
|
||||
let before = getUseCounterResults();
|
||||
assertEq(counter in before, true);
|
||||
|
||||
fn();
|
||||
|
||||
let after = getUseCounterResults();
|
||||
if (expected_growth) {
|
||||
console.log("Yes Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] > before[counter], true);
|
||||
} else {
|
||||
console.log("No Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] == before[counter], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyPromise extends Promise { }
|
||||
|
||||
function promise_all() {
|
||||
let p = Promise.all([Promise.resolve(1)]);
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
function promise_all_subclassing_type_ii() {
|
||||
let p = MyPromise.all([Promise.resolve(1)]);
|
||||
assertEq(p instanceof MyPromise, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_all, "SubclassingPromiseTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_all_subclassing_type_ii, "SubclassingPromiseTypeII", /* expected_growth = */ true);
|
||||
|
||||
function promise_allSettled() {
|
||||
let p = Promise.allSettled([Promise.resolve(1)]);
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
function promise_allSettled_subclassing_type_ii() {
|
||||
let p = MyPromise.allSettled([Promise.resolve(1)]);
|
||||
assertEq(p instanceof MyPromise, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_allSettled, "SubclassingPromiseTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_allSettled_subclassing_type_ii, "SubclassingPromiseTypeII", /* expected_growth = */ true);
|
||||
|
||||
function promise_any() {
|
||||
let p = Promise.any([Promise.resolve(1)]);
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
function promise_any_subclassing_type_ii() {
|
||||
let p = MyPromise.any([Promise.resolve(1)]);
|
||||
assertEq(p instanceof MyPromise, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_any, "SubclassingPromiseTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_any_subclassing_type_ii, "SubclassingPromiseTypeII", /* expected_growth = */ true);
|
||||
|
||||
function promise_race() {
|
||||
let p = Promise.race([Promise.resolve(1)]);
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
function promise_race_subclassing_type_ii() {
|
||||
let p = MyPromise.race([Promise.resolve(1)]);
|
||||
assertEq(p instanceof MyPromise, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_race, "SubclassingPromiseTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_race_subclassing_type_ii, "SubclassingPromiseTypeII", /* expected_growth = */ true);
|
||||
|
||||
function promise_resolve() {
|
||||
let p = Promise.resolve(1)
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
function promise_resolve_subclassing_type_ii() {
|
||||
let p = MyPromise.resolve(1)
|
||||
assertEq(p instanceof MyPromise, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_resolve, "SubclassingPromiseTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_resolve_subclassing_type_ii, "SubclassingPromiseTypeII", /* expected_growth = */ true);
|
||||
|
||||
function promise_reject() {
|
||||
let p = Promise.reject(1).catch(() => undefined)
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
function promise_reject_subclassing_type_ii() {
|
||||
let p = MyPromise.reject(1).catch(() => undefined)
|
||||
assertEq(p instanceof MyPromise, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_reject, "SubclassingPromiseTypeII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_reject_subclassing_type_ii, "SubclassingPromiseTypeII", /* expected_growth = */ true);
|
||||
|
||||
class Sentinel extends Promise { }
|
||||
class MyPromise2 extends Promise {
|
||||
static get [Symbol.species]() {
|
||||
return Sentinel;
|
||||
}
|
||||
}
|
||||
|
||||
function promise_finally() {
|
||||
let p = Promise.reject(0).finally(() => { });
|
||||
assertEq(p instanceof Promise, true);
|
||||
p.catch(() => { })
|
||||
}
|
||||
|
||||
function promise_finally_subclassing_type_iii() {
|
||||
var p = MyPromise2.reject().finally(() => { });
|
||||
assertEq(p instanceof Sentinel, true);
|
||||
p.catch(() => { })
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_finally, "SubclassingPromiseTypeIII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_finally_subclassing_type_iii, "SubclassingPromiseTypeIII", /* expected_growth = */ true);
|
||||
|
||||
function promise_then() {
|
||||
let p = Promise.resolve(0).then(() => { });
|
||||
assertEq(p instanceof Promise, true);
|
||||
}
|
||||
|
||||
function promise_then_subclassing_type_iii() {
|
||||
var p = MyPromise2.resolve().then(() => { });
|
||||
assertEq(p instanceof Sentinel, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(promise_then, "SubclassingPromiseTypeIII", /* expected_growth = */ false);
|
||||
test_function_for_use_counter_integration(promise_then_subclassing_type_iii, "SubclassingPromiseTypeIII", /* expected_growth = */ true);
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
function test_function_for_use_counter_integration(fn, counter, expected_growth = true) {
|
||||
let before = getUseCounterResults();
|
||||
assertEq(counter in before, true);
|
||||
|
||||
fn();
|
||||
|
||||
let after = getUseCounterResults();
|
||||
if (expected_growth) {
|
||||
console.log("Yes Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] > before[counter], true);
|
||||
} else {
|
||||
console.log("No Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] == before[counter], true);
|
||||
}
|
||||
}
|
||||
|
||||
function R() { }
|
||||
Object.setPrototypeOf(R, RegExp);
|
||||
Object.setPrototypeOf(R.prototype, RegExp.prototype);
|
||||
|
||||
// Define a bunch of new getters since the builtin getters throw on
|
||||
// non-RegExp-branded `this`
|
||||
Object.defineProperty(R.prototype, "hasIndices", { value: false });
|
||||
Object.defineProperty(R.prototype, "global", { value: true });
|
||||
Object.defineProperty(R.prototype, "ignoreCase", { value: false });
|
||||
Object.defineProperty(R.prototype, "multiline", { value: false });
|
||||
Object.defineProperty(R.prototype, "dotAll", { value: false });
|
||||
Object.defineProperty(R.prototype, "unicode", { value: false });
|
||||
Object.defineProperty(R.prototype, "unicodeSets", { value: false });
|
||||
Object.defineProperty(R.prototype, "sticky", { value: false });
|
||||
|
||||
function test_regexp_matchall() {
|
||||
"some".matchAll(/foo/g);
|
||||
}
|
||||
|
||||
function test_regexp_matchall_type_iii() {
|
||||
"some string".matchAll(new R("foo"))
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(test_regexp_matchall, "SubclassingRegExpTypeIII", false)
|
||||
test_function_for_use_counter_integration(test_regexp_matchall_type_iii, "SubclassingRegExpTypeIII", true)
|
||||
|
||||
function test_regexp_split() {
|
||||
let r = /p/;
|
||||
let split = r[Symbol.split];
|
||||
split.call(r, "split");
|
||||
}
|
||||
|
||||
function test_regexp_split_type_iii() {
|
||||
let r = /r/;
|
||||
|
||||
class B extends RegExp {
|
||||
x = "this";
|
||||
}
|
||||
|
||||
let b = new B("R");
|
||||
|
||||
let split = r[Symbol.split];
|
||||
|
||||
// This reciever needs to be a class-subclass RegExp,
|
||||
// as RegExp[@@split] will call RegExp.exec, which
|
||||
// typechecks this.
|
||||
split.call(b, "split");
|
||||
}
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
function test_function_for_use_counter_integration(fn, counter, expected_growth = true) {
|
||||
let before = getUseCounterResults();
|
||||
assertEq(counter in before, true);
|
||||
|
||||
fn();
|
||||
|
||||
let after = getUseCounterResults();
|
||||
if (expected_growth) {
|
||||
printErr("Yes Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] > before[counter], true);
|
||||
} else {
|
||||
printErr("No Increase: Before ", before[counter], " After", after[counter]);
|
||||
assertEq(after[counter] == before[counter], true);
|
||||
}
|
||||
}
|
||||
|
||||
const TYPED_ARRAY_CONSTRUCTORS = [
|
||||
Int8Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray,
|
||||
Int16Array,
|
||||
Uint16Array,
|
||||
Int32Array,
|
||||
Uint32Array,
|
||||
Float32Array,
|
||||
Float64Array,
|
||||
BigInt64Array,
|
||||
BigUint64Array
|
||||
]
|
||||
|
||||
const SUBCLASS_CONSTRUCTORS = TYPED_ARRAY_CONSTRUCTORS.map((x) => { let c = eval(`class ${x.name}Subclass extends ${x.name} {}; ${x.name}Subclass`); print(c); return c; });
|
||||
|
||||
const TYPED_ARRAY_FROM = TYPED_ARRAY_CONSTRUCTORS.map((C) => function () { let r = C.from([]); assertEq(r instanceof C, true); });
|
||||
const SUBCLASS_FROM = SUBCLASS_CONSTRUCTORS.map((C) => function () { let r = C.from([]); assertEq(r instanceof C, true); });
|
||||
|
||||
TYPED_ARRAY_FROM.forEach((x) => {
|
||||
test_function_for_use_counter_integration(x, "SubclassingTypedArrayTypeII", /* expected_growth = */ false)
|
||||
})
|
||||
SUBCLASS_FROM.forEach((x) => {
|
||||
test_function_for_use_counter_integration(x, "SubclassingTypedArrayTypeII", /* expected_growth = */ true)
|
||||
})
|
||||
|
||||
let source = [];
|
||||
source[Symbol.iterator] = null;
|
||||
|
||||
const TYPED_ARRAY_FROM_NON_ITERATOR = TYPED_ARRAY_CONSTRUCTORS.map((C) => function () { let r = C.from([]); assertEq(r instanceof C, true); });
|
||||
const SUBCLASS_FROM_NON_ITERATOR = SUBCLASS_CONSTRUCTORS.map((C) => function () { let r = C.from([]); assertEq(r instanceof C, true); });
|
||||
|
||||
TYPED_ARRAY_FROM_NON_ITERATOR.forEach((x) => {
|
||||
test_function_for_use_counter_integration(x, "SubclassingTypedArrayTypeII", /* expected_growth = */ false)
|
||||
})
|
||||
SUBCLASS_FROM_NON_ITERATOR.forEach((x) => {
|
||||
test_function_for_use_counter_integration(x, "SubclassingTypedArrayTypeII", /* expected_growth = */ true)
|
||||
})
|
||||
|
||||
// Type III Subclassing
|
||||
class Sentinel extends Int8Array { }
|
||||
class MyInt8Array extends Int8Array {
|
||||
static get [Symbol.species]() {
|
||||
return Sentinel;
|
||||
}
|
||||
}
|
||||
|
||||
function int8_test() {
|
||||
let a = Int8Array.of(0, 1, 2, 3);
|
||||
let r = a.filter(() => true);
|
||||
assertEq(r instanceof Int8Array, true);
|
||||
}
|
||||
|
||||
function myint8_test() {
|
||||
let a = MyInt8Array.of(0, 1, 2, 3);
|
||||
let r = a.filter(() => true);
|
||||
assertEq(r instanceof Sentinel, true);
|
||||
}
|
||||
|
||||
test_function_for_use_counter_integration(int8_test, "SubclassingTypedArrayTypeIII", /*expected_growth=*/ false);
|
||||
test_function_for_use_counter_integration(myint8_test, "SubclassingTypedArrayTypeIII", /*expected_growth=*/ true);
|
||||
|
|
@ -363,9 +363,11 @@ void counters_dump(int) { __gcov_dump(); }
|
|||
|
||||
void counters_reset(int) { __gcov_reset(); }
|
||||
# else
|
||||
void counters_dump(int) { /* Do nothing */ }
|
||||
void counters_dump(int) { /* Do nothing */
|
||||
}
|
||||
|
||||
void counters_reset(int) { /* Do nothing */ }
|
||||
void counters_reset(int) { /* Do nothing */
|
||||
}
|
||||
# endif
|
||||
|
||||
static void InstallCoverageSignalHandlers() {
|
||||
|
|
@ -1506,54 +1508,6 @@ static void WriteTelemetryDataToDisk(const char* dir) {
|
|||
|
||||
#undef MAP_TELEMETRY
|
||||
|
||||
// Use Counter introspection
|
||||
static Mutex useCounterLock(mutexid::ShellUseCounters);
|
||||
class MOZ_RAII AutoLockUseCounters : public LockGuard<Mutex> {
|
||||
using Base = LockGuard<Mutex>;
|
||||
|
||||
public:
|
||||
AutoLockUseCounters() : Base(useCounterLock) {}
|
||||
};
|
||||
|
||||
using UseCounterArray =
|
||||
mozilla::Array<uint32_t, static_cast<size_t>(JSUseCounter::COUNT)>;
|
||||
static UseCounterArray useCounterResults;
|
||||
static void SetUseCounterCallback(JSObject* obj, JSUseCounter counter) {
|
||||
MOZ_RELEASE_ASSERT(obj);
|
||||
AutoLockUseCounters aluc;
|
||||
// Maybe should ensure obj is a global object?
|
||||
useCounterResults[static_cast<size_t>(counter)]++;
|
||||
}
|
||||
|
||||
static bool GetUseCounterResults(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make a private copy holding the lock then release, because we can't
|
||||
// hold this mutex while doing JS_DefineProperty, which holds MemoryTracker
|
||||
// mutex.
|
||||
UseCounterArray local;
|
||||
{
|
||||
AutoLockUseCounters aluc;
|
||||
local = useCounterResults;
|
||||
}
|
||||
|
||||
RootedValue val(cx);
|
||||
#define ADD_VALUE(ENUM, NAME) \
|
||||
val.setInt32(local[static_cast<size_t>(JSUseCounter::ENUM)]); \
|
||||
if (!JS_DefineProperty(cx, obj, #NAME, val, JSPROP_ENUMERATE)) { \
|
||||
return false; \
|
||||
}
|
||||
|
||||
FOR_EACH_JS_USE_COUNTER(ADD_VALUE);
|
||||
|
||||
args.rval().setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool BoundToAsyncStack(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
|
|
@ -9915,10 +9869,6 @@ JS_FN_HELP("createUserArrayBuffer", CreateUserArrayBuffer, 1, 0,
|
|||
" Return an object with a property 'obj.test == 42', backed by a resolve hook "
|
||||
" with the Debugger shouldAvoidSideEffects flag integration."),
|
||||
|
||||
JS_FN_HELP("getUseCounterResults", GetUseCounterResults, 0, 0,
|
||||
"getUseCounterResults()",
|
||||
" Return the values of the shell use counters."),
|
||||
|
||||
JS_FS_HELP_END
|
||||
};
|
||||
// clang-format on
|
||||
|
|
@ -11944,7 +11894,6 @@ int main(int argc, char** argv) {
|
|||
if (telemetryLock) {
|
||||
JS_SetAccumulateTelemetryCallback(cx, AccumulateTelemetryDataCallback);
|
||||
}
|
||||
JS_SetSetUseCounterCallback(cx, SetUseCounterCallback);
|
||||
|
||||
auto destroyCx = MakeScopeExit([cx] { JS_DestroyContext(cx); });
|
||||
|
||||
|
|
|
|||
|
|
@ -605,14 +605,6 @@ class GlobalObject : public NativeObject {
|
|||
return &global->getPrototype(JSProto_RegExp);
|
||||
}
|
||||
|
||||
static JSObject* getOrCreateRegExpConstructor(JSContext* cx,
|
||||
Handle<GlobalObject*> global) {
|
||||
if (!ensureConstructor(cx, global, JSProto_RegExp)) {
|
||||
return nullptr;
|
||||
}
|
||||
return &global->getConstructor(JSProto_RegExp);
|
||||
}
|
||||
|
||||
JSObject* maybeGetRegExpPrototype() {
|
||||
if (classIsInitialized(JSProto_RegExp)) {
|
||||
return &getPrototype(JSProto_RegExp);
|
||||
|
|
@ -652,14 +644,6 @@ class GlobalObject : public NativeObject {
|
|||
return &global->getPrototype(JSProto_SharedArrayBuffer);
|
||||
}
|
||||
|
||||
static JSObject* getOrCreateSharedArrayBufferConstructor(
|
||||
JSContext* cx, Handle<GlobalObject*> global) {
|
||||
if (!ensureConstructor(cx, global, JSProto_SharedArrayBuffer)) {
|
||||
return nullptr;
|
||||
}
|
||||
return &global->getConstructor(JSProto_SharedArrayBuffer);
|
||||
}
|
||||
|
||||
static JSObject* getOrCreateCustomErrorPrototype(JSContext* cx,
|
||||
Handle<GlobalObject*> global,
|
||||
JSExnType exnType) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@
|
|||
#include "vm/PromiseObject.h"
|
||||
#include "vm/ProxyObject.h"
|
||||
#include "vm/RegExpObject.h"
|
||||
#include "vm/SelfHosting.h"
|
||||
#include "vm/Shape.h"
|
||||
#include "vm/TypedArrayObject.h"
|
||||
#include "vm/Watchtower.h"
|
||||
|
|
@ -2753,7 +2752,8 @@ void GetObjectSlotNameFunctor::operator()(JS::TracingContext* tcx, char* buf,
|
|||
;
|
||||
}
|
||||
#define TEST_SLOT_MATCHES_PROTOTYPE(name, clasp) \
|
||||
else if ((JSProto_##name) == slot){slotname = #name; \
|
||||
else if ((JSProto_##name) == slot) { \
|
||||
slotname = #name; \
|
||||
}
|
||||
JS_FOR_EACH_PROTOTYPE(TEST_SLOT_MATCHES_PROTOTYPE)
|
||||
#undef TEST_SLOT_MATCHES_PROTOTYPE
|
||||
|
|
@ -3428,9 +3428,6 @@ void JSObject::traceChildren(JSTracer* trc) {
|
|||
|
||||
// Step 7.
|
||||
if (IsConstructor(s)) {
|
||||
ReportUsageCounter(cx, defaultCtor,
|
||||
SUBCLASSING_DETERMINE_THROUGH_CONSTRUCTOR,
|
||||
SUBCLASSING_TYPE_III);
|
||||
return &s.toObject();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@
|
|||
_(ThreadId, 600) \
|
||||
_(WasmCodeSegmentMap, 600) \
|
||||
_(VTuneLock, 600) \
|
||||
_(ShellTelemetry, 600) \
|
||||
_(ShellUseCounters, 600)
|
||||
_(ShellTelemetry, 600)
|
||||
|
||||
namespace js {
|
||||
namespace mutexid {
|
||||
|
|
|
|||
|
|
@ -2161,7 +2161,6 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
JS_INLINABLE_FN("RegExpSearcher", RegExpSearcher, 3, 0, RegExpSearcher),
|
||||
JS_INLINABLE_FN("RegExpSearcherLastLimit", RegExpSearcherLastLimit, 0, 0,
|
||||
RegExpSearcherLastLimit),
|
||||
JS_FN("ReportUsageCounter", intrinsic_ReportUsageCounter, 2, 0),
|
||||
JS_INLINABLE_FN("SameValue", js::obj_is, 2, 0, ObjectIs),
|
||||
JS_FN("SetCopy", SetObject::copy, 1, 0),
|
||||
JS_FN("SharedArrayBufferByteLength",
|
||||
|
|
@ -2961,223 +2960,6 @@ bool js::IsSelfHostedFunctionWithName(const Value& v, JSAtom* name) {
|
|||
return IsSelfHostedFunctionWithName(fun, name);
|
||||
}
|
||||
|
||||
// MG:XXX: Need to adopt a solid policy around CCW constructors.
|
||||
// -- Going to default to "different realm don't matter".
|
||||
bool js::ReportUsageCounter(JSContext* cx, HandleObject constructorArg,
|
||||
int32_t builtin, int32_t type) {
|
||||
RootedObject constructor(cx, constructorArg);
|
||||
|
||||
// Do this here rather than as part of the self-hosted code.
|
||||
if (builtin == SUBCLASSING_DETERMINE_THROUGH_CONSTRUCTOR) {
|
||||
MOZ_ASSERT(constructor);
|
||||
|
||||
do {
|
||||
if (IsPromiseConstructor(constructor)) {
|
||||
builtin = SUBCLASSING_PROMISE;
|
||||
break;
|
||||
}
|
||||
if (IsTypedArrayConstructor(constructor)) {
|
||||
builtin = SUBCLASSING_TYPEDARRAY;
|
||||
break;
|
||||
}
|
||||
if (IsArrayConstructor(constructor)) {
|
||||
builtin = SUBCLASSING_ARRAY;
|
||||
break;
|
||||
}
|
||||
if (IsCrossCompartmentWrapper(constructor)) {
|
||||
// Bail on reporting CCWs.
|
||||
return true;
|
||||
}
|
||||
|
||||
Rooted<GlobalObject*> global(cx, &constructor->nonCCWGlobal());
|
||||
RootedObject abConstructor(
|
||||
cx, GlobalObject::getOrCreateArrayBufferConstructor(cx, global));
|
||||
if (!abConstructor) {
|
||||
return false;
|
||||
}
|
||||
if (constructor == abConstructor) {
|
||||
builtin = SUBCLASSING_ARRAYBUFFER;
|
||||
break;
|
||||
}
|
||||
|
||||
RootedObject sabConstructor(
|
||||
cx,
|
||||
GlobalObject::getOrCreateSharedArrayBufferConstructor(cx, global));
|
||||
if (!sabConstructor) {
|
||||
return false;
|
||||
}
|
||||
if (constructor == sabConstructor) {
|
||||
builtin = SUBCLASSING_SHAREDARRAYBUFFER;
|
||||
break;
|
||||
}
|
||||
|
||||
RootedObject regExpConstructor(
|
||||
cx, GlobalObject::getOrCreateRegExpConstructor(cx, global));
|
||||
if (!regExpConstructor) {
|
||||
return false;
|
||||
}
|
||||
if (constructor == regExpConstructor) {
|
||||
builtin = SUBCLASSING_REGEXP;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (false);
|
||||
|
||||
// We should have determined the constructor here.
|
||||
if (builtin == SUBCLASSING_DETERMINE_THROUGH_CONSTRUCTOR) {
|
||||
MOZ_CRASH("Unable to determine constructor where expected.");
|
||||
return true;
|
||||
}
|
||||
// We -do- want to report here, because we've determined exterior to this
|
||||
// that we're in a subclassing scenario; so don't do the check for a
|
||||
// matching constructor here.
|
||||
constructor = nullptr;
|
||||
}
|
||||
|
||||
switch (builtin) {
|
||||
case SUBCLASSING_ARRAY: {
|
||||
// Check if the provided function is actually the array constructor
|
||||
// anyhow; Constructor may be nullptr if check has already been done.
|
||||
if (constructor && IsArrayConstructor(constructor)) {
|
||||
return true;
|
||||
}
|
||||
switch (type) {
|
||||
case SUBCLASSING_TYPE_II:
|
||||
cx->runtime()->setUseCounter(cx->global(),
|
||||
JSUseCounter::SUBCLASSING_ARRAY_TYPE_II);
|
||||
return true;
|
||||
case SUBCLASSING_TYPE_III:
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_ARRAY_TYPE_III);
|
||||
return true;
|
||||
default:
|
||||
MOZ_CRASH("Unexpected Subclassing Type");
|
||||
}
|
||||
}
|
||||
case SUBCLASSING_PROMISE: {
|
||||
if (constructor && IsPromiseConstructor(constructor)) {
|
||||
return true;
|
||||
}
|
||||
switch (type) {
|
||||
case SUBCLASSING_TYPE_II:
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_PROMISE_TYPE_II);
|
||||
return true;
|
||||
case SUBCLASSING_TYPE_III:
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_PROMISE_TYPE_III);
|
||||
return true;
|
||||
default:
|
||||
MOZ_CRASH("Unexpected Subclassing Type");
|
||||
}
|
||||
}
|
||||
case SUBCLASSING_TYPEDARRAY: {
|
||||
// So here's a design question: Do we ultimately care about
|
||||
// matching typed arrays? i.e. if someone does
|
||||
// UInt8Array.from.call(Int8Array, 0), should this count
|
||||
// as subclassing?
|
||||
//
|
||||
// I'm inclined to say not at the moment -- but it would
|
||||
// be a behaviour change if we removed subclassing.
|
||||
if (constructor && IsTypedArrayConstructor(constructor)) {
|
||||
return true;
|
||||
}
|
||||
switch (type) {
|
||||
case SUBCLASSING_TYPE_II:
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_TYPEDARRAY_TYPE_II);
|
||||
return true;
|
||||
case SUBCLASSING_TYPE_III:
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(), JSUseCounter::SUBCLASSING_TYPEDARRAY_TYPE_III);
|
||||
return true;
|
||||
default:
|
||||
MOZ_CRASH("Unhandled subclassing type");
|
||||
}
|
||||
}
|
||||
case SUBCLASSING_ARRAYBUFFER:
|
||||
case SUBCLASSING_SHAREDARRAYBUFFER: {
|
||||
MOZ_ASSERT(type == SUBCLASSING_TYPE_III);
|
||||
cx->runtime()->setUseCounter(
|
||||
cx->global(),
|
||||
builtin == SUBCLASSING_ARRAYBUFFER
|
||||
? JSUseCounter::SUBCLASSING_ARRAYBUFFER_TYPE_III
|
||||
: JSUseCounter::SUBCLASSING_SHAREDARRAYBUFFER_TYPE_III);
|
||||
return true;
|
||||
}
|
||||
case SUBCLASSING_REGEXP: {
|
||||
switch (type) {
|
||||
case SUBCLASSING_TYPE_III:
|
||||
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");
|
||||
}
|
||||
}
|
||||
default:
|
||||
MOZ_CRASH("Unexpected builtin");
|
||||
};
|
||||
}
|
||||
|
||||
// In the interests of efficiency and simplicity, we would like this function
|
||||
// to have to do as little as possible, and take as few parameters as possible.
|
||||
//
|
||||
// Nevethreless, we also wish to be able to report correctly for interesting
|
||||
// cases like Array.from.call(Map, ...) -- essentially, catching the case where
|
||||
// someone using a subclassing-elgible class as the 'this' value, thereby
|
||||
// executing a sub classing.
|
||||
//
|
||||
// To handle this with just two parameters, we treat our integer parameter as a
|
||||
// packed integer; This introduces some magic, but allows us to communicate all
|
||||
// call-site constant data in a single int32.
|
||||
//`
|
||||
// The packing is as follows:
|
||||
//
|
||||
// SubclassingElgibleBuiltins << 16 | SubclassingType
|
||||
//
|
||||
// This produces the following magic constant values:
|
||||
//
|
||||
// Array Subclassing Type II: (1 << 16) | 2 == 0x010002
|
||||
// Array Subclassing Type III: (1 << 16) | 3 == 0x010003
|
||||
// Array Subclassing Type IV: (1 << 16) | 4 == 0x010000
|
||||
//
|
||||
// Promise Subclassing Type II: (2 << 16) | 2 == 0x020002
|
||||
// Promise Subclassing Type III: (2 << 16) | 3 == 0x020003
|
||||
// Promise Subclassing Type IV: (2 << 16) | 4 == 0x020004
|
||||
//
|
||||
// ... etc.
|
||||
//
|
||||
// Subclassing is reported iff the constructor provided doesn't match
|
||||
// the existing prototype.
|
||||
//
|
||||
bool js::intrinsic_ReportUsageCounter(JSContext* cx, unsigned int argc,
|
||||
JS::Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
// Currently usage counter is only used for reporting subclassing
|
||||
// as a result we hyper-specialize the following
|
||||
MOZ_ASSERT(args.length() == 2);
|
||||
MOZ_ASSERT(args.get(0).isObject());
|
||||
MOZ_ASSERT(args.get(1).isInt32());
|
||||
|
||||
HandleValue arg0 = args.get(0);
|
||||
RootedObject constructor(cx, &arg0.toObject());
|
||||
|
||||
int32_t packedTypeAndBuiltin = args.get(1).toInt32();
|
||||
|
||||
int32_t type = packedTypeAndBuiltin & SUBCLASSING_TYPE_MASK;
|
||||
MOZ_ASSERT(type >= SUBCLASSING_TYPE_II && type <= SUBCLASSING_TYPE_IV);
|
||||
|
||||
int32_t builtin = packedTypeAndBuiltin >> SUBCLASSING_BUILTIN_SHIFT;
|
||||
MOZ_ASSERT(builtin >= 0 && builtin < SUBCLASSING_LAST_BUILTIN);
|
||||
|
||||
return ReportUsageCounter(cx, constructor, builtin, type);
|
||||
}
|
||||
|
||||
static_assert(
|
||||
JSString::MAX_LENGTH <= INT32_MAX,
|
||||
"StringIteratorNext in builtin/String.js assumes the stored index "
|
||||
|
|
|
|||
|
|
@ -292,12 +292,6 @@ bool IsTupleUnchecked(JSContext* cx, const CallArgs& args);
|
|||
bool intrinsic_IsTuple(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
#endif
|
||||
|
||||
bool intrinsic_ReportUsageCounter(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
// The arguments to this are defined in SelfHostingDefines.h
|
||||
bool ReportUsageCounter(JSContext* cx, HandleObject constructor,
|
||||
int32_t builtin, int32_t type);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* vm_SelfHosting_h_ */
|
||||
|
|
|
|||
|
|
@ -2628,59 +2628,17 @@ static void SetUseCounterCallback(JSObject* obj, JSUseCounter counter) {
|
|||
switch (counter) {
|
||||
case JSUseCounter::ASMJS:
|
||||
SetUseCounter(obj, eUseCounter_custom_JS_asmjs);
|
||||
return;
|
||||
break;
|
||||
case JSUseCounter::WASM:
|
||||
SetUseCounter(obj, eUseCounter_custom_JS_wasm);
|
||||
return;
|
||||
break;
|
||||
case JSUseCounter::WASM_LEGACY_EXCEPTIONS:
|
||||
SetUseCounter(obj, eUseCounter_custom_JS_wasm_legacy_exceptions);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_ARRAY_TYPE_II:
|
||||
SetUseCounter(obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_array_type_2);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_ARRAY_TYPE_III:
|
||||
SetUseCounter(obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_array_type_3);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_PROMISE_TYPE_II:
|
||||
SetUseCounter(obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_promise_type_2);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_PROMISE_TYPE_III:
|
||||
SetUseCounter(obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_promise_type_3);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_TYPEDARRAY_TYPE_II:
|
||||
SetUseCounter(
|
||||
obj, mozilla::eUseCounter_custom_JS_subclassing_typedarray_type_2);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_TYPEDARRAY_TYPE_III:
|
||||
SetUseCounter(
|
||||
obj, mozilla::eUseCounter_custom_JS_subclassing_typedarray_type_3);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_ARRAYBUFFER_TYPE_III:
|
||||
SetUseCounter(
|
||||
obj, mozilla::eUseCounter_custom_JS_subclassing_arraybuffer_type_3);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_SHAREDARRAYBUFFER_TYPE_III:
|
||||
SetUseCounter(
|
||||
obj,
|
||||
mozilla::eUseCounter_custom_JS_subclassing_sharedarraybuffer_type_3);
|
||||
return;
|
||||
case JSUseCounter::SUBCLASSING_REGEXP_TYPE_III:
|
||||
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;
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected JSUseCounter id");
|
||||
}
|
||||
}
|
||||
|
||||
static void GetRealmNameCallback(JSContext* cx, Realm* realm, char* buf,
|
||||
size_t bufsize,
|
||||
|
|
|
|||
Loading…
Reference in a new issue