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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
(...skipping 7469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7480 | 7480 |
7481 if ((block->next() == instr) && | 7481 if ((block->next() == instr) && |
7482 (instr->next() == block->last_instruction())) { | 7482 (instr->next() == block->last_instruction())) { |
7483 before->previous()->LinkTo(instr); | 7483 before->previous()->LinkTo(instr); |
7484 instr->LinkTo(before); | 7484 instr->LinkTo(before); |
7485 } | 7485 } |
7486 } | 7486 } |
7487 | 7487 |
7488 | 7488 |
7489 void IfConverter::Simplify(FlowGraph* flow_graph) { | 7489 void IfConverter::Simplify(FlowGraph* flow_graph) { |
7490 if (!IfThenElseInstr::IsSupported()) { | |
7491 return; | |
7492 } | |
7493 | |
7494 bool changed = false; | 7490 bool changed = false; |
7495 | 7491 |
7496 const GrowableArray<BlockEntryInstr*>& postorder = flow_graph->postorder(); | 7492 const GrowableArray<BlockEntryInstr*>& postorder = flow_graph->postorder(); |
7497 for (BlockIterator it(postorder); !it.Done(); it.Advance()) { | 7493 for (BlockIterator it(postorder); !it.Done(); it.Advance()) { |
7498 BlockEntryInstr* block = it.Current(); | 7494 BlockEntryInstr* block = it.Current(); |
7499 JoinEntryInstr* join = block->AsJoinEntry(); | 7495 JoinEntryInstr* join = block->AsJoinEntry(); |
7500 | 7496 |
7501 // Detect diamond control flow pattern which materializes a value depending | 7497 // Detect diamond control flow pattern which materializes a value depending |
7502 // on the result of the comparison: | 7498 // on the result of the comparison: |
7503 // | 7499 // |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7851 } | 7847 } |
7852 | 7848 |
7853 // Insert materializations at environment uses. | 7849 // Insert materializations at environment uses. |
7854 for (intptr_t i = 0; i < exits.length(); i++) { | 7850 for (intptr_t i = 0; i < exits.length(); i++) { |
7855 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7851 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
7856 } | 7852 } |
7857 } | 7853 } |
7858 | 7854 |
7859 | 7855 |
7860 } // namespace dart | 7856 } // namespace dart |
OLD | NEW |