Closed Bug 1696861 Opened 4 years ago Closed 4 years ago

Clean up shape teleporting a bit more

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(6 files)

No description provided.

This goes back to when shape teleporting was used for environment chains too.
See also bug 1608034 where we made this change for (other) environment objects.

The global has a lot of properties and this avoids doing unnecessary work to
invalidate teleporting.

Add Object.prototype to the test-JSObject GDB test so that we still have a test for
the delegate flag.

This goes back to bug 787856 but dynamic prototypes don't need to be marked as
delegate, because shape teleporting and JITs don't optimize those prototype chains.

Other proxy handlers such as ScriptedProxyHandler, ForwardingProxyHandler, Xrays
don't do this so this is also more consistent.

Depends on D107416

Eagerly marking prototypes as delegate resulted in a lot of unnecessary shadowing
checks and reshaping when initializing the properties of those objects. This is
a regression from bug 724768.

It's more efficient, simpler, and consistent with JS-defined objects to mark
objects as delegate when they become the prototype of another object.

This removes the check for delegates in EmptyShape::ensureInitialCustomShape. That
should be fine because the only object it applies to is String.prototype and it
doesn't affect correctness. (RegExp and Error prototypes are plain objects since
bug 1213341 and bug 1192038 so don't show up there anyway.)

Depends on D107417

We already peeled off the receiver for non-delegates (= most objects) but we can
do this for delegates too.

Depends on D107418

This was used to ensure no cross-compartment objects were embedded by
ShapeGuardProtoChain (used for the property-not-found case) but that's no longer
an issue because ShapeGuardProtoChain only does shape guards now.

Depends on D107419

Attachment #9207385 - Attachment description: Bug 1696861 part 6 - Rename Delegate flag to IsPrototype. r?tcampbell! → Bug 1696861 part 6 - Rename Delegate flag to IsUsedAsPrototype. r?tcampbell!
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e7d5c30051f1 part 1 - Stop marking the global object as delegate. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/18b53abc9c5c part 2 - Stop marking CCW's dynamic prototype as delegate. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/5081e5168c62 part 3 - Stop eagerly marking prototypes as delegate. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/5966b61fe981 part 4 - Simplify some code in GeneratePrototypeGuards. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/e09bd565aefc part 5 - Remove UncacheableProtoOnChain. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/a35d192bfe25 part 6 - Rename Delegate flag to IsUsedAsPrototype. r=tcampbell
Regressions: 1697434
Regressions: 1697435
No longer regressions: 1697435
No longer regressions: 1697434
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: