Split JS::Compartment from JS::Realm

RESOLVED FIXED in Firefox 62

Status

()

enhancement
P2
normal
RESOLVED FIXED
2 years ago
4 months ago

People

(Reporter: jorendorff, Assigned: jandem)

Tracking

unspecified
mozilla62
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox60 wontfix, firefox61 wontfix, firefox62 fixed)

Details

Attachments

(1 attachment)

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.
Priority: -- → P2
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 ..
https://hg.mozilla.org/mozilla-central/rev/011f238cc9ab
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.