void js_TraceAtomState(JSTracer *trc) { JSRuntime *rt = trc->context->runtime; JSAtomState *state = &rt->atomState; #ifdef DEBUG size_t number = 0; #endif if (rt->gcKeepAtoms) { for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { JS_SET_TRACING_INDEX(trc, "locked_atom", number++); MarkString(trc, r.front().asPtr()); } } else { for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { AtomStateEntry entry = r.front(); if (!entry.isTagged()) continue; JS_SET_TRACING_INDEX(trc, "interned_atom", number++); MarkString(trc, entry.asPtr()); } } }
void js_TraceAtomState(JSTracer *trc) { JSRuntime *rt = trc->context->runtime; JSAtomState *state = &rt->atomState; #ifdef DEBUG size_t number = 0; #endif if (rt->gcKeepAtoms) { for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { JS_SET_TRACING_INDEX(trc, "locked_atom", number++); MarkString(trc, AtomEntryToKey(r.front())); } } else { for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { AtomEntryType entry = r.front(); uintN flags = AtomEntryFlags(entry); if (flags & (ATOM_PINNED | ATOM_INTERNED)) { JS_SET_TRACING_INDEX(trc, flags & ATOM_PINNED ? "pinned_atom" : "interned_atom", number++); MarkString(trc, AtomEntryToKey(entry)); } } } }
js_DumpAtoms(JSContext *cx, FILE *fp) { JSAtomState *state = &cx->runtime->atomState; fprintf(fp, "atoms table contents:\n"); unsigned number = 0; for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { AtomEntryType entry = r.front(); fprintf(fp, "%3u ", number++); if (entry == 0) { fputs("<uninitialized>", fp); } else { JSAtom *key = AtomEntryToKey(entry); FileEscapedString(fp, key, '"'); uintN flags = AtomEntryFlags(entry); if (flags != 0) { fputs((flags & (ATOM_PINNED | ATOM_INTERNED)) ? " pinned | interned" : (flags & ATOM_PINNED) ? " pinned" : " interned", fp); } } putc('\n', fp); } putc('\n', fp); }
void js_TraceAtomState(JSTracer *trc) { JSRuntime *rt = trc->runtime; JSAtomState *state = &rt->atomState; if (rt->gcKeepAtoms) { for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { MarkRoot(trc, r.front().asPtr(), "locked_atom"); } } else { for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { AtomStateEntry entry = r.front(); if (!entry.isTagged()) continue; MarkRoot(trc, entry.asPtr(), "interned_atom"); } } }
void js_FinishCommonAtoms(JSContext *cx) { cx->runtime->emptyString = NULL; JSAtomState *state = &cx->runtime->atomState; for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) ClearAtomEntryFlags(r.front(), ATOM_PINNED); #ifdef DEBUG memset(COMMON_ATOMS_START(state), JS_FREE_PATTERN, ATOM_OFFSET_LIMIT - ATOM_OFFSET_START); #endif }
void js::MarkAtoms(JSTracer *trc) { JSRuntime *rt = trc->runtime; for (AtomSet::Range r = rt->atoms.all(); !r.empty(); r.popFront()) { AtomStateEntry entry = r.front(); if (!entry.isTagged()) continue; JSAtom *tmp = entry.asPtr(); MarkStringRoot(trc, &tmp, "interned_atom"); JS_ASSERT(tmp == entry.asPtr()); } }
void js::FinishAtoms(JSRuntime *rt) { AtomSet &atoms = rt->atoms; if (!atoms.initialized()) { /* * We are called with uninitialized state when JS_NewRuntime fails and * calls JS_DestroyRuntime on a partially initialized runtime. */ return; } FreeOp fop(rt, false); for (AtomSet::Range r = atoms.all(); !r.empty(); r.popFront()) r.front().asPtr()->finalize(&fop); }
void js_FinishAtomState(JSRuntime *rt) { JSAtomState *state = &rt->atomState; if (!state->atoms.initialized()) { /* * We are called with uninitialized state when JS_NewRuntime fails and * calls JS_DestroyRuntime on a partially initialized runtime. */ return; } for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) r.front().asPtr()->finalize(rt); }
js_DumpAtoms(JSContext *cx, FILE *fp) { JSAtomState *state = &cx->runtime->atomState; fprintf(fp, "atoms table contents:\n"); unsigned number = 0; for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) { AtomStateEntry entry = r.front(); fprintf(fp, "%3u ", number++); JSAtom *key = entry.asPtr(); FileEscapedString(fp, key, '"'); if (entry.isTagged()) fputs(" interned", fp); putc('\n', fp); } putc('\n', fp); }
void js_FinishAtomState(JSRuntime *rt) { JSAtomState *state = &rt->atomState; if (!state->atoms.initialized()) { /* * We are called with uninitialized state when JS_NewRuntime fails and * calls JS_DestroyRuntime on a partially initialized runtime. */ return; } for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) AtomEntryToKey(r.front())->finalize(rt); #ifdef JS_THREADSAFE js_FinishLock(&state->lock); #endif }