Bug 937818, part 2 - Add js::ZoneGlobalsAreAllGray. r=jonco

If all globals in a zone are gray, then all live objects in that zone
should also be gray.
This commit is contained in:
Andrew McCreight 2013-12-16 21:30:53 -08:00
parent 4b4868e59c
commit 887ed3eb3d
2 changed files with 14 additions and 0 deletions

View File

@ -647,6 +647,17 @@ js::AreGCGrayBitsValid(JSRuntime *rt)
return rt->gcGrayBitsValid;
}
JS_FRIEND_API(bool)
js::ZoneGlobalsAreAllGray(JS::Zone *zone)
{
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next()) {
JSObject *obj = comp->maybeGlobal();
if (!obj || !JS::GCThingIsMarkedGray(obj))
return false;
}
return true;
}
JS_FRIEND_API(JSGCTraceKind)
js::GCThingTraceKind(void *thing)
{

View File

@ -339,6 +339,9 @@ TraceWeakMaps(WeakMapTracer *trc);
extern JS_FRIEND_API(bool)
AreGCGrayBitsValid(JSRuntime *rt);
extern JS_FRIEND_API(bool)
ZoneGlobalsAreAllGray(JS::Zone *zone);
typedef void
(*GCThingCallback)(void *closure, void *gcthing);