Bug 1367905 - Try to run GC/CC slices, including forgetSkippable, during idle time, tweaks to keep reftest memory usage lower, r=mccr8

--HG--
extra : rebase_source : 850e4f25ef1ac18b768dc50dc4fa9b77f0743080
This commit is contained in:
Olli Pettay 2017-06-10 02:41:06 +03:00
parent ce6010c7d6
commit 5591c27af9
2 changed files with 9 additions and 7 deletions

View File

@ -240,6 +240,10 @@ public:
Create(CollectorRunnerCallback aCallback, uint32_t aDelay,
int64_t aBudget, bool aRepeating, void* aData = nullptr)
{
if (sShuttingDown) {
return nullptr;
}
RefPtr<CollectorRunner> runner =
new CollectorRunner(aCallback, aDelay, aBudget, aRepeating, aData);
runner->Schedule(false); // Initial scheduling shouldn't use idle dispatch.
@ -1921,7 +1925,10 @@ InterSliceGCRunnerFired(TimeStamp aDeadline, void* aData)
{
nsJSContext::KillInterSliceGCRunner();
MOZ_ASSERT(sActiveIntersliceGCBudget > 0);
int64_t budget = sActiveIntersliceGCBudget;
// We use longer budgets when timer runs since that means
// there hasn't been idle time recently and we may have significant amount
// garbage to collect.
int64_t budget = sActiveIntersliceGCBudget * 2;
if (!aDeadline.IsNull()) {
budget = int64_t((aDeadline - TimeStamp::Now()).ToMilliseconds());
}

View File

@ -41,7 +41,6 @@ var gTimeoutHook = null;
var gFailureTimeout = null;
var gFailureReason;
var gAssertionCount = 0;
var gTestCount = 0;
var gDebug;
var gVerbose = false;
@ -143,11 +142,7 @@ function StartTestURI(type, uri, timeout)
// The GC is only able to clean up compartments after the CC runs. Since
// the JS ref tests disable the normal browser chrome and do not otherwise
// create substatial DOM garbage, the CC tends not to run enough normally.
++gTestCount;
if (gTestCount % 500 == 0) {
CU.forceGC();
CU.forceCC();
}
windowUtils().runNextCollectorTimer();
// Reset gExplicitPendingPaintCount in case there was a timeout or
// the count is out of sync for some other reason