Changeset 121382 in webkit


Ignore:
Timestamp:
Jun 27, 2012 4:16:10 PM (12 years ago)
Author:
fpizlo@apple.com
Message:

DFG disassembly should be easier to read
https://bugs.webkit.org/show_bug.cgi?id=90106

Reviewed by Mark Hahnenberg.

Did a few things:

  • Options::showDFGDisassembly now shows OSR exit disassembly as well.


  • Phi node dumping doesn't attempt to do line wrapping since it just made the dump harder to read.


  • DFG graph disassembly view shows a few additional node types that turn out to be essential for understanding OSR exits.


Put together, these changes reinforce the philosophy that anything needed for computing
OSR exit is just as important as the machine code itself. Of course, we still don't take
that philosophy to its full extreme - for example Phantom nodes are not dumped. We may
revisit that in the future.

  • assembler/LinkBuffer.cpp:

(JSC::LinkBuffer::finalizeCodeWithDisassembly):

  • assembler/LinkBuffer.h:

(JSC):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::dump):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dumpBlockHeader):

  • dfg/DFGNode.h:

(JSC::DFG::Node::willHaveCodeGenOrOSR):

  • dfg/DFGOSRExitCompiler.cpp:
  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r121381 r121382  
     12012-06-27  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG disassembly should be easier to read
     4        https://bugs.webkit.org/show_bug.cgi?id=90106
     5
     6        Reviewed by Mark Hahnenberg.
     7       
     8        Did a few things:
     9       
     10        - Options::showDFGDisassembly now shows OSR exit disassembly as well.
     11       
     12        - Phi node dumping doesn't attempt to do line wrapping since it just made the dump harder
     13          to read.
     14       
     15        - DFG graph disassembly view shows a few additional node types that turn out to be
     16          essential for understanding OSR exits.
     17       
     18        Put together, these changes reinforce the philosophy that anything needed for computing
     19        OSR exit is just as important as the machine code itself. Of course, we still don't take
     20        that philosophy to its full extreme - for example Phantom nodes are not dumped. We may
     21        revisit that in the future.
     22
     23        * assembler/LinkBuffer.cpp:
     24        (JSC::LinkBuffer::finalizeCodeWithDisassembly):
     25        * assembler/LinkBuffer.h:
     26        (JSC):
     27        * dfg/DFGDisassembler.cpp:
     28        (JSC::DFG::Disassembler::dump):
     29        * dfg/DFGGraph.cpp:
     30        (JSC::DFG::Graph::dumpBlockHeader):
     31        * dfg/DFGNode.h:
     32        (JSC::DFG::Node::willHaveCodeGenOrOSR):
     33        * dfg/DFGOSRExitCompiler.cpp:
     34        * jit/JIT.cpp:
     35        (JSC::JIT::privateCompile):
     36
    1372012-06-25  Mark Hahnenberg  <mhahnenberg@apple.com>
    238
  • trunk/Source/JavaScriptCore/assembler/LinkBuffer.cpp

    r120786 r121382  
    4242LinkBuffer::CodeRef LinkBuffer::finalizeCodeWithDisassembly(const char* format, ...)
    4343{
    44     ASSERT(Options::showDisassembly);
     44    ASSERT(Options::showDisassembly || Options::showDFGDisassembly);
    4545   
    4646    CodeRef result = finalizeCodeWithoutDisassembly();
  • trunk/Source/JavaScriptCore/assembler/LinkBuffer.h

    r120786 r121382  
    258258};
    259259
     260#define FINALIZE_CODE_IF(condition, linkBufferReference, dataLogArgumentsForHeading)  \
     261    (UNLIKELY((condition))                                              \
     262     ? ((linkBufferReference).finalizeCodeWithDisassembly dataLogArgumentsForHeading) \
     263     : (linkBufferReference).finalizeCodeWithoutDisassembly())
     264
    260265// Use this to finalize code, like so:
    261266//
     
    275280
    276281#define FINALIZE_CODE(linkBufferReference, dataLogArgumentsForHeading)  \
    277     (UNLIKELY(Options::showDisassembly)                                 \
    278      ? ((linkBufferReference).finalizeCodeWithDisassembly dataLogArgumentsForHeading) \
    279      : (linkBufferReference).finalizeCodeWithoutDisassembly())
     282    FINALIZE_CODE_IF(Options::showDisassembly, linkBufferReference, dataLogArgumentsForHeading)
    280283
    281284} // namespace JSC
  • trunk/Source/JavaScriptCore/dfg/DFGDisassembler.cpp

    r120834 r121382  
    4444    m_graph.m_dominators.computeIfNecessary(m_graph);
    4545   
    46     dataLog("Generated JIT code for DFG CodeBlock %p:\n", m_graph.m_codeBlock);
     46    dataLog("Generated JIT code for DFG CodeBlock %p, instruction count = %u:\n", m_graph.m_codeBlock, m_graph.m_codeBlock->instructionCount());
    4747    dataLog("    Code at [%p, %p):\n", linkBuffer.debugAddress(), static_cast<char*>(linkBuffer.debugAddress()) + linkBuffer.debugSize());
    4848   
     
    6060        NodeIndex lastNodeIndexForDisassembly = block->at(0);
    6161        for (size_t i = 0; i < block->size(); ++i) {
    62             if (!m_graph[block->at(i)].willHaveCodeGen())
     62            if (!m_graph[block->at(i)].willHaveCodeGenOrOSR())
    6363                continue;
    6464            MacroAssembler::Label currentLabel;
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp

    r120834 r121382  
    328328    }
    329329    dataLog("%s  Phi Nodes:", prefix);
    330     unsigned count = 0;
    331330    for (size_t i = 0; i < block->phis.size(); ++i) {
    332331        NodeIndex phiNodeIndex = block->phis[i];
     
    334333        if (!phiNode.shouldGenerate() && phiNodeDumpMode == DumpLivePhisOnly)
    335334            continue;
    336         if (!((++count) % 4))
    337             dataLog("\n%s      ", prefix);
    338335        dataLog(" @%u->(", phiNodeIndex);
    339336        if (phiNode.child1()) {
  • trunk/Source/JavaScriptCore/dfg/DFGNode.h

    r120834 r121382  
    732732    }
    733733   
    734     bool willHaveCodeGen()
    735     {
    736         return shouldGenerate() && op() != Phantom && op() != Nop;
     734    bool willHaveCodeGenOrOSR()
     735    {
     736        switch (op()) {
     737        case SetLocal:
     738        case Int32ToDouble:
     739        case ValueToInt32:
     740        case UInt32ToNumber:
     741        case DoubleAsInt32:
     742            return true;
     743        case Phantom:
     744        case Nop:
     745            return false;
     746        default:
     747            return shouldGenerate();
     748        }
    737749    }
    738750
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp

    r121073 r121382  
    3030
    3131#include "CallFrame.h"
     32#include "DFGCommon.h"
    3233#include "LinkBuffer.h"
    3334#include "RepatchBuffer.h"
     
    8081       
    8182        LinkBuffer patchBuffer(*globalData, &jit, codeBlock);
    82         exit.m_code = FINALIZE_CODE(
     83        exit.m_code = FINALIZE_CODE_IF(
     84            shouldShowDisassembly(),
    8385            patchBuffer,
    8486            ("DFG OSR exit #%u (bc#%u, @%u, %s) from CodeBlock %p",
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r121073 r121382  
    764764   
    765765    CodeRef result = FINALIZE_CODE(
    766         patchBuffer, ("Baseline JIT code for CodeBlock %p", m_codeBlock));
     766        patchBuffer,
     767        ("Baseline JIT code for CodeBlock %p, instruction count = %u",
     768         m_codeBlock, m_codeBlock->instructionCount()));
    767769   
    768770    m_globalData->machineCodeBytesPerBytecodeWordForBaselineJIT.add(
Note: See TracChangeset for help on using the changeset viewer.