зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1064578 - Part 6: make zone sweeping fine-grained too; r=jonco
--HG-- extra : rebase_source : 002d5e61254440f939e5f35bb35937481189f046
This commit is contained in:
Родитель
bb969e6fa0
Коммит
ed249d7942
|
@ -104,33 +104,35 @@ Zone::onTooMuchMalloc()
|
|||
}
|
||||
|
||||
void
|
||||
Zone::sweep(FreeOp *fop, bool releaseTypes, bool *oom)
|
||||
Zone::sweepAnalysis(FreeOp *fop, bool releaseTypes)
|
||||
{
|
||||
/*
|
||||
* Periodically release observed types for all scripts. This is safe to
|
||||
* do when there are no frames for the zone on the stack.
|
||||
*/
|
||||
// Periodically release observed types for all scripts. This is safe to
|
||||
// do when there are no frames for the zone on the stack.
|
||||
if (active)
|
||||
releaseTypes = false;
|
||||
|
||||
GCRuntime &gc = fop->runtime()->gc;
|
||||
bool oom = false;
|
||||
types.sweep(fop, releaseTypes, &oom);
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap(gc.stats, !gc.isHeapCompacting(),
|
||||
gcstats::PHASE_DISCARD_ANALYSIS);
|
||||
types.sweep(fop, releaseTypes, oom);
|
||||
}
|
||||
|
||||
if (!fop->runtime()->debuggerList.isEmpty()) {
|
||||
gcstats::MaybeAutoPhase ap2(gc.stats, !gc.isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_BREAKPOINT);
|
||||
sweepBreakpoints(fop);
|
||||
// If there was an OOM while sweeping types, the type information needs to
|
||||
// be deoptimized so that it will still correct (i.e. overapproximates the
|
||||
// possible types in the zone), but the constraints might not have been
|
||||
// triggered on the deoptimization or even copied over completely. In this
|
||||
// case, destroy all JIT code and new script information in the zone, the
|
||||
// only things whose correctness depends on the type constraints.
|
||||
if (oom) {
|
||||
setPreservingCode(false);
|
||||
discardJitCode(fop);
|
||||
types.clearAllNewScriptsOnOOM();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Zone::sweepBreakpoints(FreeOp *fop)
|
||||
{
|
||||
if (fop->runtime()->debuggerList.isEmpty())
|
||||
return;
|
||||
|
||||
/*
|
||||
* Sweep all compartments in a zone at the same time, since there is no way
|
||||
* to iterate over the scripts belonging to a single compartment in a zone.
|
||||
|
|
|
@ -157,7 +157,7 @@ struct Zone : public JS::shadow::Zone,
|
|||
}
|
||||
void reportAllocationOverflow() { js_ReportAllocationOverflow(nullptr); }
|
||||
|
||||
void sweep(js::FreeOp *fop, bool releaseTypes, bool *oom);
|
||||
void sweepAnalysis(js::FreeOp *fop, bool releaseTypes);
|
||||
|
||||
bool hasMarkedCompartments();
|
||||
|
||||
|
|
|
@ -4705,12 +4705,15 @@ GCRuntime::beginSweepingZoneGroup()
|
|||
c->sweepSavedStacks();
|
||||
c->sweepGlobalObject(&fop);
|
||||
c->sweepSelfHostingScriptSource();
|
||||
c->sweepJitCompartment(&fop);
|
||||
c->sweepDebugScopes();
|
||||
c->sweepJitCompartment(&fop);
|
||||
c->sweepWeakMaps();
|
||||
c->sweepNativeIterators();
|
||||
}
|
||||
|
||||
// Bug 1071218: the following two methods have not yet been
|
||||
// refactored to work on a single zone-group at once.
|
||||
|
||||
// Collect watch points associated with unreachable objects.
|
||||
WatchpointMap::sweepAll(rt);
|
||||
|
||||
|
@ -4726,22 +4729,18 @@ GCRuntime::beginSweepingZoneGroup()
|
|||
}
|
||||
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_DISCARD_ANALYSIS);
|
||||
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
|
||||
// If there is an OOM while sweeping types, the type information
|
||||
// will be deoptimized so that it is still correct (i.e.
|
||||
// overapproximates the possible types in the zone), but the
|
||||
// constraints might not have been triggered on the deoptimization
|
||||
// or even copied over completely. In this case, destroy all JIT
|
||||
// code and new script information in the zone, the only things
|
||||
// whose correctness depends on the type constraints.
|
||||
bool oom = false;
|
||||
zone->sweep(&fop, releaseObservedTypes && !zone->isPreservingCode(), &oom);
|
||||
zone->sweepAnalysis(&fop, releaseObservedTypes && !zone->isPreservingCode());
|
||||
}
|
||||
}
|
||||
|
||||
if (oom) {
|
||||
zone->setPreservingCode(false);
|
||||
zone->discardJitCode(&fop);
|
||||
zone->types.clearAllNewScriptsOnOOM();
|
||||
}
|
||||
{
|
||||
gcstats::MaybeAutoPhase ap(stats, !isHeapCompacting(),
|
||||
gcstats::PHASE_SWEEP_BREAKPOINT);
|
||||
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
|
||||
zone->sweepBreakpoints(&fop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче