Ignore:
Timestamp:
Jul 24, 2013, 9:02:17 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: don't insert ForceOSRExits except for inadequate coverage
https://bugs.webkit.org/show_bug.cgi?id=117363

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Previously (in http://trac.webkit.org/changeset/151303) I made it so that we
inserted ForceOSRExits more eagerly. I now think it's better to have
contradictions execute normally and exit with full OSR exit profiling. It's
better at catching the few cases where the DFG will end up with different
types than the baseline engines.

This simplifies a bunch of code. For example it gets rid of
ConstantFoldingPhase::paintUnreachableCode().

You can think of this as a partial roll-out of r151303, except that it uses
the facilities introduced by that patch to give us run-time assertions that
check the CFA's correctness: if the CFA thought that something was a
contradiction but the code didn't exit, we'll now trap.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::AbstractState):
(JSC::DFG::AbstractState::startExecuting):
(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::execute):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):
(DFG):

  • dfg/DFGAbstractState.h:

(AbstractState):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::run):
(JSC::DFG::ConstantFoldingPhase::foldConstants):
(ConstantFoldingPhase):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):

LayoutTests:

Reviewed by Mark Hahnenberg.

Convert this test, since this was the test originally added for
ConstantFoldingPhase::paintUnreachableCode(). I wanted to make sure that I had good coverage
for this since I am removing that method.

  • fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt:
  • fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractState.h

    r153213 r153215  
    9494    };
    9595   
    96     enum ExecutionMode {
    97         // If we encounter a contradiction, assume that this might just
    98         // be because we haven't converged yet.
    99         StillConverging,
    100        
    101         // If we encounter a contradition, assume that this contradiction
    102         // is real and report it to the profiling infrastructure as if it
    103         // happened at run time.
    104         AfterConvergence,
    105        
    106         // Assume that there cannot be any contradictions other than
    107         // ForceOSRExit because we have already cleaned the graph.
    108         CleanFiltration
    109     };
    110    
    11196    AbstractState(Graph&);
    11297   
     
    192177    // This is guaranteed to be equivalent to doing:
    193178    //
    194     // if (state.startExecuting(index, executionMode)) {
     179    // if (state.startExecuting(index)) {
    195180    //     state.executeEdges(index);
    196181    //     result = state.executeEffects(index);
    197182    // } else
    198183    //     result = true;
    199     bool execute(unsigned indexInBlock, ExecutionMode);
     184    bool execute(unsigned indexInBlock);
    200185   
    201186    // Indicate the start of execution of the node. It resets any state in the node,
     
    205190    // analysis concluded that the node can exit, you should probably set that
    206191    // information aside prior to calling startExecuting().
    207     bool startExecuting(Node*, ExecutionMode);
    208     bool startExecuting(unsigned indexInBlock, ExecutionMode);
     192    bool startExecuting(Node*);
     193    bool startExecuting(unsigned indexInBlock);
    209194   
    210195    // Abstractly execute the edges of the given node. This runs filterEdgeByUse()
     
    248233   
    249234    template<typename T>
    250     FiltrationResult filter(T node, const StructureSet& set, ExitKind exitKind)
    251     {
    252         return filter(forNode(node), set, exitKind);
     235    FiltrationResult filter(T node, const StructureSet& set)
     236    {
     237        return filter(forNode(node), set);
    253238    }
    254239   
    255240    template<typename T>
    256     FiltrationResult filterArrayModes(
    257         T node, ArrayModes arrayModes, ExitKind exitKind = BadIndexingType)
    258     {
    259         return filterArrayModes(forNode(node), arrayModes, exitKind);
     241    FiltrationResult filterArrayModes(T node, ArrayModes arrayModes)
     242    {
     243        return filterArrayModes(forNode(node), arrayModes);
    260244    }
    261245   
    262246    template<typename T>
    263     FiltrationResult filter(T node, SpeculatedType type, ExitKind exitKind = BadType)
    264     {
    265         return filter(forNode(node), type, exitKind);
     247    FiltrationResult filter(T node, SpeculatedType type)
     248    {
     249        return filter(forNode(node), type);
    266250    }
    267251   
    268252    template<typename T>
    269     FiltrationResult filterByValue(T node, JSValue value, ExitKind exitKind)
    270     {
    271         return filterByValue(forNode(node), value, exitKind);
    272     }
    273    
    274     FiltrationResult filter(AbstractValue&, const StructureSet&, ExitKind);
    275     FiltrationResult filterArrayModes(AbstractValue&, ArrayModes, ExitKind = BadIndexingType);
    276     FiltrationResult filter(AbstractValue&, SpeculatedType, ExitKind = BadType);
    277     FiltrationResult filterByValue(AbstractValue&, JSValue, ExitKind);
    278    
    279     void bail(ExitKind);
     253    FiltrationResult filterByValue(T node, JSValue value)
     254    {
     255        return filterByValue(forNode(node), value);
     256    }
     257   
     258    FiltrationResult filter(AbstractValue&, const StructureSet&);
     259    FiltrationResult filterArrayModes(AbstractValue&, ArrayModes);
     260    FiltrationResult filter(AbstractValue&, SpeculatedType);
     261    FiltrationResult filterByValue(AbstractValue&, JSValue);
    280262   
    281263private:
     
    333315    BasicBlock* m_block;
    334316    Node* m_currentNode;
    335     ExecutionMode m_executionMode;
    336317   
    337318    bool m_haveStructures;
Note: See TracChangeset for help on using the changeset viewer.