Bug 1662254 - Remove a couple of calls to TimeStamp::Now() r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D90900
This commit is contained in:
Steve Fink 2020-11-12 19:05:08 +00:00
Родитель ebe551ba1a
Коммит eadb717a11
2 изменённых файлов: 7 добавлений и 5 удалений

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

@ -181,18 +181,19 @@ class CCGCScheduler {
// Scheduling
TimeDuration ComputeInterSliceGCBudget(TimeStamp aDeadline) const {
TimeDuration ComputeInterSliceGCBudget(TimeStamp aDeadline,
TimeStamp aNow) const {
// We use longer budgets when the CC has been locked out but the CC has
// tried to run since that means we may have a significant amount of
// garbage to collect and it's better to GC in several longer slices than
// in a very long one.
TimeDuration budget = aDeadline.IsNull() ? mActiveIntersliceGCBudget * 2
: aDeadline - TimeStamp::Now();
TimeDuration budget =
aDeadline.IsNull() ? mActiveIntersliceGCBudget * 2 : aDeadline - aNow;
if (!mCCBlockStart) {
return budget;
}
TimeDuration blockedTime = TimeStamp::Now() - mCCBlockStart;
TimeDuration blockedTime = aNow - mCCBlockStart;
TimeDuration maxSliceGCBudget = mActiveIntersliceGCBudget * 10;
double percentOfBlockedTime =
std::min(blockedTime / kMaxCCLockedoutTime, 1.0);

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

@ -1540,8 +1540,9 @@ void nsJSContext::EndCycleCollectionCallback(CycleCollectorResults& aResults) {
// static
bool InterSliceGCRunnerFired(TimeStamp aDeadline, void* aData) {
MOZ_ASSERT(sScheduler.mActiveIntersliceGCBudget);
TimeDuration budget = sScheduler.ComputeInterSliceGCBudget(aDeadline);
TimeStamp startTimeStamp = TimeStamp::Now();
TimeDuration budget =
sScheduler.ComputeInterSliceGCBudget(aDeadline, startTimeStamp);
TimeDuration duration = sGCUnnotifiedTotalTime;
uintptr_t reason = reinterpret_cast<uintptr_t>(aData);
nsJSContext::GarbageCollectNow(