Closed Bug 1465472 Opened 6 years ago Closed 6 years ago

Remove the atoms realm/compartment

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(2 files)

A while ago Jon suggested we could remove the atoms realm and compartment and just keep the atoms zone. AutoAtomsRealm could be renamed to AutoAtomsZone.

I tried this and it's pretty nice, for instance the CompartmentsIter and RealmsIter classes no longer need a ZoneSelector argument. It also saves some memory because we no longer allocate a mostly-unused realm and compartment for each runtime.
Attached patch PatchSplinter Review
Some of the less trivial changes:

* When we allocated a symbol, we used the atom realm's RNG to create a hash code [0]. Instead of this I added a RNG for this to the runtime.

* IsCompilingWasm returned true if the JitContext's realm is nullptr, but that's now also true when we initialize the trampolines stored in the atoms zone. To fix that I added a CompileZone* to JitContext, in addition to the CompileRuntime and CompileRealm, and we now check the zone instead of the realm in IsCompilingWasm.

* JSContext::hasEnteredRealm is only called in DEBUG builds so I made hasEnteredRealm and enterRealmDepth_ #ifdef DEBUG.

[0] https://searchfox.org/mozilla-central/rev/5a744713370ec47969595e369fd5125f123e6d24/js/src/vm/SymbolType.cpp#52
Attachment #8981894 - Flags: review?(jcoppeard)
Comment on attachment 8981894 [details] [diff] [review]
Patch

Review of attachment 8981894 [details] [diff] [review]:
-----------------------------------------------------------------

Nice.
Attachment #8981894 - Flags: review?(jcoppeard) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b671b92bea18
Remove the atoms realm/compartment. r=jonco
https://hg.mozilla.org/mozilla-central/rev/b671b92bea18
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Just a GCRuntime::markCompartments one-liner to remove the |comp->zone()->isAtomsZone()| check. The atoms zone no longer contains any compartments.
Attachment #8982991 - Flags: review?(jcoppeard)
Comment on attachment 8982991 [details] [diff] [review]
Followup - Remove (now always-false) check for atoms compartment

Review of attachment 8982991 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.
Attachment #8982991 - Flags: review?(jcoppeard) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/52c23f361adb
followup - Remove (now always-false) check for atoms compartment. r=jonco
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: