Changeset 161705 in webkit


Ignore:
Timestamp:
Jan 10, 2014 5:29:24 PM (10 years ago)
Author:
fpizlo@apple.com
Message:

It should be easier to diagnose FTL performance issues due to register preservation thunks
https://bugs.webkit.org/show_bug.cgi?id=126798

Not yet reviewed.

You can now use --verboseFTLToJSThunk=true --verboseFTLFailure=true to figure out
which code blocks are rejected by the FTL and yet get called from functions that
were FTL compiled. Any such rejections in major benchmarks should be fixed.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::verboseCapabilities):
(JSC::FTL::canCompile):

  • jit/RegisterPreservationWrapperGenerator.cpp:

(JSC::generateRegisterPreservationWrapper):

  • runtime/Executable.cpp:

(JSC::ExecutableBase::dump):

  • runtime/Executable.h:
  • runtime/Options.cpp:

(JSC::Options::initialize):

  • runtime/Options.h:
Location:
branches/jsCStack/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/jsCStack/Source/JavaScriptCore/ChangeLog

    r161695 r161705  
     12014-01-10  Filip Pizlo  <fpizlo@apple.com>
     2
     3        It should be easier to diagnose FTL performance issues due to register preservation thunks
     4        https://bugs.webkit.org/show_bug.cgi?id=126798
     5
     6        Not yet reviewed.
     7       
     8        You can now use --verboseFTLToJSThunk=true --verboseFTLFailure=true to figure out
     9        which code blocks are rejected by the FTL and yet get called from functions that
     10        were FTL compiled. Any such rejections in major benchmarks should be fixed.
     11
     12        * bytecode/CodeBlock.cpp:
     13        (JSC::CodeBlock::CodeBlock):
     14        * ftl/FTLCapabilities.cpp:
     15        (JSC::FTL::verboseCapabilities):
     16        (JSC::FTL::canCompile):
     17        * jit/RegisterPreservationWrapperGenerator.cpp:
     18        (JSC::generateRegisterPreservationWrapper):
     19        * runtime/Executable.cpp:
     20        (JSC::ExecutableBase::dump):
     21        * runtime/Executable.h:
     22        * runtime/Options.cpp:
     23        (JSC::Options::initialize):
     24        * runtime/Options.h:
     25
    1262014-01-10  Filip Pizlo  <fpizlo@apple.com>
    227
  • branches/jsCStack/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r161600 r161705  
    18441844    // If the concurrent thread will want the code block's hash, then compute it here
    18451845    // synchronously.
    1846     if (Options::showDisassembly()
    1847         || Options::showDFGDisassembly()
    1848         || Options::dumpBytecodeAtDFGTime()
    1849         || Options::dumpGraphAtEachPhase()
    1850         || Options::verboseCompilation()
    1851         || Options::logCompilationChanges()
    1852         || Options::validateGraph()
    1853         || Options::validateGraphAtEachPhase()
    1854         || Options::verboseOSR()
    1855         || Options::verboseCompilationQueue()
    1856         || Options::reportCompileTimes()
    1857         || Options::verboseCFA())
     1846    if (Options::alwaysComputeHash())
    18581847        hash();
    18591848
  • branches/jsCStack/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

    r161409 r161705  
    3232
    3333using namespace DFG;
     34
     35static bool verboseCapabilities()
     36{
     37    return verboseCompilationEnabled() || Options::verboseFTLFailure();
     38}
    3439
    3540inline CapabilityLevel canCompile(Node* node)
     
    235240{
    236241    if (graph.m_codeBlock->codeType() != FunctionCode) {
    237         if (verboseCompilationEnabled())
    238             dataLog("FTL rejecting code block that doesn't belong to a function.\n");
     242        if (verboseCapabilities())
     243            dataLog("FTL rejecting ", *graph.m_codeBlock, " because it doesn't belong to a function.\n");
    239244        return CannotCompile;
    240245    }
     
    244249        // CreateActivation/TearOffActivation, we might not see those nodes in case of
    245250        // OSR entry.
    246         if (verboseCompilationEnabled())
    247             dataLog("FTL rejecting code block that uses activations.\n");
     251        if (verboseCapabilities())
     252            dataLog("FTL rejecting ", *graph.m_codeBlock, " because it uses activations.\n");
    248253        return CannotCompile;
    249254    }
     
    286291                default:
    287292                    // Don't know how to handle anything else.
    288                     if (verboseCompilationEnabled()) {
    289                         dataLog("FTL rejecting node because of bad use kind: ", edge.useKind(), " in node:\n");
     293                    if (verboseCapabilities()) {
     294                        dataLog("FTL rejecting node in ", *graph.m_codeBlock, " because of bad use kind: ", edge.useKind(), " in node:\n");
    290295                        graph.dump(WTF::dataFile(), "    ", node);
    291296                    }
     
    296301            switch (canCompile(node)) {
    297302            case CannotCompile:
    298                 if (verboseCompilationEnabled()) {
    299                     dataLog("FTL rejecting node:\n");
     303                if (verboseCapabilities()) {
     304                    dataLog("FTL rejecting node in ", *graph.m_codeBlock, ":\n");
    300305                    graph.dump(WTF::dataFile(), "    ", node);
    301306                }
  • branches/jsCStack/Source/JavaScriptCore/jit/RegisterPreservationWrapperGenerator.cpp

    r161270 r161705  
    117117    LinkBuffer linkBuffer(vm, &jit, GLOBAL_THUNK_ID);
    118118    linkBuffer.link(call, CodeLocationLabel(target));
     119
     120    if (Options::verboseFTLToJSThunk())
     121        dataLog("Need a thunk for calls from FTL to non-FTL version of ", *executable, "\n");
    119122   
    120123    return FINALIZE_DFG_CODE(linkBuffer, ("Register preservation wrapper for %s/%s, %p", toCString(executable->hashFor(CodeForCall)).data(), toCString(executable->hashFor(CodeForConstruct)).data(), target.executableAddress()));
  • branches/jsCStack/Source/JavaScriptCore/runtime/Executable.cpp

    r160893 r161705  
    607607}
    608608
     609void ExecutableBase::dump(PrintStream& out) const
     610{
     611    ExecutableBase* realThis = const_cast<ExecutableBase*>(this);
     612   
     613    if (classInfo() == NativeExecutable::info()) {
     614        NativeExecutable* native = jsCast<NativeExecutable*>(realThis);
     615        out.print("NativeExecutable:", RawPointer(bitwise_cast<void*>(native->function())), "/", RawPointer(bitwise_cast<void*>(native->constructor())));
     616        return;
     617    }
     618   
     619    if (classInfo() == EvalExecutable::info()) {
     620        EvalExecutable* eval = jsCast<EvalExecutable*>(realThis);
     621        if (CodeBlock* codeBlock = eval->codeBlock())
     622            out.print(*codeBlock);
     623        else
     624            out.print("EvalExecutable w/o CodeBlock");
     625        return;
     626    }
     627   
     628    if (classInfo() == ProgramExecutable::info()) {
     629        ProgramExecutable* eval = jsCast<ProgramExecutable*>(realThis);
     630        if (CodeBlock* codeBlock = eval->codeBlock())
     631            out.print(*codeBlock);
     632        else
     633            out.print("ProgramExecutable w/o CodeBlock");
     634        return;
     635    }
     636   
     637    FunctionExecutable* function = jsCast<FunctionExecutable*>(realThis);
     638    if (!function->eitherCodeBlock())
     639        out.print("FunctionExecutable w/o CodeBlock");
     640    else {
     641        CommaPrinter comma("/");
     642        if (function->codeBlockForCall())
     643            out.print(comma, *function->codeBlockForCall());
     644        if (function->codeBlockForConstruct())
     645            out.print(comma, *function->codeBlockForConstruct());
     646    }
     647}
     648
    609649CodeBlockHash ExecutableBase::hashFor(CodeSpecializationKind kind) const
    610650{
  • branches/jsCStack/Source/JavaScriptCore/runtime/Executable.h

    r160980 r161705  
    270270        return NoIntrinsic;
    271271    }
     272   
     273    void dump(PrintStream&) const;
    272274       
    273275protected:
  • branches/jsCStack/Source/JavaScriptCore/runtime/Options.cpp

    r160092 r161705  
    212212    useRegExpJIT() = false;
    213213#endif
    214 
     214   
     215    if (showDisassembly()
     216        || showDFGDisassembly()
     217        || dumpBytecodeAtDFGTime()
     218        || dumpGraphAtEachPhase()
     219        || verboseCompilation()
     220        || logCompilationChanges()
     221        || validateGraph()
     222        || validateGraphAtEachPhase()
     223        || verboseOSR()
     224        || verboseCompilationQueue()
     225        || reportCompileTimes()
     226        || verboseCFA()
     227        || verboseFTLFailure())
     228        alwaysComputeHash() = true;
     229   
    215230    // Do range checks where needed and make corrections to the options:
    216231    ASSERT(thresholdForOptimizeAfterLongWarmUp() >= thresholdForOptimizeAfterWarmUp());
  • branches/jsCStack/Source/JavaScriptCore/runtime/Options.h

    r161599 r161705  
    125125    v(bool, reportCompileTimes, false) \
    126126    v(bool, verboseCFA, false) \
     127    v(bool, verboseFTLToJSThunk, false) \
     128    v(bool, verboseFTLFailure, false) \
     129    v(bool, alwaysComputeHash, false) \
    127130    \
    128131    v(bool, enableOSREntryToDFG, true) \
Note: See TracChangeset for help on using the changeset viewer.