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

This commit is contained in:
Bill McCloskey 2012-01-24 18:32:17 -08:00
Родитель df4c901c44
Коммит 2138e8b786
3 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -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()) {

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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);