Don't guard on prototype object identity for instanceof
Categories
(Core :: JavaScript Engine: JIT, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox101 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
The CacheIR we generate to optimize instanceof currently guards on a specific .prototype object. I think IonBuilder (BaselineInspector) relied on this, but it's no longer necessary.
We can now generate CacheIR that guards the .prototype value is an object, and then pass that object to LoadInstanceOfObjectResult. This way we can deal better with certain forms of polymorphism.
This gets rid of most fallback hits for Ion ICs for instanceof on matrix-react-bench.
| Assignee | ||
Comment 1•4 years ago
|
||
We used to rely on knowing the specific .prototype object in BaselineInspector,
but now that we no longer do that there's no value in guarding on a specific object
here. By supporting any object we can handle polymorphism better.
| Assignee | ||
Comment 2•4 years ago
|
||
We can simplify the code a bit now that RHS is usually a register instead of a
constant.
A constant object can still show up for inlined isPrototypeOf, because that uses
the same CacheIR/MIR instruction, but this is uncommon (shows up on one jit-test
with --ion).
Depends on D143022
Comment 4•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/3e0edc5c329a
https://hg.mozilla.org/mozilla-central/rev/9341ba02a8dc
Description
•