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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user