Open
Bug 1116807
Opened 10 years ago
Updated 2 years ago
IonMonkey: Form unsigned comparisons with array.length
Categories
(Core :: JavaScript Engine: JIT, enhancement, P5)
Core
JavaScript Engine: JIT
Tracking
()
NEW
People
(Reporter: sunfish, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: perf, Whiteboard: [lang=c++])
This code, run with --ion-eager, could be optimized with an unsigned comparison:
function foo(a, i) {
if ((i>>>0) < a.length)
return a[i];
else
return 3;
}
x=[34,54,56,65];
print(foo(x, 2));
print(foo(x, 1));
print(foo(x, 0));
print(foo(x, 4));
It's probably just a matter of teaching MustBeUInt32 that MArrayLength and MTypedArrayLength are unsigned.
Reporter | ||
Comment 1•10 years ago
|
||
For details about why MArrayLength and friends can be considered unsigned, see the comment in MArrayLength::computeRange. There are several other *Length operators there which could benefit from unsigned comparisons too.
Whiteboard: [lang=c++]
Updated•8 years ago
|
Blocks: sm-js-perf
Priority: -- → P5
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•