diff --git a/js/public/Realm.h b/js/public/Realm.h index c3b0d20901be..9489e460517b 100644 --- a/js/public/Realm.h +++ b/js/public/Realm.h @@ -23,14 +23,13 @@ namespace js { namespace gc { JS_PUBLIC_API void TraceRealm(JSTracer* trc, JS::Realm* realm, const char* name); -JS_PUBLIC_API bool RealmNeedsSweep(JS::Realm* realm); } // namespace gc } // namespace js namespace JS { class JS_PUBLIC_API AutoRequireNoGC; -// Each Realm holds a strong reference to its GlobalObject, and vice versa. +// Each Realm holds a weak reference to its GlobalObject. template <> struct GCPolicy : public NonGCPointerPolicy { static void trace(JSTracer* trc, Realm** vp, const char* name) { @@ -38,9 +37,6 @@ struct GCPolicy : public NonGCPointerPolicy { ::js::gc::TraceRealm(trc, *vp, name); } } - static bool needsSweep(Realm** vp) { - return *vp && ::js::gc::RealmNeedsSweep(*vp); - } }; // Get the current realm, if any. The ECMAScript spec calls this "the current diff --git a/js/src/vm/Realm-inl.h b/js/src/vm/Realm-inl.h index f1827e6c6667..4c4fd9f16c10 100644 --- a/js/src/vm/Realm-inl.h +++ b/js/src/vm/Realm-inl.h @@ -28,11 +28,6 @@ js::GlobalObject* JS::Realm::maybeGlobal() const { return global_; } -inline bool JS::Realm::globalIsAboutToBeFinalized() { - MOZ_ASSERT(zone_->isGCSweeping()); - return global_ && js::gc::IsAboutToBeFinalized(&global_); -} - inline bool JS::Realm::hasLiveGlobal() const { js::GlobalObject* global = unsafeUnbarrieredMaybeGlobal(); return global && !js::gc::IsAboutToBeFinalizedUnbarriered(&global); diff --git a/js/src/vm/Realm.cpp b/js/src/vm/Realm.cpp index dab3b104e589..07c8206e50dc 100644 --- a/js/src/vm/Realm.cpp +++ b/js/src/vm/Realm.cpp @@ -686,10 +686,6 @@ JS_PUBLIC_API void gc::TraceRealm(JSTracer* trc, JS::Realm* realm, realm->traceGlobalData(trc); } -JS_PUBLIC_API bool gc::RealmNeedsSweep(JS::Realm* realm) { - return realm->globalIsAboutToBeFinalized(); -} - JS_PUBLIC_API JS::Realm* JS::GetCurrentRealmOrNull(JSContext* cx) { return cx->realm(); } diff --git a/js/src/vm/Realm.h b/js/src/vm/Realm.h index e1478dc96dce..05072618ddbb 100644 --- a/js/src/vm/Realm.h +++ b/js/src/vm/Realm.h @@ -494,9 +494,6 @@ class JS::Realm : public JS::shadow::Realm { return global_.unbarrieredGet(); } - /* True if a global object exists, but it's being collected. */ - inline bool globalIsAboutToBeFinalized(); - /* True if a global exists and it's not being collected. */ inline bool hasLiveGlobal() const;