| 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 3643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 TargetEntryInstr* if_true = branch->true_successor(); | 3654 TargetEntryInstr* if_true = branch->true_successor(); |
| 3655 TargetEntryInstr* if_false = branch->false_successor(); | 3655 TargetEntryInstr* if_false = branch->false_successor(); |
| 3656 JoinEntryInstr* join = NULL; | 3656 JoinEntryInstr* join = NULL; |
| 3657 Instruction* next = NULL; | 3657 Instruction* next = NULL; |
| 3658 | 3658 |
| 3659 if (!reachable_->Contains(if_true->preorder_number())) { | 3659 if (!reachable_->Contains(if_true->preorder_number())) { |
| 3660 ASSERT(reachable_->Contains(if_false->preorder_number())); | 3660 ASSERT(reachable_->Contains(if_false->preorder_number())); |
| 3661 ASSERT(branch->comparison()->IsStrictCompare()); | 3661 ASSERT(branch->comparison()->IsStrictCompare()); |
| 3662 ASSERT(if_false->parallel_move() == NULL); | 3662 ASSERT(if_false->parallel_move() == NULL); |
| 3663 ASSERT(if_false->loop_info() == NULL); | 3663 ASSERT(if_false->loop_info() == NULL); |
| 3664 join = | 3664 join = new JoinEntryInstr(if_false->block_id(), |
| 3665 new JoinEntryInstr(if_false->block_id(), if_false->try_index()); | 3665 if_false->try_index(), |
| 3666 if_false->loop_depth()); |
| 3666 next = if_false->next(); | 3667 next = if_false->next(); |
| 3667 } else if (!reachable_->Contains(if_false->preorder_number())) { | 3668 } else if (!reachable_->Contains(if_false->preorder_number())) { |
| 3668 ASSERT(branch->comparison()->IsStrictCompare()); | 3669 ASSERT(branch->comparison()->IsStrictCompare()); |
| 3669 ASSERT(if_true->parallel_move() == NULL); | 3670 ASSERT(if_true->parallel_move() == NULL); |
| 3670 ASSERT(if_true->loop_info() == NULL); | 3671 ASSERT(if_true->loop_info() == NULL); |
| 3671 join = new JoinEntryInstr(if_true->block_id(), if_true->try_index()); | 3672 join = new JoinEntryInstr(if_true->block_id(), |
| 3673 if_true->try_index(), |
| 3674 if_true->loop_depth()); |
| 3672 next = if_true->next(); | 3675 next = if_true->next(); |
| 3673 } | 3676 } |
| 3674 | 3677 |
| 3675 if (join != NULL) { | 3678 if (join != NULL) { |
| 3676 // Replace the branch with a jump to the reachable successor. | 3679 // Replace the branch with a jump to the reachable successor. |
| 3677 // Drop the comparison, which does not have side effects as long | 3680 // Drop the comparison, which does not have side effects as long |
| 3678 // as it is a strict compare (the only one we can determine is | 3681 // as it is a strict compare (the only one we can determine is |
| 3679 // constant with the current analysis). | 3682 // constant with the current analysis). |
| 3680 GotoInstr* jump = new GotoInstr(join); | 3683 GotoInstr* jump = new GotoInstr(join); |
| 3681 Instruction* previous = branch->previous(); | 3684 Instruction* previous = branch->previous(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3701 | 3704 |
| 3702 if (FLAG_trace_constant_propagation) { | 3705 if (FLAG_trace_constant_propagation) { |
| 3703 OS::Print("\n==== After constant propagation ====\n"); | 3706 OS::Print("\n==== After constant propagation ====\n"); |
| 3704 FlowGraphPrinter printer(*graph_); | 3707 FlowGraphPrinter printer(*graph_); |
| 3705 printer.PrintBlocks(); | 3708 printer.PrintBlocks(); |
| 3706 } | 3709 } |
| 3707 } | 3710 } |
| 3708 | 3711 |
| 3709 | 3712 |
| 3710 } // namespace dart | 3713 } // namespace dart |
| OLD | NEW |