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

fourthTier: DFG should do a high-level LICM before going to FTL
https://bugs.webkit.org/show_bug.cgi?id=118749

Reviewed by Oliver Hunt.

Implements LICM hoisting for nodes that never write anything and never read
things that are clobbered by the loop. There are some other preconditions for
hoisting, see DFGLICMPhase.cpp.

Also did a few fixes:

  • ClobberSet::add was failing to switch Super entries to Direct entries in some cases.
  • DFGClobberize.cpp needed to #include "Operations.h".
  • DCEPhase needs to process the graph in reverse DFS order, when we're in SSA.
  • AbstractInterpreter can now execute a Node without knowing its indexInBlock. Knowing the indexInBlock is an optional optimization that all other clients of AI still opt into, but LICM doesn't.

This makes the FTL a 2.19x speed-up on imaging-gaussian-blur.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGAbstractInterpreter.h:

(AbstractInterpreter):

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):
(JSC::DFG::::execute):
(DFG):
(JSC::DFG::::clobberWorld):
(JSC::DFG::::clobberStructures):

  • dfg/DFGAtTailAbstractState.cpp: Added.

(DFG):
(JSC::DFG::AtTailAbstractState::AtTailAbstractState):
(JSC::DFG::AtTailAbstractState::~AtTailAbstractState):
(JSC::DFG::AtTailAbstractState::createValueForNode):
(JSC::DFG::AtTailAbstractState::forNode):

  • dfg/DFGAtTailAbstractState.h: Added.

(DFG):
(AtTailAbstractState):
(JSC::DFG::AtTailAbstractState::initializeTo):
(JSC::DFG::AtTailAbstractState::forNode):
(JSC::DFG::AtTailAbstractState::variables):
(JSC::DFG::AtTailAbstractState::block):
(JSC::DFG::AtTailAbstractState::isValid):
(JSC::DFG::AtTailAbstractState::setDidClobber):
(JSC::DFG::AtTailAbstractState::setIsValid):
(JSC::DFG::AtTailAbstractState::setBranchDirection):
(JSC::DFG::AtTailAbstractState::setFoundConstants):
(JSC::DFG::AtTailAbstractState::haveStructures):
(JSC::DFG::AtTailAbstractState::setHaveStructures):

  • dfg/DFGBasicBlock.h:

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

  • dfg/DFGBasicBlockInlines.h:

(DFG):

  • dfg/DFGClobberSet.cpp:

(JSC::DFG::ClobberSet::add):
(JSC::DFG::ClobberSet::addAll):

  • dfg/DFGClobberize.cpp:

(JSC::DFG::doesWrites):

  • dfg/DFGClobberize.h:

(DFG):

  • dfg/DFGDCEPhase.cpp:

(JSC::DFG::DCEPhase::DCEPhase):
(JSC::DFG::DCEPhase::run):
(JSC::DFG::DCEPhase::fixupBlock):
(DCEPhase):

  • dfg/DFGEdgeDominates.h: Added.

(DFG):
(EdgeDominates):
(JSC::DFG::EdgeDominates::EdgeDominates):
(JSC::DFG::EdgeDominates::operator()):
(JSC::DFG::EdgeDominates::result):
(JSC::DFG::edgesDominate):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::checkArray):

  • dfg/DFGLICMPhase.cpp: Added.

(LICMPhase):
(JSC::DFG::LICMPhase::LICMPhase):
(JSC::DFG::LICMPhase::run):
(JSC::DFG::LICMPhase::attemptHoist):
(DFG):
(JSC::DFG::performLICM):

  • dfg/DFGLICMPhase.h: Added.

(DFG):

  • dfg/DFGPlan.cpp:

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

File:
1 copied

Legend:

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

    r153294 r153295  
    2424 */
    2525
    26 #ifndef DFGBasicBlockInlines_h
    27 #define DFGBasicBlockInlines_h
     26#ifndef DFGAtTailAbstractState_h
     27#define DFGAtTailAbstractState_h
    2828
     29#include <wtf/Platform.h>
     30
     31#if ENABLE(DFG_JIT)
     32
     33#include "DFGAbstractValue.h"
    2934#include "DFGBasicBlock.h"
    3035#include "DFGGraph.h"
    3136
    32 #if ENABLE(DFG_JIT)
     37namespace JSC { namespace DFG {
    3338
    34 namespace JSC { namespace DFG {
     39class AtTailAbstractState {
     40public:
     41    AtTailAbstractState();
     42   
     43    ~AtTailAbstractState();
     44   
     45    void initializeTo(BasicBlock* block)
     46    {
     47        m_block = block;
     48    }
     49   
     50    void createValueForNode(Node*);
     51    AbstractValue& forNode(Node*);
     52    AbstractValue& forNode(Edge edge) { return forNode(edge.node()); }
     53    Operands<AbstractValue>& variables() { return m_block->valuesAtTail; }
     54   
     55    BasicBlock* block() const { return m_block; }
     56   
     57    bool isValid() { return m_block->cfaDidFinish; }
     58   
     59    void setDidClobber(bool) { }
     60    void setIsValid(bool isValid) { m_block->cfaDidFinish = isValid; }
     61    void setBranchDirection(BranchDirection) { }
     62    void setFoundConstants(bool) { }
     63    bool haveStructures() const { return true; } // It's always safe to return true.
     64    void setHaveStructures(bool) { }
    3565
    36 #define DFG_DEFINE_APPEND_NODE(templatePre, templatePost, typeParams, valueParamsComma, valueParams, valueArgs) \
    37     templatePre typeParams templatePost inline Node* BasicBlock::appendNode(Graph& graph, SpeculatedType type valueParamsComma valueParams) \
    38     { \
    39         Node* result = graph.addNode(type valueParamsComma valueArgs); \
    40         append(result); \
    41         return result; \
    42     }
    43     DFG_VARIADIC_TEMPLATE_FUNCTION(DFG_DEFINE_APPEND_NODE)
    44 #undef DFG_DEFINE_APPEND_NODE
    45 
    46 #define DFG_DEFINE_APPEND_NODE(templatePre, templatePost, typeParams, valueParamsComma, valueParams, valueArgs) \
    47     templatePre typeParams templatePost inline Node* BasicBlock::appendNonTerminal(Graph& graph, SpeculatedType type valueParamsComma valueParams) \
    48     { \
    49         Node* result = graph.addNode(type valueParamsComma valueArgs); \
    50         append(last()); \
    51         at(size() - 2) = result; \
    52         return result; \
    53     }
    54     DFG_VARIADIC_TEMPLATE_FUNCTION(DFG_DEFINE_APPEND_NODE)
    55 #undef DFG_DEFINE_APPEND_NODE
     66private:
     67    BasicBlock* m_block;
     68};
    5669
    5770} } // namespace JSC::DFG
     
    5972#endif // ENABLE(DFG_JIT)
    6073
    61 #endif // DFGBasicBlockInlines_h
     74#endif // DFGAtTailAbstractState_h
    6275
Note: See TracChangeset for help on using the changeset viewer.