Add a CacheIR op that matches MToIntegerInt32
Categories
(Core :: JavaScript Engine: JIT, task, P2)
Tracking
()
People
(Reporter: jandem, Unassigned)
References
(Blocks 1 open bug)
Details
Suggested by anba:
Can you file a follow-up bug to add a separate CacheIR op which is a better match for
MToIntegerInt32::New
?
GuardToInt32Index
rejects numbers with fractional parts, which means codegen needs to perform double->int32->double to check for fractionals. This can be avoided throughMToIntegerInt32
.
Reporter | ||
Comment 1•5 years ago
|
||
André, how do you feel about renaming CacheIR's GuardToInt32Index
to GuardToNumberInt32
? That matches MToNumberInt32
and we already transpile it to that...
Comment 2•5 years ago
|
||
MToNumberInt32
doesn't support -0
by default, only when the canBeNegativeZero_
flag is set. But for GuardToInt32Index
we always want to treat -0
equal to +0
(to account for the cases when users inadvertently use -0
, which sadly happens in practice), because this CacheIR op is only used for property key operations.
Reporter | ||
Comment 3•5 years ago
|
||
That's a good point. It means we have to fix WarpCacheIRTranspiler::emitGuardToInt32Index
too, because MToNumberInt32::canBeNegativeZero_
is initialized to true and that means we perform the negative zero check. Maybe it makes sense to have allowNegativeZero
as an explicit argument to these CacheIR and MIR instructions so when they're used you have to make a conscious decision...
Comment 4•5 years ago
|
||
The NeedNegativeZeroCheck
call in MToNumberInt32::analyzeEdgeCasesBackward()
should set canBeNegativeZero_
to false in most cases.
Description
•