Changeset 139496 in webkit


Ignore:
Timestamp:
Jan 11, 2013, 2:18:27 PM (12 years ago)
Author:
fpizlo@apple.com
Message:

It should be possible to enable verbose printing of each OSR exit at run-time (rather than compile-time) and it should print register state
https://bugs.webkit.org/show_bug.cgi?id=106700

Reviewed by Mark Hahnenberg.

  • dfg/DFGAssemblyHelpers.h:

(DFG):
(JSC::DFG::AssemblyHelpers::debugCall):

  • dfg/DFGCommon.h:
  • dfg/DFGOSRExit.h:

(DFG):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • runtime/Options.h:

(JSC):

Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r139491 r139496  
     12013-01-11  Filip Pizlo  <fpizlo@apple.com>
     2
     3        It should be possible to enable verbose printing of each OSR exit at run-time (rather than compile-time) and it should print register state
     4        https://bugs.webkit.org/show_bug.cgi?id=106700
     5
     6        Reviewed by Mark Hahnenberg.
     7
     8        * dfg/DFGAssemblyHelpers.h:
     9        (DFG):
     10        (JSC::DFG::AssemblyHelpers::debugCall):
     11        * dfg/DFGCommon.h:
     12        * dfg/DFGOSRExit.h:
     13        (DFG):
     14        * dfg/DFGOSRExitCompiler32_64.cpp:
     15        (JSC::DFG::OSRExitCompiler::compileExit):
     16        * dfg/DFGOSRExitCompiler64.cpp:
     17        (JSC::DFG::OSRExitCompiler::compileExit):
     18        * dfg/DFGOperations.cpp:
     19        * dfg/DFGOperations.h:
     20        * runtime/Options.h:
     21        (JSC):
     22
    1232013-01-11  Geoffrey Garen  <ggaren@apple.com>
    224
  • trunk/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h

    r138669 r139496  
    4040namespace JSC { namespace DFG {
    4141
    42 typedef void (*V_DFGDebugOperation_EP)(ExecState*, void*);
     42typedef void (*V_DFGDebugOperation_EPP)(ExecState*, void*, void*);
    4343
    4444class AssemblyHelpers : public MacroAssembler {
     
    171171
    172172    // Add a debug call. This call has no effect on JIT code execution state.
    173     void debugCall(V_DFGDebugOperation_EP function, void* argument)
     173    void debugCall(V_DFGDebugOperation_EPP function, void* argument)
    174174    {
    175175        size_t scratchSize = sizeof(EncodedJSValue) * (GPRInfo::numberOfRegisters + FPRInfo::numberOfRegisters);
     
    195195
    196196#if CPU(X86_64) || CPU(ARM)
     197        move(TrustedImmPtr(buffer), GPRInfo::argumentGPR2);
    197198        move(TrustedImmPtr(argument), GPRInfo::argumentGPR1);
    198199        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     
    201202        poke(GPRInfo::callFrameRegister, 0);
    202203        poke(TrustedImmPtr(argument), 1);
     204        poke(TrustedImmPtr(buffer), 2);
    203205        GPRReg scratch = GPRInfo::regT0;
    204206#else
  • trunk/Source/JavaScriptCore/dfg/DFGCommon.h

    r135640 r139496  
    7171// Emit a breakpoint into the speculation failure code.
    7272#define DFG_ENABLE_JIT_BREAK_ON_SPECULATION_FAILURE 0
    73 // Log every speculation failure.
    74 #define DFG_ENABLE_VERBOSE_SPECULATION_FAILURE 0
    7573// Disable the DFG JIT without having to touch Platform.h
    7674#define DFG_DEBUG_LOCAL_DISBALE 0
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.h

    r137976 r139496  
    123123};
    124124
    125 #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
    126125struct SpeculationFailureDebugInfo {
    127126    CodeBlock* codeBlock;
    128127    NodeIndex nodeIndex;
    129128};
    130 #endif
    131129
    132130} } // namespace JSC::DFG
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp

    r138669 r139496  
    4848    dumpOperands(operands, WTF::dataFile());
    4949#endif
    50 #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
    51     SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
    52     debugInfo->codeBlock = m_jit.codeBlock();
    53     debugInfo->nodeIndex = exit.m_nodeIndex;
    54    
    55     m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
    56 #endif
     50   
     51    if (Options::printEachOSRExit()) {
     52        SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
     53        debugInfo->codeBlock = m_jit.codeBlock();
     54        debugInfo->nodeIndex = exit.m_nodeIndex;
     55       
     56        m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
     57    }
    5758   
    5859#if DFG_ENABLE(JIT_BREAK_ON_SPECULATION_FAILURE)
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp

    r138669 r139496  
    4848    dumpOperands(operands, WTF::dataFile());
    4949#endif
    50 #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
    51     SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
    52     debugInfo->codeBlock = m_jit.codeBlock();
    53     debugInfo->nodeIndex = exit.m_nodeIndex;
    54    
    55     m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
    56 #endif
     50
     51    if (Options::printEachOSRExit()) {
     52        SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
     53        debugInfo->codeBlock = m_jit.codeBlock();
     54        debugInfo->nodeIndex = exit.m_nodeIndex;
     55       
     56        m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
     57    }
    5758   
    5859#if DFG_ENABLE(JIT_BREAK_ON_SPECULATION_FAILURE)
     
    137138        if (!!exit.m_valueProfile) {
    138139            EncodedJSValue* bucket = exit.m_valueProfile.getSpecFailBucket(0);
    139            
    140 #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
    141             dataLogF("  (have exit profile, bucket %p)  ", bucket);
    142 #endif
    143140           
    144141            if (exit.m_jsValueSource.isAddress()) {
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r139491 r139496  
    16081608}
    16091609
    1610 #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
    1611 void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState* exec, void* debugInfoRaw)
     1610void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState* exec, void* debugInfoRaw, void* scratch)
    16121611{
    16131612    JSGlobalData* globalData = &exec->globalData();
     
    16281627        dataLog("no alternative code block (i.e. we've been jettisoned)");
    16291628    dataLog(", osrExitCounter = ", codeBlock->osrExitCounter(), "\n");
    1630 }
    1631 #endif
     1629    dataLog("    GPRs at time of exit:");
     1630    char* scratchPointer = static_cast<char*>(scratch);
     1631    for (unsigned i = 0; i < GPRInfo::numberOfRegisters; ++i) {
     1632        GPRReg gpr = GPRInfo::toRegister(i);
     1633        dataLog(" ", GPRInfo::debugName(gpr), ":", RawPointer(*reinterpret_cast<void**>(scratchPointer)));
     1634        scratchPointer += sizeof(EncodedJSValue);
     1635    }
     1636    dataLog("\n");
     1637    dataLog("    FPRs at time of exit:");
     1638    for (unsigned i = 0; i < FPRInfo::numberOfRegisters; ++i) {
     1639        FPRReg fpr = FPRInfo::toRegister(i);
     1640        dataLog(" ", FPRInfo::debugName(fpr), ":");
     1641        uint64_t bits = *reinterpret_cast<uint64_t*>(scratchPointer);
     1642        double value = *reinterpret_cast<double*>(scratchPointer);
     1643        dataLogF("%llx:%lf", bits, value);
     1644        scratchPointer += sizeof(EncodedJSValue);
     1645    }
     1646    dataLog("\n");
     1647}
    16321648
    16331649extern "C" void DFG_OPERATION triggerReoptimizationNow(CodeBlock* codeBlock)
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.h

    r139145 r139496  
    260260size_t DFG_OPERATION dfgConvertJSValueToBoolean(ExecState*, EncodedJSValue) WTF_INTERNAL;
    261261
    262 #if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
    263 void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState*, void*) WTF_INTERNAL;
    264 #endif
     262void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState*, void*, void*) WTF_INTERNAL;
    265263
    266264void DFG_OPERATION triggerReoptimizationNow(CodeBlock*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r138924 r139496  
    7676    v(bool, showAllDFGNodes, false) \
    7777    \
     78    v(bool, printEachOSRExit, false) \
     79    \
    7880    v(bool, enableProfiler, false) \
    7981    \
Note: See TracChangeset for help on using the changeset viewer.