Bug 1130618: Ensure float32 coercion of inputs to Float32 MConstant; r=luke

--HG--
extra : rebase_source : 9513ab5cecb9da7aade20a332504f6865eedf660
This commit is contained in:
Benjamin Bouvier 2015-02-12 16:15:59 +01:00
Родитель 56975be652
Коммит 8b314aadfe
3 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -147,9 +147,6 @@ class AsmJSNumLit
static AsmJSNumLit Create(Which w, Value v) {
AsmJSNumLit lit;
lit.which_ = w;
// Force float32 coercion, as the caller may have not done it.
if (w == Float)
v = Float32Value(v.toNumber());
lit.value.scalar_ = v;
MOZ_ASSERT(!lit.isSimd());
return lit;

Просмотреть файл

@ -1,5 +1,6 @@
load(libdir + "asm.js");
// Bug 1126251
var v = asmLink(asmCompile('global', `
"use asm";
var frd = global.Math.fround;
@ -34,3 +35,16 @@ var v = asmLink(asmCompile('global', `
`), this)();
assertEq(v, NaN);
// Bug 1130618
var v = asmLink(asmCompile('global', `
"use asm";
var float32x4 = global.SIMD.float32x4;
var splat = float32x4.splat;
function e() {
return +splat(.1e+71).x;
}
return e;
`), this)();
assertEq(v, Infinity);

Просмотреть файл

@ -629,6 +629,7 @@ MConstant *
MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, CompilerConstraintList *constraints)
{
MOZ_ASSERT(!IsSimdType(type));
MOZ_ASSERT_IF(type == MIRType_Float32, v.toDouble() == double(float(v.toDouble())));
MConstant *constant = new(alloc) MConstant(v, constraints);
constant->setResultType(type);
return constant;
@ -637,6 +638,8 @@ MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, Com
MConstant *
MConstant::NewAsmJS(TempAllocator &alloc, const Value &v, MIRType type)
{
if (type == MIRType_Float32)
return NewTypedValue(alloc, Float32Value(v.toNumber()), type);
return NewTypedValue(alloc, v, type);
}