Bug 790349 - Make JSAtomState store FixedHeapPtr<PropertyName> so that cached-name uses don't have to be rooted. r=jorendorff

This commit is contained in:
Jeff Walden
2012-09-10 20:42:08 -07:00
parent 7f42f9aedc
commit 6c92888c28
3 changed files with 24 additions and 15 deletions

View File

@@ -159,16 +159,16 @@ js::InitCommonNames(JSContext *cx)
#undef COMMON_NAME_INFO
};
PropertyName **names = &cx->runtime->firstCachedName;
FixedHeapPtr<PropertyName> *names = &cx->runtime->firstCachedName;
for (size_t i = 0; i < ArrayLength(cachedNames); i++, names++) {
JSAtom *atom = Atomize(cx, cachedNames[i].str, cachedNames[i].length, InternAtom);
if (!atom)
return false;
*names = atom->asPropertyName();
names->init(atom->asPropertyName());
}
JS_ASSERT(uintptr_t(names) == uintptr_t(&cx->runtime->atomState + 1));
cx->runtime->emptyString = cx->runtime->atomState.emptyAtom;
cx->runtime->emptyString = cx->names().empty;
return true;
}