Bug 1373651 - Ensure we don't report too large GC-during-idle values, r=mccr8

--HG--
extra : rebase_source : 597faa884e613f9580c9ae3283f6e54cb02dd46b
This commit is contained in:
Olli Pettay 2017-06-16 17:45:15 +03:00
Родитель 1bbd64432a
Коммит 19e0e34c6d
1 изменённых файлов: 5 добавлений и 5 удалений

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

@ -1995,7 +1995,7 @@ InterSliceGCRunnerFired(TimeStamp aDeadline, void* aData)
}
TimeStamp startTimeStamp = TimeStamp::Now();
TimeDuration duration = sGCUnnotifiedTotalTime;
uintptr_t reason = reinterpret_cast<uintptr_t>(aData);
nsJSContext::GarbageCollectNow(aData ?
static_cast<JS::gcreason::Reason>(reason) :
@ -2004,20 +2004,20 @@ InterSliceGCRunnerFired(TimeStamp aDeadline, void* aData)
nsJSContext::NonShrinkingGC,
budget);
TimeDuration duration = sGCUnnotifiedTotalTime;
sGCUnnotifiedTotalTime = TimeDuration();
TimeStamp now = TimeStamp::Now();
TimeDuration sliceDuration = now - startTimeStamp;
duration += sliceDuration;
if (duration.ToSeconds()) {
TimeDuration idleDuration;
if (!aDeadline.IsNull()) {
TimeStamp now = TimeStamp::Now();
if (aDeadline < now) {
// This slice overflowed the idle period.
idleDuration = aDeadline - startTimeStamp;
} else {
// Note, we don't want to use duration here, since it may contain
// data also from JS engine triggered GC slices.
idleDuration = now - startTimeStamp;
idleDuration = sliceDuration;
}
}