Bug 1856574 - Run GC/CC slices before page load only if GC/CC is ongoing, and increase the slice delays, r=jonco

Differential Revision: https://phabricator.services.mozilla.com/D189917
This commit is contained in:
Olli Pettay 2023-10-05 18:11:35 +00:00
Родитель e91c949212
Коммит debecf0861
4 изменённых файлов: 7 добавлений и 6 удалений

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

@ -22,7 +22,7 @@ const TimeDuration kTimeBetweenForgetSkippableCycles =
TimeDuration::FromSeconds(2);
const TimeDuration kForgetSkippableSliceDuration =
TimeDuration::FromMilliseconds(2);
const TimeDuration kICCIntersliceDelay = TimeDuration::FromMilliseconds(64);
const TimeDuration kICCIntersliceDelay = TimeDuration::FromMilliseconds(250);
const TimeDuration kICCSliceBudget = TimeDuration::FromMilliseconds(3);
const TimeDuration kIdleICCSliceBudget = TimeDuration::FromMilliseconds(2);
const TimeDuration kMaxICCDuration = TimeDuration::FromSeconds(2);

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

@ -1696,7 +1696,8 @@ void nsJSContext::MaybeRunNextCollectorSlice(nsIDocShell* aDocShell,
Maybe<TimeStamp> next = nsRefreshDriver::GetNextTickHint();
// Try to not delay the next RefreshDriver tick, so give a reasonable
// deadline for collectors.
if (next.isSome()) {
if (next.isSome() &&
(sScheduler.InIncrementalGC() || sScheduler.IsCollectingCycles())) {
sScheduler.RunNextCollectorTimer(aReason, next.value());
}
}

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

@ -265,9 +265,9 @@ void TestNonIdleCC::RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd,
} else if (aSliceNum == 2) {
// We're not overrunning kMaxICCDuration, so we don't go unlimited.
EXPECT_FALSE(budget.isUnlimited());
// This slice is delayed by twice the allowed amount. Slice time should be
// doubled.
EXPECT_NEAR(budget.timeBudget(), kICCSliceBudget.ToMilliseconds() * 2, 0.1);
// This slice is delayed, slice time should be increased.
EXPECT_NEAR(budget.timeBudget(),
MainThreadIdlePeriod::GetLongIdlePeriod() / 2, 0.1);
} else {
// We're not overrunning kMaxICCDuration, so we don't go unlimited.
EXPECT_FALSE(budget.isUnlimited());

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

@ -7462,7 +7462,7 @@
# Maximum amount of time that should elapse between incremental GC slices, in ms.
- name: javascript.options.gc_delay.interslice
type: uint32_t
value: 100
value: 250
mirror: always
# nsJSEnvironmentObserver observes the memory-pressure notifications and