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-17 19:29:57 -08:00
parent c815051008
commit b3df5c35be
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);