Bug 1400478 - Dump object class info if we find a compartment mismatch during marking r=sfink

This commit is contained in:
Jon Coppeard 2017-09-20 10:27:18 +01:00
Родитель 1865b9d851
Коммит d2239c88fa
1 изменённых файлов: 13 добавлений и 1 удалений

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

@ -1662,6 +1662,18 @@ ObjectDenseElementsMayBeMarkable(NativeObject* nobj)
return mayBeMarkable;
}
static inline void
CheckForCompartmentMismatch(JSObject* obj, JSObject* obj2)
{
#ifdef DEBUG
if (MOZ_UNLIKELY(obj->compartment() != obj2->compartment())) {
fprintf(stderr, "Compartment mismatch in pointer from %s object slot to %s object\n",
obj->getClass()->name, obj2->getClass()->name);
MOZ_CRASH("Compartment mismatch");
}
#endif
}
inline void
GCMarker::processMarkStackTop(SliceBudget& budget)
{
@ -1732,7 +1744,7 @@ GCMarker::processMarkStackTop(SliceBudget& budget)
traverseEdge(obj, v.toString());
} else if (v.isObject()) {
JSObject* obj2 = &v.toObject();
MOZ_ASSERT(obj->compartment() == obj2->compartment());
CheckForCompartmentMismatch(obj, obj2);
if (mark(obj2)) {
// Save the rest of this value array for later and start scanning obj2's children.
pushValueArray(obj, vp, end);