Closed
Bug 1940907
Opened 2 months ago
Closed 2 months ago
Add folding for MSameValue and MSameValueDouble
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
136 Branch
Tracking | Status | |
---|---|---|
firefox136 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(8 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
- MSameValue can fold to
MCompare::Compare_Null
when one operand is guaranteed to benull
. - MSameValue can fold to
MCompare::Compare_Undefined
when one operand is guaranteed to beundefined
. - MSameValueDouble can fold to
MCompare::Compare_Double
when one operand is either NaN or non-zero. - MSameValueDouble can fold to bitwise comparison when one operand is +/-0.
Assignee | ||
Comment 1•2 months ago
|
||
Assignee | ||
Comment 2•2 months ago
|
||
Without constant folding, if (Object.is(x, NaN)) { ... }
compiled to:
[Codegen] # LIR=SameValueDouble
[Codegen] vucomisd %xmm0, %xmm1
[Codegen] jne .Lfrom912
[Codegen] jp .Lfrom918
[Codegen] xorpd %xmm2, %xmm2
[Codegen] vucomisd %xmm2, %xmm1
[Codegen] jne .Lfrom932
[Codegen] movsd .Lfrom940(%rip), %xmm2
[Codegen] divsd %xmm1, %xmm2
[Codegen] vucomisd %xmm2, %xmm1
[Codegen] ja .Lfrom954
[Codegen] movsd .Lfrom962(%rip), %xmm2
[Codegen] divsd %xmm0, %xmm2
[Codegen] vucomisd %xmm0, %xmm2
[Codegen] ja .Lfrom976
[Codegen] jmp .Lfrom981
[Codegen] .set .Lfrom954
[Codegen] movsd .Lfrom989(%rip), %xmm2
[Codegen] divsd %xmm0, %xmm2
[Codegen] vucomisd %xmm2, %xmm0
[Codegen] ja .Lfrom1003
[Codegen] jmp .Lfrom1008
[Codegen] .set .Lfrom918
[Codegen] .set .Lfrom912
[Codegen] vucomisd %xmm1, %xmm1
[Codegen] jnp .Lfrom1018
[Codegen] vucomisd %xmm0, %xmm0
[Codegen] jnp .Lfrom1028
[Codegen] .set .Lfrom1003
[Codegen] .set .Lfrom976
[Codegen] .set .Lfrom932
[Codegen] movl $0x1, %ecx
[Codegen] jmp .Lfrom1038
[Codegen] .set .Lfrom1028
[Codegen] .set .Lfrom1018
[Codegen] .set .Lfrom1008
[Codegen] .set .Lfrom981
[Codegen] xorl %ecx, %ecx
[Codegen] .set .Lfrom1038
[Codegen] # LIR=TestIAndBranch
[Codegen] testl %ecx, %ecx
[Codegen] je .Lfrom1048
With this change it compiles to:
[Codegen] # LIR=CompareDAndBranch
[Codegen] vucomisd %xmm0, %xmm0
[Codegen] jp .Lfrom904
[Codegen] je .Lfrom910
Assignee | ||
Comment 3•2 months ago
|
||
Improves the codegen for if (Object.is(x, Nan)) { ... }
from:
[Codegen] # LIR=CompareDAndBranch
[Codegen] vucomisd %xmm0, %xmm0
[Codegen] jp .Lfrom904
[Codegen] je .Lfrom910
to:
[Codegen] # LIR=CompareDAndBranch
[Codegen] vucomisd %xmm0, %xmm0
[Codegen] jnp .Lfrom904
Assignee | ||
Comment 4•2 months ago
|
||
Assignee | ||
Comment 5•2 months ago
|
||
Assignee | ||
Comment 6•2 months ago
|
||
Assignee | ||
Comment 7•2 months ago
|
||
Assignee | ||
Comment 8•2 months ago
|
||
Updated•2 months ago
|
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/3e64f1ea29ac
Part 1: Fold MSameValue with constant null or undefined operand. r=iain
https://hg.mozilla.org/integration/autoland/rev/e27dac96bd3a
Part 2: Add MSameValueDouble::foldsTo. r=iain
https://hg.mozilla.org/integration/autoland/rev/e55dc1a635bd
Part 3: Improve codegen for x86 NaN comparison. r=iain
https://hg.mozilla.org/integration/autoland/rev/5f08c471a5bd
Part 4: Rename WasmReinterpret to ReinterpretCast. r=iain
https://hg.mozilla.org/integration/autoland/rev/f6c20a39db0d
Part 5: Generator LIR code for ReinterpretCast. r=iain
https://hg.mozilla.org/integration/autoland/rev/38008a7f2e6d
Part 6: Move codegen for ReinterpretCast to common CodeGenerator. r=iain
https://hg.mozilla.org/integration/autoland/rev/ab0048feec2f
Part 7: Move codegen for ReinterpretCastFromI64 to common CodeGenerator. r=iain
https://hg.mozilla.org/integration/autoland/rev/435530a07115
Part 8: Move codegen for ReinterpretCastToI64 to common CodeGenerator. r=iain
Comment 10•2 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3e64f1ea29ac
https://hg.mozilla.org/mozilla-central/rev/e27dac96bd3a
https://hg.mozilla.org/mozilla-central/rev/e55dc1a635bd
https://hg.mozilla.org/mozilla-central/rev/5f08c471a5bd
https://hg.mozilla.org/mozilla-central/rev/f6c20a39db0d
https://hg.mozilla.org/mozilla-central/rev/38008a7f2e6d
https://hg.mozilla.org/mozilla-central/rev/ab0048feec2f
https://hg.mozilla.org/mozilla-central/rev/435530a07115
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
status-firefox136:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•