mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 804064 - TableSwitchV, unbox integers values before branching. r=h4writer
This commit is contained in:
parent
755e644afe
commit
7a0380e724
@ -392,13 +392,18 @@ CodeGenerator::visitTableSwitchV(LTableSwitchV *ins)
|
||||
Register tag = masm.extractTag(value, index);
|
||||
masm.branchTestNumber(Assembler::NotEqual, tag, defaultcase);
|
||||
|
||||
Label isInt;
|
||||
masm.branchTestInt32(Assembler::Equal, tag, &isInt);
|
||||
Label unboxInt, isInt;
|
||||
masm.branchTestInt32(Assembler::Equal, tag, &unboxInt);
|
||||
{
|
||||
FloatRegister floatIndex = ToFloatRegister(ins->tempFloat());
|
||||
masm.unboxDouble(value, floatIndex);
|
||||
emitDoubleToInt32(floatIndex, index, defaultcase, false);
|
||||
masm.jmp(&isInt);
|
||||
}
|
||||
|
||||
masm.bind(&unboxInt);
|
||||
masm.unboxInt32(value, index);
|
||||
|
||||
masm.bind(&isInt);
|
||||
|
||||
return emitTableSwitchDispatch(mir, index, ToRegisterOrInvalid(ins->tempPointer()));
|
||||
|
18
js/src/jit-test/tests/ion/bug804064.js
Normal file
18
js/src/jit-test/tests/ion/bug804064.js
Normal file
@ -0,0 +1,18 @@
|
||||
function f (v, i) {
|
||||
var c = v[i];
|
||||
switch (c) {
|
||||
case 0:
|
||||
assertEq(v[i], 0);
|
||||
break;
|
||||
case 1:
|
||||
assertEq(v[i], 1);
|
||||
break;
|
||||
default:
|
||||
if (c == 0 || c == 1)
|
||||
assertEq(c, false);
|
||||
}
|
||||
}
|
||||
|
||||
var v = [0, 0.0, 0.1, 1, 1.0, 1.1, null, undefined];
|
||||
for (var i = 0; i < 100; i++)
|
||||
f(v, i % v.length);
|
Loading…
Reference in New Issue
Block a user