Bug 951722 - Add asserts that hash table postbarriers are working for new type objects r=terrence

This commit is contained in:
Jon Coppeard 2013-12-19 10:46:41 +00:00
Родитель 59d8377c49
Коммит 3f708b4232
3 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -292,7 +292,9 @@ StoreBuffer::mark(JSTracer *trc)
bufferGeneric.mark(this, trc);
#if defined(DEBUG)
/* Check that internal hash tables no longer have any pointers into the nursery. */
for (CompartmentsIter c(runtime_, SkipAtoms); !c.done(); c.next()) {
c->checkNewTypeObjectTableAfterMovingGC();
if (c->debugScopes)
c->debugScopes->checkHashTablesAfterMovingGC(runtime_);
}

Просмотреть файл

@ -247,6 +247,9 @@ struct JSCompartment
js::types::TypeObjectWithNewScriptSet newTypeObjects;
js::types::TypeObjectWithNewScriptSet lazyTypeObjects;
void sweepNewTypeObjectTable(js::types::TypeObjectWithNewScriptSet &table);
#if defined(DEBUG) && defined(JSGC_GENERATIONAL)
void checkNewTypeObjectTableAfterMovingGC();
#endif
/*
* Hash table of all manually call site-cloned functions from within

Просмотреть файл

@ -3959,6 +3959,29 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto, JSFunction *
return type;
}
#if defined(DEBUG) && defined(JSGC_GENERATIONAL)
void
JSCompartment::checkNewTypeObjectTableAfterMovingGC()
{
/*
* Assert that the postbarriers have worked and that nothing is left in
* newTypeObjects that points into the nursery, and that the hash table
* entries are discoverable.
*/
JS::shadow::Runtime *rt = JS::shadow::Runtime::asShadowRuntime(runtimeFromMainThread());
for (TypeObjectWithNewScriptSet::Enum e(newTypeObjects); !e.empty(); e.popFront()) {
TypeObjectWithNewScriptEntry entry = e.front();
JS_ASSERT(!IsInsideNursery(rt, entry.newFunction));
TaggedProto proto = entry.object->proto();
JS_ASSERT_IF(proto.isObject(), !IsInsideNursery(rt, proto.toObject()));
TypeObjectWithNewScriptEntry::Lookup
lookup(entry.object->clasp(), proto, entry.newFunction);
TypeObjectWithNewScriptSet::Ptr ptr = newTypeObjects.lookup(lookup);
JS_ASSERT(ptr.found() && &*ptr == &e.front());
}
}
#endif
TypeObject *
ExclusiveContext::getLazyType(const Class *clasp, TaggedProto proto)
{