V8 Project
v8::internal::HFlowEngine< State, Effects > Class Template Reference

#include <hydrogen-flow-engine.h>

+ Collaboration diagram for v8::internal::HFlowEngine< State, Effects >:

Public Member Functions

 HFlowEngine (HGraph *graph, Zone *zone)
 
StateAnalyzeOneBlock (HBasicBlock *block, State *state)
 
void AnalyzeDominatedBlocks (HBasicBlock *root, State *initial)
 

Private Member Functions

EffectsComputeLoopEffects (HBasicBlock *block)
 
bool SkipNonDominatedBlock (HBasicBlock *root, HBasicBlock *other)
 
StateStateAt (HBasicBlock *block)
 
void SetStateAt (HBasicBlock *block, State *state)
 
void InitializeStates ()
 
void CheckPredecessorCount (HBasicBlock *block)
 
void IncrementPredecessorCount (HBasicBlock *block)
 

Private Attributes

HGraph * graph_
 
Zonezone_
 
ZoneList< State * > block_states_
 
ZoneList< Effects * > loop_effects_
 

Detailed Description

template<class State, class Effects>
class v8::internal::HFlowEngine< State, Effects >

Definition at line 68 of file hydrogen-flow-engine.h.

Constructor & Destructor Documentation

◆ HFlowEngine()

template<class State , class Effects >
v8::internal::HFlowEngine< State, Effects >::HFlowEngine ( HGraph *  graph,
Zone zone 
)
inline

Definition at line 70 of file hydrogen-flow-engine.h.

71  : graph_(graph),
72  zone_(zone),
73 #if DEBUG
74  pred_counts_(graph->blocks()->length(), zone),
75 #endif
76  block_states_(graph->blocks()->length(), zone),
77  loop_effects_(graph->blocks()->length(), zone) {
78  loop_effects_.AddBlock(NULL, graph_->blocks()->length(), zone);
79  }
ZoneList< Effects * > loop_effects_
ZoneList< State * > block_states_
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References v8::internal::HFlowEngine< State, Effects >::graph_, v8::internal::HFlowEngine< State, Effects >::loop_effects_, and NULL.

Member Function Documentation

◆ AnalyzeDominatedBlocks()

template<class State , class Effects >
void v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks ( HBasicBlock *  root,
State initial 
)
inline

Definition at line 92 of file hydrogen-flow-engine.h.

92  {
94  SetStateAt(root, initial);
95 
96  // Iterate all dominated blocks starting from the given start block.
97  for (int i = root->block_id(); i < graph_->blocks()->length(); i++) {
98  HBasicBlock* block = graph_->blocks()->at(i);
99 
100  // Skip blocks not dominated by the root node.
101  if (SkipNonDominatedBlock(root, block)) continue;
102  State* state = State::Finish(StateAt(block), block, zone_);
103 
104  if (block->IsReachable()) {
105  DCHECK(state != NULL);
106  if (block->IsLoopHeader()) {
107  // Apply loop effects before analyzing loop body.
108  ComputeLoopEffects(block)->Apply(state);
109  } else {
110  // Must have visited all predecessors before this block.
111  CheckPredecessorCount(block);
112  }
113 
114  // Go through all instructions of the current block, updating the state.
115  for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
116  state = state->Process(it.Current(), zone_);
117  }
118  }
119 
120  // Propagate the block state forward to all successor blocks.
121  int max = block->end()->SuccessorCount();
122  for (int i = 0; i < max; i++) {
123  HBasicBlock* succ = block->end()->SuccessorAt(i);
125 
126  if (max == 1 && succ->predecessors()->length() == 1) {
127  // Optimization: successor can inherit this state.
128  SetStateAt(succ, state);
129  } else {
130  // Merge the current state with the state already at the successor.
131  SetStateAt(succ,
132  State::Merge(StateAt(succ), succ, state, block, zone_));
133  }
134  }
135  }
136  }
State * StateAt(HBasicBlock *block)
void SetStateAt(HBasicBlock *block, State *state)
Effects * ComputeLoopEffects(HBasicBlock *block)
bool SkipNonDominatedBlock(HBasicBlock *root, HBasicBlock *other)
void CheckPredecessorCount(HBasicBlock *block)
void IncrementPredecessorCount(HBasicBlock *block)
static State * Finish(State *state, HBasicBlock *block, Zone *zone)
static State * Merge(State *succ_state, HBasicBlock *succ_block, State *pred_state, HBasicBlock *pred_block, Zone *zone)
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::Effects< Var, kNoVar >::Apply(), v8::internal::HFlowEngine< State, Effects >::CheckPredecessorCount(), v8::internal::HFlowEngine< State, Effects >::ComputeLoopEffects(), DCHECK, v8::internal::State::Finish(), v8::internal::HFlowEngine< State, Effects >::graph_, v8::internal::HFlowEngine< State, Effects >::IncrementPredecessorCount(), v8::internal::HFlowEngine< State, Effects >::InitializeStates(), v8::internal::State::Merge(), NULL, v8::internal::State::Process(), v8::internal::HFlowEngine< State, Effects >::SetStateAt(), v8::internal::HFlowEngine< State, Effects >::SkipNonDominatedBlock(), v8::internal::HFlowEngine< State, Effects >::StateAt(), and v8::internal::HFlowEngine< State, Effects >::zone_.

Referenced by v8::internal::HCheckEliminationPhase::Run(), v8::internal::HLoadEliminationPhase::Run(), and v8::internal::HMergeRemovableSimulatesPhase::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AnalyzeOneBlock()

template<class State , class Effects >
State* v8::internal::HFlowEngine< State, Effects >::AnalyzeOneBlock ( HBasicBlock *  block,
State state 
)
inline

