Open Bug 1653920 Opened 4 years ago Updated 4 years ago

Add a CacheIR op that matches MToIntegerInt32

Categories

(Core :: JavaScript Engine: JIT, task, P2)

task

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 through MToIntegerInt32.

André, how do you feel about renaming CacheIR's GuardToInt32Index to GuardToNumberInt32? That matches MToNumberInt32 and we already transpile it to that...

Flags: needinfo?(andrebargull)

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.

Flags: needinfo?(andrebargull)

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...

The NeedNegativeZeroCheck call in MToNumberInt32::analyzeEdgeCasesBackward() should set canBeNegativeZero_ to false in most cases.

You need to log in before you can comment on or make changes to this bug.