From 956fd74ca69514d91c6fec1780fb749e846fa324 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Sat, 16 Dec 2017 11:04:54 -0800 Subject: [PATCH] #438: revert M1371908 for startup assertions and crashes --- js/src/jit-test/tests/gc/bug-1371908.js | 6 ------ js/src/jit-test/tests/gc/bug1146213.js | 21 --------------------- js/src/jsgc.cpp | 6 +----- js/src/vm/HelperThreads.cpp | 9 ++++----- 4 files changed, 5 insertions(+), 37 deletions(-) delete mode 100644 js/src/jit-test/tests/gc/bug-1371908.js delete mode 100644 js/src/jit-test/tests/gc/bug1146213.js diff --git a/js/src/jit-test/tests/gc/bug-1371908.js b/js/src/jit-test/tests/gc/bug-1371908.js deleted file mode 100644 index da4540459..000000000 --- a/js/src/jit-test/tests/gc/bug-1371908.js +++ /dev/null @@ -1,6 +0,0 @@ -if (helperThreadCount() === 0) - quit(); -offThreadCompileScript(""); -startgc(0); -runOffThreadScript(); - diff --git a/js/src/jit-test/tests/gc/bug1146213.js b/js/src/jit-test/tests/gc/bug1146213.js deleted file mode 100644 index 14ca08827..000000000 --- a/js/src/jit-test/tests/gc/bug1146213.js +++ /dev/null @@ -1,21 +0,0 @@ -if (!("setGCCallback" in this && - "schedulegc" in this && - "gcslice" in this && - "newGlobal" in this && - "helperThreadCount" in this)) -{ - quit(); -} - -if (helperThreadCount() == 0) - quit(); - -setGCCallback({ - action: "majorGC", -}); -schedulegc(this) -gcslice(3) -var lfGlobal = newGlobal(); -lfGlobal.offThreadCompileScript(""); -lfGlobal.runOffThreadScript(); - diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 73a2169a5..cf3612d41 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -6845,11 +6845,7 @@ gc::MergeCompartments(JSCompartment* source, JSCompartment* target) JSRuntime* rt = source->runtimeFromMainThread(); - MOZ_ASSERT(!source->zone()->wasGCStarted()); - MOZ_ASSERT(!target->zone()->wasGCStarted()); - JS::AutoAssertOnGC nogc(rt); - - AutoTraceSession session(rt); + AutoPrepareForTracing prepare(rt, SkipAtoms); // Cleanup tables and other state in the source compartment that will be // meaningless after merging into the target compartment. diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index 564f90b8d..fda93abfb 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -1103,13 +1103,12 @@ GlobalHelperThreadState::mergeParseTaskCompartment(JSRuntime* rt, ParseTask* par Handle global, JSCompartment* dest) { - // Finish any ongoing incremental GC that may affect the destination zone. - if (JS::IsIncrementalGCInProgress(rt) && dest->zone()->wasGCStarted()) - JS::FinishIncrementalGC(rt, JS::gcreason::API); - // After we call LeaveParseTaskZone() it's not safe to GC until we have // finished merging the contents of the parse task's compartment into the - // destination compartment. + // destination compartment. Finish any ongoing incremental GC first and + // assert that no allocation can occur. (Bug 1371908 changes this, but + // generates assertion failures.) + gc::AutoFinishGC finishGC(rt); JS::AutoAssertNoAlloc noAlloc(rt); LeaveParseTaskZone(rt, parseTask);