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/DFGBlockInsertionSet.cpp

    r164229 r164459  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5050}
    5151
    52 BasicBlock* BlockInsertionSet::insert(size_t index)
     52BasicBlock* BlockInsertionSet::insert(size_t index, float executionCount)
    5353{
    5454    RefPtr<BasicBlock> block = adoptRef(new BasicBlock(
    5555        UINT_MAX,
    5656        m_graph.block(0)->variablesAtHead.numberOfArguments(),
    57         m_graph.block(0)->variablesAtHead.numberOfLocals()));
     57        m_graph.block(0)->variablesAtHead.numberOfLocals(),
     58        executionCount));
    5859    block->isReachable = true;
    5960    insert(index, block);
     
    6162}
    6263
    63 BasicBlock* BlockInsertionSet::insertBefore(BasicBlock* before)
     64BasicBlock* BlockInsertionSet::insertBefore(BasicBlock* before, float executionCount)
    6465{
    65     return insert(before->index);
     66    return insert(before->index, executionCount);
    6667}
    6768
Note: See TracChangeset for help on using the changeset viewer.