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/DFGNaturalLoops.h

    r164424 r164459  
    155155    }
    156156   
     157    unsigned loopDepth(BasicBlock* block) const
     158    {
     159        unsigned depth = 0;
     160        for (const NaturalLoop* loop = innerMostLoopOf(block); loop; loop = innerMostOuterLoop(*loop))
     161            depth++;
     162        return depth;
     163    }
     164   
    157165    // Return the indices of all loops this belongs to.
    158166    Vector<const NaturalLoop*> loopsOf(BasicBlock*) const;
Note: See TracChangeset for help on using the changeset viewer.