Bug 790338 - Mark weak references in the current compartment group only rather than for all collecting compartments r=billm

--HG--
extra : rebase_source : 46d236a1f70a2f8fa80ef7d0b1eb8f73ccdd7c34
This commit is contained in:
Jon Coppeard 2012-11-06 16:01:18 +00:00
parent 33e1b47edf
commit c71c449d4a
3 changed files with 16 additions and 23 deletions

View File

@ -3467,16 +3467,6 @@ BeginMarkPhase(JSRuntime *rt)
rt->gcFoundBlackGrayEdges = false; rt->gcFoundBlackGrayEdges = false;
} }
bool
MarkWeakMapsIteratively(JSRuntime *rt)
{
bool markedAny = false;
GCMarker *gcmarker = &rt->gcMarker;
for (GCCompartmentGroupIter c(rt); !c.done(); c.next())
markedAny |= WeakMapBase::markCompartmentIteratively(c, gcmarker);
return markedAny;
}
void void
MarkWeakReferences(JSRuntime *rt, gcstats::Phase phase) MarkWeakReferences(JSRuntime *rt, gcstats::Phase phase)
{ {
@ -3485,10 +3475,17 @@ MarkWeakReferences(JSRuntime *rt, gcstats::Phase phase)
gcstats::AutoPhase ap(rt->gcStats, phase); gcstats::AutoPhase ap(rt->gcStats, phase);
while (WatchpointMap::markAllIteratively(gcmarker) || for (;;) {
MarkWeakMapsIteratively(rt) || bool markedAny = false;
Debugger::markAllIteratively(gcmarker)) for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) {
{ markedAny |= WatchpointMap::markCompartmentIteratively(c, gcmarker);
markedAny |= WeakMapBase::markCompartmentIteratively(c, gcmarker);
}
markedAny |= Debugger::markAllIteratively(gcmarker);
if (!markedAny)
break;
SliceBudget budget; SliceBudget budget;
gcmarker->drainMarkStack(budget); gcmarker->drainMarkStack(budget);
} }

View File

@ -143,15 +143,11 @@ WatchpointMap::triggerWatchpoint(JSContext *cx, HandleObject obj, HandleId id, M
} }
bool bool
WatchpointMap::markAllIteratively(JSTracer *trc) WatchpointMap::markCompartmentIteratively(JSCompartment *c, JSTracer *trc)
{ {
JSRuntime *rt = trc->runtime; if (!c->watchpointMap)
bool mutated = false; return false;
for (GCCompartmentsIter c(rt); !c.done(); c.next()) { return c->watchpointMap->markIteratively(trc);
if (c->isGCMarking() && c->watchpointMap)
mutated |= c->watchpointMap->markIteratively(trc);
}
return mutated;
} }
bool bool

View File

@ -55,7 +55,7 @@ class WatchpointMap {
bool triggerWatchpoint(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp); bool triggerWatchpoint(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp);
static bool markAllIteratively(JSTracer *trc); static bool markCompartmentIteratively(JSCompartment *c, JSTracer *trc);
bool markIteratively(JSTracer *trc); bool markIteratively(JSTracer *trc);
void markAll(JSTracer *trc); void markAll(JSTracer *trc);
static void sweepAll(JSRuntime *rt); static void sweepAll(JSRuntime *rt);