tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2196a21c5755dd345460d844639b9791780debfe
parent 3aef7edb16e05fba87b537ae91a632f1c383f084
Author: Jon Coppeard <jcoppeard@mozilla.com>
Date:   Thu, 13 Nov 2025 17:20:22 +0000

Bug 2000006 - Remove remaining references to ObjectGroup in the codebase r=spidermonkey-reviewers,mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D272486

Diffstat:
Mjs/src/doc/Debugger/Debugger.Memory.md | 2--
Mjs/src/gc/Zone.h | 8++++----
Mjs/src/jsfriendapi.h | 6++----
Mjs/src/proxy/Proxy.cpp | 6+++---
Mjs/src/vm/Compartment.h | 8++++----
Mjs/src/vm/Realm.h | 9++++-----
Mjs/xpconnect/src/XPCJSRuntime.cpp | 5++---
7 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/js/src/doc/Debugger/Debugger.Memory.md b/js/src/doc/Debugger/Debugger.Memory.md @@ -296,7 +296,6 @@ which produces a result like this: "other": { "js::Shape": { "count": 450, "bytes": 0 }, "js::BaseShape": { "count": 21, "bytes": 0 }, - "js::ObjectGroup": { "count": 17, "bytes": 0 } }, "domNode": { "#text": { "count": 1, "bytes": 12 } @@ -434,7 +433,6 @@ In general, a `breakdown` value has one of the following forms: "js::Shape": { "count": 450, "bytes": 0 }, "JSObject": { "count": 426, "bytes": 44160 }, "js::BaseShape": { "count": 21, "bytes": 0 }, - "js::ObjectGroup": { "count": 17, "bytes": 0 }, "JSScript": { "count": 1, "bytes": 0 } } diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h @@ -371,7 +371,8 @@ namespace JS { // compartments. If an object needs to point to a JSObject in a different // compartment, regardless of zone, it must go through a cross-compartment // wrapper. Each compartment keeps track of its outgoing wrappers in a table. -// JSObjects find their compartment via their ObjectGroup. +// JSObjects find their compartment via their Realm, which is found by +// following their shape and base shape pointers. // // - JSStrings do not belong to any particular compartment, but they do belong // to a zone. Thus, two different compartments in the same zone can point to a @@ -387,9 +388,8 @@ namespace JS { // - Scripts are also compartment-local and cannot be shared. A script points to // its compartment. // -// - ObjectGroup and JitCode objects belong to a compartment and cannot be -// shared. There is no mechanism to obtain the compartment from a JitCode -// object. +// - JitCode objects belong to a compartment and cannot be shared. There is no +// mechanism to obtain the compartment from a JitCode object. // // A zone remains alive as long as any GC things in the zone are alive. A // compartment remains alive as long as any JSObjects, scripts, shapes, or base diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h @@ -79,13 +79,11 @@ extern JS_PUBLIC_API JSObject* JS_NewDeadWrapper( JSContext* cx, JSObject* origObject = nullptr); /* - * Used by the cycle collector to trace through a shape or object group and - * all cycle-participating data it reaches, using bounded stack space. + * Used by the cycle collector to trace through a shape and all + * cycle-participating data it reaches, using bounded stack space. */ extern JS_PUBLIC_API void JS_TraceShapeCycleCollectorChildren( JS::CallbackTracer* trc, JS::GCCellPtr shape); -extern JS_PUBLIC_API void JS_TraceObjectGroupCycleCollectorChildren( - JS::CallbackTracer* trc, JS::GCCellPtr group); extern JS_PUBLIC_API JSPrincipals* JS_GetScriptPrincipals(JSScript* script); diff --git a/js/src/proxy/Proxy.cpp b/js/src/proxy/Proxy.cpp @@ -869,9 +869,9 @@ void ProxyObject::traceEdgeToTarget(JSTracer* trc, ProxyObject* obj) { #ifdef DEBUG static inline void CheckProxyIsInCCWMap(ProxyObject* proxy) { if (proxy->zone()->isGCCompacting()) { - // Skip this check during compacting GC since objects' object groups may be - // forwarded. It's not impossible to make this work, but requires adding a - // parallel lookupWrapper() path for this one case. + // Skip this check during compacting GC since objects' shapes and base + // shapes may be forwarded. It's not impossible to make this work, but + // requires adding a parallel lookupWrapper() path for this one case. return; } diff --git a/js/src/vm/Compartment.h b/js/src/vm/Compartment.h @@ -314,10 +314,10 @@ class JS::Compartment { RealmVector& realms() { return realms_; } // Cross-compartment wrappers are shared by all realms in the compartment, but - // they still have a per-realm ObjectGroup etc. To prevent us from having - // multiple realms, each with some cross-compartment wrappers potentially - // keeping the realm alive longer than necessary, we always allocate CCWs in - // the first realm. + // are still associated with a realm. To prevent us from having multiple + // realms, each with some cross-compartment wrappers potentially keeping the + // realm alive longer than necessary, we always allocate CCWs in the first + // realm. js::GlobalObject& firstGlobal() const; js::GlobalObject& globalForNewCCW() const { return firstGlobal(); } diff --git a/js/src/vm/Realm.h b/js/src/vm/Realm.h @@ -911,9 +911,9 @@ class MOZ_RAII AssertRealmUnchanged { JS::Realm* const oldRealm; }; -// AutoRealm can be used to enter the realm of a JSObject, JSScript or -// ObjectGroup. It must not be used with cross-compartment wrappers, because -// CCWs are not associated with a single realm. +// AutoRealm can be used to enter the realm of a JSObject or JSScript. It must +// not be used with cross-compartment wrappers, because CCWs are not associated +// with a single realm. class AutoRealm { JSContext* const cx_; JS::Realm* const origin_; @@ -946,8 +946,7 @@ class MOZ_RAII AutoAllocInAtomsZone { }; // During GC we sometimes need to enter a realm when we may have been allocating -// in the the atoms zone. This leaves the atoms zone temporarily. This happens -// in embedding callbacks and when we need to mark object groups as pretenured. +// in the the atoms zone. This leaves the atoms zone temporarily. class MOZ_RAII AutoMaybeLeaveAtomsZone { JSContext* const cx_; bool wasInAtomsZone_; diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1822,9 +1822,8 @@ static void ReportRealmStats(const JS::RealmStats& realmStats, ZRREPORT_BYTES(realmJSPathPrefix + "realm-object"_ns, realmStats.realmObject, "The JS::Realm object itself."); - ZRREPORT_BYTES( - realmJSPathPrefix + "realm-tables"_ns, realmStats.realmTables, - "Realm-wide tables storing object group information and wasm instances."); + ZRREPORT_BYTES(realmJSPathPrefix + "realm-tables"_ns, realmStats.realmTables, + "Realm-wide tables storing wasm instances."); ZRREPORT_BYTES(realmJSPathPrefix + "inner-views"_ns, realmStats.innerViewsTable,