Bug 675806 - Make static strings be GC things (r=luke)
This commit is contained in:
@@ -423,7 +423,7 @@ js_SweepAtomState(JSContext *cx)
|
||||
JS_ASSERT(!IsAboutToBeFinalized(cx, entry.asPtr()));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (IsAboutToBeFinalized(cx, entry.asPtr()))
|
||||
e.removeFront();
|
||||
}
|
||||
@@ -432,7 +432,8 @@ js_SweepAtomState(JSContext *cx)
|
||||
bool
|
||||
AtomIsInterned(JSContext *cx, JSAtom *atom)
|
||||
{
|
||||
if (atom->isStaticAtom())
|
||||
/* We treat static strings as interned because they're never collected. */
|
||||
if (StaticStrings::isStatic(atom))
|
||||
return true;
|
||||
|
||||
AutoLockAtomsCompartment lock(cx);
|
||||
@@ -461,7 +462,7 @@ AtomizeInline(JSContext *cx, const jschar **pchars, size_t length,
|
||||
{
|
||||
const jschar *chars = *pchars;
|
||||
|
||||
if (JSAtom *s = JSAtom::lookupStatic(chars, length))
|
||||
if (JSAtom *s = cx->runtime->staticStrings.lookup(chars, length))
|
||||
return s;
|
||||
|
||||
AutoLockAtomsCompartment lock(cx);
|
||||
@@ -521,7 +522,7 @@ js_AtomizeString(JSContext *cx, JSString *str, InternBehavior ib)
|
||||
if (str->isAtom()) {
|
||||
JSAtom &atom = str->asAtom();
|
||||
/* N.B. static atoms are effectively always interned. */
|
||||
if (ib != InternAtom || atom.isStaticAtom())
|
||||
if (ib != InternAtom || js::StaticStrings::isStatic(&atom))
|
||||
return &atom;
|
||||
|
||||
/* Here we have to check whether the atom is already interned. */
|
||||
@@ -604,7 +605,7 @@ js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, InternBehavio
|
||||
JSAtom *
|
||||
js_GetExistingStringAtom(JSContext *cx, const jschar *chars, size_t length)
|
||||
{
|
||||
if (JSAtom *atom = JSAtom::lookupStatic(chars, length))
|
||||
if (JSAtom *atom = cx->runtime->staticStrings.lookup(chars, length))
|
||||
return atom;
|
||||
AutoLockAtomsCompartment lock(cx);
|
||||
AtomSet::Ptr p = cx->runtime->atomState.atoms.lookup(AtomHasher::Lookup(chars, length));
|
||||
|
||||
Reference in New Issue
Block a user