[INFER] Don't use a stub call in PROPINC on known non-objects, bug 646429.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 30 Mar 2011 11:47:02 -0700
changeset 75891 d8c960080f06674b3f7bd544f66823f11b8bec43
parent 75890 df80ae4a87769a8c7f294585e27986128e6d96fb
child 75892 b0cd13380c364f8c97d69e0685448f25a29c3e3c
push id67
push userclegnitto@mozilla.com
push dateFri, 04 Nov 2011 22:39:41 +0000
treeherdermozilla-release@04778346a3b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs646429
milestone2.0b13pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
[INFER] Don't use a stub call in PROPINC on known non-objects, bug 646429.
js/src/methodjit/Compiler.cpp
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -5127,109 +5127,105 @@ mjit::Compiler::jsop_nameinc(JSOp op, Vo
     return Compile_Okay;
 }
 
 CompileStatus
 mjit::Compiler::jsop_propinc(JSOp op, VoidStubAtom stub, uint32 index)
 {
     JSAtom *atom = script->getAtom(index);
 #if defined JS_POLYIC
-    FrameEntry *objFe = frame.peek(-1);
-    if (!objFe->isTypeKnown() || objFe->getKnownType() == JSVAL_TYPE_OBJECT) {
-        jsbytecode *next = &PC[JSOP_PROPINC_LENGTH];
-        bool pop = (JSOp(*next) == JSOP_POP) && !a->analysis.jumpTarget(next);
-        int amt = (op == JSOP_PROPINC || op == JSOP_INCPROP) ? -1 : 1;
-
-        if (pop || (op == JSOP_INCPROP || op == JSOP_DECPROP)) {
-            /*
-             * These cases are easier, the original value is not observed.
-             * Use a consistent stack layout for the value as the observed case,
-             * so that if the operation overflows the stub will be able to find
-             * the modified object.
-             */
-
-            frame.dup();
-            // OBJ OBJ
-
-            frame.dup();
-            // OBJ * OBJ
-
-            if (!jsop_getprop(atom, JSVAL_TYPE_UNKNOWN))
-                return Compile_Error;
-            // OBJ * V
-
-            frame.push(Int32Value(amt));
-            // OBJ * V 1
-
-            /* Use sub since it calls ValueToNumber instead of string concat. */
-            frame.syncAt(-4);
-            if (!jsop_binary(JSOP_SUB, stubs::Sub, JSVAL_TYPE_UNKNOWN, pushedTypeSet(0)))
-                return Compile_Retry;
-            // OBJ * V+1
-
-            frame.shimmy(1);
-            // OBJ V+1
-
-            if (!jsop_setprop(atom, false))
-                return Compile_Error;
-            // V+1
-
-            if (pop)
-                frame.pop();
-        } else {
-            /* The pre-value is observed, making this more tricky. */
-
-            frame.dup();
-            // OBJ OBJ 
-
-            if (!jsop_getprop(atom, JSVAL_TYPE_UNKNOWN))
-                return Compile_Error;
-            // OBJ V
-
-            jsop_pos();
-            // OBJ N
-
-            frame.dup();
-            // OBJ N N
-
-            frame.push(Int32Value(-amt));
-            // OBJ N N 1
-
-            frame.syncAt(-4);
-            if (!jsop_binary(JSOP_ADD, stubs::Add, JSVAL_TYPE_UNKNOWN, pushedTypeSet(0)))
-                return Compile_Retry;
-            // OBJ N N+1
-
-            frame.dupAt(-3);
-            // OBJ N N+1 OBJ
-
-            frame.dupAt(-2);
-            // OBJ N N+1 OBJ N+1
-
-            if (!jsop_setprop(atom, false))
-                return Compile_Error;
-            // OBJ N N+1 N+1
-
-            frame.popn(2);
-            // OBJ N
-
-            frame.shimmy(1);
-            // N
-        }
+    jsbytecode *next = &PC[JSOP_PROPINC_LENGTH];
+    bool pop = (JSOp(*next) == JSOP_POP) && !a->analysis.jumpTarget(next);
+    int amt = (op == JSOP_PROPINC || op == JSOP_INCPROP) ? -1 : 1;
+
+    if (pop || (op == JSOP_INCPROP || op == JSOP_DECPROP)) {
+        /*
+         * These cases are easier, the original value is not observed.
+         * Use a consistent stack layout for the value as the observed case,
+         * so that if the operation overflows the stub will be able to find
+         * the modified object.
+         */
+
+        frame.dup();
+        // OBJ OBJ
+
+        frame.dup();
+        // OBJ * OBJ
+
+        if (!jsop_getprop(atom, JSVAL_TYPE_UNKNOWN))
+            return Compile_Error;
+        // OBJ * V
+
+        frame.push(Int32Value(amt));
+        // OBJ * V 1
+
+        /* Use sub since it calls ValueToNumber instead of string concat. */
+        frame.syncAt(-4);
+        if (!jsop_binary(JSOP_SUB, stubs::Sub, JSVAL_TYPE_UNKNOWN, pushedTypeSet(0)))
+            return Compile_Retry;
+        // OBJ * V+1
+
+        frame.shimmy(1);
+        // OBJ V+1
+
+        if (!jsop_setprop(atom, false))
+            return Compile_Error;
+        // V+1
+
         if (pop)
-            PC += JSOP_POP_LENGTH;
-    } else
+            frame.pop();
+    } else {
+        /* The pre-value is observed, making this more tricky. */
+
+        frame.dup();
+        // OBJ OBJ 
+
+        if (!jsop_getprop(atom, JSVAL_TYPE_UNKNOWN))
+            return Compile_Error;
+        // OBJ V
+
+        jsop_pos();
+        // OBJ N
+
+        frame.dup();
+        // OBJ N N
+
+        frame.push(Int32Value(-amt));
+        // OBJ N N 1
+
+        frame.syncAt(-4);
+        if (!jsop_binary(JSOP_ADD, stubs::Add, JSVAL_TYPE_UNKNOWN, pushedTypeSet(0)))
+            return Compile_Retry;
+        // OBJ N N+1
+
+        frame.dupAt(-3);
+        // OBJ N N+1 OBJ
+
+        frame.dupAt(-2);
+        // OBJ N N+1 OBJ N+1
+
+        if (!jsop_setprop(atom, false))
+            return Compile_Error;
+        // OBJ N N+1 N+1
+
+        frame.popn(2);
+        // OBJ N
+
+        frame.shimmy(1);
+        // N
+    }
+    if (pop)
+        PC += JSOP_POP_LENGTH;
+#else
+    prepareStubCall(Uses(1));
+    masm.move(ImmPtr(atom), Registers::ArgReg1);
+    INLINE_STUBCALL(stub);
+    frame.pop();
+    pushSyncedEntry(0);
 #endif
-    {
-        prepareStubCall(Uses(1));
-        masm.move(ImmPtr(atom), Registers::ArgReg1);
-        INLINE_STUBCALL(stub);
-        frame.pop();
-        pushSyncedEntry(0);
-    }
 
     PC += JSOP_PROPINC_LENGTH;
     return Compile_Okay;
 }
 
 bool
 mjit::Compiler::iter(uintN flags)
 {