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 193393 d3f2e54cf39cb0a734ff068633b2b2c4f24efacb
parent 193392 a89aa1e3e367fb7c62a3ae7b2e2cb8b28406d9d5
child 193394 f572a9d3afc86345c40697e99145f3bead27b41b
child 193396 96491de02d3aaf35b883950b584932048d051ec4
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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;
     }