From e5e63a48e9437078085eb67470074164535d7267 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 22 Aug 2013 00:02:12 +0300 Subject: [PATCH] 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 --- dom/base/nsJSEnvironment.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 2543af91d4aa..73c17f946db8 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -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;