Closed Bug 1750558 Opened 2 years ago Closed 2 years ago

Fix Object.assign shape-reuse fast path for HasEnumerable flag

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

In bug 1733075 we added the HasEnumerable object flag. This broke the fast path we have for assign where we can reuse the source object's shape.

We were checking the old and new shapes have the same object flags, but this was
(almost) never the case after we added the HasEnumerable flag in bug 1733075,
disabling the optimization in practice.

With this patch we hit the fast path again on Reddit.

In bug 1738020 we moved the shape teleporting code into NativeObject::addProperty,
which we call from TryAssignPlain, so this should just work now.

Exception is the shape-reuse fast path, but the previous patch ensures we no longer
use that if the object is a prototype object, so we can just add an assertion there.

Depends on D136145

Drive-by change to remove some code we no longer need after Stencil removed the
off-thread parse/XDR global.

Note that we still assert/check isUsedAsPrototype under getInitialOrPropMapShape.

Depends on D136146

Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eb404993ccfc
part 1 - Fix NativeObject::canReuseShapeForNewProperties to handle the HasEnumerable flag. r=iain
https://hg.mozilla.org/integration/autoland/rev/f35d23d93326
part 2 - Support prototype objects in assign fast path. r=iain
https://hg.mozilla.org/integration/autoland/rev/5d4d9fb762bc
part 3 - Remove unnecessary setIsUsedAsPrototype call. r=iain

The Bugbug bot thinks this bug is a defect, but please change it back in case of error.

Type: task → defect

Set release status flags based on info from the regressing bug 1733075

Has Regression Range: --- → yes
Regressions: 1754968
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: