Bug 1631133 - MToNumberInt32 does not directly map to CacheIR's GuardToInt32Index. r=iain

Differential Revision: https://phabricator.services.mozilla.com/D71419
This commit is contained in:
Tom Schuster 2020-04-18 17:28:42 +00:00
parent 976500d7ac
commit 31c7a3bec0
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,17 @@
// |jit-test| --no-threads
function f(index) {
var a = [123];
return a[index]
}
function g() {
for (var i = 0; i < 100; i++) {
// Make sure |null| is not treated like a |0| index.
assertEq(f(i > 90 ? null : 0), i > 90 ? undefined : 123)
}
}
for (var j = 0; j < 10; j++) {
g();
}

View File

@ -167,7 +167,8 @@ bool WarpCacheIRTranspiler::transpile_GuardToInt32Index() {
Int32OperandId outputId = reader.int32OperandId();
MDefinition* input = getOperand(inputId);
auto* ins = MToNumberInt32::New(alloc(), input);
auto* ins =
MToNumberInt32::New(alloc(), input, IntConversionInputKind::NumbersOnly);
current->add(ins);
return defineOperand(outputId, ins);