bool WatchpointMap::markIteratively(JSTracer *trc) { JSContext *cx = trc->context; bool marked = false; for (Map::Range r = map.all(); !r.empty(); r.popFront()) { Map::Entry &e = r.front(); bool objectIsLive = !IsAboutToBeFinalized(cx, e.key.object); if (objectIsLive || e.value.held) { if (!objectIsLive) { MarkObject(trc, *e.key.object, "held Watchpoint object"); marked = true; } jsid id = e.key.id; JS_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id)); MarkId(trc, id, "WatchKey::id"); if (e.value.closure && IsAboutToBeFinalized(cx, e.value.closure)) { MarkObject(trc, *e.value.closure, "Watchpoint::closure"); marked = true; } } } return marked; }
bool WatchpointMap::markIteratively(JSTracer *trc) { bool marked = false; for (Map::Range r = map.all(); !r.empty(); r.popFront()) { Map::Entry &e = r.front(); bool objectIsLive = !IsAboutToBeFinalized(e.key.object); if (objectIsLive || e.value.held) { if (!objectIsLive) { HeapPtrObject tmp(e.key.object); MarkObject(trc, &tmp, "held Watchpoint object"); JS_ASSERT(tmp == e.key.object); marked = true; } const HeapId &id = e.key.id; JS_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id)); HeapId tmp(id.get()); MarkId(trc, &tmp, "WatchKey::id"); JS_ASSERT(tmp.get() == id.get()); if (e.value.closure && IsAboutToBeFinalized(e.value.closure)) { MarkObject(trc, &e.value.closure, "Watchpoint::closure"); marked = true; } } } return marked; }
size_t JSObject2WrappedJSMap::SizeOfWrappedJS(mozilla::MallocSizeOf mallocSizeOf) const { size_t n = 0; for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) n += r.front().value()->SizeOfIncludingThis(mallocSizeOf); return n; }
void WatchpointMap::trace(WeakMapTracer* trc) { for (Map::Range r = map.all(); !r.empty(); r.popFront()) { Map::Entry& entry = r.front(); trc->trace(nullptr, JS::GCCellPtr(entry.key().object.get()), JS::GCCellPtr(entry.value().closure.get())); } }
void WatchpointMap::trace(WeakMapTracer *trc) { for (Map::Range r = map.all(); !r.empty(); r.popFront()) { Map::Entry &entry = r.front(); trc->callback(trc, NULL, entry.key.object.get(), JSTRACE_OBJECT, entry.value.closure.get(), JSTRACE_OBJECT); } }
void JSObject2WrappedJSMap::ShutdownMarker() { for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) { nsXPCWrappedJS* wrapper = r.front().value(); MOZ_ASSERT(wrapper, "found a null JS wrapper!"); MOZ_ASSERT(wrapper->IsValid(), "found an invalid JS wrapper!"); wrapper->SystemIsBeingShutDown(); } }
/* See the comment on RegExpShared lifetime in RegExpObject.h. */ void RegExpCompartment::sweep(JSRuntime *rt) { #ifdef DEBUG for (Map::Range r = map_.all(); !r.empty(); r.popFront()) JS_ASSERT(inUse_.has(r.front().value())); #endif map_.clear(); for (PendingSet::Enum e(inUse_); !e.empty(); e.popFront()) { RegExpShared *shared = e.front(); if (shared->activeUseCount == 0 && shared->gcNumberWhenUsed < rt->gcStartNumber) { js_delete(shared); e.removeFront(); } } }
void WatchpointMap::markAll(JSTracer *trc) { for (Map::Range r = map.all(); !r.empty(); r.popFront()) { Map::Entry &e = r.front(); HeapPtrObject tmpObj(e.key.object); MarkObject(trc, &tmpObj, "held Watchpoint object"); JS_ASSERT(tmpObj == e.key.object); const HeapId &id = e.key.id; JS_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id)); HeapId tmpId(id.get()); MarkId(trc, &tmpId, "WatchKey::id"); JS_ASSERT(tmpId.get() == id.get()); MarkObject(trc, &e.value.closure, "Watchpoint::closure"); } }
/* See the comment on RegExpShared lifetime in RegExpObject.h. */ void RegExpCompartment::sweep(JSRuntime *rt) { #ifdef DEBUG for (Map::Range r = map_.all(); !r.empty(); r.popFront()) JS_ASSERT(inUse_.has(r.front().value())); #endif map_.clear(); for (PendingSet::Enum e(inUse_); !e.empty(); e.popFront()) { RegExpShared *shared = e.front(); if (shared->activeUseCount == 0 && shared->gcNumberWhenUsed < rt->gcStartNumber) { js_delete(shared); e.removeFront(); } } if (matchResultTemplateObject_ && IsObjectAboutToBeFinalized(matchResultTemplateObject_.unsafeGet())) { matchResultTemplateObject_ = nullptr; } }