Bug 1010747 - Don't inline Ceil when input is a FP value and output is an Int32. r=jandem, a=sledru
authorBenjamin Bouvier <benj@benj.me>
Wed, 21 May 2014 10:53:39 +0200
changeset 192368 d3f2e54cf39c
parent 192367 a89aa1e3e367
child 192369 f572a9d3afc8
child 192371 96491de02d3a
push id3585
push userryanvm@gmail.com
push date2014-05-22 13:39 +0000
Treeherderresults
reviewersjandem, sledru
bugs1010747
milestone30.0
Bug 1010747 - Don't inline Ceil when input is a FP value and output is an Int32. r=jandem, a=sledru
js/src/jit/MCallOptimize.cpp
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -635,31 +635,16 @@ IonBuilder::inlineMathCeil(CallInfo &cal
 
     // Math.ceil(int(x)) == int(x)
     if (argType == MIRType_Int32 && returnType == MIRType_Int32) {
         callInfo.setImplicitlyUsedUnchecked();
         current->push(callInfo.getArg(0));
         return InliningStatus_Inlined;
     }
 
-    if (IsFloatingPointType(argType) && returnType == MIRType_Int32) {
-        // Math.ceil(x) == -Math.floor(-x)
-        callInfo.setImplicitlyUsedUnchecked();
-        MConstant *minusOne = MConstant::New(alloc(), DoubleValue(-1.0));
-        current->add(minusOne);
-        MMul *mul = MMul::New(alloc(), callInfo.getArg(0), minusOne, argType);
-        current->add(mul);
-        MFloor *floor = MFloor::New(alloc(), mul);
-        current->add(floor);
-        MMul *result = MMul::New(alloc(), floor, minusOne, MIRType_Int32);
-        current->add(result);
-        current->push(result);
-        return InliningStatus_Inlined;
-    }
-
     if (IsFloatingPointType(argType) && returnType == MIRType_Double) {
         callInfo.setImplicitlyUsedUnchecked();
         MMathFunction *ins = MMathFunction::New(alloc(), callInfo.getArg(0), MMathFunction::Ceil, nullptr);
         current->add(ins);
         current->push(ins);
         return InliningStatus_Inlined;
     }