Closed Bug 1750962 Opened 2 years ago Closed 2 years ago

Add initial Watchtower code for shape teleporting

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

The code we have for invalidating the shape teleporting optimization can be generalized into the initial Watchtower code. We can then build similar optimizations on top of it.

This factors out the code we have for invalidating shape teleporting and puts it
behind the initial Watchtower interface.

This adds a testing mechanism to call a JS callback for changes to watched objects.
We can use this to write tests for Watchtower hooks.

Depends on D136358

The compiler doesn't fold multiple ObjectFlag checks into one branch, because
relaxed-atomics are involved, so we have to do this explicitly.

Depends on D136359

This is a case we didn't handle correctly before the changes in bug 1750558.

Depends on D136360

Teleporting is handled under NativeObject::addProperty since bug 1738020, so the
case we're asserting against would no longer be a problem for us here.

Depends on D136361

At one point we might have had a subtle correctness bug here with shape teleporting
that this patch would have fixed, but nowadays it seems hard to trigger due to the way
shapes, prototypes and teleporting interact.

If not optimizing AddSlot in this case is a problem, we could support it with a
VMFunction, similar to what we do for (DOM) objects with an addProperty hook, or
we could allow a subset of Watchtower-watched objects based on the specific object
flags. For now this will hopefully be okay.

Depends on D136362

Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2384997f1201
part 1 - Add Watchtower interface for shape teleporting code. r=iain
https://hg.mozilla.org/integration/autoland/rev/bd2388ff62d7
part 2 - Add a testing mechanism for Watchtower. r=iain
https://hg.mozilla.org/integration/autoland/rev/bc30acd8634e
part 3 - Optimize ObjectFlags tests. r=iain
https://hg.mozilla.org/integration/autoland/rev/e49eeb1318e8
part 4 - Add test for Object.assign edge case. r=iain
https://hg.mozilla.org/integration/autoland/rev/d0603ee735ba
part 5 - Remove unnecessary assertion. r=iain
https://hg.mozilla.org/integration/autoland/rev/6b946c5f5eb8
part 6 - Don't optimize AddSlot on monitored objects. r=iain
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: