| 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 4538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4549 if (branch != NULL) { | 4549 if (branch != NULL) { |
| 4550 TargetEntryInstr* if_true = branch->true_successor(); | 4550 TargetEntryInstr* if_true = branch->true_successor(); |
| 4551 TargetEntryInstr* if_false = branch->false_successor(); | 4551 TargetEntryInstr* if_false = branch->false_successor(); |
| 4552 JoinEntryInstr* join = NULL; | 4552 JoinEntryInstr* join = NULL; |
| 4553 Instruction* next = NULL; | 4553 Instruction* next = NULL; |
| 4554 | 4554 |
| 4555 if (!reachable_->Contains(if_true->preorder_number())) { | 4555 if (!reachable_->Contains(if_true->preorder_number())) { |
| 4556 ASSERT(reachable_->Contains(if_false->preorder_number())); | 4556 ASSERT(reachable_->Contains(if_false->preorder_number())); |
| 4557 ASSERT(if_false->parallel_move() == NULL); | 4557 ASSERT(if_false->parallel_move() == NULL); |
| 4558 ASSERT(if_false->loop_info() == NULL); | 4558 ASSERT(if_false->loop_info() == NULL); |
| 4559 join = new JoinEntryInstr(if_false->block_id(), | 4559 join = new JoinEntryInstr(if_false->block_id(), if_false->try_index()); |
| 4560 if_false->try_index(), | |
| 4561 if_false->loop_depth()); | |
| 4562 next = if_false->next(); | 4560 next = if_false->next(); |
| 4563 } else if (!reachable_->Contains(if_false->preorder_number())) { | 4561 } else if (!reachable_->Contains(if_false->preorder_number())) { |
| 4564 ASSERT(if_true->parallel_move() == NULL); | 4562 ASSERT(if_true->parallel_move() == NULL); |
| 4565 ASSERT(if_true->loop_info() == NULL); | 4563 ASSERT(if_true->loop_info() == NULL); |
| 4566 join = new JoinEntryInstr(if_true->block_id(), | 4564 join = new JoinEntryInstr(if_true->block_id(), if_true->try_index()); |
| 4567 if_true->try_index(), | |
| 4568 if_true->loop_depth()); | |
| 4569 next = if_true->next(); | 4565 next = if_true->next(); |
| 4570 } | 4566 } |
| 4571 | 4567 |
| 4572 if (join != NULL) { | 4568 if (join != NULL) { |
| 4573 // Replace the branch with a jump to the reachable successor. | 4569 // Replace the branch with a jump to the reachable successor. |
| 4574 // Drop the comparison, which does not have side effects as long | 4570 // Drop the comparison, which does not have side effects as long |
| 4575 // as it is a strict compare (the only one we can determine is | 4571 // as it is a strict compare (the only one we can determine is |
| 4576 // constant with the current analysis). | 4572 // constant with the current analysis). |
| 4577 GotoInstr* jump = new GotoInstr(join); | 4573 GotoInstr* jump = new GotoInstr(join); |
| 4578 Instruction* previous = branch->previous(); | 4574 Instruction* previous = branch->previous(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4600 | 4596 |
| 4601 if (FLAG_trace_constant_propagation) { | 4597 if (FLAG_trace_constant_propagation) { |
| 4602 OS::Print("\n==== After constant propagation ====\n"); | 4598 OS::Print("\n==== After constant propagation ====\n"); |
| 4603 FlowGraphPrinter printer(*graph_); | 4599 FlowGraphPrinter printer(*graph_); |
| 4604 printer.PrintBlocks(); | 4600 printer.PrintBlocks(); |
| 4605 } | 4601 } |
| 4606 } | 4602 } |
| 4607 | 4603 |
| 4608 | 4604 |
| 4609 } // namespace dart | 4605 } // namespace dart |
| OLD | NEW |