From b6ece5581213331273c267b654eeb9f23b0c7495 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Wed, 1 Jan 2014 11:00:35 -0800 Subject: [PATCH] Bug 950959 - Rename scheduled cycle collector stuff to slice. r=smaug --- dom/base/nsJSEnvironment.cpp | 14 +++++++------- dom/base/nsJSEnvironment.h | 2 +- xpcom/base/nsCycleCollector.cpp | 17 +++++++++-------- xpcom/base/nsCycleCollector.h | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 2c028b68e92..d61a0d03722 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2133,18 +2133,18 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener, //static void -nsJSContext::ScheduledCycleCollectNow(int64_t aSliceTime) +nsJSContext::RunCycleCollectorSlice(int64_t aSliceTime) { if (!NS_IsMainThread()) { return; } - PROFILER_LABEL("CC", "ScheduledCycleCollectNow"); + PROFILER_LABEL("CC", "RunCycleCollectorSlice"); // Ideally, the slice time would be decreased by the amount of // time spent on PrepareForCycleCollection(). gCCStats.PrepareForCycleCollectionSlice(); - nsCycleCollector_scheduledCollect(aSliceTime); + nsCycleCollector_collectSlice(aSliceTime); gCCStats.FinishCycleCollectionSlice(); } @@ -2169,7 +2169,7 @@ ICCTimerFired(nsITimer* aTimer, void* aClosure) } } - nsJSContext::ScheduledCycleCollectNow(ICCSliceTime()); + nsJSContext::RunCycleCollectorSlice(ICCSliceTime()); } //static @@ -2436,9 +2436,9 @@ CCTimerFired(nsITimer *aTimer, void *aClosure) } } else { // We are in the final timer fire and still meet the conditions for - // triggering a CC. Let CycleCollectNow finish the current IGC, if any, - // because that will allow us to include the GC time in the CC pause. - nsJSContext::ScheduledCycleCollectNow(ICCSliceTime()); + // triggering a CC. Let RunCycleCollectorSlice finish the current IGC, if + // any because that will allow us to include the GC time in the CC pause. + nsJSContext::RunCycleCollectorSlice(ICCSliceTime()); } } else if ((sPreviousSuspectedCount + 100) <= suspected) { // Only do a forget skippable if there are more than a few new objects. diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index e945b8ccc63..f0c70a33363 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -110,7 +110,7 @@ public: // If aSliceTime is negative, the CC will run to completion. If aSliceTime // is 0, only a minimum quantum of work will be done. Otherwise, aSliceTime // will be used as the time budget for the slice, in ms. - static void ScheduledCycleCollectNow(int64_t aSliceTime); + static void RunCycleCollectorSlice(int64_t aSliceTime); static void BeginCycleCollectionCallback(); static void EndCycleCollectionCallback(mozilla::CycleCollectorResults &aResults); diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 7926026a16c..f5712faddfc 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1079,7 +1079,7 @@ enum ccPhase { }; enum ccType { - ScheduledCC, /* Automatically triggered, based on time or the purple buffer. */ + SliceCC, /* If a CC is in progress, continue it. Otherwise, start a new one. */ ManualCC, /* Explicitly triggered. */ ShutdownCC /* Shutdown CC, used for finding leaks. */ }; @@ -3032,7 +3032,7 @@ nsCycleCollector::Collect(ccType aCCType, mActivelyCollecting = false; - if (aCCType != ScheduledCC && !startedIdle) { + if (aCCType != SliceCC && !startedIdle) { // We were in the middle of an incremental CC (using its own listener). // Somebody has forced a CC, so after having finished out the current CC, // run the CC again using the new listener. @@ -3042,7 +3042,7 @@ nsCycleCollector::Collect(ccType aCCType, } } - MOZ_ASSERT_IF(aCCType != ScheduledCC, mIncrementalPhase == IdlePhase); + MOZ_ASSERT_IF(aCCType != SliceCC, mIncrementalPhase == IdlePhase); return collectedAny; } @@ -3062,7 +3062,8 @@ nsCycleCollector::PrepareForGarbageCollection() SliceBudget unlimitedBudget; PrintPhase("PrepareForGarbageCollection"); - Collect(ScheduledCC, unlimitedBudget, nullptr); + // Use SliceCC because we only want to finish the CC in progress. + Collect(SliceCC, unlimitedBudget, nullptr); MOZ_ASSERT(mIncrementalPhase == IdlePhase); } @@ -3092,7 +3093,7 @@ nsCycleCollector::ShouldMergeZones(ccType aCCType) return false; } - if (aCCType == ScheduledCC && mJSRuntime->UsefulToMergeZones()) { + if (aCCType == SliceCC && mJSRuntime->UsefulToMergeZones()) { mMergedInARow++; return true; } else { @@ -3547,7 +3548,7 @@ nsCycleCollector_collect(nsICycleCollectorListener *aManualListener) } void -nsCycleCollector_scheduledCollect(int64_t aSliceTime) +nsCycleCollector_collectSlice(int64_t aSliceTime) { CollectorData *data = sCollectorData.get(); @@ -3555,14 +3556,14 @@ nsCycleCollector_scheduledCollect(int64_t aSliceTime) MOZ_ASSERT(data); MOZ_ASSERT(data->mCollector); - PROFILER_LABEL("CC", "nsCycleCollector_scheduledCollect"); + PROFILER_LABEL("CC", "nsCycleCollector_collectSlice"); SliceBudget budget; if (aSliceTime > 0) { budget = SliceBudget::TimeBudget(aSliceTime); } else if (aSliceTime == 0) { budget = SliceBudget::WorkBudget(1); } - data->mCollector->Collect(ScheduledCC, budget, nullptr); + data->mCollector->Collect(SliceCC, budget, nullptr); } void diff --git a/xpcom/base/nsCycleCollector.h b/xpcom/base/nsCycleCollector.h index 012a79f2b28..8f986a93145 100644 --- a/xpcom/base/nsCycleCollector.h +++ b/xpcom/base/nsCycleCollector.h @@ -45,7 +45,7 @@ void nsCycleCollector_collect(nsICycleCollectorListener *aManualListener); // If aSliceTime is negative, the CC will run to completion. If aSliceTime // is 0, only a minimum quantum of work will be done. Otherwise, aSliceTime // will be used as the time budget for the slice, in ms. -void nsCycleCollector_scheduledCollect(int64_t aSliceTime); +void nsCycleCollector_collectSlice(int64_t aSliceTime); uint32_t nsCycleCollector_suspectedCount(); void nsCycleCollector_shutdown();