Closed Bug 1137978 Opened 10 years ago Closed 10 years ago

Store JSObject::compartment() via its group

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: bhackett1024, Assigned: bhackett1024)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
As discussed on IRC, storing an object's compartment via its group instead of its shape is both forward compatible with objects that don't have a shape, and saves a dereference when accessing the compartment. This patch moves the canonical location of an object's compartment into its group, and also removes the unnecessary ObjectGroup::singleton_ field so that sizeof(ObjectGroup) does not increase. BaseShape::compartment_ is still there, because removing it doesn't improve memory usage on 32 bit platforms and because memory reporting stuff (about:memory and Ubi) seem to depend on knowing the compartment for a shape or base shape. r? jandem for TI changes, r? terrence for GC changes. With the latter I mainly just copied over the stuff from BaseShapes for marking compartments, which was kind of strange code --- the compartment and its global are marked from ScanShape, but not MarkChildren(BaseShape*), and I preserved this behavior for object groups.
Attachment #8570824 - Flags: review?(terrence)
Attachment #8570824 - Flags: review?(jdemooij)
Comment on attachment 8570824 [details] [diff] [review] patch Review of attachment 8570824 [details] [diff] [review]: ----------------------------------------------------------------- Nice, using these flags instead of ObjectGroup::singleton_ is pretty nice.
Attachment #8570824 - Flags: review?(jdemooij) → review+
Comment on attachment 8570824 [details] [diff] [review] patch Review of attachment 8570824 [details] [diff] [review]: ----------------------------------------------------------------- (In reply to Brian Hackett (:bhackett) from comment #0) > r? jandem for TI changes, r? terrence for GC changes. With the latter I > mainly just copied over the stuff from BaseShapes for marking compartments, > which was kind of strange code --- the compartment and its global are marked > from ScanShape, but not MarkChildren(BaseShape*), and I preserved this > behavior for object groups. Yeah, compartment liveness culling is extremely complex: I would assume this distinction is necessary, but I wouldn't want to hazard a guess as to why. ::: js/src/jsobj.h @@ +168,5 @@ > return group_->lazy(); > } > > JSCompartment *compartment() const { > + return group_->compartment(); I think this is going to break Minor and Compacting GC because we expect JSObject::compartment to continue working on relocated objects. You should be able to restore the existing functionality by swapping the field order in RelocationOverlay, since ObjectGroup is always Tenured; please refer to and update the comment at jsgc.h:1146.
Attachment #8570824 - Flags: review?(terrence) → review+
Assignee: nobody → bhackett1024
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: