| 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 3420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3431 TargetEntryInstr* if_true = branch->true_successor(); | 3431 TargetEntryInstr* if_true = branch->true_successor(); |
| 3432 TargetEntryInstr* if_false = branch->false_successor(); | 3432 TargetEntryInstr* if_false = branch->false_successor(); |
| 3433 JoinEntryInstr* join = NULL; | 3433 JoinEntryInstr* join = NULL; |
| 3434 Instruction* next = NULL; | 3434 Instruction* next = NULL; |
| 3435 | 3435 |
| 3436 if (!reachable_->Contains(if_true->preorder_number())) { | 3436 if (!reachable_->Contains(if_true->preorder_number())) { |
| 3437 ASSERT(reachable_->Contains(if_false->preorder_number())); | 3437 ASSERT(reachable_->Contains(if_false->preorder_number())); |
| 3438 ASSERT(branch->comparison()->IsStrictCompare()); | 3438 ASSERT(branch->comparison()->IsStrictCompare()); |
| 3439 ASSERT(if_false->parallel_move() == NULL); | 3439 ASSERT(if_false->parallel_move() == NULL); |
| 3440 ASSERT(if_false->loop_info() == NULL); | 3440 ASSERT(if_false->loop_info() == NULL); |
| 3441 join = | 3441 join = new JoinEntryInstr(if_false->block_id(), |
| 3442 new JoinEntryInstr(if_false->block_id(), if_false->try_index()); | 3442 if_false->try_index(), |
| 3443 if_false->loop_depth()); |
| 3443 next = if_false->next(); | 3444 next = if_false->next(); |
| 3444 } else if (!reachable_->Contains(if_false->preorder_number())) { | 3445 } else if (!reachable_->Contains(if_false->preorder_number())) { |
| 3445 ASSERT(branch->comparison()->IsStrictCompare()); | 3446 ASSERT(branch->comparison()->IsStrictCompare()); |
| 3446 ASSERT(if_true->parallel_move() == NULL); | 3447 ASSERT(if_true->parallel_move() == NULL); |
| 3447 ASSERT(if_true->loop_info() == NULL); | 3448 ASSERT(if_true->loop_info() == NULL); |
| 3448 join = new JoinEntryInstr(if_true->block_id(), if_true->try_index()); | 3449 join = new JoinEntryInstr(if_true->block_id(), |
| 3450 if_true->try_index(), |
| 3451 if_true->loop_depth()); |
| 3449 next = if_true->next(); | 3452 next = if_true->next(); |
| 3450 } | 3453 } |
| 3451 | 3454 |
| 3452 if (join != NULL) { | 3455 if (join != NULL) { |
| 3453 // Replace the branch with a jump to the reachable successor. | 3456 // Replace the branch with a jump to the reachable successor. |
| 3454 // Drop the comparison, which does not have side effects as long | 3457 // Drop the comparison, which does not have side effects as long |
| 3455 // as it is a strict compare (the only one we can determine is | 3458 // as it is a strict compare (the only one we can determine is |
| 3456 // constant with the current analysis). | 3459 // constant with the current analysis). |
| 3457 GotoInstr* jump = new GotoInstr(join); | 3460 GotoInstr* jump = new GotoInstr(join); |
| 3458 Instruction* previous = branch->previous(); | 3461 Instruction* previous = branch->previous(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3472 | 3475 |
| 3473 if (FLAG_trace_constant_propagation) { | 3476 if (FLAG_trace_constant_propagation) { |
| 3474 OS::Print("\n==== After constant propagation ====\n"); | 3477 OS::Print("\n==== After constant propagation ====\n"); |
| 3475 FlowGraphPrinter printer(*graph_); | 3478 FlowGraphPrinter printer(*graph_); |
| 3476 printer.PrintBlocks(); | 3479 printer.PrintBlocks(); |
| 3477 } | 3480 } |
| 3478 } | 3481 } |
| 3479 | 3482 |
| 3480 | 3483 |
| 3481 } // namespace dart | 3484 } // namespace dart |
| OLD | NEW |