• oliver@apple.com's avatar
    fourthTier: Add a phase to create loop pre-headers · 5663e31c
    oliver@apple.com authored
    Reviewed by Oliver Hunt.
    Add a loop pre-header creation phase. Any loop that doesn't already have
    just one predecessor that isn't part of the loop has a pre-header
    prepended. All non-loop predecessors then jump to that pre-header.
    Also fix a handful of bugs:
    - DFG::Analysis should set m_valid before running the analysis, since that
      makes it easier to use ASSERT(m_valid) in the analysis' methods, which
      may be called by the analysis before the analysis completes. NaturalLoops
      does this with loopsOf().
    - NaturalLoops::headerOf() was missing a check for innerMostLoopOf()
      returning 0, since that'll happen if the block isn't in any loop.
    - Change BlockInsertionSet to dethread the graph, since anyone using it
      will want to do so.
    - Change dethreading to ignore SSA form graphs.
    This also adds NaturalLoops::belongsTo(), which I always used in the
    pre-header creation phase. I didn't end up using it but I'll probably use
    it in the near future.
    * JavaScriptCore.xcodeproj/project.pbxproj:
    * dfg/DFGAnalysis.h:
    * dfg/DFGBlockInsertionSet.cpp:
    * dfg/DFGCriticalEdgeBreakingPhase.cpp:
    * dfg/DFGGraph.cpp:
    * dfg/DFGLoopPreHeaderCreationPhase.cpp: Added.
    * dfg/DFGLoopPreHeaderCreationPhase.h: Added.
    * dfg/DFGNaturalLoops.h:
    * dfg/DFGPlan.cpp:
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153279 268f45cc-cd09-0410-ab3c-d52691b4dbfc