Title: [104770] trunk/Source/_javascript_Core
Revision
104770
Author
[email protected]
Date
2012-01-11 17:00:58 -0800 (Wed, 11 Jan 2012)

Log Message

Bytecode dumping is broken for call opcodes (due to two new operands)
https://bugs.webkit.org/show_bug.cgi?id=75886

Reviewed by Oliver Hunt.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::printCallOp): Made a helper function, so I wouldn't have
to fix this more than once. The helper function skips the extra two operands
at the end of the opcode, used for optimization.
        
(JSC::CodeBlock::dump): Used the helper function.

* bytecode/CodeBlock.h: Declared the helper function.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (104769 => 104770)


--- trunk/Source/_javascript_Core/ChangeLog	2012-01-12 01:00:17 UTC (rev 104769)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-01-12 01:00:58 UTC (rev 104770)
@@ -1,3 +1,19 @@
+2012-01-11  Geoffrey Garen  <[email protected]>
+
+        Bytecode dumping is broken for call opcodes (due to two new operands)
+        https://bugs.webkit.org/show_bug.cgi?id=75886
+
+        Reviewed by Oliver Hunt.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::printCallOp): Made a helper function, so I wouldn't have
+        to fix this more than once. The helper function skips the extra two operands
+        at the end of the opcode, used for optimization.
+        
+        (JSC::CodeBlock::dump): Used the helper function.
+
+        * bytecode/CodeBlock.h: Declared the helper function.
+
 2012-01-09  Geoffrey Garen  <[email protected]>
 
         REGRESSION: d3 Bullet Charts demo doesn't work (call with argument assignment is broken)

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (104769 => 104770)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2012-01-12 01:00:17 UTC (rev 104769)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2012-01-12 01:00:58 UTC (rev 104770)
@@ -183,6 +183,15 @@
     it += 4;
 }
 
+void CodeBlock::printCallOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
+{
+    int func = (++it)->u.operand;
+    int argCount = (++it)->u.operand;
+    int registerOffset = (++it)->u.operand;
+    printf("[%4d] %s\t %s, %d, %d\n", location, op, registerName(exec, func).data(), argCount, registerOffset);
+    it += 2;
+}
+
 void CodeBlock::printPutByIdOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
 {
     int r0 = (++it)->u.operand;
@@ -522,7 +531,7 @@
         }
         case op_convert_this: {
             int r0 = (++it)->u.operand;
-            printf("[%4d] convert_this %s\n", location, registerName(exec, r0).data());
+            printf("[%4d] convert_this\t %s\n", location, registerName(exec, r0).data());
             break;
         }
         case op_new_object: {
@@ -1119,17 +1128,11 @@
             break;
         }
         case op_call: {
-            int func = (++it)->u.operand;
-            int argCount = (++it)->u.operand;
-            int registerOffset = (++it)->u.operand;
-            printf("[%4d] call\t\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
+            printCallOp(exec, location, it, "call");
             break;
         }
         case op_call_eval: {
-            int func = (++it)->u.operand;
-            int argCount = (++it)->u.operand;
-            int registerOffset = (++it)->u.operand;
-            printf("[%4d] call_eval\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
+            printCallOp(exec, location, it, "call_eval");
             break;
         }
         case op_call_varargs: {
@@ -1148,7 +1151,7 @@
         }
         case op_tear_off_arguments: {
             int r0 = (++it)->u.operand;
-            printf("[%4d] tear_off_arguments\t %s\n", location, registerName(exec, r0).data());
+            printf("[%4d] tear_off_arguments %s\n", location, registerName(exec, r0).data());
             break;
         }
         case op_ret: {
@@ -1168,10 +1171,7 @@
             break;
         }
         case op_construct: {
-            int func = (++it)->u.operand;
-            int argCount = (++it)->u.operand;
-            int registerOffset = (++it)->u.operand;
-            printf("[%4d] construct\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
+            printCallOp(exec, location, it, "construct");
             break;
         }
         case op_strcat: {

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (104769 => 104770)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2012-01-12 01:00:17 UTC (rev 104769)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2012-01-12 01:00:58 UTC (rev 104770)
@@ -989,6 +989,7 @@
         void printBinaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
         void printConditionalJump(ExecState*, const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator&, int location, const char* op) const;
         void printGetByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
+        void printCallOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
         void printPutByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
 #endif
         void visitStructures(SlotVisitor&, Instruction* vPC) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to