Closed
Bug 2044243
Opened 5 months ago
Closed 5 months ago
Use sign-extended tags for value tests
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
153 Branch
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
Use sign-extended tags for value tests like we already do for ARM64.
function f(x) {
return typeof x == "string";
}
Is compiled to:
srli t4, t0, 47
lui t5, 0x20
addiw t5, t5, -10
xor t0, t4, t5
seqz t0, t0
This can be improved to:
srai t0, t0, 47
xori t0, t0, 0xfffffff6
seqz t0, t0
And LIR=Unbox:Int32 can be improved from:
srli t4, t0, 47
lui t5, 0x20
addiw t5, t5, -15
beq t4, t5, 0
...
to:
srai t4, t0, 47
li t5, -15
beq t4, t5, 0
...
| Assignee | ||
Comment 1•5 months ago
|
||
This is similar to ARM64 and requires fewer instructions to test value types.
For example:
function f(x) {
return typeof x == "string";
}
Was compiled to:
srli t4, t0, 47
lui t5, 0x20
addiw t5, t5, -10
xor t0, t4, t5
seqz t0, t0
And is now just:
srai t0, t0, 47
xori t0, t0, 0xfffffff6
seqz t0, t0
Or:
function f(x) {
return typeof x == "string";
}
Was compiled to:
srli t4, t0, 47
lui t5, 0x20
addiw t5, t5, -15
sltu t0, t5, t4
xori t0, t0, 0x1
And is now compiled to just two instructions (with the changes from bug 2044242):
srai t0, t0, 47
sltiu t0, t0, -14
Fallible unbox to Int32 used:
srli t4, t0, 47
lui t5, 0x20
addiw t5, t5, -15
beq t4, t5, 0
...
And now requires one less instruction:
srai t4, t0, 47
li t5, -15
beq t4, t5, 0
...
Updated•5 months ago
|
Severity: -- → N/A
Priority: -- → P1
Pushed by andre.bargull@gmail.com:
https://github.com/mozilla-firefox/firefox/commit/7708d0da72ad
https://hg.mozilla.org/integration/autoland/rev/1f2c5b30e657
Use sign-extended tags for value tests. r=jandem
Comment 3•5 months ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
status-firefox153:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
Updated•4 months ago
|
QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in
before you can comment on or make changes to this bug.
Description
•