Bug 1188124 - Use rootKind to select the right PersistentRooted list head; r=sfink

--HG--
extra : rebase_source : 8f2df6b63bddaac62e2b9def8564432625efaaaf
This commit is contained in:
Terrence Cole 2015-07-23 14:05:53 -07:00
parent a161a3e370
commit a4087728b5

View File

@ -993,7 +993,15 @@ class PersistentRooted : public js::PersistentRootedBase<T>,
void registerWithRootLists(js::RootLists& roots) {
MOZ_ASSERT(!initialized());
roots.getPersistentRootedList<T>().insertBack(this);
js::ThingRootKind kind = js::RootKind<T>::rootKind();
roots.heapRoots_[kind].insertBack(reinterpret_cast<JS::PersistentRooted<void*>*>(this));
// Until marking and destruction support the full set, we assert that
// we don't try to add any unsupported types.
MOZ_ASSERT(kind == js::THING_ROOT_OBJECT ||
kind == js::THING_ROOT_SCRIPT ||
kind == js::THING_ROOT_STRING ||
kind == js::THING_ROOT_ID ||
kind == js::THING_ROOT_VALUE);
}
public: