Bug 930477: Follow-up - Don't allow the power type to be Float32 for MPow; r=h4writer

--HG--
extra : rebase_source : 361b5edcdf6e464168ff2bcd82aee00843410dd2
This commit is contained in:
Benjamin Bouvier 2014-02-21 11:37:27 +01:00
parent e66743c1f7
commit d9cb2d618a
3 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,6 @@
for (var j = 0; j < 9999; ++j) {
(function() {
Math.pow(Math.fround(), Math.fround(0))
})();
}

View File

@ -842,6 +842,8 @@ IonBuilder::inlineMathPow(CallInfo &callInfo)
// Use MPow for other powers // Use MPow for other powers
if (!output) { if (!output) {
if (powerType == MIRType_Float32)
powerType = MIRType_Double;
MPow *pow = MPow::New(alloc(), base, power, powerType); MPow *pow = MPow::New(alloc(), base, power, powerType);
current->add(pow); current->add(pow);
output = pow; output = pow;

View File

@ -3752,6 +3752,7 @@ class MPow
static MPow *New(TempAllocator &alloc, MDefinition *input, MDefinition *power, static MPow *New(TempAllocator &alloc, MDefinition *input, MDefinition *power,
MIRType powerType) MIRType powerType)
{ {
JS_ASSERT(powerType == MIRType_Double || powerType == MIRType_Int32);
return new(alloc) MPow(input, power, powerType); return new(alloc) MPow(input, power, powerType);
} }