Title: [237141] trunk/Source/_javascript_Core
Revision
237141
Author
keith_mil...@apple.com
Date
2018-10-15 13:58:24 -0700 (Mon, 15 Oct 2018)

Log Message

BytecodeDumper should print all switch labels
https://bugs.webkit.org/show_bug.cgi?id=190596

Reviewed by Saam Barati.

Right now the bytecode dumper only prints the default target not any of the
non-default targets.

* bytecode/BytecodeDumper.cpp:
(JSC::BytecodeDumper<Block>::dumpBytecode):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (237140 => 237141)


--- trunk/Source/_javascript_Core/ChangeLog	2018-10-15 20:52:15 UTC (rev 237140)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-10-15 20:58:24 UTC (rev 237141)
@@ -1,3 +1,16 @@
+2018-10-15  Keith Miller  <keith_mil...@apple.com>
+
+        BytecodeDumper should print all switch labels
+        https://bugs.webkit.org/show_bug.cgi?id=190596
+
+        Reviewed by Saam Barati.
+
+        Right now the bytecode dumper only prints the default target not any of the
+        non-default targets.
+
+        * bytecode/BytecodeDumper.cpp:
+        (JSC::BytecodeDumper<Block>::dumpBytecode):
+
 2018-10-15  Saam barati  <sbar...@apple.com>
 
         Emit fjcvtzs on ARM64E on Darwin

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp (237140 => 237141)


--- trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp	2018-10-15 20:52:15 UTC (rev 237140)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp	2018-10-15 20:58:24 UTC (rev 237141)
@@ -1359,7 +1359,11 @@
         int defaultTarget = (++it)->u.operand;
         int scrutineeRegister = (++it)->u.operand;
         printLocationAndOp(out, location, it, "switch_imm");
-        out.printf("%d, %d(->%d), %s", tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).data());
+        out.printf("%d, default:%d(->%d)", tableIndex, defaultTarget, location + defaultTarget);
+        const auto& table = block()->switchJumpTable(tableIndex);
+        for (unsigned i = 0; i < table.branchOffsets.size(); ++i)
+            out.printf(", %d:%d(->%d)", i, table.branchOffsets[i], location + table.branchOffsets[i]);
+        out.print(", ", registerName(scrutineeRegister).data());
         break;
     }
     case op_switch_char: {
@@ -1367,7 +1371,11 @@
         int defaultTarget = (++it)->u.operand;
         int scrutineeRegister = (++it)->u.operand;
         printLocationAndOp(out, location, it, "switch_char");
-        out.printf("%d, %d(->%d), %s", tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).data());
+        out.printf("%d, default:%d(->%d)", tableIndex, defaultTarget, location + defaultTarget);
+        const auto& table = block()->switchJumpTable(tableIndex);
+        for (unsigned i = 0; i < table.branchOffsets.size(); ++i)
+            out.printf(", %c:%d(->%d)", i, table.branchOffsets[i], location + table.branchOffsets[i]);
+        out.print(", ", registerName(scrutineeRegister).data());
         break;
     }
     case op_switch_string: {
@@ -1375,7 +1383,13 @@
         int defaultTarget = (++it)->u.operand;
         int scrutineeRegister = (++it)->u.operand;
         printLocationAndOp(out, location, it, "switch_string");
-        out.printf("%d, %d(->%d), %s", tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).data());
+        out.printf("%d, default:%d(->%d)", tableIndex, defaultTarget, location + defaultTarget);
+        const auto& table = block()->stringSwitchJumpTable(tableIndex);
+        for (const auto& offset : table.offsetTable) {
+            out.print(", ", Identifier::fromUid(vm(), static_cast<UniquedStringImpl*>(offset.key.get())));
+            out.printf(":%d(%d)", offset.value.branchOffset, location + offset.value.branchOffset);
+        }
+        out.print(", ", registerName(scrutineeRegister).data());
         break;
     }
     case op_new_func: {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to