Bug 804636 part 4 - Remove TypeOracle::incslot and inc/dec handling in TypeDynamicResult. r=dvander
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 29 Oct 2012 11:26:09 +0100
changeset 111796 a3dcaf02c5e5eb047d0ea6b75b3c619987c6c955
parent 111795 7035e54f92fc029ecaf168cb480e416e1a488e1e
child 111797 a18076dda6c8c89ba9772bbad05a5c1fa1ea0e6b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersdvander
bugs804636
milestone19.0a1
Bug 804636 part 4 - Remove TypeOracle::incslot and inc/dec handling in TypeDynamicResult. r=dvander
js/src/ion/TypeOracle.cpp
js/src/ion/TypeOracle.h
js/src/jsinfer.cpp
--- a/js/src/ion/TypeOracle.cpp
+++ b/js/src/ion/TypeOracle.cpp
@@ -77,52 +77,28 @@ TypeInferenceOracle::unaryTypes(JSScript
 TypeOracle::BinaryTypes
 TypeInferenceOracle::binaryTypes(JSScript *script, jsbytecode *pc)
 {
     JS_ASSERT(script == this->script_);
 
     JSOp op = (JSOp)*pc;
 
     BinaryTypes res;
-    if ((js_CodeSpec[op].format & JOF_INCDEC) || op == JSOP_NEG || op == JSOP_POS) {
+    if (op == JSOP_NEG || op == JSOP_POS) {
         res.lhsTypes = script->analysis()->poppedTypes(pc, 0);
         res.rhsTypes = NULL;
         res.outTypes = script->analysis()->pushedTypes(pc, 0);
     } else {
         res.lhsTypes = script->analysis()->poppedTypes(pc, 1);
         res.rhsTypes = script->analysis()->poppedTypes(pc, 0);
         res.outTypes = script->analysis()->pushedTypes(pc, 0);
     }
     return res;
 }
 
-TypeOracle::BinaryTypes
-TypeInferenceOracle::incslot(JSScript *script, jsbytecode *pc)
-{
-    JSOp op = JSOp(*pc);
-    unsigned index = GET_SLOTNO(pc);
- 
-    StackTypeSet *types = NULL;
-    if (js_CodeSpec[op].type() == JOF_LOCAL) {
-        if (script->analysis()->trackSlot(LocalSlot(script, index)))
-            return binaryTypes(script, pc);
-        types = TypeScript::LocalTypes(script, index);
-    } else {
-        if (script->analysis()->trackSlot(ArgSlot(index)))
-            return binaryTypes(script, pc);
-        types = TypeScript::ArgTypes(script, index);
-    }
-
-    BinaryTypes b;
-    b.lhsTypes = types;
-    b.rhsTypes = NULL;
-    b.outTypes = script->analysis()->pushedTypes(pc, 0);
-    return b;
-}
-
 TypeOracle::Unary
 TypeInferenceOracle::unaryOp(JSScript *script, jsbytecode *pc)
 {
     JS_ASSERT(script == this->script_);
 
     Unary res;
     res.ival = getMIRType(script->analysis()->poppedTypes(pc, 0));
     res.rval = getMIRType(script->analysis()->pushedTypes(pc, 0));
@@ -132,17 +108,17 @@ TypeInferenceOracle::unaryOp(JSScript *s
 TypeOracle::Binary
 TypeInferenceOracle::binaryOp(JSScript *script, jsbytecode *pc)
 {
     JS_ASSERT(script == this->script_);
 
     JSOp op = (JSOp)*pc;
 
     Binary res;
-    if ((js_CodeSpec[op].format & JOF_INCDEC) || op == JSOP_NEG || op == JSOP_POS) {
+    if (op == JSOP_NEG || op == JSOP_POS) {
         res.lhs = getMIRType(script->analysis()->poppedTypes(pc, 0));
         res.rhs = MIRType_Int32;
         res.rval = getMIRType(script->analysis()->pushedTypes(pc, 0));
     } else {
         res.lhs = getMIRType(script->analysis()->poppedTypes(pc, 1));
         res.rhs = getMIRType(script->analysis()->poppedTypes(pc, 0));
         res.rval = getMIRType(script->analysis()->pushedTypes(pc, 0));
     }
--- a/js/src/ion/TypeOracle.h
+++ b/js/src/ion/TypeOracle.h
@@ -169,19 +169,16 @@ class TypeOracle
         return MaybeArguments;
     }
     virtual LazyArgumentsType elementReadMagicArguments(JSScript *script, jsbytecode *pc) {
         return MaybeArguments;
     }
     virtual LazyArgumentsType elementWriteMagicArguments(JSScript *script, jsbytecode *pc) {
         return MaybeArguments;
     }
-    virtual BinaryTypes incslot(JSScript *script, jsbytecode *pc) {
-        return binaryTypes(script, pc);
-    }
     virtual types::StackTypeSet *aliasedVarBarrier(JSScript *script, jsbytecode *pc, types::StackTypeSet **barrier) {
         return NULL;
     }
 };
 
 class DummyOracle : public TypeOracle
 {
   public:
@@ -261,18 +258,16 @@ class TypeInferenceOracle : public TypeO
     bool canInlineCall(JSScript *caller, jsbytecode *pc);
     bool canEnterInlinedFunction(JSFunction *callee);
     types::StackTypeSet *aliasedVarBarrier(JSScript *script, jsbytecode *pc, types::StackTypeSet **barrier);
 
     LazyArgumentsType isArgumentObject(types::StackTypeSet *obj);
     LazyArgumentsType propertyReadMagicArguments(JSScript *script, jsbytecode *pc);
     LazyArgumentsType elementReadMagicArguments(JSScript *script, jsbytecode *pc);
     LazyArgumentsType elementWriteMagicArguments(JSScript *script, jsbytecode *pc);
-
-    BinaryTypes incslot(JSScript *script, jsbytecode *pc);
 };
 
 static inline MIRType
 MIRTypeFromValueType(JSValueType type)
 {
     switch (type) {
       case JSVAL_TYPE_DOUBLE:
         return MIRType_Double;
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -5214,52 +5214,16 @@ TypeDynamicResult(JSContext *cx, HandleS
         if (!types->hasType(type)) {
             InferSpew(ISpewOps, "externalType: monitorResult #%u:%05u: %s",
                       script->id(), pc - script->code, TypeString(type));
             types->addType(cx, type);
         }
         return;
     }
 
-    /*
-     * For inc/dec ops, we need to go back and reanalyze the affected opcode
-     * taking the overflow into account. We won't see an explicit adjustment
-     * of the type of the thing being inc/dec'ed, nor will adding TYPE_DOUBLE to
-     * the pushed value affect that type.
-     */
-    JSOp op = JSOp(*pc);
-    const JSCodeSpec *cs = &js_CodeSpec[op];
-    if (cs->format & (JOF_INC | JOF_DEC)) {
-        switch (op) {
-          case JSOP_INCLOCAL:
-          case JSOP_DECLOCAL:
-          case JSOP_LOCALINC:
-          case JSOP_LOCALDEC:
-          case JSOP_INCARG:
-          case JSOP_DECARG:
-          case JSOP_ARGINC:
-          case JSOP_ARGDEC: {
-            /*
-             * Just mark the slot's type as holding the new type. This captures
-             * the effect if the slot is not being tracked, and if the slot
-             * doesn't escape we will update the pushed types below to capture
-             * the slot's value after this write.
-             */
-            uint32_t slot = GetBytecodeSlot(script, pc);
-            if (slot < TotalSlots(script)) {
-                TypeSet *types = TypeScript::SlotTypes(script, slot);
-                types->addType(cx, type);
-            }
-            break;
-          }
-
-          default:;
-        }
-    }
-
     if (script->hasAnalysis() && script->analysis()->ranInference()) {
         /*
          * If the pushed set already has this type, we don't need to ensure
          * there is a TypeIntermediate. Either there already is one, or the
          * type could be determined from the script's other input type sets.
          */
         TypeSet *pushed = script->analysis()->pushedTypes(pc, 0);
         if (pushed->hasType(type))