예제 #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
void
WeakMapBase::traceAllMappings(WeakMapTracer *tracer)
{
    JSRuntime *rt = tracer->context->runtime;
    for (WeakMapBase *m = rt->gcWeakMapList; m; m = m->next)
        m->traceMappings(tracer);
}
예제 #3
0
파일: WeakMap.cpp 프로젝트: servo/mozjs
void WeakMapBase::restoreMarkedWeakMaps(WeakMapSet& markedWeakMaps) {
  for (WeakMapSet::Range r = markedWeakMaps.all(); !r.empty(); r.popFront()) {
    WeakMapBase* map = r.front();
    MOZ_ASSERT(map->zone()->isGCMarking());
    MOZ_ASSERT(!map->marked);
    map->marked = true;
  }
}
예제 #4
0
void
WeakMapBase::traceAllMappings(WeakMapTracer *tracer)
{
    JSRuntime *rt = tracer->runtime;
    for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
        for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next)
            m->traceMappings(tracer);
    }
}
예제 #5
0
bool
WeakMapBase::findZoneEdgesForCompartment(JSCompartment *c)
{
    for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next) {
        if (!m->findZoneEdges())
            return false;
    }
    return true;
}
예제 #6
0
bool
WeakMapBase::markCompartmentIteratively(JSCompartment *c, JSTracer *tracer)
{
    bool markedAny = false;
    for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next) {
        if (m->markIteratively(tracer))
            markedAny = true;
    }
    return markedAny;
}
예제 #7
0
void
WeakMapBase::markAll(JSCompartment* c, JSTracer* tracer)
{
    MOZ_ASSERT(tracer->eagerlyTraceWeakMaps() != DoNotTraceWeakMaps);
    for (WeakMapBase* m = c->gcWeakMapList; m; m = m->next) {
        m->trace(tracer);
        if (m->memberOf)
            TraceEdge(tracer, &m->memberOf, "memberOf");
    }
}
예제 #8
0
bool
WeakMapBase::markAllIteratively(JSTracer *tracer)
{
    bool markedAny = false;
    JSRuntime *rt = tracer->context->runtime;
    for (WeakMapBase *m = rt->gcWeakMapList; m; m = m->next) {
        if (m->markIteratively(tracer))
            markedAny = true;
    }
    return markedAny;
}
예제 #9
0
void
WeakMapBase::traceAllMappings(WeakMapTracer* tracer)
{
    JSRuntime* rt = tracer->runtime;
    for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
        for (WeakMapBase* m = c->gcWeakMapList; m; m = m->next) {
            // The WeakMapTracer callback is not allowed to GC.
            JS::AutoSuppressGCAnalysis nogc;
            m->traceMappings(tracer);
        }
    }
}
예제 #10
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
}
예제 #11
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
}
예제 #12
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
}
예제 #13
0
void
WeakMapBase::sweepCompartment(JSCompartment *c)
{
    for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next)
        m->sweep();
}