SpiderMonkey should keep weak map list in zone, not compartment

RESOLVED FIXED in Firefox 44

Status

()

Core
JavaScript Engine
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jimb, Assigned: jimb)

Tracking

unspecified
mozilla44
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(firefox44 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
Created attachment 8663504 [details] [diff] [review]
Move gcWeakMapList from JSCompartment to JS::Zone.

JSCompartment::gcWeakMapList should be moved to JS::Zone. This would make it possible to have weak map types associated with a zone but no particular compartment; and it also would simplify some GC code.

Each weak map that inherits from js::WeakMapBase must be included in the linked list headed by JSCompartment::gcWeakMapList. This requirement makes it impossible to have a weak map that belongs to a zone, but no particular compartment: which compartment's list should it be listed in?

As it turns out, the GC itself would evidently prefer that weak maps be listed on the zone: every spot that iterates over JSCompartment::gcWeakMapList is actually doing so as part of an iteration over all the compartments in some zone or set of zones. The patch is quite clean.

Moving JSCompartment::gcWeakMapList to JS::Zone would put all the weak maps in a zone in one list, which would make calls to WeakMapBase::removeWeakMapFromList slower.
Attachment #8663504 - Flags: review?(terrence)
Comment on attachment 8663504 [details] [diff] [review]
Move gcWeakMapList from JSCompartment to JS::Zone.

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

Thanks for doing this!
Attachment #8663504 - Flags: review?(terrence) → review+
(Assignee)

Updated

3 years ago
Flags: in-testsuite-
Target Milestone: --- → mozilla44
https://hg.mozilla.org/mozilla-central/rev/fd4353cbde80
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox44: --- → fixed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.