author | Jan de Mooij <jdemooij@mozilla.com> |
Thu, 19 Apr 2018 13:14:18 +0200 | |
changeset 414538 | cf2687e4e96eaff899122f321ef3391ba5a5a260 |
parent 414537 | 292f8e5c6336f089843d98b661771bc90db69adb |
child 414539 | 22ed5e1657aa09a41cca5ae6efa93421e82c842d |
push id | 33871 |
push user | csabou@mozilla.com |
push date | Thu, 19 Apr 2018 22:30:08 +0000 |
treeherder | mozilla-central@5d73549d363f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jonco |
bugs | 1452602 |
milestone | 61.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/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -6220,36 +6220,48 @@ EnsureGrayRoot(JSContext* cx, unsigned a return true; } static MarkBitObservers* EnsureMarkBitObservers(JSContext* cx) { ShellContext* sc = GetShellContext(cx); if (!sc->markObservers) { - sc->markObservers.reset(cx->new_<MarkBitObservers>(cx->runtime(), - NonshrinkingGCObjectVector())); + auto* observers = + cx->new_<MarkBitObservers>(cx->runtime(), NonshrinkingGCObjectVector()); + if (!observers) + return nullptr; + sc->markObservers.reset(observers); } return sc->markObservers.get(); } static bool ClearMarkObservers(JSContext* cx, unsigned argc, Value* vp) { + CallArgs args = CallArgsFromVp(argc, vp); + auto markObservers = EnsureMarkBitObservers(cx); + if (!markObservers) + return false; + markObservers->get().clear(); + + args.rval().setUndefined(); return true; } static bool AddMarkObservers(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); auto markObservers = EnsureMarkBitObservers(cx); + if (!markObservers) + return false; if (!args.get(0).isObject()) { JS_ReportErrorASCII(cx, "argument must be an Array of objects"); return false; } // WeakCaches are not swept during a minor GC. To prevent nursery-allocated // contents from having the mark bits be deceptively black until the second @@ -7094,16 +7106,44 @@ JS_FN_HELP("parseBin", BinParse, 1, 0, "Take jobs from the shell's job queue in FIFO order and run them until the\n" "queue is empty.\n"), JS_FN_HELP("setPromiseRejectionTrackerCallback", SetPromiseRejectionTrackerCallback, 1, 0, "setPromiseRejectionTrackerCallback()", "Sets the callback to be invoked whenever a Promise rejection is unhandled\n" "or a previously-unhandled rejection becomes handled."), + JS_FN_HELP("dumpScopeChain", DumpScopeChain, 1, 0, +"dumpScopeChain(obj)", +" Prints the scope chain of an interpreted function or a module."), + + JS_FN_HELP("grayRoot", EnsureGrayRoot, 0, 0, +"grayRoot()", +" Create a gray root Array, if needed, for the current compartment, and\n" +" return it."), + + JS_FN_HELP("addMarkObservers", AddMarkObservers, 1, 0, +"addMarkObservers(array_of_objects)", +" Register an array of objects whose mark bits will be tested by calls to\n" +" getMarks. The objects will be in calling compartment. Objects from\n" +" multiple compartments may be monitored by calling this function in\n" +" different compartments."), + + JS_FN_HELP("clearMarkObservers", ClearMarkObservers, 1, 0, +"clearMarkObservers()", +" Clear out the list of objects whose mark bits will be tested.\n"), + + JS_FN_HELP("getMarks", GetMarks, 0, 0, +"getMarks()", +" Return an array of strings representing the current state of the mark\n" +" bits ('gray' or 'black', or 'dead' if the object has been collected)\n" +" for the objects registered via addMarkObservers. Note that some of the\n" +" objects tested may be from different compartments than the one in which\n" +" this function runs."), + JS_FN_HELP("bindToAsyncStack", BindToAsyncStack, 2, 0, "bindToAsyncStack(fn, { stack, cause, explicit })", " Returns a new function that calls 'fn' with no arguments, passing\n" " 'undefined' as the 'this' value, and supplies an async stack for the\n" " call as described by the second argument, an object with the following\n" " properties (which are not optional, unless specified otherwise):\n" "\n" " stack: A SavedFrame object, like that returned by 'saveStack'. Stacks\n" @@ -7185,44 +7225,16 @@ TestAssertRecoveredOnBailout, " performed, and which, presumably, only |hook| knows how to find.\n"), JS_FN_HELP("trackedOpts", ReflectTrackedOptimizations, 1, 0, "trackedOpts(fun)", " Returns an object describing the tracked optimizations of |fun|, if\n" " any. If |fun| is not a scripted function or has not been compiled by\n" " Ion, null is returned."), - JS_FN_HELP("dumpScopeChain", DumpScopeChain, 1, 0, -"dumpScopeChain(obj)", -" Prints the scope chain of an interpreted function or a module."), - - JS_FN_HELP("grayRoot", EnsureGrayRoot, 0, 0, -"grayRoot()", -" Create a gray root Array, if needed, for the current compartment, and\n" -" return it."), - - JS_FN_HELP("addMarkObservers", AddMarkObservers, 1, 0, -"addMarkObservers(array_of_objects)", -" Register an array of objects whose mark bits will be tested by calls to\n" -" getMarks. The objects will be in calling compartment. Objects from\n" -" multiple compartments may be monitored by calling this function in\n" -" different compartments."), - - JS_FN_HELP("clearMarkObservers", ClearMarkObservers, 1, 0, -"clearMarkObservers()", -" Clear out the list of objects whose mark bits will be tested.\n"), - - JS_FN_HELP("getMarks", GetMarks, 0, 0, -"getMarks()", -" Return an array of strings representing the current state of the mark\n" -" bits ('gray' or 'black', or 'dead' if the object has been collected)\n" -" for the objects registered via addMarkObservers. Note that some of the\n" -" objects tested may be from different compartments than the one in which\n" -" this function runs."), - JS_FN_HELP("crash", Crash, 0, 0, "crash([message, [{disable_minidump:true}]])", " Crashes the process with a MOZ_CRASH, optionally providing a message.\n" " An options object may be passed as the second argument. If the key\n" " 'suppress_minidump' is set to true, then a minidump will not be\n" " generated by the crash (which only has an effect if the breakpad\n" " dumping library is loaded.)"),