Ignore:
Timestamp:
Nov 17, 2015, 1:41:43 PM (10 years ago)
Author:
[email protected]
Message:

It's best for the DFG to always have some guess of basic block frequency
https://bugs.webkit.org/show_bug.cgi?id=151350

Reviewed by Geoffrey Garen.

It'll simplify things for B3 if we always have some estimate of block frequency, even if it's not
a great estimate. Using NaN as an estimate is probably worse than using any non-NaN number.

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGCriticalEdgeBreakingPhase.cpp:

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

  • dfg/DFGLoopPreHeaderCreationPhase.cpp:

(JSC::DFG::createPreHeader):

File:
1 edited

Legend:

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

    r191870 r192529  
    6565    //
    6666    // https://bugs.webkit.org/show_bug.cgi?id=148587
    67    
    68     // Don't bother to preserve execution frequencies for now.
    69     BasicBlock* preHeader = insertionSet.insertBefore(block, PNaN);
     67
     68    // Determine a good frequency for the pre-header. It's definitely not the frequency of the loop body.
     69    // Instead, we use the max of the frequencies of the loop body's non-loop predecessors.
     70    float frequency = 0;
     71    for (BasicBlock* predecessor : block->predecessors) {
     72        if (graph.m_dominators->dominates(block, predecessor))
     73            continue;
     74        frequency = std::max(frequency, predecessor->executionCount);
     75    }
     76    BasicBlock* preHeader = insertionSet.insertBefore(block, frequency);
    7077
    7178    // FIXME: It would be great if we put some effort into enabling exitOK at this origin, if it
Note: See TracChangeset for help on using the changeset viewer.