Bug 979047, part 4 - Run ICCSliceTime() after PrepareForCollectionSlice. r=smaug

This way we take into account time spent finishing off a GC, or something.
This commit is contained in:
Andrew McCreight 2014-03-04 16:21:48 -08:00
parent 4fa61d549b
commit ccea4e7f95
2 changed files with 6 additions and 8 deletions

View File

@ -2124,7 +2124,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
//static
void
nsJSContext::RunCycleCollectorSlice(int64_t aSliceTime)
nsJSContext::RunCycleCollectorSlice()
{
if (!NS_IsMainThread()) {
return;
@ -2135,7 +2135,7 @@ nsJSContext::RunCycleCollectorSlice(int64_t aSliceTime)
// Ideally, the slice time would be decreased by the amount of
// time spent on PrepareForCycleCollection().
gCCStats.PrepareForCycleCollectionSlice();
nsCycleCollector_collectSlice(aSliceTime);
nsCycleCollector_collectSlice(ICCSliceTime());
gCCStats.FinishCycleCollectionSlice();
}
@ -2160,7 +2160,7 @@ ICCTimerFired(nsITimer* aTimer, void* aClosure)
}
}
nsJSContext::RunCycleCollectorSlice(ICCSliceTime());
nsJSContext::RunCycleCollectorSlice();
}
//static
@ -2436,7 +2436,7 @@ CCTimerFired(nsITimer *aTimer, void *aClosure)
// We are in the final timer fire and still meet the conditions for
// 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());
nsJSContext::RunCycleCollectorSlice();
}
} else if ((sPreviousSuspectedCount + 100) <= suspected) {
// Only do a forget skippable if there are more than a few new objects.

View File

@ -110,10 +110,8 @@ public:
static void CycleCollectNow(nsICycleCollectorListener *aListener = nullptr,
int32_t aExtraForgetSkippableCalls = 0);
// 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 RunCycleCollectorSlice(int64_t aSliceTime);
// Run a cycle collector slice, using a heuristic to decide how long to run it.
static void RunCycleCollectorSlice();
static void BeginCycleCollectionCallback();
static void EndCycleCollectionCallback(mozilla::CycleCollectorResults &aResults);