bool AtomIsInterned(JSContext *cx, JSAtom *atom) { if (atom->isStaticAtom()) return true; AutoLockAtomsCompartment lock(cx); AtomSet::Ptr p = cx->runtime->atomState.atoms.lookup(atom); if (!p) return false; return p->isTagged(); }
bool AtomIsInterned(JSContext *cx, JSAtom *atom) { /* We treat static strings as interned because they're never collected. */ if (StaticStrings::isStatic(atom)) return true; AtomSet::Ptr p = cx->runtime->atoms.lookup(atom); if (!p) return false; return p->isTagged(); }
bool AtomIsInterned(JSContext *cx, JSAtom *atom) { /* We treat static strings as interned because they're never collected. */ if (StaticStrings::isStatic(atom)) return true; AtomHasher::Lookup lookup(atom); /* Likewise, permanent strings are considered to be interned. */ AtomSet::Ptr p = cx->permanentAtoms().readonlyThreadsafeLookup(lookup); if (p) return true; AutoLockForExclusiveAccess lock(cx); p = cx->runtime()->atoms().lookup(lookup); if (!p) return false; return p->isTagged(); }