Closed
Bug 1519113
Opened 6 years ago
Closed 4 years ago
Avoid generating unnecessary Box -> Unbox sequences
Categories
(Core :: JavaScript Engine: JIT, enhancement, P2)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
DUPLICATE
of bug 1632757
Tracking | Status | |
---|---|---|
firefox66 | --- | fix-optional |
People
(Reporter: anba, Unassigned)
Details
(Keywords: perf)
We're sometimes generating unnecessary MBox directly followed by MUnbox sequences. This happens when a MUnbox definition has a MPhi as its input and the MPhi is later simplified in GVN, so only one of the MPhi's inputs is still present.
Excerpt after Alias Analysis:
79 newiterator constant78 Object
133 box newiterator79 Value
117 constant undefined Undefined
125 box constant117 Value
135 phi box125 box133 Value
144 unbox phi135 to Object (fallible) Object
Excerpt after GVN:
47 newiterator constant46 Object
69 box newiterator47 Value
72 unbox box69 to Object (fallible) Object
Handling this case in MUnbox::foldsTo
should help us to avoid the extra box
-> unbox
sequence.
Test case:
function f() {
Array.from(new Int32Array(10));
var r = 0;
for (var i = 0; i < 100000; ++i) {
for (var x of [1,2,3,4,5]) {
r += x;
}
}
return r;
}
for (var i = 0; i < 4; ++i) print(f());
Comment 1•6 years ago
|
||
I guess we could add a GVN pass to fold "MUnbox (MPhi x y z)" to "MPhi (MUnbox x) (MUnbox y) (MUnbox z)".
And we should do that if at least one of the input of MPhi is a MBox.
Reporter | ||
Comment 2•5 years ago
|
||
bug 1632757 will probably fix this issue (https://phabricator.services.mozilla.com/D72335).
Reporter | ||
Updated•4 years ago
|
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•