Bug 979047, part 1 - Only clear mBeginSliceTime in EndCycleCollectionCallback. r=smaug

Run FinishCycleCollectionSlice only once per slice, and only if we've previously run PrepareForCycleCollectionSlice.
This commit is contained in:
Andrew McCreight 2014-03-04 16:21:48 -08:00
Родитель a2d2b2b27f
Коммит 4ee753c914
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -2000,9 +2000,15 @@ struct CycleCollectorStats
void FinishCycleCollectionSlice()
{
if (mBeginSliceTime.IsNull()) {
// We already called this method from EndCycleCollectionCallback for this slice.
return;
}
uint32_t sliceTime = TimeUntilNow(mBeginSliceTime);
mMaxSliceTime = std::max(mMaxSliceTime, sliceTime);
mTotalSliceTime += sliceTime;
mBeginSliceTime = TimeStamp();
MOZ_ASSERT(mExtraForgetSkippableCalls == 0, "Forget to reset extra forget skippable calls?");
}
@ -2197,7 +2203,9 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
nsJSContext::KillICCTimer();
// Update timing information for the current slice before we log it.
// Update timing information for the current slice before we log it, if
// we previously called PrepareForCycleCollectionSlice(). During shutdown
// CCs, this won't happen.
gCCStats.FinishCycleCollectionSlice();
sCCollectedWaitingForGC += aResults.mFreedRefCounted + aResults.mFreedGCed;