diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 611e4f86986..dc1a19533fc 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -827,52 +827,32 @@ FinalizeCount(JSContext *cx, unsigned argc, jsval *vp) static bool DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp) { - CallArgs args = CallArgsFromVp(argc, vp); - - DumpHeapNurseryBehaviour nurseryBehaviour = js::IgnoreNurseryObjects; - FILE *dumpFile = NULL; - - unsigned i = 0; - if (argc > i) { - Value v = args[i]; + const char *fileName = nullptr; + JSAutoByteString fileNameBytes; + if (argc > 0) { + Value v = JS_ARGV(cx, vp)[0]; if (v.isString()) { JSString *str = v.toString(); - bool same = false; - if (!JS_StringEqualsAscii(cx, str, "collectNurseryBeforeDump", &same)) - return false; - if (same) { - nurseryBehaviour = js::CollectNurseryBeforeDump; - ++i; - } - } - } - - if (argc > i) { - Value v = args[i]; - if (v.isString()) { - JSString *str = v.toString(); - JSAutoByteString fileNameBytes; if (!fileNameBytes.encodeLatin1(cx, str)) return false; - const char *fileName = fileNameBytes.ptr(); - dumpFile = fopen(fileName, "w"); - if (!dumpFile) { - JS_ReportError(cx, "can't open %s", fileName); - return false; - } - ++i; + fileName = fileNameBytes.ptr(); } } - if (i != argc) { - JS_ReportError(cx, "bad arguments passed to dumpHeapComplete"); - return false; + FILE *dumpFile; + if (!fileName) { + dumpFile = stdout; + } else { + dumpFile = fopen(fileName, "w"); + if (!dumpFile) { + JS_ReportError(cx, "can't open %s", fileName); + return false; + } } - js::DumpHeapComplete(JS_GetRuntime(cx), dumpFile ? dumpFile : stdout, nurseryBehaviour); + js::DumpHeapComplete(JS_GetRuntime(cx), dumpFile); - if (dumpFile) - fclose(dumpFile); + fclose(dumpFile); JS_SET_RVAL(cx, vp, JSVAL_VOID); return true; @@ -1204,10 +1184,8 @@ static const JSFunctionSpecWithHelp TestingFunctions[] = { " If true, obj is a proxy of some sort"), JS_FN_HELP("dumpHeapComplete", DumpHeapComplete, 1, 0, -"dumpHeapComplete(['collectNurseryBeforeDump'], [filename])", -" Dump reachable and unreachable objects to the named file, or to stdout. If\n" -" 'collectNurseryBeforeDump' is specified, a minor GC is performed first,\n" -" otherwise objects in the nursery are ignored."), +"dumpHeapComplete([filename])", +" Dump reachable and unreachable objects to a file."), JS_FN_HELP("terminate", Terminate, 0, 0, "terminate()", diff --git a/js/src/jit-test/tests/gc/bug-913224.js b/js/src/jit-test/tests/gc/bug-913224.js deleted file mode 100644 index d410e1b9c35..00000000000 --- a/js/src/jit-test/tests/gc/bug-913224.js +++ /dev/null @@ -1 +0,0 @@ -dumpHeapComplete(); diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 9a4cd432abf..a986da04abf 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -753,9 +753,6 @@ DumpHeapVisitCell(JSRuntime *rt, void *data, void *thing, static void DumpHeapVisitChild(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - if (gc::IsInsideNursery(trc->runtime, *thingp)) - return; - JSDumpHeapTracer *dtrc = static_cast(trc); char buffer[1024]; fprintf(dtrc->output, "> %p %c %s\n", *thingp, MarkDescriptor(*thingp), @@ -765,9 +762,6 @@ DumpHeapVisitChild(JSTracer *trc, void **thingp, JSGCTraceKind kind) static void DumpHeapVisitRoot(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - if (gc::IsInsideNursery(trc->runtime, *thingp)) - return; - JSDumpHeapTracer *dtrc = static_cast(trc); char buffer[1024]; fprintf(dtrc->output, "%p %c %s\n", *thingp, MarkDescriptor(*thingp), @@ -775,15 +769,10 @@ DumpHeapVisitRoot(JSTracer *trc, void **thingp, JSGCTraceKind kind) } void -js::DumpHeapComplete(JSRuntime *rt, FILE *fp, js::DumpHeapNurseryBehaviour nurseryBehaviour) +js::DumpHeapComplete(JSRuntime *rt, FILE *fp) { JSDumpHeapTracer dtrc(fp); -#ifdef JSGC_GENERATIONAL - if (nurseryBehaviour == js::CollectNurseryBeforeDump) - MinorGC(rt, JS::gcreason::API); -#endif - JS_TracerInit(&dtrc, rt, DumpHeapVisitRoot); dtrc.eagerlyTraceWeakMaps = TraceWeakMapKeysValues; TraceRuntime(&dtrc); diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index bdee8216caa..9565a752e83 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -255,17 +255,12 @@ GetCompartmentZone(JSCompartment *comp); typedef bool (* PreserveWrapperCallback)(JSContext *cx, JSObject *obj); -typedef enum { - CollectNurseryBeforeDump, - IgnoreNurseryObjects -} DumpHeapNurseryBehaviour; - /* * Dump the complete object graph of heap-allocated things. * fp is the file for the dump output. */ extern JS_FRIEND_API(void) -DumpHeapComplete(JSRuntime *rt, FILE *fp, DumpHeapNurseryBehaviour nurseryBehaviour); +DumpHeapComplete(JSRuntime *rt, FILE *fp); #ifdef JS_OLD_GETTER_SETTER_METHODS JS_FRIEND_API(bool) obj_defineGetter(JSContext *cx, unsigned argc, JS::Value *vp); diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index af2f4dc7c7c..1db9dea1325 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -968,7 +968,7 @@ CycleCollectedJSRuntime::DeferredFinalize(nsISupports* aSupports) void CycleCollectedJSRuntime::DumpJSHeap(FILE* file) { - js::DumpHeapComplete(Runtime(), file, js::CollectNurseryBeforeDump); + js::DumpHeapComplete(Runtime(), file); }