Page MenuHomePhabricator

Bug 1717438 part 3 - Use the InvalidatedTeleporting flag also for shadowed properties. r?tcampbell!
ClosedPublic

Authored by jandem on Jun 21 2021, 2:49 PM.
Referenced Files
Unknown Object (File)
Mar 11 2025, 2:23 AM
Unknown Object (File)
Jan 20 2025, 4:30 AM
Unknown Object (File)
Jul 23 2024, 12:02 PM
Subscribers
None

Details

Summary

The flag is now used to guard against both cases teleporting has to watch out
for: proto changes and shadowed properties.

This lets us get rid of dictionary conversions and reshaping for ReshapeForShadowedProp.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Lint Not Applicable
Unit
Tests Not Applicable
Build Status
Buildable 336580
Build 430651: arc lint + arc unit

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
jandem edited the summary of this revision. (Show Details)

Rebase on central

This is a pretty nice cleanup.

Since you have the simple flag now, I wonder if it makes sense to expose as a testing function so that we can write a few tests to show this behaviour (and we don't even need JITs).

One impact of this change is that shadowing the ObjectPrototype will now cause future accesses to common properties to not use teleporting anymore. This was always the can for SetProto invalidations, but now is expanded to shadowing. In practice, I think the avoidance of dictionary mode here outweighs this, and the invalidation flag has much more gradual JIT impact.

A potential thing we could do if we are concerned about in-the-wild behaviour is to capture telemetry when tearing down the realm about if ObjectPrototype has set the flag.

This revision is now accepted and ready to land.Jun 23 2021, 9:30 PM

Testing function is a good idea, I posted D119063.

Regarding Object.prototype: it helps that we only check the flag on the holder object. I don't think Object.prototype has very hot properties except for toString and hasOwnProperty, so hopefully it would still be okay if we happen to invalidate teleporting for it.

This revision is now accepted and ready to land.Jul 15 2021, 3:09 PM
jandem added inline comments.
js/src/jit/CacheIR.cpp
698

@tcampbell: putting this back in your queue. This was backed out because of a silly bug I should have seen: if we reuse the flag for shadowing properties instead of reshaping the holder each time, this must now do a shape guard instead of a proto guard so that we properly detect shadowing properties after the first one. See test1 in the test case for the buggy scenario.

I think this should be okay: shape guards are faster than proto guards, and falling back to shape guards when teleporting doesn't work is more robust and more obviously correct.

tcampbell added inline comments.
js/src/jit/CacheIR.cpp
698

Ah, I missed this as well. This is much nicer code anyways, the previous code was quite tricky here so simplifing to just a shape-guard is welcome.

This revision is now accepted and ready to land.Jul 19 2021, 11:43 PM
jandem added a commit: Restricted Diffusion Commit.Jul 21 2021, 9:36 AM