Closed Bug 1363214 Opened 8 years ago Closed 6 years ago

Split JS::Compartment from JS::Realm

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox60 --- wontfix
firefox61 --- wontfix
firefox62 --- fixed

People

(Reporter: jorendorff, Assigned: jandem)

References

Details

Attachments

(1 file)

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 jandemooij@gmail.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 ..
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: