[INFER] Decompiler and Windows interpreter fixes for decomposed property ops, bug 647624.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 16 Jul 2011 16:40:47 -0700
changeset 76048 7f471e15146eb0c507f2cfbbb72fa2051d42be18
parent 76047 ce4c49e8575f3429be96e57f1b96c6b87fd91d7c
child 76049 993716952d8681f43cfb4358177657586f80be82
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
bugs647624
milestone8.0a1
[INFER] Decompiler and Windows interpreter fixes for decomposed property ops, bug 647624.
js/src/jsemit.cpp
js/src/jsinterp.cpp
--- a/js/src/jsemit.cpp
+++ b/js/src/jsemit.cpp
@@ -6699,16 +6699,24 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
             if (!js_EmitTree(cx, cg, pn2))
                 return JS_FALSE;
             if (js_NewSrcNote2(cx, cg, SRC_PCBASE,
                                CG_OFFSET(cg) - pn2->pn_offset) < 0) {
                 return JS_FALSE;
             }
             if (js_Emit1(cx, cg, op) < 0)
                 return JS_FALSE;
+            if (js_CodeSpec[op].format & JOF_DECOMPOSE) {
+                /*
+                 * This is dead code for the decompiler, don't generate
+                 * a decomposed version of the opcode.
+                 */
+                if (js_Emit1(cx, cg, (JSOp)0) < 0)
+                    return JS_FALSE;
+            }
             break;
 #if JS_HAS_XML_SUPPORT
           case TOK_UNARYOP:
             JS_ASSERT(pn2->pn_op == JSOP_SETXMLNAME);
             if (!js_EmitTree(cx, cg, pn2->pn_kid))
                 return JS_FALSE;
             if (js_Emit1(cx, cg, JSOP_BINDXMLNAME) < 0)
                 return JS_FALSE;
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -3424,34 +3424,38 @@ END_CASE(JSOP_VOID)
     jsid id;
     jsint i;
 
 BEGIN_CASE(JSOP_INCELEM)
 BEGIN_CASE(JSOP_DECELEM)
 BEGIN_CASE(JSOP_ELEMINC)
 BEGIN_CASE(JSOP_ELEMDEC)
 
-    if (cx->typeInferenceEnabled())
-        DO_NEXT_OP(JSOP_INCELEM_LENGTH);
+    if (cx->typeInferenceEnabled()) {
+        len = JSOP_INCELEM_LENGTH;
+        DO_NEXT_OP(len);
+    }
 
     /*
      * Delay fetching of id until we have the object to ensure the proper
      * evaluation order. See bug 372331.
      */
     id = JSID_VOID;
     i = -2;
     goto fetch_incop_obj;
 
 BEGIN_CASE(JSOP_INCPROP)
 BEGIN_CASE(JSOP_DECPROP)
 BEGIN_CASE(JSOP_PROPINC)
 BEGIN_CASE(JSOP_PROPDEC)
 
-    if (cx->typeInferenceEnabled())
-        DO_NEXT_OP(JSOP_INCPROP_LENGTH);
+    if (cx->typeInferenceEnabled()) {
+        len = JSOP_INCPROP_LENGTH;
+        DO_NEXT_OP(len);
+    }
 
     LOAD_ATOM(0, atom);
     id = ATOM_TO_JSID(atom);
     i = -1;
 
   fetch_incop_obj:
     FETCH_OBJECT(cx, i, obj);
     if (JSID_IS_VOID(id))
@@ -3462,18 +3466,20 @@ BEGIN_CASE(JSOP_INCNAME)
 BEGIN_CASE(JSOP_DECNAME)
 BEGIN_CASE(JSOP_NAMEINC)
 BEGIN_CASE(JSOP_NAMEDEC)
 BEGIN_CASE(JSOP_INCGNAME)
 BEGIN_CASE(JSOP_DECGNAME)
 BEGIN_CASE(JSOP_GNAMEINC)
 BEGIN_CASE(JSOP_GNAMEDEC)
 {
-    if (cx->typeInferenceEnabled())
-        DO_NEXT_OP(JSOP_INCNAME_LENGTH);
+    if (cx->typeInferenceEnabled()) {
+        len = JSOP_INCNAME_LENGTH;
+        DO_NEXT_OP(len);
+    }
 
     obj = &regs.fp()->scopeChain();
 
     bool global = (js_CodeSpec[op].format & JOF_GNAME);
     if (global)
         obj = obj->getGlobal();
 
     JSObject *obj2;