Bug 768282 - Run GCCyle only once for CC_FORCED GCs (r=mccr8)

This commit is contained in:
Bill McCloskey 2012-06-26 13:11:39 -07:00
Родитель 28461068f1
Коммит 1041c09ce9
3 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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()");
}