mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 966926: Force ToString not to have Float32 inputs; r=h4writer
--HG-- extra : rebase_source : beef551756493a697923db13607f41a3680c1eb6
This commit is contained in:
parent
ceeebb6a73
commit
b2f56a0473
12
js/src/jit-test/tests/ion/bug966926.js
Normal file
12
js/src/jit-test/tests/ion/bug966926.js
Normal file
@ -0,0 +1,12 @@
|
||||
var f32 = new Float32Array(32);
|
||||
function f(n) {
|
||||
var x;
|
||||
if (n > 10000) {
|
||||
x = (0);
|
||||
} else {
|
||||
x = f32[0];
|
||||
}
|
||||
g('' + (x));
|
||||
}
|
||||
function g(y){}
|
||||
f(0);
|
@ -15,6 +15,17 @@ using namespace js::jit;
|
||||
|
||||
using JS::DoubleNaNValue;
|
||||
|
||||
static void
|
||||
EnsureOperandNotFloat32(TempAllocator &alloc, MInstruction *def, unsigned op)
|
||||
{
|
||||
MDefinition *in = def->getOperand(op);
|
||||
if (in->type() == MIRType_Float32) {
|
||||
MToDouble *replace = MToDouble::New(alloc, in);
|
||||
def->block()->insertBefore(def, replace);
|
||||
def->replaceOperand(op, replace);
|
||||
}
|
||||
}
|
||||
|
||||
MDefinition *
|
||||
BoxInputsPolicy::boxAt(TempAllocator &alloc, MInstruction *at, MDefinition *operand)
|
||||
{
|
||||
@ -409,6 +420,9 @@ ConvertToStringPolicy<Op>::staticAdjustInputs(TempAllocator &alloc, MInstruction
|
||||
|
||||
replace = MUnbox::New(alloc, in, MIRType_String, MUnbox::Fallible);
|
||||
} else {
|
||||
// TODO remove these two lines once 966957 has landed
|
||||
EnsureOperandNotFloat32(alloc, ins, Op);
|
||||
in = ins->getOperand(Op);
|
||||
replace = MToString::New(alloc, in);
|
||||
}
|
||||
|
||||
@ -522,17 +536,6 @@ template bool Float32Policy<0>::staticAdjustInputs(TempAllocator &alloc, MInstru
|
||||
template bool Float32Policy<1>::staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
|
||||
template bool Float32Policy<2>::staticAdjustInputs(TempAllocator &alloc, MInstruction *def);
|
||||
|
||||
static void
|
||||
EnsureOperandNotFloat32(TempAllocator &alloc, MInstruction *def, unsigned op)
|
||||
{
|
||||
MDefinition *in = def->getOperand(op);
|
||||
if (in->type() == MIRType_Float32) {
|
||||
MToDouble *replace = MToDouble::New(alloc, in);
|
||||
def->block()->insertBefore(def, replace);
|
||||
def->replaceOperand(op, replace);
|
||||
}
|
||||
}
|
||||
|
||||
template <unsigned Op>
|
||||
bool
|
||||
NoFloatPolicy<Op>::staticAdjustInputs(TempAllocator &alloc, MInstruction *def)
|
||||
|
Loading…
Reference in New Issue
Block a user