Bug 1413218 - Make the malloc threashold grow a little slower r=sfink

This commit is contained in:
Jon Coppeard 2017-11-01 11:07:13 +00:00
parent 95ee2e55dc
commit 45d7cc2fc4

View File

@ -288,6 +288,15 @@ namespace TuningDefaults {
/* JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT */
static const float AllocThresholdFactorAvoidInterrupt = 0.9f;
/* no parameter */
static const float MallocThresholdGrowFactor = 1.5f;
/* no parameter */
static const float MallocThresholdShrinkFactor = 0.9f;
/* no parameter */
static const size_t MallocThresholdLimit = 1024 * 1024 * 1024;
/* no parameter */
static const size_t ZoneAllocDelayBytes = 1024 * 1024;
@ -1380,7 +1389,7 @@ GCSchedulingTunables::setParameter(JSGCParamKey key, uint32_t value, const AutoL
void
GCSchedulingTunables::setMaxMallocBytes(size_t value)
{
maxMallocBytes_ = value;
maxMallocBytes_ = std::min(value, TuningDefaults::MallocThresholdLimit);
}
void
@ -1917,10 +1926,13 @@ MemoryCounter::updateOnGCEnd(const GCSchedulingTunables& tunables, const AutoLoc
// Update the trigger threshold at the end of GC and adjust the current
// byte count to reflect bytes allocated since the start of GC.
MOZ_ASSERT(bytes_ >= bytesAtStartOfGC_);
if (shouldTriggerGC(tunables))
maxBytes_ *= 2;
else
maxBytes_ = std::max(tunables.maxMallocBytes(), size_t(maxBytes_ * 0.9));
if (shouldTriggerGC(tunables)) {
maxBytes_ = std::min(TuningDefaults::MallocThresholdLimit,
size_t(maxBytes_ * TuningDefaults::MallocThresholdGrowFactor));
} else {
maxBytes_ = std::max(tunables.maxMallocBytes(),
size_t(maxBytes_ * TuningDefaults::MallocThresholdShrinkFactor));
}
bytes_ -= bytesAtStartOfGC_;
triggered_ = NoTrigger;
}