Bug 1192306 - Use a function to check if IsShutdownGC rather than open-coding it; r=jonco

This commit is contained in:
Terrence Cole 2015-08-10 14:16:25 -07:00
parent b055779ccf
commit dfd3ef3c40

View File

@ -5758,15 +5758,19 @@ GCRuntime::pushZealSelectedObjects()
#endif
}
static bool
IsShutdownGC(JS::gcreason::Reason reason)
{
return reason == JS::gcreason::SHUTDOWN_CC || reason == JS::gcreason::DESTROY_RUNTIME;
}
static bool
ShouldCleanUpEverything(JS::gcreason::Reason reason, JSGCInvocationKind gckind)
{
// During shutdown, we must clean everything up, for the sake of leak
// 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.
return reason == JS::gcreason::DESTROY_RUNTIME ||
reason == JS::gcreason::SHUTDOWN_CC ||
gckind == GC_SHRINK;
return IsShutdownGC(reason) || gckind == GC_SHRINK;
}
void
@ -6172,8 +6176,7 @@ GCRuntime::collect(bool incremental, SliceBudget budget, JS::gcreason::Reason re
AutoTraceLog logGC(TraceLoggerForMainThread(rt), TraceLogger_GC);
AutoStopVerifyingBarriers av(rt, reason == JS::gcreason::SHUTDOWN_CC ||
reason == JS::gcreason::DESTROY_RUNTIME);
AutoStopVerifyingBarriers av(rt, IsShutdownGC(reason));
gcstats::AutoGCSlice agc(stats, scanZonesBeforeGC(), invocationKind, budget, reason);