Bug 845016 - Inline Math.abs with double input and int output (r=sstangl)

This commit is contained in:
Shu-yu Guo 2013-02-26 14:51:43 -08:00
parent 93d435a7d3
commit f3235f6758

View File

@ -466,15 +466,23 @@ IonBuilder::inlineMathAbs(CallInfo &callInfo)
MIRType argType = getInlineArgType(callInfo, 0);
if (argType != MIRType_Int32 && argType != MIRType_Double)
return InliningStatus_NotInlined;
if (argType != returnType)
if (argType != returnType && returnType != MIRType_Int32)
return InliningStatus_NotInlined;
callInfo.unwrapArgs();
MAbs *ins = MAbs::New(callInfo.getArg(0), returnType);
MInstruction *ins = MAbs::New(callInfo.getArg(0), argType);
current->add(ins);
current->push(ins);
if (argType != returnType) {
MToInt32 *toInt = MToInt32::New(ins);
toInt->setCanBeNegativeZero(false);
current->add(toInt);
ins = toInt;
}
current->push(ins);
return InliningStatus_Inlined;
}