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 //static
void void
nsJSContext::RunCycleCollectorSlice(int64_t aSliceTime) nsJSContext::RunCycleCollectorSlice()
{ {
if (!NS_IsMainThread()) { if (!NS_IsMainThread()) {
return; return;
@ -2135,7 +2135,7 @@ nsJSContext::RunCycleCollectorSlice(int64_t aSliceTime)
// Ideally, the slice time would be decreased by the amount of // Ideally, the slice time would be decreased by the amount of
// time spent on PrepareForCycleCollection(). // time spent on PrepareForCycleCollection().
gCCStats.PrepareForCycleCollectionSlice(); gCCStats.PrepareForCycleCollectionSlice();
nsCycleCollector_collectSlice(aSliceTime); nsCycleCollector_collectSlice(ICCSliceTime());
gCCStats.FinishCycleCollectionSlice(); gCCStats.FinishCycleCollectionSlice();
} }
@ -2160,7 +2160,7 @@ ICCTimerFired(nsITimer* aTimer, void* aClosure)
} }
} }
nsJSContext::RunCycleCollectorSlice(ICCSliceTime()); nsJSContext::RunCycleCollectorSlice();
} }
//static //static
@ -2436,7 +2436,7 @@ CCTimerFired(nsITimer *aTimer, void *aClosure)
// We are in the final timer fire and still meet the conditions for // We are in the final timer fire and still meet the conditions for
// triggering a CC. Let RunCycleCollectorSlice finish the current IGC, if // 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. // 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) { } else if ((sPreviousSuspectedCount + 100) <= suspected) {
// Only do a forget skippable if there are more than a few new objects. // 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, static void CycleCollectNow(nsICycleCollectorListener *aListener = nullptr,
int32_t aExtraForgetSkippableCalls = 0); int32_t aExtraForgetSkippableCalls = 0);
// If aSliceTime is negative, the CC will run to completion. If aSliceTime // Run a cycle collector slice, using a heuristic to decide how long to run it.
// is 0, only a minimum quantum of work will be done. Otherwise, aSliceTime static void RunCycleCollectorSlice();
// will be used as the time budget for the slice, in ms.
static void RunCycleCollectorSlice(int64_t aSliceTime);
static void BeginCycleCollectionCallback(); static void BeginCycleCollectionCallback();
static void EndCycleCollectionCallback(mozilla::CycleCollectorResults &aResults); static void EndCycleCollectionCallback(mozilla::CycleCollectorResults &aResults);