diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index b8d2de3f490..9bdb8083309 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -593,7 +593,8 @@ SizeOfJSContext(); D(DOM_WORKER) \ D(INTER_SLICE_GC) \ D(REFRESH_FRAME) \ - D(FULL_GC_TIMER) + D(FULL_GC_TIMER) \ + D(SHUTDOWN_CC) namespace gcreason { diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 43134e65f5a..331c64a8775 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -3799,13 +3799,15 @@ static bool ShouldCleanUpEverything(JSRuntime *rt, gcreason::Reason reason) { // During shutdown, we must clean everything up, for the sake of leak - // detection. When a runtime has no contexts, or we're doing a forced GC, - // those are strong indications that we're shutting down. + // detection. When a runtime has no contexts, or we're doing a GC before a + // shutdown CC, those are strong indications that we're shutting down. // // DEBUG_MODE_GC indicates we're discarding code because the debug mode // has changed; debug mode affects the results of bytecode analysis, so // we need to clear everything away. - return !rt->hasContexts() || reason == gcreason::CC_FORCED || reason == gcreason::DEBUG_MODE_GC; + return !rt->hasContexts() || + reason == gcreason::SHUTDOWN_CC || + reason == gcreason::DEBUG_MODE_GC; } static void @@ -3824,7 +3826,7 @@ Collect(JSRuntime *rt, bool incremental, int64_t budget, #ifdef JS_GC_ZEAL bool restartVerify = rt->gcVerifyData && rt->gcZeal() == ZealVerifierValue && - reason != gcreason::CC_FORCED && + reason != gcreason::SHUTDOWN_CC && rt->hasContexts(); struct AutoVerifyBarriers { diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index f992eaec948..d08503bcbfc 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -2605,7 +2605,7 @@ nsCycleCollector::GCIfNeeded(bool aForceGC) // mJSRuntime->Collect() must be called from the main thread, // because it invokes XPCJSRuntime::GCCallback(cx, JSGC_BEGIN) // which returns false if not in the main thread. - mJSRuntime->Collect(js::gcreason::CC_FORCED, nsGCNormal); + mJSRuntime->Collect(aForceGC ? js::gcreason::SHUTDOWN_CC : js::gcreason::CC_FORCED, nsGCNormal); timeLog.Checkpoint("GC()"); }