author | Ed Morley <emorley@mozilla.com> |
Fri, 27 Sep 2013 10:54:06 +0100 | |
changeset 148972 | 06f9ccafcf8b61de0df0b48abc60ca6a373b944b |
parent 148971 | 08d9bbb1044fbb1a228ef3a0851db8687bb585d5 |
child 148973 | 49047b0c1c8126841049d768e905d0fc814545db |
push id | 25366 |
push user | kwierso@gmail.com |
push date | Sat, 28 Sep 2013 02:13:38 +0000 |
treeherder | mozilla-central@e1914e294152 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 913224 |
milestone | 27.0a1 |
backs out | 2e76e3b9479ef3f9a09481e21d25973fa1f604f0 |
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
|
js/src/builtin/TestingFunctions.cpp | file | annotate | diff | comparison | revisions | |
js/src/jit-test/tests/gc/bug-913224.js | file | annotate | diff | comparison | revisions | |
js/src/jsfriendapi.cpp | file | annotate | diff | comparison | revisions | |
js/src/jsfriendapi.h | file | annotate | diff | comparison | revisions |
--- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -822,62 +822,42 @@ FinalizeCount(JSContext *cx, unsigned ar { *vp = INT_TO_JSVAL(finalizeCount); return true; } 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)) + if (!fileNameBytes.encodeLatin1(cx, str)) return false; - if (same) { - nurseryBehaviour = js::CollectNurseryBeforeDump; - ++i; - } + fileName = fileNameBytes.ptr(); } } - 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; + FILE *dumpFile; + if (!fileName) { + dumpFile = stdout; + } else { + dumpFile = fopen(fileName, "w"); + if (!dumpFile) { + JS_ReportError(cx, "can't open %s", fileName); + return false; } } - if (i != argc) { - JS_ReportError(cx, "bad arguments passed to dumpHeapComplete"); - return false; - } + js::DumpHeapComplete(JS_GetRuntime(cx), dumpFile); - js::DumpHeapComplete(JS_GetRuntime(cx), dumpFile ? dumpFile : stdout, nurseryBehaviour); - - if (dumpFile) - fclose(dumpFile); + fclose(dumpFile); JS_SET_RVAL(cx, vp, JSVAL_VOID); return true; } static bool Terminate(JSContext *cx, unsigned arg, jsval *vp) { @@ -1199,20 +1179,18 @@ static const JSFunctionSpecWithHelp Test " Query an internal constant for the engine. See InternalConst source for\n" " the list of constant names."), JS_FN_HELP("isProxy", IsProxy, 1, 0, "isProxy(obj)", " 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()", " Terminate JavaScript execution, as if we had run out of\n" " memory or been terminated by the slow script dialog."), JS_FN_HELP("enableSPSProfilingAssertions", EnableSPSProfilingAssertions, 1, 0, "enableSPSProfilingAssertions(slow)",
deleted file mode 100644 --- a/js/src/jit-test/tests/gc/bug-913224.js +++ /dev/null @@ -1,1 +0,0 @@ -dumpHeapComplete();
--- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -748,47 +748,36 @@ DumpHeapVisitCell(JSRuntime *rt, void *d JS_GetTraceThingInfo(cellDesc, sizeof(cellDesc), dtrc, thing, traceKind, true); fprintf(dtrc->output, "%p %c %s\n", thing, MarkDescriptor(thing), cellDesc); JS_TraceChildren(dtrc, thing, traceKind); } static void DumpHeapVisitChild(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - if (gc::IsInsideNursery(trc->runtime, *thingp)) - return; - JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(trc); char buffer[1024]; fprintf(dtrc->output, "> %p %c %s\n", *thingp, MarkDescriptor(*thingp), JS_GetTraceEdgeName(dtrc, buffer, sizeof(buffer))); } static void DumpHeapVisitRoot(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - if (gc::IsInsideNursery(trc->runtime, *thingp)) - return; - JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(trc); char buffer[1024]; fprintf(dtrc->output, "%p %c %s\n", *thingp, MarkDescriptor(*thingp), JS_GetTraceEdgeName(dtrc, buffer, sizeof(buffer))); } 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); fprintf(dtrc.output, "==========\n"); JS_TracerInit(&dtrc, rt, DumpHeapVisitChild); IterateZonesCompartmentsArenasCells(rt, &dtrc,
--- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -250,27 +250,22 @@ GetContextZone(const JSContext *cx) } extern JS_FRIEND_API(JS::Zone *) 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); JS_FRIEND_API(bool) obj_defineSetter(JSContext *cx, unsigned argc, JS::Value *vp); #endif extern JS_FRIEND_API(bool) IsSystemCompartment(JSCompartment *comp);