Bug 642957 - Remove obsolete x|0 and x << 0 optimization. r=jandem
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Mon, 24 Oct 2011 19:11:15 +0200
changeset 79144 a955bd83e9dfd8de73b846d58feba6f3397c8365
parent 79143 1595eb996964849255d4a18b1756bb6cfd661c54
child 79145 e6f9db38f49292a6f7554a6befd9177faea6c01e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjandem
bugs642957
milestone10.0a1
Bug 642957 - Remove obsolete x|0 and x << 0 optimization. r=jandem
js/src/methodjit/FastOps.cpp
--- a/js/src/methodjit/FastOps.cpp
+++ b/js/src/methodjit/FastOps.cpp
@@ -182,36 +182,16 @@ mjit::Compiler::jsop_bitop(JSOp op)
       case JSOP_URSH:
         stub = stubs::Ursh;
         break;
       default:
         JS_NOT_REACHED("wat");
         return;
     }
 
-    bool lhsIntOrDouble = !(lhs->isNotType(JSVAL_TYPE_DOUBLE) && 
-                            lhs->isNotType(JSVAL_TYPE_INT32));
-
-    /* Fast-path double to int conversion. */
-    if (!lhs->isConstant() && rhs->isConstant() && lhsIntOrDouble &&
-        rhs->isType(JSVAL_TYPE_INT32) && rhs->getValue().toInt32() == 0 &&
-        (op == JSOP_BITOR || op == JSOP_LSH)) {
-        ensureInteger(lhs, Uses(2));
-        RegisterID reg = frame.ownRegForData(lhs);
-
-        stubcc.leave();
-        OOL_STUBCALL(stub, REJOIN_FALLTHROUGH);
-
-        frame.popn(2);
-        frame.pushTypedPayload(JSVAL_TYPE_INT32, reg);
-
-        stubcc.rejoin(Changes(1));
-        return;
-    }
-
     /* Convert a double RHS to integer if it's constant for the test below. */
     if (rhs->isConstant() && rhs->getValue().isDouble())
         rhs->convertConstantDoubleToInt32(cx);
 
     /* We only want to handle integers here. */
     if ((lhs->isNotType(JSVAL_TYPE_INT32) && lhs->isNotType(JSVAL_TYPE_DOUBLE)) ||
         (rhs->isNotType(JSVAL_TYPE_INT32) && rhs->isNotType(JSVAL_TYPE_DOUBLE)) ||
         (op == JSOP_URSH && rhs->isConstant() && rhs->getValue().toInt32() % 32 == 0)) {
@@ -277,17 +257,17 @@ mjit::Compiler::jsop_bitop(JSOp op)
 
         reg = frame.ownRegForData(lhs);
         if (rhs->isConstant()) {
             int32 rhsInt = rhs->getValue().toInt32();
             if (op == JSOP_BITAND)
                 masm.and32(Imm32(rhsInt), reg);
             else if (op == JSOP_BITXOR)
                 masm.xor32(Imm32(rhsInt), reg);
-            else
+            else if (rhsInt != 0)
                 masm.or32(Imm32(rhsInt), reg);
         } else if (frame.shouldAvoidDataRemat(rhs)) {
             Address rhsAddr = masm.payloadOf(frame.addressOf(rhs));
             if (op == JSOP_BITAND)
                 masm.and32(rhsAddr, reg);
             else if (op == JSOP_BITXOR)
                 masm.xor32(rhsAddr, reg);
             else