Bug 720848 - Trace through watchpoints from TraceRuntime (r=jorendorff)

This commit is contained in:
Bill McCloskey 2012-01-24 18:32:17 -08:00
parent 3b16857c51
commit 5432dc90b6
3 changed files with 22 additions and 0 deletions

View File

@ -2125,6 +2125,12 @@ MarkRuntime(JSTracer *trc)
if (c->activeAnalysis)
c->markTypes(trc);
/* During a GC, these are treated as weak pointers. */
if (!IS_GC_MARKING_TRACER(trc)) {
if (c->watchpointMap)
c->watchpointMap->markAll(trc);
}
/* Do not discard scripts with counters while profiling. */
if (rt->profilingScripts) {
for (CellIterUnderGC i(c, FINALIZE_SCRIPT); !i.done(); i.next()) {

View File

@ -220,6 +220,21 @@ WatchpointMap::markIteratively(JSTracer *trc)
return marked;
}
void
WatchpointMap::markAll(JSTracer *trc)
{
for (Map::Range r = map.all(); !r.empty(); r.popFront()) {
Map::Entry &e = r.front();
MarkObject(trc, e.key.object, "held Watchpoint object");
const HeapId &id = e.key.id;
JS_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id));
MarkId(trc, id, "WatchKey::id");
MarkObject(trc, e.value.closure, "Watchpoint::closure");
}
}
void
WatchpointMap::sweepAll(JSContext *cx)
{

View File

@ -89,6 +89,7 @@ class WatchpointMap {
static bool markAllIteratively(JSTracer *trc);
bool markIteratively(JSTracer *trc);
void markAll(JSTracer *trc);
static void sweepAll(JSContext *cx);
void sweep(JSContext *cx);