Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2222 } | 2222 } |
| 2223 | 2223 |
| 2224 return dom_block->Dominates(use_block); | 2224 return dom_block->Dominates(use_block); |
| 2225 } | 2225 } |
| 2226 | 2226 |
| 2227 | 2227 |
| 2228 void RangeAnalysis::RenameDominatedUses(Definition* def, | 2228 void RangeAnalysis::RenameDominatedUses(Definition* def, |
| 2229 Instruction* dom, | 2229 Instruction* dom, |
| 2230 Definition* other) { | 2230 Definition* other) { |
| 2231 Value* next_use = NULL; | 2231 Value* next_use = NULL; |
| 2232 Value* prev_use = NULL; | |
| 2233 for (Value* use = def->input_use_list(); | 2232 for (Value* use = def->input_use_list(); |
| 2234 use != NULL; | 2233 use != NULL; |
| 2235 use = next_use) { | 2234 use = next_use) { |
| 2236 next_use = use->next_use(); | 2235 next_use = use->next_use(); |
| 2237 | 2236 |
| 2238 // Skip dead phis. | 2237 // Skip dead phis. |
| 2239 if (use->instruction()->IsPhi() && | 2238 PhiInstr* phi = use->instruction()->AsPhi(); |
| 2240 !use->instruction()->AsPhi()->is_alive()) { | 2239 if ((phi != NULL) && !phi->is_alive()) continue; |
| 2241 prev_use = use; | |
| 2242 continue; | |
| 2243 } | |
| 2244 | 2240 |
| 2245 if (IsDominatedUse(dom, use)) { | 2241 if (IsDominatedUse(dom, use)) { |
| 2246 if (prev_use != NULL) { | 2242 use->RemoveFromInputUseList(); |
|
Kevin Millikin (Google)
2013/01/31 12:44:54
In another change, I will create a single operatio
| |
| 2247 prev_use->set_next_use(next_use); | |
| 2248 } else { | |
| 2249 def->set_input_use_list(next_use); | |
| 2250 } | |
| 2251 use->set_definition(other); | 2243 use->set_definition(other); |
| 2252 use->AddToInputUseList(); | 2244 use->AddToInputUseList(); |
| 2253 } else { | |
| 2254 prev_use = use; | |
| 2255 } | 2245 } |
| 2256 } | 2246 } |
| 2257 } | 2247 } |
| 2258 | 2248 |
| 2259 | 2249 |
| 2260 // For a comparison operation return an operation for the equivalent flipped | 2250 // For a comparison operation return an operation for the equivalent flipped |
| 2261 // comparison: a (op) b === b (op') a. | 2251 // comparison: a (op) b === b (op') a. |
| 2262 static Token::Kind FlipComparison(Token::Kind op) { | 2252 static Token::Kind FlipComparison(Token::Kind op) { |
| 2263 switch (op) { | 2253 switch (op) { |
| 2264 case Token::kEQ: return Token::kEQ; | 2254 case Token::kEQ: return Token::kEQ; |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4615 | 4605 |
| 4616 if (FLAG_trace_constant_propagation) { | 4606 if (FLAG_trace_constant_propagation) { |
| 4617 OS::Print("\n==== After constant propagation ====\n"); | 4607 OS::Print("\n==== After constant propagation ====\n"); |
| 4618 FlowGraphPrinter printer(*graph_); | 4608 FlowGraphPrinter printer(*graph_); |
| 4619 printer.PrintBlocks(); | 4609 printer.PrintBlocks(); |
| 4620 } | 4610 } |
| 4621 } | 4611 } |
| 4622 | 4612 |
| 4623 | 4613 |
| 4624 } // namespace dart | 4614 } // namespace dart |
| OLD | NEW |