Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: src/hydrogen-flow-engine.h

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | src/hydrogen-gvn.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HYDROGEN_FLOW_ENGINE_H_ 5 #ifndef V8_HYDROGEN_FLOW_ENGINE_H_
6 #define V8_HYDROGEN_FLOW_ENGINE_H_ 6 #define V8_HYDROGEN_FLOW_ENGINE_H_
7 7
8 #include "src/hydrogen.h" 8 #include "src/hydrogen.h"
9 #include "src/hydrogen-instructions.h" 9 #include "src/hydrogen-instructions.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // Iterate all dominated blocks starting from the given start block. 96 // Iterate all dominated blocks starting from the given start block.
97 for (int i = root->block_id(); i < graph_->blocks()->length(); i++) { 97 for (int i = root->block_id(); i < graph_->blocks()->length(); i++) {
98 HBasicBlock* block = graph_->blocks()->at(i); 98 HBasicBlock* block = graph_->blocks()->at(i);
99 99
100 // Skip blocks not dominated by the root node. 100 // Skip blocks not dominated by the root node.
101 if (SkipNonDominatedBlock(root, block)) continue; 101 if (SkipNonDominatedBlock(root, block)) continue;
102 State* state = State::Finish(StateAt(block), block, zone_); 102 State* state = State::Finish(StateAt(block), block, zone_);
103 103
104 if (block->IsReachable()) { 104 if (block->IsReachable()) {
105 ASSERT(state != NULL); 105 DCHECK(state != NULL);
106 if (block->IsLoopHeader()) { 106 if (block->IsLoopHeader()) {
107 // Apply loop effects before analyzing loop body. 107 // Apply loop effects before analyzing loop body.
108 ComputeLoopEffects(block)->Apply(state); 108 ComputeLoopEffects(block)->Apply(state);
109 } else { 109 } else {
110 // Must have visited all predecessors before this block. 110 // Must have visited all predecessors before this block.
111 CheckPredecessorCount(block); 111 CheckPredecessorCount(block);
112 } 112 }
113 113
114 // Go through all instructions of the current block, updating the state. 114 // Go through all instructions of the current block, updating the state.
115 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { 115 for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
(...skipping 16 matching lines...) Expand all
132 State::Merge(StateAt(succ), succ, state, block, zone_)); 132 State::Merge(StateAt(succ), succ, state, block, zone_));
133 } 133 }
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 private: 138 private:
139 // Computes and caches the loop effects for the loop which has the given 139 // Computes and caches the loop effects for the loop which has the given
140 // block as its loop header. 140 // block as its loop header.
141 Effects* ComputeLoopEffects(HBasicBlock* block) { 141 Effects* ComputeLoopEffects(HBasicBlock* block) {
142 ASSERT(block->IsLoopHeader()); 142 DCHECK(block->IsLoopHeader());
143 Effects* effects = loop_effects_[block->block_id()]; 143 Effects* effects = loop_effects_[block->block_id()];
144 if (effects != NULL) return effects; // Already analyzed this loop. 144 if (effects != NULL) return effects; // Already analyzed this loop.
145 145
146 effects = new(zone_) Effects(zone_); 146 effects = new(zone_) Effects(zone_);
147 loop_effects_[block->block_id()] = effects; 147 loop_effects_[block->block_id()] = effects;
148 if (effects->Disabled()) return effects; // No effects for this analysis. 148 if (effects->Disabled()) return effects; // No effects for this analysis.
149 149
150 HLoopInformation* loop = block->loop_information(); 150 HLoopInformation* loop = block->loop_information();
151 int end = loop->GetLastBackEdge()->block_id(); 151 int end = loop->GetLastBackEdge()->block_id();
152 // Process the blocks between the header and the end. 152 // Process the blocks between the header and the end.
153 for (int i = block->block_id(); i <= end; i++) { 153 for (int i = block->block_id(); i <= end; i++) {
154 HBasicBlock* member = graph_->blocks()->at(i); 154 HBasicBlock* member = graph_->blocks()->at(i);
155 if (i != block->block_id() && member->IsLoopHeader()) { 155 if (i != block->block_id() && member->IsLoopHeader()) {
156 // Recursively compute and cache the effects of the nested loop. 156 // Recursively compute and cache the effects of the nested loop.
157 ASSERT(member->loop_information()->parent_loop() == loop); 157 DCHECK(member->loop_information()->parent_loop() == loop);
158 Effects* nested = ComputeLoopEffects(member); 158 Effects* nested = ComputeLoopEffects(member);
159 effects->Union(nested, zone_); 159 effects->Union(nested, zone_);
160 // Skip the nested loop's blocks. 160 // Skip the nested loop's blocks.
161 i = member->loop_information()->GetLastBackEdge()->block_id(); 161 i = member->loop_information()->GetLastBackEdge()->block_id();
162 } else { 162 } else {
163 // Process all the effects of the block. 163 // Process all the effects of the block.
164 if (member->IsUnreachable()) continue; 164 if (member->IsUnreachable()) continue;
165 ASSERT(member->current_loop() == loop); 165 DCHECK(member->current_loop() == loop);
166 for (HInstructionIterator it(member); !it.Done(); it.Advance()) { 166 for (HInstructionIterator it(member); !it.Done(); it.Advance()) {
167 effects->Process(it.Current(), zone_); 167 effects->Process(it.Current(), zone_);
168 } 168 }
169 } 169 }
170 } 170 }
171 return effects; 171 return effects;
172 } 172 }
173 173
174 inline bool SkipNonDominatedBlock(HBasicBlock* root, HBasicBlock* other) { 174 inline bool SkipNonDominatedBlock(HBasicBlock* root, HBasicBlock* other) {
175 if (root->block_id() == 0) return false; // Visit the whole graph. 175 if (root->block_id() == 0) return false; // Visit the whole graph.
(...skipping 12 matching lines...) Expand all
188 inline void InitializeStates() { 188 inline void InitializeStates() {
189 #if DEBUG 189 #if DEBUG
190 pred_counts_.Rewind(0); 190 pred_counts_.Rewind(0);
191 pred_counts_.AddBlock(0, graph_->blocks()->length(), zone_); 191 pred_counts_.AddBlock(0, graph_->blocks()->length(), zone_);
192 #endif 192 #endif
193 block_states_.Rewind(0); 193 block_states_.Rewind(0);
194 block_states_.AddBlock(NULL, graph_->blocks()->length(), zone_); 194 block_states_.AddBlock(NULL, graph_->blocks()->length(), zone_);
195 } 195 }
196 196
197 inline void CheckPredecessorCount(HBasicBlock* block) { 197 inline void CheckPredecessorCount(HBasicBlock* block) {
198 ASSERT(block->predecessors()->length() == pred_counts_[block->block_id()]); 198 DCHECK(block->predecessors()->length() == pred_counts_[block->block_id()]);
199 } 199 }
200 200
201 inline void IncrementPredecessorCount(HBasicBlock* block) { 201 inline void IncrementPredecessorCount(HBasicBlock* block) {
202 #if DEBUG 202 #if DEBUG
203 pred_counts_[block->block_id()]++; 203 pred_counts_[block->block_id()]++;
204 #endif 204 #endif
205 } 205 }
206 206
207 HGraph* graph_; // The hydrogen graph. 207 HGraph* graph_; // The hydrogen graph.
208 Zone* zone_; // Temporary zone. 208 Zone* zone_; // Temporary zone.
209 #if DEBUG 209 #if DEBUG
210 ZoneList<int> pred_counts_; // Finished predecessors (by block id). 210 ZoneList<int> pred_counts_; // Finished predecessors (by block id).
211 #endif 211 #endif
212 ZoneList<State*> block_states_; // Block states (by block id). 212 ZoneList<State*> block_states_; // Block states (by block id).
213 ZoneList<Effects*> loop_effects_; // Loop effects (by block id). 213 ZoneList<Effects*> loop_effects_; // Loop effects (by block id).
214 }; 214 };
215 215
216 216
217 } } // namespace v8::internal 217 } } // namespace v8::internal
218 218
219 #endif // V8_HYDROGEN_FLOW_ENGINE_H_ 219 #endif // V8_HYDROGEN_FLOW_ENGINE_H_
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | src/hydrogen-gvn.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698