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

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

Issue 130613003: Eliminatable CheckMaps replaced with if(true) or if(false). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review notes applied, rev.2 Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 SetStateAt(root, initial); 117 SetStateAt(root, initial);
118 118
119 // Iterate all dominated blocks starting from the given start block. 119 // Iterate all dominated blocks starting from the given start block.
120 for (int i = root->block_id(); i < graph_->blocks()->length(); i++) { 120 for (int i = root->block_id(); i < graph_->blocks()->length(); i++) {
121 HBasicBlock* block = graph_->blocks()->at(i); 121 HBasicBlock* block = graph_->blocks()->at(i);
122 122
123 // Skip blocks not dominated by the root node. 123 // Skip blocks not dominated by the root node.
124 if (SkipNonDominatedBlock(root, block)) continue; 124 if (SkipNonDominatedBlock(root, block)) continue;
125 State* state = StateAt(block); 125 State* state = StateAt(block);
126 126
127 if (block->IsLoopHeader()) { 127 if (block->IsReachable()) {
128 // Apply loop effects before analyzing loop body. 128 if (block->IsLoopHeader()) {
129 ComputeLoopEffects(block)->Apply(state); 129 // Apply loop effects before analyzing loop body.
130 } else { 130 ComputeLoopEffects(block)->Apply(state);
131 // Must have visited all predecessors before this block. 131 } else {
132 CheckPredecessorCount(block); 132 // Must have visited all predecessors before this block.
133 } 133 CheckPredecessorCount(block);
134 }
134 135
135 // Go through all instructions of the current block, updating the state. 136 // Go through all instructions of the current block, updating the state.
136 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { 137 for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
137 state = state->Process(it.Current(), zone_); 138 state = state->Process(it.Current(), zone_);
139 }
138 } 140 }
139 141
140 // Propagate the block state forward to all successor blocks. 142 // Propagate the block state forward to all successor blocks.
141 int max = block->end()->SuccessorCount(); 143 int max = block->end()->SuccessorCount();
142 for (int i = 0; i < max; i++) { 144 for (int i = 0; i < max; i++) {
143 HBasicBlock* succ = block->end()->SuccessorAt(i); 145 HBasicBlock* succ = block->end()->SuccessorAt(i);
144 IncrementPredecessorCount(succ); 146 IncrementPredecessorCount(succ);
145 if (StateAt(succ) == NULL) { 147 if (StateAt(succ) == NULL) {
146 // This is the first state to reach the successor. 148 // This is the first state to reach the successor.
147 if (max == 1 && succ->predecessors()->length() == 1) { 149 if (max == 1 && succ->predecessors()->length() == 1) {
(...skipping 30 matching lines...) Expand all
178 HBasicBlock* member = graph_->blocks()->at(i); 180 HBasicBlock* member = graph_->blocks()->at(i);
179 if (i != block->block_id() && member->IsLoopHeader()) { 181 if (i != block->block_id() && member->IsLoopHeader()) {
180 // Recursively compute and cache the effects of the nested loop. 182 // Recursively compute and cache the effects of the nested loop.
181 ASSERT(member->loop_information()->parent_loop() == loop); 183 ASSERT(member->loop_information()->parent_loop() == loop);
182 Effects* nested = ComputeLoopEffects(member); 184 Effects* nested = ComputeLoopEffects(member);
183 effects->Union(nested, zone_); 185 effects->Union(nested, zone_);
184 // Skip the nested loop's blocks. 186 // Skip the nested loop's blocks.
185 i = member->loop_information()->GetLastBackEdge()->block_id(); 187 i = member->loop_information()->GetLastBackEdge()->block_id();
186 } else { 188 } else {
187 // Process all the effects of the block. 189 // Process all the effects of the block.
190 if (member->IsUnreachable()) continue;
188 ASSERT(member->current_loop() == loop); 191 ASSERT(member->current_loop() == loop);
189 for (HInstructionIterator it(member); !it.Done(); it.Advance()) { 192 for (HInstructionIterator it(member); !it.Done(); it.Advance()) {
190 effects->Process(it.Current(), zone_); 193 effects->Process(it.Current(), zone_);
191 } 194 }
192 } 195 }
193 } 196 }
194 return effects; 197 return effects;
195 } 198 }
196 199
197 inline bool SkipNonDominatedBlock(HBasicBlock* root, HBasicBlock* other) { 200 inline bool SkipNonDominatedBlock(HBasicBlock* root, HBasicBlock* other) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ZoneList<int> pred_counts_; // Finished predecessors (by block id). 236 ZoneList<int> pred_counts_; // Finished predecessors (by block id).
234 #endif 237 #endif
235 ZoneList<State*> block_states_; // Block states (by block id). 238 ZoneList<State*> block_states_; // Block states (by block id).
236 ZoneList<Effects*> loop_effects_; // Loop effects (by block id). 239 ZoneList<Effects*> loop_effects_; // Loop effects (by block id).
237 }; 240 };
238 241
239 242
240 } } // namespace v8::internal 243 } } // namespace v8::internal
241 244
242 #endif // V8_HYDROGEN_FLOW_ENGINE_H_ 245 #endif // V8_HYDROGEN_FLOW_ENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698