Definition at line 82 of file hydrogen-flow-engine.h.

82  {
83  // Go through all instructions of the current block, updating the state.
84  for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
85  state = state->Process(it.Current(), zone_);
86  }
87  return state;
88  }

References v8::internal::State::Process(), and v8::internal::HFlowEngine< State, Effects >::zone_.

Referenced by v8::internal::HCheckEliminationPhase::Run(), and v8::internal::HLoadEliminationPhase::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckPredecessorCount()

template<class State , class Effects >
void v8::internal::HFlowEngine< State, Effects >::CheckPredecessorCount ( HBasicBlock *  block)
inlineprivate

Definition at line 197 of file hydrogen-flow-engine.h.

197  {
198  DCHECK(block->predecessors()->length() == pred_counts_[block->block_id()]);
199  }

References DCHECK.

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the caller graph for this function:

◆ ComputeLoopEffects()

template<class State , class Effects >
Effects* v8::internal::HFlowEngine< State, Effects >::ComputeLoopEffects ( HBasicBlock *  block)
inlineprivate

Definition at line 141 of file hydrogen-flow-engine.h.

141  {
142  DCHECK(block->IsLoopHeader());
143  Effects* effects = loop_effects_[block->block_id()];
144  if (effects != NULL) return effects; // Already analyzed this loop.
145 
146  effects = new(zone_) Effects(zone_);
147  loop_effects_[block->block_id()] = effects;
148  if (effects->Disabled()) return effects; // No effects for this analysis.
149 
150  HLoopInformation* loop = block->loop_information();
151  int end = loop->GetLastBackEdge()->block_id();
152  // Process the blocks between the header and the end.
153  for (int i = block->block_id(); i <= end; i++) {
154  HBasicBlock* member = graph_->blocks()->at(i);
155  if (i != block->block_id() && member->IsLoopHeader()) {
156  // Recursively compute and cache the effects of the nested loop.
157  DCHECK(member->loop_information()->parent_loop() == loop);
158  Effects* nested = ComputeLoopEffects(member);
159  effects->Union(nested, zone_);
160  // Skip the nested loop's blocks.
161  i = member->loop_information()->GetLastBackEdge()->block_id();
162  } else {
163  // Process all the effects of the block.
164  if (member->IsUnreachable()) continue;
165  DCHECK(member->current_loop() == loop);
166  for (HInstructionIterator it(member); !it.Done(); it.Advance()) {
167  effects->Process(it.Current(), zone_);
168  }
169  }
170  }
171  return effects;
172  }

References DCHECK, v8::internal::Effects< Var, kNoVar >::Disabled(), v8::internal::HFlowEngine< State, Effects >::graph_, v8::internal::HFlowEngine< State, Effects >::loop_effects_, NULL, v8::internal::Effects< Var, kNoVar >::Process(), v8::internal::Effects< Var, kNoVar >::Union(), and v8::internal::HFlowEngine< State, Effects >::zone_.

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IncrementPredecessorCount()

template<class State , class Effects >
void v8::internal::HFlowEngine< State, Effects >::IncrementPredecessorCount ( HBasicBlock *  block)
inlineprivate

Definition at line 201 of file hydrogen-flow-engine.h.

201  {
202 #if DEBUG
203  pred_counts_[block->block_id()]++;
204 #endif
205  }

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the caller graph for this function:

◆ InitializeStates()

template<class State , class Effects >
void v8::internal::HFlowEngine< State, Effects >::InitializeStates ( )
inlineprivate

Definition at line 188 of file hydrogen-flow-engine.h.

188  {
189 #if DEBUG
190  pred_counts_.Rewind(0);
191  pred_counts_.AddBlock(0, graph_->blocks()->length(), zone_);
192 #endif
193  block_states_.Rewind(0);
194  block_states_.AddBlock(NULL, graph_->blocks()->length(), zone_);
195  }

References v8::internal::HFlowEngine< State, Effects >::block_states_, v8::internal::HFlowEngine< State, Effects >::graph_, NULL, and v8::internal::HFlowEngine< State, Effects >::zone_.

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the caller graph for this function:

◆ SetStateAt()

template<class State , class Effects >
void v8::internal::HFlowEngine< State, Effects >::SetStateAt ( HBasicBlock *  block,
State state 
)
inlineprivate

Definition at line 184 of file hydrogen-flow-engine.h.

184  {
185  block_states_.Set(block->block_id(), state);
186  }

References v8::internal::HFlowEngine< State, Effects >::block_states_.

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the caller graph for this function:

◆ SkipNonDominatedBlock()

template<class State , class Effects >
bool v8::internal::HFlowEngine< State, Effects >::SkipNonDominatedBlock ( HBasicBlock *  root,
HBasicBlock *  other 
)
inlineprivate

Definition at line 174 of file hydrogen-flow-engine.h.

174  {
175  if (root->block_id() == 0) return false; // Visit the whole graph.
176  if (root == other) return false; // Always visit the root.
177  return !root->Dominates(other); // Only visit dominated blocks.
178  }

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the caller graph for this function:

◆ StateAt()

template<class State , class Effects >
State* v8::internal::HFlowEngine< State, Effects >::StateAt ( HBasicBlock *  block)
inlineprivate

Definition at line 180 of file hydrogen-flow-engine.h.

180  {
181  return block_states_.at(block->block_id());
182  }

References v8::internal::HFlowEngine< State, Effects >::block_states_.

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

+ Here is the caller graph for this function:

Member Data Documentation

◆ block_states_

◆ graph_

◆ loop_effects_

◆ zone_


The documentation for this class was generated from the following file: