Bug 1029648 - Calculate GCRuntime::highFrequencyGC once rather than once per zone r=terrence

This commit is contained in:
Jon Coppeard 2014-07-02 08:06:49 +01:00
parent ee778fea9c
commit 428a3096c8

View File

@ -1696,8 +1696,7 @@ GCRuntime::computeHeapGrowthFactor(size_t lastBytes)
factor = lowFrequencyHeapGrowth;
} else {
JS_ASSERT(highFrequencyHighLimitBytes > highFrequencyLowLimitBytes);
uint64_t now = PRMJ_Now();
if (lastGCTime && lastGCTime + highFrequencyTimeThreshold * PRMJ_USEC_PER_MSEC > now) {
if (highFrequencyGC) {
if (lastBytes <= highFrequencyLowLimitBytes) {
factor = highFrequencyHeapGrowthMax;
} else if (lastBytes >= highFrequencyHighLimitBytes) {
@ -1710,10 +1709,8 @@ GCRuntime::computeHeapGrowthFactor(size_t lastBytes)
JS_ASSERT(factor <= highFrequencyHeapGrowthMax
&& factor >= highFrequencyHeapGrowthMin);
}
highFrequencyGC = true;
} else {
factor = lowFrequencyHeapGrowth;
highFrequencyGC = false;
}
}
@ -4476,6 +4473,10 @@ GCRuntime::endSweepPhase(JSGCInvocationKind gckind, bool lastGC)
sweepZones(&fop, lastGC);
}
uint64_t currentTime = PRMJ_Now();
highFrequencyGC = dynamicHeapGrowth && lastGCTime &&
lastGCTime + highFrequencyTimeThreshold * PRMJ_USEC_PER_MSEC > currentTime;
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
zone->setGCLastBytes(zone->gcBytes, gckind);
if (zone->isCollecting()) {
@ -4509,7 +4510,7 @@ GCRuntime::endSweepPhase(JSGCInvocationKind gckind, bool lastGC)
finishMarkingValidation();
lastGCTime = PRMJ_Now();
lastGCTime = currentTime;
}
/* Start a new heap session. */