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

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

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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-check-elimination.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 // 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void AnalyzeDominatedBlocks(HBasicBlock* root, State* initial) { 115 void AnalyzeDominatedBlocks(HBasicBlock* root, State* initial) {
116 InitializeStates(); 116 InitializeStates();
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 = State::Finish(StateAt(block), block, zone_); 125 State* state = StateAt(block);
126 126
127 if (block->IsReachable()) { 127 if (block->IsReachable()) {
128 ASSERT(state != NULL);
129 if (block->IsLoopHeader()) { 128 if (block->IsLoopHeader()) {
130 // Apply loop effects before analyzing loop body. 129 // Apply loop effects before analyzing loop body.
131 ComputeLoopEffects(block)->Apply(state); 130 ComputeLoopEffects(block)->Apply(state);
132 } else { 131 } else {
133 // Must have visited all predecessors before this block. 132 // Must have visited all predecessors before this block.
134 CheckPredecessorCount(block); 133 CheckPredecessorCount(block);
135 } 134 }
136 135
137 // Go through all instructions of the current block, updating the state. 136 // Go through all instructions of the current block, updating the state.
138 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { 137 for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
139 state = state->Process(it.Current(), zone_); 138 state = state->Process(it.Current(), zone_);
140 } 139 }
141 } 140 }
142 141
143 // Propagate the block state forward to all successor blocks. 142 // Propagate the block state forward to all successor blocks.
144 int max = block->end()->SuccessorCount(); 143 int max = block->end()->SuccessorCount();
145 for (int i = 0; i < max; i++) { 144 for (int i = 0; i < max; i++) {
146 HBasicBlock* succ = block->end()->SuccessorAt(i); 145 HBasicBlock* succ = block->end()->SuccessorAt(i);
147 IncrementPredecessorCount(succ); 146 IncrementPredecessorCount(succ);
148 147 if (StateAt(succ) == NULL) {
149 if (max == 1 && succ->predecessors()->length() == 1) { 148 // This is the first state to reach the successor.
150 // Optimization: successor can inherit this state. 149 if (max == 1 && succ->predecessors()->length() == 1) {
151 SetStateAt(succ, state); 150 // Optimization: successor can inherit this state.
151 SetStateAt(succ, state);
152 } else {
153 // Successor needs a copy of the state.
154 SetStateAt(succ, state->Copy(succ, block, zone_));
155 }
152 } else { 156 } else {
153 // Merge the current state with the state already at the successor. 157 // Merge the current state with the state already at the successor.
154 SetStateAt(succ, 158 SetStateAt(succ, StateAt(succ)->Merge(succ, state, block, zone_));
155 State::Merge(StateAt(succ), succ, state, block, zone_));
156 } 159 }
157 } 160 }
158 } 161 }
159 } 162 }
160 163
161 private: 164 private:
162 // Computes and caches the loop effects for the loop which has the given 165 // Computes and caches the loop effects for the loop which has the given
163 // block as its loop header. 166 // block as its loop header.
164 Effects* ComputeLoopEffects(HBasicBlock* block) { 167 Effects* ComputeLoopEffects(HBasicBlock* block) {
165 ASSERT(block->IsLoopHeader()); 168 ASSERT(block->IsLoopHeader());
(...skipping 67 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
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-gvn.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698