Bug 1088214 - Assert JSCLASS_IMPLEMENTS_BARRIERS is implemented everywhere r=terrence

This commit is contained in:
Jon Coppeard 2015-01-21 10:53:32 +00:00
parent 7dcec5ebe5
commit 3778c25227
3 changed files with 5 additions and 29 deletions

View File

@ -1801,10 +1801,8 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
// Global objects all have the same trace hook. That hook is safe without barriers
// if the global has no custom trace hook of its own, or has been moved to a different
// compartment, and so can't have one.
MOZ_ASSERT_IF(runtime()->gc.isIncrementalGCEnabled() &&
!(clasp->trace == JS_GlobalObjectTraceHook &&
(!obj->compartment()->options().getTrace() ||
!obj->isOwnGlobal())),
MOZ_ASSERT_IF(!(clasp->trace == JS_GlobalObjectTraceHook &&
(!obj->compartment()->options().getTrace() || !obj->isOwnGlobal())),
clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS);
if (clasp->trace == InlineTypedObject::obj_trace)
goto scan_typed_obj;

View File

@ -21,7 +21,7 @@ int BarkWhenTracedClass::finalizeCount;
int BarkWhenTracedClass::traceCount;
const JSClass BarkWhenTracedClass::class_ = {
"BarkWhenTracedClass", 0,
"BarkWhenTracedClass", JSCLASS_IMPLEMENTS_BARRIERS,
nullptr,
nullptr,
nullptr,

View File

@ -1232,32 +1232,10 @@ NewObject(ExclusiveContext *cx, types::TypeObject *type_, JSObject *parent, gc::
obj = nobj;
}
/*
* This will cancel an already-running incremental GC from doing any more
* slices, and it will prevent any future incremental GCs.
*/
bool globalWithoutCustomTrace = clasp->trace == JS_GlobalObjectTraceHook &&
!cx->compartment()->options().getTrace();
if (clasp->trace &&
!globalWithoutCustomTrace &&
!(clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS))
{
if (!cx->shouldBeJSContext())
return nullptr;
JSRuntime *rt = cx->asJSContext()->runtime();
rt->gc.disallowIncrementalGC();
#ifdef DEBUG
if (rt->gc.gcMode() == JSGC_MODE_INCREMENTAL) {
fprintf(stderr,
"The class %s has a trace hook but does not declare the\n"
"JSCLASS_IMPLEMENTS_BARRIERS flag. Please ensure that it correctly\n"
"implements write barriers and then set the flag.\n",
clasp->name);
MOZ_CRASH();
}
#endif
}
if (clasp->trace && !globalWithoutCustomTrace)
MOZ_RELEASE_ASSERT(clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS);
probes::CreateObject(cx, obj);
return obj;