Bug 924538 - Float32 support for Uint8ClampedArray. r=luke

This commit is contained in:
Sean Stangl 2013-10-08 13:17:49 -07:00
parent 20bf92d55e
commit 6da5815a24
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// Don't die a float32-related death.
function testFloat32SetElemIC(a) {
for (var i = 0; i < a.length; i++) {
var r = Math.fround(Math.random());
a[i] = r;
}
}
testFloat32SetElemIC(new Array(2048));
testFloat32SetElemIC(new Uint8ClampedArray(2048));

View File

@ -1854,6 +1854,11 @@ MacroAssembler::convertTypedOrValueToInt(TypedOrValueRegister src, FloatRegister
case MIRType_Double: case MIRType_Double:
convertDoubleToInt(src.typedReg().fpu(), output, temp, nullptr, fail, behavior); convertDoubleToInt(src.typedReg().fpu(), output, temp, nullptr, fail, behavior);
break; break;
case MIRType_Float32:
// Conversion to Double simplifies implementation at the expense of performance.
convertFloatToDouble(src.typedReg().fpu(), temp);
convertDoubleToInt(temp, output, temp, nullptr, fail, behavior);
break;
case MIRType_String: case MIRType_String:
case MIRType_Object: case MIRType_Object:
jump(fail); jump(fail);