diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index e62b9dec378..ff0a433c803 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -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) { diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 6e41232400c..4c5d113d2d3 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -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);