Bug 986843 - Don't sweep empty zones if they contain marked compartments r=terrence

This commit is contained in:
Jon Coppeard 2014-04-07 11:03:22 +01:00
parent df81b7d231
commit 5a83c0a822
3 changed files with 14 additions and 2 deletions

View File

@ -258,4 +258,12 @@ js::ZoneOfObjectFromAnyThread(const JSObject &obj)
return obj.zoneFromAnyThread();
}
bool
Zone::hasMarkedCompartments()
{
for (CompartmentsInZoneIter comp(this); !comp.done(); comp.next()) {
if (comp->marked)
return true;
}
return false;
}

View File

@ -317,6 +317,8 @@ struct Zone : public JS::shadow::Zone,
void sweep(js::FreeOp *fop, bool releaseTypes);
bool hasMarkedCompartments();
private:
void sweepBreakpoints(js::FreeOp *fop);

View File

@ -2864,7 +2864,9 @@ SweepZones(FreeOp *fop, bool lastGC)
Zone *zone = *read++;
if (zone->wasGCStarted()) {
if (zone->allocator.arenas.arenaListsAreEmpty() || lastGC) {
if ((zone->allocator.arenas.arenaListsAreEmpty() && !zone->hasMarkedCompartments()) ||
lastGC)
{
zone->allocator.arenas.checkEmptyFreeLists();
if (callback)
callback(zone);