Changeset 197873 in webkit


Ignore:
Timestamp:
Mar 9, 2016, 12:36:40 PM (9 years ago)
Author:
mark.lam@apple.com
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:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r197869 r197873  
     12016-03-09  Mark Lam  <mark.lam@apple.com>
     2
     3        Add dumping of function expression names in CodeBlock bytecode dump.
     4        https://bugs.webkit.org/show_bug.cgi?id=155248
     5
     6        Reviewed by Filip Pizlo.
     7
     8        Because ...
     9        [  19] new_func_exp      loc5, loc3, f0:foo
     10
     11        ... is more informative than
     12        [  19] new_func_exp      loc5, loc3, f0
     13
     14        Anonymous functions will be dumped as <anon>.
     15
     16        * bytecode/CodeBlock.cpp:
     17        (JSC::CodeBlock::dumpFunctionExpr):
     18        (JSC::CodeBlock::dumpBytecode):
     19        * bytecode/CodeBlock.h:
     20
    1212016-03-09  Michael Saboff  <msaboff@apple.com>
    222
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r197869 r197873  
    770770}
    771771
     772void CodeBlock::dumpFunctionExpr(PrintStream& out, int funcExprIndex)
     773{
     774    out.printf("f%d", funcExprIndex);
     775    if (!isCompilationThread()) {
     776        FunctionExecutable* executable = functionExpr(funcExprIndex);
     777        String name = executable->inferredName().string();
     778        if (name.isEmpty())
     779            out.print(":<anon>");
     780        else
     781            out.print(":", name.utf8());
     782    }
     783}
     784
    772785void CodeBlock::dumpBytecode(
    773786    PrintStream& out, ExecState* exec, const Instruction* begin, const Instruction*& it,
     
    13371350            int f0 = (++it)->u.operand;
    13381351            printLocationAndOp(out, exec, location, it, "new_func");
    1339             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
     1352            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
     1353            dumpFunctionExpr(out, f0);
    13401354            break;
    13411355        }
     
    13451359            int f0 = (++it)->u.operand;
    13461360            printLocationAndOp(out, exec, location, it, "new_generator_func");
    1347             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
     1361            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
     1362            dumpFunctionExpr(out, f0);
    13481363            break;
    13491364        }
     
    13531368            int f0 = (++it)->u.operand;
    13541369            printLocationAndOp(out, exec, location, it, "op_new_arrow_func_exp");
    1355             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
     1370            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
     1371            dumpFunctionExpr(out, f0);
    13561372            break;
    13571373        }
     
    13611377            int f0 = (++it)->u.operand;
    13621378            printLocationAndOp(out, exec, location, it, "new_func_exp");
    1363             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
     1379            out.printf("%s, %s, ", registerName(r0).data(), registerName(r1).data());
     1380            dumpFunctionExpr(out, f0);
    13641381            break;
    13651382        }
     
    13691386            int f0 = (++it)->u.operand;
    13701387            printLocationAndOp(out, exec, location, it, "new_generator_func_exp");
    1371             out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
     1388            out.printf("%s, %s", registerName(r0).data(), registerName(r1).data());
     1389            dumpFunctionExpr(out, f0);
    13721390            break;
    13731391        }
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r197563 r197873  
    959959    }
    960960
     961    void dumpFunctionExpr(PrintStream&, int funcExprIndex);
    961962    void dumpBytecode(
    962963        PrintStream&, ExecState*, const Instruction* begin, const Instruction*&,
Note: See TracChangeset for help on using the changeset viewer.