mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1032750 - Don't update GC triggers on uncollected zones r=terrence
This commit is contained in:
parent
514348c3a1
commit
eb8fe4ffcf
@ -107,6 +107,13 @@ Zone::onTooMuchMalloc()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Zone::isCloseToAllocTrigger(bool highFrequencyGC) const
|
||||
{
|
||||
double factor = highFrequencyGC ? 0.85 : 0.9;
|
||||
return usage.gcBytes() >= factor * threshold.gcTriggerBytes();
|
||||
}
|
||||
|
||||
void
|
||||
Zone::beginSweepTypes(FreeOp *fop, bool releaseTypes)
|
||||
{
|
||||
|
@ -153,6 +153,8 @@ struct Zone : public JS::shadow::Zone,
|
||||
bool isTooMuchMalloc() const { return gcMallocBytes <= 0; }
|
||||
void onTooMuchMalloc();
|
||||
|
||||
bool isCloseToAllocTrigger(bool highFrequencyGC) const;
|
||||
|
||||
void *onOutOfMemory(void *p, size_t nbytes) {
|
||||
return runtimeFromMainThread()->onOutOfMemory(p, nbytes);
|
||||
}
|
||||
|
@ -1113,7 +1113,7 @@ GCRuntime::GCRuntime(JSRuntime *rt) :
|
||||
verifyPostData(nullptr),
|
||||
chunkAllocationSinceLastGC(false),
|
||||
nextFullGCTime(0),
|
||||
lastGCTime(0),
|
||||
lastGCTime(PRMJ_Now()),
|
||||
mode(JSGC_MODE_INCREMENTAL),
|
||||
decommitThreshold(32 * 1024 * 1024),
|
||||
cleanUpEverything(false),
|
||||
@ -3308,9 +3308,8 @@ GCRuntime::maybeGC(Zone *zone)
|
||||
if (gcIfNeeded())
|
||||
return true;
|
||||
|
||||
double factor = schedulingState.inHighFrequencyGCMode() ? 0.85 : 0.9;
|
||||
if (zone->usage.gcBytes() > 1024 * 1024 &&
|
||||
zone->usage.gcBytes() >= factor * zone->threshold.gcTriggerBytes() &&
|
||||
zone->isCloseToAllocTrigger(schedulingState.inHighFrequencyGCMode()) &&
|
||||
incrementalState == NO_INCREMENTAL &&
|
||||
!isBackgroundSweeping())
|
||||
{
|
||||
@ -5628,10 +5627,10 @@ GCRuntime::finishCollection()
|
||||
schedulingState.updateHighFrequencyMode(lastGCTime, currentTime, tunables);
|
||||
|
||||
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
|
||||
zone->threshold.updateAfterGC(zone->usage.gcBytes(), invocationKind, tunables,
|
||||
schedulingState);
|
||||
if (zone->isCollecting()) {
|
||||
MOZ_ASSERT(zone->isGCFinished() || zone->isGCCompacting());
|
||||
zone->threshold.updateAfterGC(zone->usage.gcBytes(), invocationKind, tunables,
|
||||
schedulingState);
|
||||
zone->setGCState(Zone::NoGC);
|
||||
zone->active = false;
|
||||
}
|
||||
@ -6219,6 +6218,10 @@ GCRuntime::scanZonesBeforeGC()
|
||||
if (incrementalState != NO_INCREMENTAL && zone->needsIncrementalBarrier())
|
||||
zone->scheduleGC();
|
||||
|
||||
/* This is a heuristic to reduce the total number of collections. */
|
||||
if (zone->isCloseToAllocTrigger(schedulingState.inHighFrequencyGCMode()))
|
||||
zone->scheduleGC();
|
||||
|
||||
zoneStats.zoneCount++;
|
||||
if (zone->isGCScheduled()) {
|
||||
zoneStats.collectedZoneCount++;
|
||||
|
Loading…
Reference in New Issue
Block a user