mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 650161 - We don't need special fixup for CCWs after compacting GC r=terrence
This commit is contained in:
parent
181db3f30e
commit
c4ef452bd6
@ -512,9 +512,7 @@ JSCompartment::markCrossCompartmentWrappers(JSTracer *trc)
|
||||
* We have a cross-compartment wrapper. Its private pointer may
|
||||
* point into the compartment being collected, so we should mark it.
|
||||
*/
|
||||
Value referent = wrapper->private_();
|
||||
MarkValueRoot(trc, &referent, "cross-compartment wrapper");
|
||||
MOZ_ASSERT(referent == wrapper->private_());
|
||||
MarkSlot(trc, wrapper->slotOfPrivate(), "cross-compartment wrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -654,39 +652,6 @@ JSCompartment::sweepCrossCompartmentWrappers()
|
||||
|
||||
#ifdef JSGC_COMPACTING
|
||||
|
||||
/*
|
||||
* Fixup wrappers with moved keys or values.
|
||||
*/
|
||||
void
|
||||
JSCompartment::fixupCrossCompartmentWrappers(JSTracer *trc)
|
||||
{
|
||||
for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) {
|
||||
Value val = e.front().value();
|
||||
if (IsForwarded(val)) {
|
||||
val = Forwarded(val);
|
||||
e.front().value().set(val);
|
||||
}
|
||||
|
||||
// CrossCompartmentKey's hash does not depend on the debugger object,
|
||||
// so update it but do not rekey if it changes
|
||||
CrossCompartmentKey key = e.front().key();
|
||||
if (key.debugger)
|
||||
key.debugger = MaybeForwarded(key.debugger);
|
||||
if (key.wrapped && IsForwarded(key.wrapped)) {
|
||||
key.wrapped = Forwarded(key.wrapped);
|
||||
e.rekeyFront(key, key);
|
||||
}
|
||||
|
||||
if (!zone()->isCollecting() && val.isObject()) {
|
||||
// Call the trace hook to update any pointers to relocated things.
|
||||
JSObject *obj = &val.toObject();
|
||||
const Class *clasp = obj->getClass();
|
||||
if (clasp->trace)
|
||||
clasp->trace(trc, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JSCompartment::fixupAfterMovingGC()
|
||||
{
|
||||
fixupGlobal();
|
||||
|
@ -367,7 +367,6 @@ struct JSCompartment
|
||||
#ifdef JSGC_COMPACTING
|
||||
void fixupInitialShapeTable();
|
||||
void fixupNewTypeObjectTable(js::types::TypeObjectWithNewScriptSet &table);
|
||||
void fixupCrossCompartmentWrappers(JSTracer *trc);
|
||||
void fixupAfterMovingGC();
|
||||
void fixupGlobal();
|
||||
#endif
|
||||
|
@ -2344,32 +2344,27 @@ MovingTracer::Visit(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
|
||||
void
|
||||
GCRuntime::sweepZoneAfterCompacting(Zone *zone)
|
||||
{
|
||||
MOZ_ASSERT(zone->isCollecting());
|
||||
FreeOp *fop = rt->defaultFreeOp();
|
||||
if (zone->isCollecting()) {
|
||||
zone->discardJitCode(fop);
|
||||
zone->sweepAnalysis(fop, rt->gc.releaseObservedTypes && !zone->isPreservingCode());
|
||||
zone->sweepBreakpoints(fop);
|
||||
zone->discardJitCode(fop);
|
||||
zone->sweepAnalysis(fop, rt->gc.releaseObservedTypes && !zone->isPreservingCode());
|
||||
zone->sweepBreakpoints(fop);
|
||||
|
||||
for (CompartmentsInZoneIter c(zone); !c.done(); c.next()) {
|
||||
c->sweepInnerViews();
|
||||
c->sweepCrossCompartmentWrappers();
|
||||
c->sweepBaseShapeTable();
|
||||
c->sweepInitialShapeTable();
|
||||
c->sweepTypeObjectTables();
|
||||
c->sweepRegExps();
|
||||
c->sweepCallsiteClones();
|
||||
c->sweepSavedStacks();
|
||||
c->sweepGlobalObject(fop);
|
||||
c->sweepSelfHostingScriptSource();
|
||||
c->sweepDebugScopes();
|
||||
c->sweepJitCompartment(fop);
|
||||
c->sweepWeakMaps();
|
||||
c->sweepNativeIterators();
|
||||
}
|
||||
} else {
|
||||
/* Update cross compartment wrappers into moved zones. */
|
||||
for (CompartmentsInZoneIter c(zone); !c.done(); c.next())
|
||||
c->sweepCrossCompartmentWrappers();
|
||||
for (CompartmentsInZoneIter c(zone); !c.done(); c.next()) {
|
||||
c->sweepInnerViews();
|
||||
c->sweepCrossCompartmentWrappers();
|
||||
c->sweepBaseShapeTable();
|
||||
c->sweepInitialShapeTable();
|
||||
c->sweepTypeObjectTables();
|
||||
c->sweepRegExps();
|
||||
c->sweepCallsiteClones();
|
||||
c->sweepSavedStacks();
|
||||
c->sweepGlobalObject(fop);
|
||||
c->sweepSelfHostingScriptSource();
|
||||
c->sweepDebugScopes();
|
||||
c->sweepJitCompartment(fop);
|
||||
c->sweepWeakMaps();
|
||||
c->sweepNativeIterators();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2417,7 +2412,7 @@ GCRuntime::updatePointersToRelocatedCells()
|
||||
|
||||
// Fixup cross compartment wrappers as we assert the existence of wrappers in the map.
|
||||
for (CompartmentsIter comp(rt, SkipAtoms); !comp.done(); comp.next())
|
||||
comp->fixupCrossCompartmentWrappers(&trc);
|
||||
comp->sweepCrossCompartmentWrappers();
|
||||
|
||||
// Fixup generators as these are not normally traced.
|
||||
for (ContextIter i(rt); !i.done(); i.next()) {
|
||||
@ -2458,9 +2453,10 @@ GCRuntime::updatePointersToRelocatedCells()
|
||||
// Sweep everything to fix up weak pointers
|
||||
WatchpointMap::sweepAll(rt);
|
||||
Debugger::sweepAll(rt->defaultFreeOp());
|
||||
|
||||
for (ZonesIter zone(rt, SkipAtoms); !zone.done(); zone.next())
|
||||
rt->gc.sweepZoneAfterCompacting(zone);
|
||||
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
|
||||
if (!rt->isAtomsZone(zone))
|
||||
rt->gc.sweepZoneAfterCompacting(zone);
|
||||
}
|
||||
|
||||
// Type inference may put more blocks here to free.
|
||||
rt->freeLifoAlloc.freeAll();
|
||||
|
Loading…
Reference in New Issue
Block a user