To support same-compartment realms, we factor out a Compartment class so that Compartment and Realm are no longer identical inside js/src. However, initially there will be no way to create multiple Realms in the same Compartment, so they'll still be one-to-one. Each Realm has a pointer to its freshly factored-out Compartment. All Wrapper stuff moves from JS::Realm to the new JS::Compartment. Initially, JS::Compartment also contains a pointer to its sole Realm. (It will be eliminated later.) To make way for JS::Compartment, js::wasm::Compartment will have to be renamed to js::wasm::WasmCompartment.
On top of the other changes, this is now pretty straight-forward. JS::GetCompartmentForRealm still exists, it uses JS::shadow::Realm that contains just the compartment pointer. Internally, JS::Realm inherits from JS::shadow::Realm. Memory reporting of a zone now uses a compartments/ subtree for the compartment data (the JSCompartment objects themselves, the wrapper tables, the XPConnect private data).
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Attachment #8982981 - Flags: review?(jcoppeard)
Comment on attachment 8982981 [details] [diff] [review] Remove JS::Realm/JSCompartment inheritance Review of attachment 8982981 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/vm/TypeInference.cpp @@ +4590,1 @@ > Zone::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, Huh, why is this defined here?
Attachment #8982981 - Flags: review?(jcoppeard) → review+
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/011f238cc9ab Remove JS::Realm/JSCompartment inheritance. r=jonco
(In reply to Jon Coppeard (:jonco) from comment #2) > ::: js/src/vm/TypeInference.cpp > @@ +4590,1 @@ > > Zone::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, > > Huh, why is this defined here? Looking at the history of this code in searchfox, I think initially the Zone memory reporting code only measured the TI data so that's probably why it's still in TypeInference.cpp ..
You need to log in before you can comment on or make changes to this bug.