mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1293542
- IonMonkey: Fix the logic of pow, r=sunfish
This commit is contained in:
parent
114e53ff4e
commit
e6d8c010cd
7
js/src/jit-test/tests/ion/bug1293542.js
Normal file
7
js/src/jit-test/tests/ion/bug1293542.js
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
function f(x) {
|
||||
return (x ** (1 / ~4294967297)) && x;
|
||||
};
|
||||
for (var i = 0; i < 2; ++i) {
|
||||
assertEq(f(-Infinity), 0);
|
||||
}
|
@ -878,8 +878,8 @@ CodeGeneratorX86Shared::visitPowHalfD(LPowHalfD* ins)
|
||||
masm.branchDouble(cond, input, scratch, &sqrt);
|
||||
|
||||
// Math.pow(-Infinity, 0.5) == Infinity.
|
||||
masm.zeroDouble(input);
|
||||
masm.subDouble(scratch, input);
|
||||
masm.zeroDouble(output);
|
||||
masm.subDouble(scratch, output);
|
||||
masm.jump(&done);
|
||||
|
||||
masm.bind(&sqrt);
|
||||
@ -888,11 +888,12 @@ CodeGeneratorX86Shared::visitPowHalfD(LPowHalfD* ins)
|
||||
if (!ins->mir()->operandIsNeverNegativeZero()) {
|
||||
// Math.pow(-0, 0.5) == 0 == Math.pow(0, 0.5). Adding 0 converts any -0 to 0.
|
||||
masm.zeroDouble(scratch);
|
||||
masm.addDouble(scratch, input);
|
||||
masm.addDouble(input, scratch);
|
||||
masm.vsqrtsd(scratch, output, output);
|
||||
} else {
|
||||
masm.vsqrtsd(input, output, output);
|
||||
}
|
||||
|
||||
masm.vsqrtsd(input, output, output);
|
||||
|
||||
masm.bind(&done);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user