Bug 950959 - Rename scheduled cycle collector stuff to slice. r=smaug

This commit is contained in:
Andrew McCreight 2014-01-01 11:00:35 -08:00
parent 5b5e6a9500
commit b6ece55812
4 changed files with 18 additions and 17 deletions

View File

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

View File

@ -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);

View File

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

View File

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