Bug 1589066 - Part 2: Remove unused RealmNeedsSweep API and implementation r=sfink

Depends on D128347

Differential Revision: https://phabricator.services.mozilla.com/D128350
This commit is contained in:
Jon Coppeard 2021-10-14 10:52:27 +00:00
Родитель 2adf7881ad
Коммит 5b2207b61e
4 изменённых файлов: 1 добавлений и 17 удалений

Просмотреть файл

@ -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<Realm*> : public NonGCPointerPolicy<Realm*> {
static void trace(JSTracer* trc, Realm** vp, const char* name) {
@ -38,9 +37,6 @@ struct GCPolicy<Realm*> : public NonGCPointerPolicy<Realm*> {
::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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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;