示例#1
0
void
WeakMapBase::sweepAll(JSTracer *tracer)
{
    JSRuntime *rt = tracer->context->runtime;
    for (WeakMapBase *m = rt->gcWeakMapList; m; m = m->next)
        m->sweep(tracer);
}
示例#2
0
文件: WeakMap.cpp 项目: servo/mozjs
void WeakMapBase::sweepZone(JS::Zone* zone) {
  for (WeakMapBase* m = zone->gcWeakMapList().getFirst(); m;) {
    WeakMapBase* next = m->getNext();
    if (m->marked) {
      m->sweep();
    } else {
      m->clearAndCompact();
      m->removeFrom(zone->gcWeakMapList());
    }
    m = next;
  }

#ifdef DEBUG
  for (WeakMapBase* m : zone->gcWeakMapList()) {
    MOZ_ASSERT(m->isInList() && m->marked);
  }
#endif
}
示例#3
0
void
WeakMapBase::sweepZone(JS::Zone* zone)
{
    for (WeakMapBase* m = zone->gcWeakMapList().getFirst(); m; ) {
        WeakMapBase* next = m->getNext();
        if (m->marked) {
            m->sweep();
        } else {
            /* Destroy the hash map now to catch any use after this point. */
            m->finish();
            m->removeFrom(zone->gcWeakMapList());
        }
        m = next;
    }

#ifdef DEBUG
    for (WeakMapBase* m : zone->gcWeakMapList())
        MOZ_ASSERT(m->isInList() && m->marked);
#endif
}
示例#4
0
void
WeakMapBase::sweepCompartment(JSCompartment *c)
{
    WeakMapBase **tailPtr = &c->gcWeakMapList;
    for (WeakMapBase *m = c->gcWeakMapList, *next; m; m = next) {
        next = m->next;
        if (m->marked) {
            m->sweep();
            *tailPtr = m;
            tailPtr = &m->next;
        } else {
            /* Destroy the hash map now to catch any use after this point. */
            m->finish();
            m->next = WeakMapNotInList;
        }
    }
    *tailPtr = nullptr;

#ifdef DEBUG
    for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next)
        JS_ASSERT(m->isInList() && m->marked);
#endif
}
示例#5
0
void
WeakMapBase::sweepCompartment(JSCompartment *c)
{
    for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next)
        m->sweep();
}