mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 906269, don't start a GC cycle so likely while we're in middle of a CC cycle, r=mccr8
--HG-- extra : rebase_source : 90d3ad3d19159613f2cb83f0d28dd37a1a429b75
This commit is contained in:
parent
23d3390f26
commit
e5e63a48e9
@ -174,6 +174,7 @@ static uint32_t sForgetSkippableBeforeCC = 0;
|
||||
static uint32_t sPreviousSuspectedCount = 0;
|
||||
static uint32_t sCleanupsSinceLastGC = UINT32_MAX;
|
||||
static bool sNeedsFullCC = false;
|
||||
static bool sNeedsGCAfterCC = false;
|
||||
static nsJSContext *sContextList = nullptr;
|
||||
|
||||
static nsScriptNameSpaceManager *gNameSpaceManager;
|
||||
@ -2055,7 +2056,8 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
// If we collected a substantial amount of cycles, poke the GC since more objects
|
||||
// might be unreachable now.
|
||||
if (sCCollectedWaitingForGC > 250 ||
|
||||
sLikelyShortLivingObjectsNeedingGC > 2500) {
|
||||
sLikelyShortLivingObjectsNeedingGC > 2500 ||
|
||||
sNeedsGCAfterCC) {
|
||||
PokeGC(JS::gcreason::CC_WAITING);
|
||||
}
|
||||
|
||||
@ -2170,6 +2172,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
sRemovedPurples = 0;
|
||||
sForgetSkippableBeforeCC = 0;
|
||||
sNeedsFullCC = false;
|
||||
sNeedsGCAfterCC = false;
|
||||
}
|
||||
|
||||
// static
|
||||
@ -2320,6 +2323,14 @@ nsJSContext::PokeGC(JS::gcreason::Reason aReason, int aDelay)
|
||||
return;
|
||||
}
|
||||
|
||||
if (sCCTimer) {
|
||||
// Make sure CC is called...
|
||||
sNeedsFullCC = true;
|
||||
// and GC after it.
|
||||
sNeedsGCAfterCC = true;
|
||||
return;
|
||||
}
|
||||
|
||||
CallCreateInstance("@mozilla.org/timer;1", &sGCTimer);
|
||||
|
||||
if (!sGCTimer) {
|
||||
@ -2585,6 +2596,7 @@ mozilla::dom::StartupJSEnvironment()
|
||||
sLikelyShortLivingObjectsNeedingGC = 0;
|
||||
sPostGCEventsToConsole = false;
|
||||
sNeedsFullCC = false;
|
||||
sNeedsGCAfterCC = false;
|
||||
gNameSpaceManager = nullptr;
|
||||
sRuntimeService = nullptr;
|
||||
sRuntime = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user