Bug 1366903 - Fix decompilation of JSOP_REGEXP and JSOP_NEWARRAY_COPYONWRITE. r=nbp
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 27 Jun 2017 19:52:34 -0400
changeset 366370 d9489f5df7bea25619d19e2688fd7065cc724bad
parent 366369 b99ff3a0012c57ffab1fa291234be3f4428d5875
child 366371 03a8816ad63173437c7bb5a825a61f5740b5a384
push id32099
push usercbook@mozilla.com
push dateWed, 28 Jun 2017 11:23:49 +0000
treeherdermozilla-central@306d2070e105 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1366903
milestone56.0a1
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
Bug 1366903 - Fix decompilation of JSOP_REGEXP and JSOP_NEWARRAY_COPYONWRITE. r=nbp
js/src/jsopcode.cpp
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -1881,19 +1881,42 @@ ExpressionDecompiler::decompilePC(jsbyte
       case JSOP_FUNAPPLY:
         return decompilePCForStackOperand(pc, -int32_t(GET_ARGC(pc) + 2)) &&
                write("(...)");
       case JSOP_SPREADCALL:
         return decompilePCForStackOperand(pc, -3) &&
                write("(...)");
       case JSOP_NEWARRAY:
         return write("[]");
-      case JSOP_REGEXP:
-      case JSOP_OBJECT:
+      case JSOP_REGEXP: {
+        RootedObject obj(cx, script->getObject(GET_UINT32_INDEX(pc)));
+        JSString* str = obj->as<RegExpObject>().toString(cx);
+        if (!str)
+            return false;
+        return write(str);
+      }
       case JSOP_NEWARRAY_COPYONWRITE: {
+        RootedObject obj(cx, script->getObject(GET_UINT32_INDEX(pc)));
+        Handle<ArrayObject*> aobj = obj.as<ArrayObject>();
+        if (!write("["))
+            return false;
+        for (size_t i = 0; i < aobj->getDenseInitializedLength(); i++) {
+            if (i > 0 && !write(", "))
+                return false;
+
+            RootedValue v(cx, aobj->getDenseElement(i));
+            MOZ_RELEASE_ASSERT(v.isPrimitive() && !v.isMagic());
+
+            JSString* str = ValueToSource(cx, v);
+            if (!str || !write(str))
+                return false;
+        }
+        return write("]");
+      }
+      case JSOP_OBJECT: {
         JSObject* obj = script->getObject(GET_UINT32_INDEX(pc));
         RootedValue objv(cx, ObjectValue(*obj));
         JSString* str = ValueToSource(cx, objv);
         if (!str)
             return false;
         return write(str);
       }
       case JSOP_VOID: