author | Jim Blandy <jimb@mozilla.com> |
Tue, 01 Sep 2015 15:26:46 -0700 | |
changeset 291572 | ad5ff46b72e7168e38d1c6c4cbe3b370ee0537b5 |
parent 291571 | 8d62fbf0a21534909d69dd49dc56c862e7315ad1 |
child 291573 | fc76f66bf11f5800a7692ccf71add7ef8b01640d |
push id | 74622 |
push user | jblandy@mozilla.com |
push date | Tue, 05 Apr 2016 01:55:03 +0000 |
treeherder | mozilla-inbound@12f6c52e4b4d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | fitzgen |
bugs | 1251529 |
milestone | 48.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/public/Class.h +++ b/js/public/Class.h @@ -653,17 +653,17 @@ typedef void (*JSClassInternal)(); struct JSClass { JS_CLASS_MEMBERS(JSFinalizeOp); void* reserved[5]; }; #define JSCLASS_HAS_PRIVATE (1<<0) // objects have private slot -#define JSCLASS_DELAY_METADATA_CALLBACK (1<<1) // class's initialization code +#define JSCLASS_DELAY_METADATA_BUILDER (1<<1) // class's initialization code // will call // SetNewObjectMetadata itself #define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) // private is (nsISupports*) #define JSCLASS_IS_DOMJSCLASS (1<<4) // objects are DOM #define JSCLASS_HAS_XRAYED_CONSTRUCTOR (1<<5) // if wrapped by an xray // wrapper, the builtin // class's constructor won't // be unwrapped and invoked. @@ -793,18 +793,18 @@ struct Class bool isProxy() const { return flags & JSCLASS_IS_PROXY; } bool isDOMClass() const { return flags & JSCLASS_IS_DOMJSCLASS; } - bool shouldDelayMetadataCallback() const { - return flags & JSCLASS_DELAY_METADATA_CALLBACK; + bool shouldDelayMetadataBuilder() const { + return flags & JSCLASS_DELAY_METADATA_BUILDER; } static size_t offsetOfFlags() { return offsetof(Class, flags); } bool specDefined() const { return spec ? spec->defined() : false; } bool specDependent() const { return spec ? spec->dependent() : false; } JSProtoKey specParentKey() const { return spec ? spec->parentKey() : JSProto_Null; } bool specShouldDefineConstructor()
--- a/js/src/asmjs/WasmModule.cpp +++ b/js/src/asmjs/WasmModule.cpp @@ -1560,17 +1560,17 @@ Module::profilingLabel(uint32_t funcInde { MOZ_ASSERT(dynamicallyLinked_); MOZ_ASSERT(profilingEnabled_); return funcLabels_[funcIndex].get(); } const Class WasmModuleObject::class_ = { "WasmModuleObject", - JSCLASS_IS_ANONYMOUS | JSCLASS_DELAY_METADATA_CALLBACK | + JSCLASS_IS_ANONYMOUS | JSCLASS_DELAY_METADATA_BUILDER | JSCLASS_HAS_RESERVED_SLOTS(WasmModuleObject::RESERVED_SLOTS), nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* getProperty */ nullptr, /* setProperty */ nullptr, /* enumerate */ nullptr, /* resolve */ nullptr, /* mayResolve */
--- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -1139,24 +1139,24 @@ CallFunctionWithAsyncStack(JSContext* cx JS::AutoSetAsyncStackForNewCalls::AsyncCallKind::EXPLICIT); return Call(cx, UndefinedHandleValue, function, JS::HandleValueArray::empty(), args.rval()); } static bool EnableTrackAllocations(JSContext* cx, unsigned argc, Value* vp) { - SetObjectMetadataCallback(cx, SavedStacksMetadataCallback); + SetAllocationMetadataBuilder(cx, SavedStacksMetadataBuilder); return true; } static bool DisableTrackAllocations(JSContext* cx, unsigned argc, Value* vp) { - SetObjectMetadataCallback(cx, nullptr); + SetAllocationMetadataBuilder(cx, nullptr); return true; } #if defined(DEBUG) || defined(JS_OOM_BREAKPOINT) static bool OOMThreadTypes(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1685,83 +1685,83 @@ DisplayName(JSContext* cx, unsigned argc JSFunction* fun = &args[0].toObject().as<JSFunction>(); JSString* str = fun->displayAtom(); args.rval().setString(str ? str : cx->runtime()->emptyString); return true; } static JSObject* -ShellObjectMetadataCallback(JSContext* cx, HandleObject) +ShellAllocationMetadataBuilder(JSContext* cx, HandleObject) { AutoEnterOOMUnsafeRegion oomUnsafe; RootedObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx)); if (!obj) - oomUnsafe.crash("ShellObjectMetadataCallback"); + oomUnsafe.crash("ShellAllocationMetadataBuilder"); RootedObject stack(cx, NewDenseEmptyArray(cx)); if (!stack) - oomUnsafe.crash("ShellObjectMetadataCallback"); + oomUnsafe.crash("ShellAllocationMetadataBuilder"); static int createdIndex = 0; createdIndex++; if (!JS_DefineProperty(cx, obj, "index", createdIndex, 0, JS_STUBGETTER, JS_STUBSETTER)) { - oomUnsafe.crash("ShellObjectMetadataCallback"); + oomUnsafe.crash("ShellAllocationMetadataBuilder"); } if (!JS_DefineProperty(cx, obj, "stack", stack, 0, JS_STUBGETTER, JS_STUBSETTER)) { - oomUnsafe.crash("ShellObjectMetadataCallback"); + oomUnsafe.crash("ShellAllocationMetadataBuilder"); } int stackIndex = 0; RootedId id(cx); RootedValue callee(cx); for (NonBuiltinScriptFrameIter iter(cx); !iter.done(); ++iter) { if (iter.isFunctionFrame() && iter.compartment() == cx->compartment()) { id = INT_TO_JSID(stackIndex); RootedObject callee(cx, iter.callee(cx)); if (!JS_DefinePropertyById(cx, stack, id, callee, 0, JS_STUBGETTER, JS_STUBSETTER)) { - oomUnsafe.crash("ShellObjectMetadataCallback"); + oomUnsafe.crash("ShellAllocationMetadataBuilder"); } stackIndex++; } } return obj; } static bool -EnableShellObjectMetadataCallback(JSContext* cx, unsigned argc, Value* vp) +EnableShellAllocationMetadataBuilder(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - SetObjectMetadataCallback(cx, ShellObjectMetadataCallback); + SetAllocationMetadataBuilder(cx, ShellAllocationMetadataBuilder); args.rval().setUndefined(); return true; } static bool -GetObjectMetadata(JSContext* cx, unsigned argc, Value* vp) +GetAllocationMetadata(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1 || !args[0].isObject()) { JS_ReportError(cx, "Argument must be an object"); return false; } - args.rval().setObjectOrNull(GetObjectMetadata(&args[0].toObject())); + args.rval().setObjectOrNull(GetAllocationMetadata(&args[0].toObject())); return true; } static bool testingFunc_bailout(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -3767,22 +3767,22 @@ gc::ZealModeHelpText), JS_FN_HELP("isLazyFunction", IsLazyFunction, 1, 0, "isLazyFunction(fun)", " True if fun is a lazy JSFunction."), JS_FN_HELP("isRelazifiableFunction", IsRelazifiableFunction, 1, 0, "isRelazifiableFunction(fun)", " Ture if fun is a JSFunction with a relazifiable JSScript."), - JS_FN_HELP("enableShellObjectMetadataCallback", EnableShellObjectMetadataCallback, 0, 0, -"enableShellObjectMetadataCallback()", -" Use ShellObjectMetadataCallback to supply metadata for all newly created objects."), - - JS_FN_HELP("getObjectMetadata", GetObjectMetadata, 1, 0, -"getObjectMetadata(obj)", + JS_FN_HELP("enableShellAllocationMetadataBuilder", EnableShellAllocationMetadataBuilder, 0, 0, +"enableShellAllocationMetadataBuilder()", +" Use ShellAllocationMetadataBuilder to supply metadata for all newly created objects."), + + JS_FN_HELP("getAllocationMetadata", GetAllocationMetadata, 1, 0, +"getAllocationMetadata(obj)", " Get the metadata for an object."), JS_INLINABLE_FN_HELP("bailout", testingFunc_bailout, 0, 0, TestBailout, "bailout()", " Force a bailout out of ionmonkey (if running in ionmonkey)."), JS_FN_HELP("inJit", testingFunc_inJit, 0, 0, "inJit()",
--- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -20,17 +20,17 @@ using namespace js; using namespace js::gc; Zone * const Zone::NotOnList = reinterpret_cast<Zone*>(1); JS::Zone::Zone(JSRuntime* rt) : JS::shadow::Zone(rt, &rt->gc.marker), debuggers(nullptr), - suppressObjectMetadataCallback(false), + suppressAllocationMetadataBuilder(false), arenas(rt), types(this), compartments(), gcGrayRoots(), gcMallocBytes(0), gcMallocGCTriggered(false), usage(&rt->gc.usage), gcDelayBytes(0),
--- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -282,17 +282,17 @@ struct Zone : public JS::shadow::Zone, * When true, skip calling the metadata callback. We use this: * - to avoid invoking the callback recursively; * - to avoid observing lazy prototype setup (which confuses callbacks that * want to use the types being set up!); * - to avoid attaching allocation stacks to allocation stack nodes, which * is silly * And so on. */ - bool suppressObjectMetadataCallback; + bool suppressAllocationMetadataBuilder; js::gc::ArenaLists arenas; js::TypeZone types; /* Live weakmaps in this zone. */ mozilla::LinkedList<js::WeakMapBase> gcWeakMapList;
--- a/js/src/jit-test/tests/baseline/metadata-hook-on-stack.js +++ b/js/src/jit-test/tests/baseline/metadata-hook-on-stack.js @@ -1,16 +1,16 @@ // JSOP_NEWOBJECT should respect the metadata hook, even if // it's set with scripts on the stack. function f() { for (var i=0; i<100; i++) { if (i === 20) - enableShellObjectMetadataCallback(); + enableShellAllocationMetadataBuilder(); var o = {x: 1}; if (i >= 20) { - var md = getObjectMetadata(o); + var md = getAllocationMetadata(o); assertEq(typeof md === "object" && md !== null, true); assertEq(typeof md.index, "number"); } } } f();
--- a/js/src/jit-test/tests/basic/bug951213.js +++ b/js/src/jit-test/tests/basic/bug951213.js @@ -1,8 +1,8 @@ -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); function foo(x, y) { this.g = x + y; } var a = 0; var b = { valueOf: function() Object.defineProperty(Object.prototype, 'g', {}) }; var c = new foo(a, b);
--- a/js/src/jit-test/tests/basic/bug951346.js +++ b/js/src/jit-test/tests/basic/bug951346.js @@ -1,3 +1,3 @@ -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); eval(uneval({'-1':true}));
--- a/js/src/jit-test/tests/basic/bug951632.js +++ b/js/src/jit-test/tests/basic/bug951632.js @@ -1,9 +1,9 @@ -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); var g = newGlobal() g.eval("function f(a) { return h(); }"); g.h = function () { return [1, 2, 3]; }; -var o = getObjectMetadata(g.f(5)); +var o = getAllocationMetadata(g.f(5)); assertEq(o.stack.length, 1); assertEq(o.stack[0], g.h);
--- a/js/src/jit-test/tests/basic/metadata-hook.js +++ b/js/src/jit-test/tests/basic/metadata-hook.js @@ -1,10 +1,10 @@ -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); function Foo() { this.x = 0; this.y = 1; } function hello() { function there() { @@ -13,18 +13,18 @@ function hello() { y = [2,3,5]; z = {a:0,b:1}; } callee = there; callee(); } hello(); -var wc = getObjectMetadata(w).index; -var xc = getObjectMetadata(x).index; -var yc = getObjectMetadata(y).index; -var zc = getObjectMetadata(z).index; +var wc = getAllocationMetadata(w).index; +var xc = getAllocationMetadata(x).index; +var yc = getAllocationMetadata(y).index; +var zc = getAllocationMetadata(z).index; assertEq(xc > wc, true); assertEq(yc > xc, true); assertEq(zc > yc, true); -assertEq(getObjectMetadata(x).stack[0], callee); -assertEq(getObjectMetadata(x).stack[1], hello); +assertEq(getAllocationMetadata(x).stack[0], callee); +assertEq(getAllocationMetadata(x).stack[1], hello);
--- a/js/src/jit-test/tests/basic/track-allocation-sites.js +++ b/js/src/jit-test/tests/basic/track-allocation-sites.js @@ -12,13 +12,13 @@ const tests = [ { name: "new Date", object: new Date(), line: Error().lineNumber } ]; disableTrackAllocations(); for (let { name, object, line } of tests) { print("Entering test: " + name); - let allocationSite = getObjectMetadata(object); + let allocationSite = getAllocationMetadata(object); print(allocationSite); assertEq(allocationSite.line, line); }
--- a/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-03.js +++ b/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-03.js @@ -58,17 +58,17 @@ test("Adding a new debuggee to a debugge test("Setting trackingAllocationSites to true should throw if the debugger " + "cannot install the allocation hooks for *every* debuggee.", () => { let d1r1 = dbg1.addDebuggee(root1); let d1r2 = dbg1.addDebuggee(root2); // Can't install allocation hooks for root2 with this set. - root2.enableShellObjectMetadataCallback(); + root2.enableShellAllocationMetadataBuilder(); assertThrowsInstanceOf(() => dbg1.memory.trackingAllocationSites = true, Error); // And after it throws, its trackingAllocationSites accessor should reflect that // allocation site tracking is still disabled in that Debugger. assertEq(dbg1.memory.trackingAllocationSites, false); assertEq(isTrackingAllocations(root1, d1r1), false); @@ -89,17 +89,17 @@ test("Re-enabling throws an error if we "for all debuggees.", () => { dbg1.enabled = false dbg1.memory.trackingAllocationSites = true; let d1r1 = dbg1.addDebuggee(root1); let d1r2 = dbg1.addDebuggee(root2); // Can't install allocation hooks for root2 with this set. - root2.enableShellObjectMetadataCallback(); + root2.enableShellAllocationMetadataBuilder(); assertThrowsInstanceOf(() => dbg1.enabled = true, Error); assertEq(dbg1.enabled, false); assertEq(isTrackingAllocations(root1, d1r1), false); assertEq(isTrackingAllocations(root2, d1r2), false); });
--- a/js/src/jit-test/tests/debug/bug1221378.js +++ b/js/src/jit-test/tests/debug/bug1221378.js @@ -3,9 +3,9 @@ // To test for this regression, we need some way to make the code that collects // metadata about object allocations allocate an Array. Presently, // enableShellObjectMetadataCallback installs a callback that does this, but if // that hook gets removed (in production there's only ever one callback we // actually use), then the ability to make whatever metadata collection code // remains allocate an Array will cover this regression. For example, it could // be a flag that one can only set in debug builds from TestingFunctions.cpp. -newGlobal().eval('enableShellObjectMetadataCallback(); Array'); +newGlobal().eval('enableShellAllocationMetadataBuilder(); Array');
--- a/js/src/jit-test/tests/gc/bug-1148383.js +++ b/js/src/jit-test/tests/gc/bug-1148383.js @@ -9,11 +9,11 @@ if (!opts['ion.enable'] || !opts['baseli function TestCase() {} function reportCompare () { var output = ""; var testcase = new TestCase(); testcase.reason = output; } reportCompare(); gczeal(4, 1000); -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); for (var i = 0; i < 10000; ++i) reportCompare();
--- a/js/src/jit-test/tests/gc/bug-1215678.js +++ b/js/src/jit-test/tests/gc/bug-1215678.js @@ -1,10 +1,10 @@ // |jit-test| error: ReferenceError if (!('oomTest' in this)) a; -enableShellObjectMetadataCallback() +enableShellAllocationMetadataBuilder() oomTest(() => { newGlobal() }) gczeal(9, 1); a;
--- a/js/src/jit-test/tests/gc/bug-886560.js +++ b/js/src/jit-test/tests/gc/bug-886560.js @@ -1,11 +1,11 @@ // |jit-test| error: x is not defined -// enableShellObjectMetadataCallback ignores its argument, because we don't +// enableShellAllocationMetadataBuilder ignores its argument, because we don't // permit metadata callbacks to run JS any more, so this test may be // unnecessary. We'll preserve its structure just in case. -enableShellObjectMetadataCallback(function(obj) { +enableShellAllocationMetadataBuilder(function(obj) { var res = {}; return res; }); gczeal(4); x();
--- a/js/src/jit-test/tests/gc/bug-935022.js +++ b/js/src/jit-test/tests/gc/bug-935022.js @@ -1,4 +1,4 @@ function callback(obj) {} -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); gczeal(7); var statusitems = [];
--- a/js/src/jit-test/tests/gc/bug-945280.js +++ b/js/src/jit-test/tests/gc/bug-945280.js @@ -1,4 +1,4 @@ gczeal(7,1); -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); gczeal(false); var statusitems = [];
--- a/js/src/jit-test/tests/gc/bug-945285.js +++ b/js/src/jit-test/tests/gc/bug-945285.js @@ -1,3 +1,3 @@ gczeal(11); function callback(obj) {} -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder();
--- a/js/src/jit-test/tests/gc/bug-961741.js +++ b/js/src/jit-test/tests/gc/bug-961741.js @@ -1,5 +1,5 @@ function r() { for (var x in undefined) {} } -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); r();
--- a/js/src/jit-test/tests/ion/bug1006899.js +++ b/js/src/jit-test/tests/ion/bug1006899.js @@ -2,17 +2,17 @@ if (!this.hasOwnProperty("TypedObject")) quit(); this.__defineGetter__("x", function() { return this; } ); function callback(obj) {} -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); evaluate("\ var { ArrayType, StructType, uint32 } = TypedObject;\ var L = 1024;\ var Matrix = uint32.array(L, 2);\ var matrix = new Matrix();\ for (var i = 0; i < L; i++)\ matrix[i][0] = x;\ ", { isRunOnce : true });
--- a/js/src/jit-test/tests/ion/bug1054241.js +++ b/js/src/jit-test/tests/ion/bug1054241.js @@ -1,12 +1,12 @@ setJitCompilerOption("baseline.warmup.trigger", 10); setJitCompilerOption("ion.warmup.trigger", 20); -enableShellObjectMetadataCallback(); +enableShellAllocationMetadataBuilder(); (function(){ for(var i = 0; i < 100; i++) { try{ var a = new Array(5); throw 1; } catch(e) {} } })();
--- a/js/src/jit-test/tests/ion/bug1057598.js +++ b/js/src/jit-test/tests/ion/bug1057598.js @@ -1,12 +1,12 @@ -// enableShellObjectMetadataCallback ignores its argument, because we don't +// enableShellAllocationMetadataBuilder ignores its argument, because we don't // permit metadata callbacks to run JS any more, so this test may be // unnecessary. We'll preserve its structure just in case. -enableShellObjectMetadataCallback(function( r, ... d) {}); +enableShellAllocationMetadataBuilder(function( r, ... d) {}); setJitCompilerOption("ion.warmup.trigger", 20); var uceFault = function (i) { if (i > 98) uceFault = function (i) { return true; }; } var uceFault_str_split = eval(uneval(uceFault).replace('uceFault', 'uceFault_str_split')) function rstr_split(i) { var x = "str01234567899876543210rts".split("" + i);
--- a/js/src/jit-test/tests/ion/recover-lambdas-bug1113940.js +++ b/js/src/jit-test/tests/ion/recover-lambdas-bug1113940.js @@ -1,33 +1,33 @@ gczeal(14); // The object metadata callback can iterate over the stack. Thus during the // allocation of the lambda we might inspect the stack which is still incomplete // because the lambda is not yet reconstructed. // -// enableShellObjectMetadataCallback ignores its argument, because we don't +// enableShellAllocationMetadataBuilder ignores its argument, because we don't // permit metadata callbacks to run JS any more, so this test may be // unnecessary. We'll preserve its structure just in case. -enableShellObjectMetadataCallback(function() {}); +enableShellAllocationMetadataBuilder(function() {}); function f() { (function() { '' ^ Object })(); } x = 0; for (var j = 0; j < 99; ++j) { x += f(); } try { x = true; // Same comment as above. - enableShellObjectMetadataCallback(function([x, y, z], ... Debugger) {}); + enableShellAllocationMetadataBuilder(function([x, y, z], ... Debugger) {}); for (var i = 0; i < 10; ++i) { var f = function() { function g() { x++; } g(); } f();
--- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -501,17 +501,17 @@ GenerateNewObjectWithTemplateCode(JSCont #endif Label failure; Register objReg = R0.scratchReg(); Register tempReg = R1.scratchReg(); masm.movePtr(ImmGCPtr(templateObject->group()), tempReg); masm.branchTest32(Assembler::NonZero, Address(tempReg, ObjectGroup::offsetOfFlags()), Imm32(OBJECT_FLAG_PRE_TENURE), &failure); - masm.branchPtr(Assembler::NotEqual, AbsoluteAddress(cx->compartment()->addressOfMetadataCallback()), + masm.branchPtr(Assembler::NotEqual, AbsoluteAddress(cx->compartment()->addressOfMetadataBuilder()), ImmWord(0), &failure); masm.createGCObject(objReg, tempReg, templateObject, gc::DefaultHeap, &failure); masm.tagValue(JSVAL_TYPE_OBJECT, objReg, R0); EmitReturnFromIC(masm); masm.bind(&failure); EmitStubGuardFailure(masm);
--- a/js/src/jit/CompileWrappers.cpp +++ b/js/src/jit/CompileWrappers.cpp @@ -258,19 +258,19 @@ CompileCompartment::addressOfRandomNumbe const JitCompartment* CompileCompartment::jitCompartment() { return compartment()->jitCompartment(); } bool -CompileCompartment::hasObjectMetadataCallback() +CompileCompartment::hasAllocationMetadataBuilder() { - return compartment()->hasObjectMetadataCallback(); + return compartment()->hasAllocationMetadataBuilder(); } // Note: This function is thread-safe because setSingletonAsValue sets a boolean // variable to false, and this boolean variable has no way to be resetted to // true. So even if there is a concurrent write, this concurrent write will // always have the same value. If there is a concurrent read, then we will // clone a singleton instead of using the value which is baked in the JSScript, // and this would be an unfortunate allocation, but this will not change the
--- a/js/src/jit/CompileWrappers.h +++ b/js/src/jit/CompileWrappers.h @@ -112,17 +112,17 @@ class CompileCompartment CompileZone* zone(); CompileRuntime* runtime(); const void* addressOfEnumerators(); const void* addressOfRandomNumberGenerator(); const JitCompartment* jitCompartment(); - bool hasObjectMetadataCallback(); + bool hasAllocationMetadataBuilder(); // Mirror CompartmentOptions. void setSingletonsAsValues(); }; class JitCompileOptions { public:
--- a/js/src/jit/MacroAssembler.cpp +++ b/js/src/jit/MacroAssembler.cpp @@ -722,17 +722,17 @@ MacroAssembler::checkAllocatorState(Labe // Don't execute the inline path if gc zeal or tracing are active. branch32(Assembler::NotEqual, AbsoluteAddress(GetJitContext()->runtime->addressOfGCZealModeBits()), Imm32(0), fail); #endif // Don't execute the inline path if the compartment has an object metadata callback, // as the metadata to use for the object may vary between executions of the op. - if (GetJitContext()->compartment->hasObjectMetadataCallback()) + if (GetJitContext()->compartment->hasAllocationMetadataBuilder()) jump(fail); } // Inline version of ShouldNurseryAllocate. bool MacroAssembler::shouldNurseryAllocate(gc::AllocKind allocKind, gc::InitialHeap initialHeap) { // Note that Ion elides barriers on writes to objects known to be in the
--- a/js/src/jsapi-tests/testSavedStacks.cpp +++ b/js/src/jsapi-tests/testSavedStacks.cpp @@ -11,19 +11,19 @@ #include "builtin/TestingFunctions.h" #include "jsapi-tests/tests.h" #include "vm/ArrayObject.h" #include "vm/SavedStacks.h" BEGIN_TEST(testSavedStacks_withNoStack) { JSCompartment* compartment = js::GetContextCompartment(cx); - compartment->setObjectMetadataCallback(js::SavedStacksMetadataCallback); + compartment->setAllocationMetadataBuilder(js::SavedStacksMetadataBuilder); JS::RootedObject obj(cx, js::NewDenseEmptyArray(cx)); - compartment->setObjectMetadataCallback(nullptr); + compartment->setAllocationMetadataBuilder(nullptr); return true; } END_TEST(testSavedStacks_withNoStack) BEGIN_TEST(testSavedStacks_ApiDefaultValues) { js::RootedSavedFrame savedFrame(cx, nullptr);
--- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -3269,17 +3269,17 @@ static const ClassSpec ArrayObjectClassS nullptr, array_methods, nullptr, array_proto_finish }; const Class ArrayObject::class_ = { "Array", - JSCLASS_HAS_CACHED_PROTO(JSProto_Array) | JSCLASS_DELAY_METADATA_CALLBACK, + JSCLASS_HAS_CACHED_PROTO(JSProto_Array) | JSCLASS_DELAY_METADATA_BUILDER, array_addProperty, nullptr, /* delProperty */ nullptr, /* getProperty */ nullptr, /* setProperty */ nullptr, /* enumerate */ nullptr, /* resolve */ nullptr, /* mayResolve */ nullptr, /* finalize */
--- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -54,17 +54,17 @@ JSCompartment::JSCompartment(Zone* zone, warnedAboutExprClosure(false), #ifdef DEBUG firedOnNewGlobalObject(false), #endif global_(nullptr), enterCompartmentDepth(0), performanceMonitoring(runtime_), data(nullptr), - objectMetadataCallback(nullptr), + allocationMetadataBuilder(nullptr), lastAnimationTime(0), regExps(runtime_), globalWriteBarriered(false), detachedTypedObjects(0), objectMetadataState(ImmediateMetadata()), propertyTree(thisForCtor()), selfHostingScriptSource(nullptr), objectMetadataTable(nullptr), @@ -868,38 +868,38 @@ JSCompartment::clearTables() baseShapes.clear(); if (initialShapes.initialized()) initialShapes.clear(); if (savedStacks_.initialized()) savedStacks_.clear(); } void -JSCompartment::setObjectMetadataCallback(js::ObjectMetadataCallback callback) +JSCompartment::setAllocationMetadataBuilder(js::AllocationMetadataBuilder callback) { // Clear any jitcode in the runtime, which behaves differently depending on // whether there is a creation callback. ReleaseAllJITCode(runtime_->defaultFreeOp()); - objectMetadataCallback = callback; + allocationMetadataBuilder = callback; } void JSCompartment::clearObjectMetadata() { js_delete(objectMetadataTable); objectMetadataTable = nullptr; } void JSCompartment::setNewObjectMetadata(JSContext* cx, HandleObject obj) { assertSameCompartment(cx, this, obj); - if (JSObject* metadata = objectMetadataCallback(cx, obj)) { + if (JSObject* metadata = allocationMetadataBuilder(cx, obj)) { AutoEnterOOMUnsafeRegion oomUnsafe; assertSameCompartment(cx, metadata); if (!objectMetadataTable) { objectMetadataTable = cx->new_<ObjectWeakMap>(cx); if (!objectMetadataTable || !objectMetadataTable->init()) oomUnsafe.crash("setNewObjectMetadata"); } if (!objectMetadataTable->add(cx, obj, metadata))
--- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -137,35 +137,35 @@ struct WrapperHasher : public DefaultHas return l.kind == k.kind && l.debugger == k.debugger && l.wrapped == k.wrapped; } }; using WrapperMap = GCRekeyableHashMap<CrossCompartmentKey, ReadBarrieredValue, WrapperHasher, SystemAllocPolicy>; // We must ensure that all newly allocated JSObjects get their metadata -// set. However, metadata callbacks may require the new object be in a sane +// set. However, metadata builders may require the new object be in a sane // state (eg, have its reserved slots initialized so they can get the // sizeOfExcludingThis of the object). Therefore, for objects of certain -// JSClasses (those marked with JSCLASS_DELAY_METADATA_CALLBACK), it is not safe -// for the allocation paths to call the object metadata callback +// JSClasses (those marked with JSCLASS_DELAY_METADATA_BUILDER), it is not safe +// for the allocation paths to call the object metadata builder // immediately. Instead, the JSClass-specific "constructor" C++ function up the // stack makes a promise that it will ensure that the new object has its // metadata set after the object is initialized. // // To help those constructor functions keep their promise of setting metadata, // each compartment is in one of three states at any given time: // // * ImmediateMetadata: Allocators should set new object metadata immediately, // as usual. // // * DelayMetadata: Allocators should *not* set new object metadata, it will be // handled after reserved slots are initialized by custom code // for the object's JSClass. The newly allocated object's -// JSClass *must* have the JSCLASS_DELAY_METADATA_CALLBACK flag +// JSClass *must* have the JSCLASS_DELAY_METADATA_BUILDER flag // set. // // * PendingMetadata: This object has been allocated and is still pending its // metadata. This should never be the case when we begin an // allocation, as a constructor function was supposed to have // set the metadata of the previous object *before* // allocating another object. // @@ -362,17 +362,17 @@ struct JSCompartment inline js::GlobalObject* unsafeUnbarrieredMaybeGlobal() const; inline void initGlobal(js::GlobalObject& global); public: void* data; private: - js::ObjectMetadataCallback objectMetadataCallback; + js::AllocationMetadataBuilder allocationMetadataBuilder; js::SavedStacks savedStacks_; js::WrapperMap crossCompartmentWrappers; public: /* Last time at which an animation was played for a global in this compartment. */ int64_t lastAnimationTime; @@ -600,26 +600,26 @@ struct JSCompartment void purge(); void clearTables(); static void fixupCrossCompartmentWrappersAfterMovingGC(JSTracer* trc); void fixupInitialShapeTable(); void fixupAfterMovingGC(); void fixupGlobal(); - bool hasObjectMetadataCallback() const { return objectMetadataCallback; } - js::ObjectMetadataCallback getObjectMetadataCallback() const { return objectMetadataCallback; } - void setObjectMetadataCallback(js::ObjectMetadataCallback callback); - void forgetObjectMetadataCallback() { - objectMetadataCallback = nullptr; + bool hasAllocationMetadataBuilder() const { return allocationMetadataBuilder; } + js::AllocationMetadataBuilder getAllocationMetadataBuilder() const { return allocationMetadataBuilder; } + void setAllocationMetadataBuilder(js::AllocationMetadataBuilder builder); + void forgetAllocationMetadataBuilder() { + allocationMetadataBuilder = nullptr; } void setNewObjectMetadata(JSContext* cx, JS::HandleObject obj); void clearObjectMetadata(); - const void* addressOfMetadataCallback() const { - return &objectMetadataCallback; + const void* addressOfMetadataBuilder() const { + return &allocationMetadataBuilder; } js::SavedStacks& savedStacks() { return savedStacks_; } void findOutgoingEdges(js::gc::ComponentFinder<JS::Zone>& finder); js::DtoaCache dtoaCache; @@ -958,32 +958,32 @@ class MOZ_RAII AutoWrapperRooter : priva friend void JS::AutoGCRooter::trace(JSTracer* trc); private: WrapperValue value; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class MOZ_RAII AutoSuppressObjectMetadataCallback { +class MOZ_RAII AutoSuppressAllocationMetadataBuilder { JS::Zone* zone; bool saved; public: - explicit AutoSuppressObjectMetadataCallback(ExclusiveContext* cx) - : AutoSuppressObjectMetadataCallback(cx->compartment()->zone()) + explicit AutoSuppressAllocationMetadataBuilder(ExclusiveContext* cx) + : AutoSuppressAllocationMetadataBuilder(cx->compartment()->zone()) { } - explicit AutoSuppressObjectMetadataCallback(JS::Zone* zone) + explicit AutoSuppressAllocationMetadataBuilder(JS::Zone* zone) : zone(zone), - saved(zone->suppressObjectMetadataCallback) + saved(zone->suppressAllocationMetadataBuilder) { - zone->suppressObjectMetadataCallback = true; + zone->suppressAllocationMetadataBuilder = true; } - ~AutoSuppressObjectMetadataCallback() { - zone->suppressObjectMetadataCallback = saved; + ~AutoSuppressAllocationMetadataBuilder() { + zone->suppressAllocationMetadataBuilder = saved; } }; } /* namespace js */ #endif /* jscompartment_h */
--- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -134,17 +134,17 @@ JS_NewObjectWithUniqueType(JSContext* cx if (!JS_SplicePrototype(cx, obj, proto)) return nullptr; return obj; } JS_FRIEND_API(JSObject*) JS_NewObjectWithoutMetadata(JSContext* cx, const JSClass* clasp, JS::Handle<JSObject*> proto) { - AutoSuppressObjectMetadataCallback suppressMetadata(cx); + AutoSuppressAllocationMetadataBuilder suppressMetadata(cx); return JS_NewObjectWithGivenProto(cx, clasp, proto); } JS_FRIEND_API(JSPrincipals*) JS_GetCompartmentPrincipals(JSCompartment* compartment) { return compartment->principals(); } @@ -1229,23 +1229,23 @@ js::AutoCTypesActivityCallback::AutoCTyp { MOZ_GUARD_OBJECT_NOTIFIER_INIT; if (callback) callback(cx, beginType); } JS_FRIEND_API(void) -js::SetObjectMetadataCallback(JSContext* cx, ObjectMetadataCallback callback) +js::SetAllocationMetadataBuilder(JSContext* cx, AllocationMetadataBuilder callback) { - cx->compartment()->setObjectMetadataCallback(callback); + cx->compartment()->setAllocationMetadataBuilder(callback); } JS_FRIEND_API(JSObject*) -js::GetObjectMetadata(JSObject* obj) +js::GetAllocationMetadata(JSObject* obj) { ObjectWeakMap* map = obj->compartment()->objectMetadataTable; if (map) return map->lookup(obj); return nullptr; } JS_FRIEND_API(bool)
--- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -328,17 +328,17 @@ extern JS_FRIEND_DATA(const js::ObjectOp objectMoved \ } #define PROXY_CLASS_WITH_EXT(name, flags, ext) \ { \ name, \ js::Class::NON_NATIVE | \ JSCLASS_IS_PROXY | \ - JSCLASS_DELAY_METADATA_CALLBACK | \ + JSCLASS_DELAY_METADATA_BUILDER | \ flags, \ nullptr, /* addProperty */ \ nullptr, /* delProperty */ \ nullptr, /* getProperty */ \ nullptr, /* setProperty */ \ nullptr, /* enumerate */ \ nullptr, /* resolve */ \ nullptr, /* mayResolve */ \ @@ -2661,29 +2661,29 @@ class MOZ_RAII JS_FRIEND_API(AutoCTypesA if (callback) { callback(cx, endType); callback = nullptr; } } }; typedef JSObject* -(* ObjectMetadataCallback)(JSContext* cx, JS::HandleObject obj); +(* AllocationMetadataBuilder)(JSContext* cx, JS::HandleObject obj); /** * Specify a callback to invoke when creating each JS object in the current * compartment, which may return a metadata object to associate with the * object. */ JS_FRIEND_API(void) -SetObjectMetadataCallback(JSContext* cx, ObjectMetadataCallback callback); +SetAllocationMetadataBuilder(JSContext* cx, AllocationMetadataBuilder callback); /** Get the metadata associated with an object. */ JS_FRIEND_API(JSObject*) -GetObjectMetadata(JSObject* obj); +GetAllocationMetadata(JSObject* obj); JS_FRIEND_API(bool) GetElementsWithAdder(JSContext* cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t begin, uint32_t end, js::ElementAdder* adder); JS_FRIEND_API(bool) ForwardToNative(JSContext* cx, JSNative native, const JS::CallArgs& args);
--- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -272,37 +272,37 @@ ClassCanHaveFixedData(const Class* clasp // buffer's data. return !clasp->isNative() || clasp == &js::ArrayBufferObject::class_ || js::IsTypedArrayClass(clasp); } // This function is meant to be called from allocation fast paths. // -// If we do have an allocation metadata hook, it can cause a GC, so the object +// If we do have an allocation metadata builder, it can cause a GC, so the object // must be rooted. The usual way to do this would be to make our callers pass a // HandleObject, but that would require them to pay the cost of rooting the // object unconditionally, even though collecting metadata is rare. Instead, // SetNewObjectMetadata's contract is that the caller must use the pointer // returned in place of the pointer passed. If a GC occurs, the returned pointer // may be the passed pointer, relocated by GC. If no GC could occur, it's just // passed through. We root nothing unless necessary. static MOZ_ALWAYS_INLINE MOZ_WARN_UNUSED_RESULT JSObject* SetNewObjectMetadata(ExclusiveContext* cxArg, JSObject* obj) { MOZ_ASSERT(!cxArg->compartment()->hasObjectPendingMetadata()); - // The metadata callback is invoked for each object created on the main + // The metadata builder is invoked for each object created on the main // thread, except when analysis/compilation is active, to avoid recursion. if (JSContext* cx = cxArg->maybeJSContext()) { - if (MOZ_UNLIKELY((size_t)cx->compartment()->hasObjectMetadataCallback()) && - !cx->zone()->suppressObjectMetadataCallback) + if (MOZ_UNLIKELY((size_t)cx->compartment()->hasAllocationMetadataBuilder()) && + !cx->zone()->suppressAllocationMetadataBuilder) { // Don't collect metadata on objects that represent metadata. - AutoSuppressObjectMetadataCallback suppressMetadata(cx); + AutoSuppressAllocationMetadataBuilder suppressMetadata(cx); RootedObject rooted(cx, obj); cx->compartment()->setNewObjectMetadata(cx, rooted); return rooted; } } return obj; @@ -366,17 +366,17 @@ JSObject::create(js::ExclusiveContext* c memset(obj->as<JSFunction>().fixedSlots(), 0, size - sizeof(js::NativeObject)); if (kind == js::gc::AllocKind::FUNCTION_EXTENDED) { // SetNewObjectMetadata may gc, which will be unhappy if flags & // EXTENDED doesn't match the arena's AllocKind. obj->as<JSFunction>().setFlags(JSFunction::EXTENDED); } } - if (group->clasp()->shouldDelayMetadataCallback()) + if (group->clasp()->shouldDelayMetadataBuilder()) cx->compartment()->setObjectPendingMetadata(cx, obj); else obj = SetNewObjectMetadata(cx, obj); js::gc::TraceCreateObject(obj); return obj; }
--- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -672,17 +672,17 @@ ArgumentsObject::objectMovedDuringMinorG /* * The classes below collaborate to lazily reflect and synchronize actual * argument values, argument count, and callee function object stored in a * stack frame with their corresponding property values in the frame's * arguments object. */ const Class MappedArgumentsObject::class_ = { "Arguments", - JSCLASS_DELAY_METADATA_CALLBACK | + JSCLASS_DELAY_METADATA_BUILDER | JSCLASS_HAS_RESERVED_SLOTS(MappedArgumentsObject::RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_Object) | JSCLASS_SKIP_NURSERY_FINALIZE | JSCLASS_BACKGROUND_FINALIZE, nullptr, /* addProperty */ ArgumentsObject::obj_delProperty, nullptr, /* getProperty */ nullptr, /* setProperty */ @@ -697,17 +697,17 @@ const Class MappedArgumentsObject::class }; /* * Unmapped arguments is significantly less magical than mapped arguments, so * it is represented by a different class while sharing some functionality. */ const Class UnmappedArgumentsObject::class_ = { "Arguments", - JSCLASS_DELAY_METADATA_CALLBACK | + JSCLASS_DELAY_METADATA_BUILDER | JSCLASS_HAS_RESERVED_SLOTS(UnmappedArgumentsObject::RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_Object) | JSCLASS_SKIP_NURSERY_FINALIZE | JSCLASS_BACKGROUND_FINALIZE, nullptr, /* addProperty */ ArgumentsObject::obj_delProperty, nullptr, /* getProperty */ nullptr, /* setProperty */
--- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -93,17 +93,17 @@ js::ToClampedIndex(JSContext* cx, Handle const Class ArrayBufferObject::protoClass = { "ArrayBufferPrototype", JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayBuffer) }; const Class ArrayBufferObject::class_ = { "ArrayBuffer", - JSCLASS_DELAY_METADATA_CALLBACK | + JSCLASS_DELAY_METADATA_BUILDER | JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayBuffer) | JSCLASS_BACKGROUND_FINALIZE, nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* getProperty */ nullptr, /* setProperty */ nullptr, /* enumerate */
--- a/js/src/vm/ArrayObject-inl.h +++ b/js/src/vm/ArrayObject-inl.h @@ -39,17 +39,17 @@ ArrayObject::createArrayInternal(Exclusi { // Create a new array and initialize everything except for its elements. MOZ_ASSERT(shape && group); MOZ_ASSERT(group->clasp() == shape->getObjectClass()); MOZ_ASSERT(group->clasp() == &ArrayObject::class_); MOZ_ASSERT_IF(group->clasp()->finalize, heap == gc::TenuredHeap); MOZ_ASSERT_IF(group->hasUnanalyzedPreliminaryObjects(), heap == js::gc::TenuredHeap); - MOZ_ASSERT(group->clasp()->shouldDelayMetadataCallback()); + MOZ_ASSERT(group->clasp()->shouldDelayMetadataBuilder()); // Arrays can use their fixed slots to store elements, so can't have shapes // which allow named properties to be stored in the fixed slots. MOZ_ASSERT(shape->numFixedSlots() == 0); size_t nDynamicSlots = dynamicSlotsCount(0, shape->slotSpan(), group->clasp()); JSObject* obj = Allocate<JSObject>(cx, kind, nDynamicSlots, heap, group->clasp()); if (!obj)
--- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -2425,18 +2425,18 @@ Debugger::updateObservesAsmJSOnDebuggees } /*** Allocations Tracking *************************************************************************/ /* static */ bool Debugger::cannotTrackAllocations(const GlobalObject& global) { - auto existingCallback = global.compartment()->getObjectMetadataCallback(); - return existingCallback && existingCallback != SavedStacksMetadataCallback; + auto existingCallback = global.compartment()->getAllocationMetadataBuilder(); + return existingCallback && existingCallback != SavedStacksMetadataBuilder; } /* static */ bool Debugger::isObservedByDebuggerTrackingAllocations(const GlobalObject& debuggee) { if (auto* v = debuggee.getDebuggers()) { for (auto p = v->begin(); p != v->end(); p++) { if ((*p)->trackingAllocationSites && (*p)->enabled) { @@ -2456,33 +2456,33 @@ Debugger::addAllocationsTracking(JSConte MOZ_ASSERT(isObservedByDebuggerTrackingAllocations(*debuggee)); if (Debugger::cannotTrackAllocations(*debuggee)) { JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OBJECT_METADATA_CALLBACK_ALREADY_SET); return false; } - debuggee->compartment()->setObjectMetadataCallback(SavedStacksMetadataCallback); + debuggee->compartment()->setAllocationMetadataBuilder(SavedStacksMetadataBuilder); debuggee->compartment()->chooseAllocationSamplingProbability(); return true; } /* static */ void Debugger::removeAllocationsTracking(GlobalObject& global) { // If there are still Debuggers that are observing allocations, we cannot // remove the metadata callback yet. Recompute the sampling probability // based on the remaining debuggers' needs. if (isObservedByDebuggerTrackingAllocations(global)) { global.compartment()->chooseAllocationSamplingProbability(); return; } - global.compartment()->forgetObjectMetadataCallback(); + global.compartment()->forgetAllocationMetadataBuilder(); } bool Debugger::addAllocationsTrackingForAllDebuggees(JSContext* cx) { MOZ_ASSERT(trackingAllocationSites); // We don't want to end up in a state where we added allocations @@ -3480,17 +3480,17 @@ Debugger::addDebuggeeGlobal(JSContext* c /* * For global to become this js::Debugger's debuggee: * * 1. this js::Debugger must be in global->getDebuggers(), * 2. global must be in this->debuggees, * 3. it must be in zone->getDebuggers(), * 4. the debuggee's zone must be in this->debuggeeZones, - * 5. if we are tracking allocations, the SavedStacksMetadataCallback must be + * 5. if we are tracking allocations, the SavedStacksMetadataBuilder must be * installed for this compartment, and * 6. JSCompartment::isDebuggee()'s bit must be set. * * All six indications must be kept consistent. */ AutoCompartment ac(cx, global); Zone* zone = global->zone(); @@ -8001,17 +8001,17 @@ DebuggerObject_getGlobal(JSContext* cx, return false; args.rval().set(v); return true; } /* static */ SavedFrame* Debugger::getObjectAllocationSite(JSObject& obj) { - JSObject* metadata = GetObjectMetadata(&obj); + JSObject* metadata = GetAllocationMetadata(&obj); if (!metadata) return nullptr; MOZ_ASSERT(!metadata->is<WrapperObject>()); return SavedFrame::isSavedFrameAndNotProto(*metadata) ? &metadata->as<SavedFrame>() : nullptr; }
--- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -129,17 +129,17 @@ GlobalObject::ensureConstructor(JSContex GlobalObject::resolveConstructor(JSContext* cx, Handle<GlobalObject*> global, JSProtoKey key) { MOZ_ASSERT(!global->isStandardClassResolved(key)); // Prohibit collection of allocation metadata. Metadata builders shouldn't // need to observe lazily-constructed prototype objects coming into // existence. And assertions start to fail when the builder itself attempts // an allocation that re-entrantly tries to create the same prototype. - AutoSuppressObjectMetadataCallback suppressMetadata(cx); + AutoSuppressAllocationMetadataBuilder suppressMetadata(cx); // Constructor resolution may execute self-hosted scripts. These // self-hosted scripts do not call out to user code by construction. Allow // all scripts to execute, even in debuggee compartments that are paused. AutoSuppressDebuggeeNoExecuteChecks suppressNX(cx); // There are two different kinds of initialization hooks. One of them is // the class js::InitFoo hook, defined in a JSProtoKey-keyed table at the
--- a/js/src/vm/ProxyObject.cpp +++ b/js/src/vm/ProxyObject.cpp @@ -15,17 +15,17 @@ using namespace js; ProxyObject::New(JSContext* cx, const BaseProxyHandler* handler, HandleValue priv, TaggedProto proto_, const ProxyOptions& options) { Rooted<TaggedProto> proto(cx, proto_); const Class* clasp = options.clasp(); MOZ_ASSERT(isValidProxyClass(clasp)); - MOZ_ASSERT(clasp->shouldDelayMetadataCallback()); + MOZ_ASSERT(clasp->shouldDelayMetadataBuilder()); MOZ_ASSERT_IF(proto.isObject(), cx->compartment() == proto.toObject()->compartment()); /* * Eagerly mark properties unknown for proxies, so we don't try to track * their properties and so that we don't need to walk the compartment if * their prototype changes later. But don't do this for DOM proxies, * because we want to be able to keep track of them in typesets in useful * ways.
--- a/js/src/vm/Runtime-inl.h +++ b/js/src/vm/Runtime-inl.h @@ -62,17 +62,17 @@ NewObjectCache::newObjectFromHit(JSConte NativeObject* obj = static_cast<NativeObject*>(Allocate<JSObject, NoGC>(cx, entry->kind, 0, heap, group->clasp())); if (!obj) return nullptr; copyCachedToObject(obj, templateObj, entry->kind); - if (group->clasp()->shouldDelayMetadataCallback()) + if (group->clasp()->shouldDelayMetadataBuilder()) cx->compartment()->setObjectPendingMetadata(cx, obj); else obj = static_cast<NativeObject*>(SetNewObjectMetadata(cx, obj)); probes::CreateObject(cx, obj); gc::TraceCreateObject(obj); return obj; }
--- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -482,17 +482,17 @@ SavedFrame::initFromLookup(SavedFrame::H /* static */ SavedFrame* SavedFrame::create(JSContext* cx) { RootedGlobalObject global(cx, cx->global()); assertSameCompartment(cx, global); // Ensure that we don't try to capture the stack again in the - // `SavedStacksMetadataCallback` for this new SavedFrame object, and + // `SavedStacksMetadataBuilder` for this new SavedFrame object, and // accidentally cause O(n^2) behavior. SavedStacks::AutoReentrancyGuard guard(cx->compartment()->savedStacks()); RootedNativeObject proto(cx, GlobalObject::getOrCreateSavedFramePrototype(cx, global)); if (!proto) return nullptr; assertSameCompartment(cx, proto); @@ -1470,31 +1470,31 @@ SavedStacks::chooseSamplingProbability(J bernoulli.setRandomState(seed[0], seed[1]); bernoulliSeeded = true; } bernoulli.setProbability(probability); } JSObject* -SavedStacksMetadataCallback(JSContext* cx, HandleObject target) +SavedStacksMetadataBuilder(JSContext* cx, HandleObject target) { RootedObject obj(cx, target); SavedStacks& stacks = cx->compartment()->savedStacks(); if (!stacks.bernoulli.trial()) return nullptr; AutoEnterOOMUnsafeRegion oomUnsafe; RootedSavedFrame frame(cx); if (!stacks.saveCurrentStack(cx, &frame)) - oomUnsafe.crash("SavedStacksMetadataCallback"); + oomUnsafe.crash("SavedStacksMetadataBuilder"); if (!Debugger::onLogAllocationSite(cx, obj, frame, JS_GetCurrentEmbedderTime())) - oomUnsafe.crash("SavedStacksMetadataCallback"); + oomUnsafe.crash("SavedStacksMetadataBuilder"); MOZ_ASSERT_IF(frame, !frame->is<WrapperObject>()); return frame; } #ifdef JS_CRASH_DIAGNOSTICS void CompartmentChecker::check(SavedStacks* stacks)
--- a/js/src/vm/SavedStacks.h +++ b/js/src/vm/SavedStacks.h @@ -144,17 +144,17 @@ namespace js { // In the case of z, the `SavedFrame` accessors are called with the `SavedFrame` // object in the `this` value, and the content compartment as the cx's current // compartment. Similar to the case of y, only the B and C frames are exposed // because the cx's current compartment's principals do not subsume A's captured // principals. class SavedStacks { friend class SavedFrame; - friend JSObject* SavedStacksMetadataCallback(JSContext* cx, HandleObject target); + friend JSObject* SavedStacksMetadataBuilder(JSContext* cx, HandleObject target); friend bool JS::ubi::ConstructSavedFrameStackSlow(JSContext* cx, JS::ubi::StackFrame& ubiFrame, MutableHandleObject outSavedFrameStack); public: SavedStacks() : frames(), bernoulliSeeded(false), @@ -294,17 +294,17 @@ class SavedStacks { // removes the dead script; the second will clear out the source atom since // it is no longer held by the table. using PCLocationMap = GCHashMap<PCKey, LocationValue, PCLocationHasher, SystemAllocPolicy>; PCLocationMap pcLocationMap; bool getLocation(JSContext* cx, const FrameIter& iter, MutableHandle<LocationValue> locationp); }; -JSObject* SavedStacksMetadataCallback(JSContext* cx, HandleObject target); +JSObject* SavedStacksMetadataBuilder(JSContext* cx, HandleObject target); template <> class RootedBase<SavedStacks::LocationValue> : public SavedStacks::MutableLocationValueOperations<JS::Rooted<SavedStacks::LocationValue>> {}; template <> class MutableHandleBase<SavedStacks::LocationValue>
--- a/js/src/vm/SharedArrayObject.cpp +++ b/js/src/vm/SharedArrayObject.cpp @@ -343,17 +343,17 @@ SharedArrayBufferObject::addSizeOfExclud const Class SharedArrayBufferObject::protoClass = { "SharedArrayBufferPrototype", JSCLASS_HAS_CACHED_PROTO(JSProto_SharedArrayBuffer) }; const Class SharedArrayBufferObject::class_ = { "SharedArrayBuffer", - JSCLASS_DELAY_METADATA_CALLBACK | + JSCLASS_DELAY_METADATA_BUILDER | JSCLASS_HAS_RESERVED_SLOTS(SharedArrayBufferObject::RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_SharedArrayBuffer), nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* getProperty */ nullptr, /* setProperty */ nullptr, /* enumerate */ nullptr, /* resolve */
--- a/js/src/vm/TypeInference-inl.h +++ b/js/src/vm/TypeInference-inl.h @@ -281,17 +281,17 @@ struct AutoEnterAnalysis // Allow clearing inference info on OOM during incremental sweeping. AutoClearTypeInferenceStateOnOOM oom; // Pending recompilations to perform before execution of JIT code can resume. RecompileInfoVector pendingRecompiles; // Prevent us from calling the objectMetadataCallback. - js::AutoSuppressObjectMetadataCallback suppressMetadata; + js::AutoSuppressAllocationMetadataBuilder suppressMetadata; FreeOp* freeOp; Zone* zone; explicit AutoEnterAnalysis(ExclusiveContext* cx) : suppressGC(cx), oom(cx->zone()), suppressMetadata(cx) { init(cx->defaultFreeOp(), cx->zone());
--- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -1933,17 +1933,17 @@ static const ClassSpec TypedArrayObjectC }; #define IMPL_TYPED_ARRAY_CLASS(_type) \ { \ #_type "Array", \ JSCLASS_HAS_RESERVED_SLOTS(TypedArrayObject::RESERVED_SLOTS) | \ JSCLASS_HAS_PRIVATE | \ JSCLASS_HAS_CACHED_PROTO(JSProto_##_type##Array) | \ - JSCLASS_DELAY_METADATA_CALLBACK, \ + JSCLASS_DELAY_METADATA_BUILDER, \ nullptr, /* addProperty */ \ nullptr, /* delProperty */ \ nullptr, /* getProperty */ \ nullptr, /* setProperty */ \ nullptr, /* enumerate */ \ nullptr, /* resolve */ \ nullptr, /* mayResolve */ \ nullptr, /* finalize */ \
--- a/js/src/vm/UnboxedObject.cpp +++ b/js/src/vm/UnboxedObject.cpp @@ -919,17 +919,17 @@ static const ObjectOps UnboxedPlainObjec UnboxedPlainObject::obj_enumerate, nullptr /* funToString */ }; const Class UnboxedPlainObject::class_ = { js_Object_str, Class::NON_NATIVE | JSCLASS_HAS_CACHED_PROTO(JSProto_Object) | - JSCLASS_DELAY_METADATA_CALLBACK, + JSCLASS_DELAY_METADATA_BUILDER, nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* getProperty */ nullptr, /* setProperty */ nullptr, /* enumerate */ nullptr, /* resolve */ nullptr, /* mayResolve */ nullptr, /* finalize */