Ignore:
Timestamp:
Feb 20, 2014, 5:20:48 PM (11 years ago)
Author:
[email protected]
Message:

DFG should do its own static estimates of execution frequency before it starts creating OSR entrypoints
https://bugs.webkit.org/show_bug.cgi?id=129129

Reviewed by Geoffrey Garen.

We estimate execution counts based on loop depth, and then use those to estimate branch
weights. These weights then get carried all the way down to LLVM prof branch_weights
meta-data.

This is better than letting LLVM do its own static estimates, since by the time we
generate LLVM IR, we may have messed up the CFG due to OSR entrypoint creation. Of
course, it would be even better if we just slurped in some kind of execution counts
from profiling, but we don't do that, yet.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGBasicBlock.cpp:

(JSC::DFG::BasicBlock::BasicBlock):

  • dfg/DFGBasicBlock.h:
  • dfg/DFGBlockInsertionSet.cpp:

(JSC::DFG::BlockInsertionSet::insert):
(JSC::DFG::BlockInsertionSet::insertBefore):

  • dfg/DFGBlockInsertionSet.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseCodeBlock):

  • dfg/DFGCriticalEdgeBreakingPhase.cpp:

(JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge):

  • dfg/DFGLoopPreHeaderCreationPhase.cpp:

(JSC::DFG::createPreHeader):

  • dfg/DFGNaturalLoops.h:

(JSC::DFG::NaturalLoops::loopDepth):

  • dfg/DFGOSREntrypointCreationPhase.cpp:

(JSC::DFG::OSREntrypointCreationPhase::run):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGStaticExecutionCountEstimationPhase.cpp: Added.

(JSC::DFG::StaticExecutionCountEstimationPhase::StaticExecutionCountEstimationPhase):
(JSC::DFG::StaticExecutionCountEstimationPhase::run):
(JSC::DFG::StaticExecutionCountEstimationPhase::applyCounts):
(JSC::DFG::performStaticExecutionCountEstimation):

  • dfg/DFGStaticExecutionCountEstimationPhase.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGCriticalEdgeBreakingPhase.cpp

    r164229 r164459  
    7474    void breakCriticalEdge(BasicBlock* predecessor, BasicBlock** successor)
    7575    {
    76         BasicBlock* pad = m_insertionSet.insertBefore(*successor);
     76        // Note that we pass NaN for the count of the critical edge block, because we honestly
     77        // don't know its execution frequency.
     78        BasicBlock* pad = m_insertionSet.insertBefore(*successor, QNaN);
    7779        pad->appendNode(
    7880            m_graph, SpecNone, Jump, (*successor)->at(0)->origin, OpInfo(*successor));
Note: See TracChangeset for help on using the changeset viewer.