| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 3494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3505 } | 3505 } |
| 3506 return changed; | 3506 return changed; |
| 3507 } | 3507 } |
| 3508 | 3508 |
| 3509 | 3509 |
| 3510 ConstantPropagator::ConstantPropagator( | 3510 ConstantPropagator::ConstantPropagator( |
| 3511 FlowGraph* graph, | 3511 FlowGraph* graph, |
| 3512 const GrowableArray<BlockEntryInstr*>& ignored) | 3512 const GrowableArray<BlockEntryInstr*>& ignored) |
| 3513 : FlowGraphVisitor(ignored), | 3513 : FlowGraphVisitor(ignored), |
| 3514 graph_(graph), | 3514 graph_(graph), |
| 3515 unknown_(Object::ZoneHandle(Object::transition_sentinel())), | 3515 unknown_(Object::transition_sentinel()), |
| 3516 non_constant_(Object::ZoneHandle(Object::sentinel())), | 3516 non_constant_(Object::sentinel()), |
| 3517 reachable_(new BitVector(graph->preorder().length())), | 3517 reachable_(new BitVector(graph->preorder().length())), |
| 3518 definition_marks_(new BitVector(graph->max_virtual_register_number())), | 3518 definition_marks_(new BitVector(graph->max_virtual_register_number())), |
| 3519 block_worklist_(), | 3519 block_worklist_(), |
| 3520 definition_worklist_() {} | 3520 definition_worklist_() {} |
| 3521 | 3521 |
| 3522 | 3522 |
| 3523 void ConstantPropagator::Optimize(FlowGraph* graph) { | 3523 void ConstantPropagator::Optimize(FlowGraph* graph) { |
| 3524 GrowableArray<BlockEntryInstr*> ignored; | 3524 GrowableArray<BlockEntryInstr*> ignored; |
| 3525 ConstantPropagator cp(graph, ignored); | 3525 ConstantPropagator cp(graph, ignored); |
| 3526 cp.Analyze(); | 3526 cp.Analyze(); |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4351 | 4351 |
| 4352 if (FLAG_trace_constant_propagation) { | 4352 if (FLAG_trace_constant_propagation) { |
| 4353 OS::Print("\n==== After constant propagation ====\n"); | 4353 OS::Print("\n==== After constant propagation ====\n"); |
| 4354 FlowGraphPrinter printer(*graph_); | 4354 FlowGraphPrinter printer(*graph_); |
| 4355 printer.PrintBlocks(); | 4355 printer.PrintBlocks(); |
| 4356 } | 4356 } |
| 4357 } | 4357 } |
| 4358 | 4358 |
| 4359 | 4359 |
| 4360 } // namespace dart | 4360 } // namespace dart |
| OLD | NEW |