Title: [197873] trunk/Source/_javascript_Core
Revision
197873
Author
[email protected]
Date
2016-03-09 12:36:40 -0800 (Wed, 09 Mar 2016)

Log Message

Add dumping of function _expression_ names in CodeBlock bytecode dump.
https://bugs.webkit.org/show_bug.cgi?id=155248

Reviewed by Filip Pizlo.

Because ...
[  19] new_func_exp      loc5, loc3, f0:foo

... is more informative than
[  19] new_func_exp      loc5, loc3, f0

Anonymous functions will be dumped as <anon>.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpFunctionExpr):
(JSC::CodeBlock::dumpBytecode):
* bytecode/CodeBlock.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (197872 => 197873)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-09 20:36:35 UTC (rev 197872)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-09 20:36:40 UTC (rev 197873)
@@ -1,3 +1,23 @@
+2016-03-09  Mark Lam  <[email protected]>
+
+        Add dumping of function _expression_ names in CodeBlock bytecode dump.
+        https://bugs.webkit.org/show_bug.cgi?id=155248
+
+        Reviewed by Filip Pizlo.
+
+        Because ...
+        [  19] new_func_exp      loc5, loc3, f0:foo
+
+        ... is more informative than
+        [  19] new_func_exp      loc5, loc3, f0
+
+        Anonymous functions will be dumped as <anon>.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dumpFunctionExpr):
+        (JSC::CodeBlock::dumpBytecode):
+        * bytecode/CodeBlock.h:
+
 2016-03-09  Michael Saboff  <[email protected]>
 
         [ES6] Implement RegExp sticky flag and related functionality

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (197872 => 197873)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2016-03-09 20:36:35 UTC (rev 197872)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2016-03-09 20:36:40 UTC (rev 197873)
@@ -769,6 +769,19 @@
     out.printf("%s", registerName(operand).data());
 }
 
+void CodeBlock::dumpFunctionExpr(PrintStream& out, int funcExprIndex)
+{
+    out.printf("f%d", funcExprIndex);
+    if (!isCompilationThread()) {
+        FunctionExecutable* executable = functionExpr(funcExprIndex);
+        String name = executable->inferredName().string();
+        if (name.isEmpty())
+            out.print(":<anon>");
+        else
+            out.print(":", name.utf8());
+    }
+}
+
 void CodeBlock::dumpBytecode(
     PrintStream& out, ExecState* exec, const Instruction* begin, const Instruction*& it,
     const StubInfoMap& stubInfos, const CallLinkInfoMap& callLinkInfos)
@@ -1336,7 +1349,8 @@
             int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "new_func");
-            out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
+            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
+            dumpFunctionExpr(out, f0);
             break;
         }
         case op_new_generator_func: {
@@ -1344,7 +1358,8 @@
             int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "new_generator_func");
-            out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
+            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
+            dumpFunctionExpr(out, f0);
             break;
         }
         case op_new_arrow_func_exp: {
@@ -1352,7 +1367,8 @@
             int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "op_new_arrow_func_exp");
-            out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
+            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
+            dumpFunctionExpr(out, f0);
             break;
         }
         case op_new_func_exp: {
@@ -1360,7 +1376,8 @@
             int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "new_func_exp");
-            out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
+            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
+            dumpFunctionExpr(out, f0);
             break;
         }
         case op_new_generator_func_exp: {
@@ -1368,7 +1385,8 @@
             int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "new_generator_func_exp");
-            out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
+            out.printf("%s, %s", registerName(r0).data(), registerName(r1).data());
+            dumpFunctionExpr(out, f0);
             break;
         }
         case op_call: {

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (197872 => 197873)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2016-03-09 20:36:35 UTC (rev 197872)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2016-03-09 20:36:40 UTC (rev 197873)
@@ -958,6 +958,7 @@
         m_constantRegisters[index - FirstConstantRegisterIndex].set(m_globalObject->vm(), this, value);
     }
 
+    void dumpFunctionExpr(PrintStream&, int funcExprIndex);
     void dumpBytecode(
         PrintStream&, ExecState*, const Instruction* begin, const Instruction*&,
         const StubInfoMap& = StubInfoMap(), const CallLinkInfoMap& = CallLinkInfoMap());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to