Closed Bug 1137497 Opened 9 years ago Closed 9 years ago

Remove shape_ from unboxed objects

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 described in bug 1137180, the shape_ field of unboxed objects can be repurposed to store information about extra properties that have been added to the object.  The attached patch removes JSObject::shape_, and adds it to the various direct subclasses of JSObject besides UnboxedPlainObject.  UnboxedPlainObject has a dummy field in its place, which will be filled in by bug 1137180.

In the future, other non-native objects could potentially also lose their shape_ field, though doing this depends on removing the generic uses of object shapes in place (after this patch, those places that call maybeShape() or ensureShape()).
Attachment #8570181 - Flags: review?(jdemooij)
Comment on attachment 8570181 [details] [diff] [review]
patch

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

Looks good.

::: js/src/gc/Nursery.cpp
@@ +673,5 @@
>          tenuredSize += moveElementsToTenured(ndst, nsrc, dstKind);
> +
> +        /* The shape's list head may point into the old object. */
> +        if (&nsrc->shape_ == ndst->shape_->listp)
> +            ndst->shape_->listp = &ndst->shape_;

Shouldn't we also do this for InlineTypedObjects? If not, add a comment explaining why.

::: js/src/jsfriendapi.h
@@ +558,5 @@
>  };
>  
> +// This layout is shared by all native objects. For non-native objects, the
> +// group may always be accessed safely, and other members may be as well,
> +// depending on the object's specific layout.

GetObjectParent and GetObjectCompartment access obj->shape->base. Can we make shape() an accessor function that asserts group->class is not an unboxed object class? Then we can give GetObjectCompartment an unlined path just for unboxed objects.

::: js/src/vm/NativeObject.h
@@ +380,5 @@
>                        "inconsistent maximum object size");
>      }
>  
>    public:
> +    Shape * lastProperty() const {

Nit: Shape *lastProperty
Attachment #8570181 - Flags: review?(jdemooij) → review+
Depends on: 1137978
https://hg.mozilla.org/mozilla-central/rev/afda1ff329bf
Assignee: nobody → bhackett1024
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Flags: needinfo?(bhackett1024)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: