Optimize polymorphic Object.is
Categories
(Core :: JavaScript Engine: JIT, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox90 | --- | fixed |
People
(Reporter: iain, Assigned: iain)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(4 files)
Our CacheIR for Object.is
is currently focused on the case where the types are consistent, similar to any other comparison operator. Relative to most comparisons, however, Object.is
is particularly likely to be used in polymorphic code. In particular, React uses Object.is
when checking to see if the value of a property has changed (example).
Right now, polymorphic Object.is
will end up as a VM call to SameValue
. We can speed this up in a number of ways. The easiest is to do a quick bitwise comparison of the two values: because Object.is(NaN,NaN)
is true, bitwise-identical values will always return true, so we can skip the VM call.
Performance on microbenchmarks looks pretty good: a 1.67x speedup when the fast path almost always fails (I think because using a dedicated MIR op with AliasSet::None
lets us optimize better) and an 8x speedup when the fast path always succeeds.
(Not sure if this moves the needle in real-world code yet.)
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
Rename this to make room for the next patch to use that name when transpiling SameValueResult.
Depends on D114257
Assignee | ||
Comment 3•2 years ago
|
||
Depends on D114258
Pushed by iireland@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/205a40a5ac83 Optimize polymorphic Object.is in CacheIR r=jandem https://hg.mozilla.org/integration/autoland/rev/22fd0e895880 Rename SameValue MIR op r=jandem https://hg.mozilla.org/integration/autoland/rev/ca806eb90637 Transpile SameValueResult r=jandem
Comment 5•2 years ago
|
||
Backed out for causing multiple CacheIRCompiler failures.
Assignee | ||
Comment 6•2 years ago
|
||
useFixedValueRegister
was unused (since bug 1673553 part 94, I think), so I cannibalized it for spare parts.
Assignee | ||
Updated•2 years ago
|
Pushed by iireland@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d10063d1349d Optimize polymorphic Object.is in CacheIR r=jandem https://hg.mozilla.org/integration/autoland/rev/31d61c8494d0 Rename SameValue MIR op r=jandem https://hg.mozilla.org/integration/autoland/rev/e7c46af18072 Transpile SameValueResult r=jandem https://hg.mozilla.org/integration/autoland/rev/3ed6ba663393 Add copyToScratchValueRegister to fix x86 r=jandem
Comment 8•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d10063d1349d
https://hg.mozilla.org/mozilla-central/rev/31d61c8494d0
https://hg.mozilla.org/mozilla-central/rev/e7c46af18072
https://hg.mozilla.org/mozilla-central/rev/3ed6ba663393
Updated•3 months ago
|
Updated•3 months ago
|
Description
•