| 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.h" | 5 #include "vm/flow_graph.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (use_kind == Definition::kValue) { | 90 if (use_kind == Definition::kValue) { |
| 91 ASSERT(instr->IsDefinition()); | 91 ASSERT(instr->IsDefinition()); |
| 92 instr->AsDefinition()->set_ssa_temp_index(alloc_ssa_temp_index()); | 92 instr->AsDefinition()->set_ssa_temp_index(alloc_ssa_temp_index()); |
| 93 } | 93 } |
| 94 instr->InsertAfter(prev); | 94 instr->InsertAfter(prev); |
| 95 ASSERT(instr->env() == NULL); | 95 ASSERT(instr->env() == NULL); |
| 96 if (env != NULL) env->DeepCopyTo(instr); | 96 if (env != NULL) env->DeepCopyTo(instr); |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 Instruction* FlowGraph::AppendTo(Instruction* prev, |
| 101 Instruction* instr, |
| 102 Environment* env, |
| 103 Definition::UseKind use_kind) { |
| 104 if (use_kind == Definition::kValue) { |
| 105 ASSERT(instr->IsDefinition()); |
| 106 instr->AsDefinition()->set_ssa_temp_index(alloc_ssa_temp_index()); |
| 107 } |
| 108 ASSERT(instr->env() == NULL); |
| 109 if (env != NULL) env->DeepCopyTo(instr); |
| 110 return prev->AppendInstruction(instr); |
| 111 } |
| 112 |
| 113 |
| 100 void FlowGraph::DiscoverBlocks() { | 114 void FlowGraph::DiscoverBlocks() { |
| 101 // Initialize state. | 115 // Initialize state. |
| 102 preorder_.Clear(); | 116 preorder_.Clear(); |
| 103 postorder_.Clear(); | 117 postorder_.Clear(); |
| 104 reverse_postorder_.Clear(); | 118 reverse_postorder_.Clear(); |
| 105 parent_.Clear(); | 119 parent_.Clear(); |
| 106 // Perform a depth-first traversal of the graph to build preorder and | 120 // Perform a depth-first traversal of the graph to build preorder and |
| 107 // postorder block orders. | 121 // postorder block orders. |
| 108 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor. | 122 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor. |
| 109 &preorder_, | 123 &preorder_, |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 } | 1168 } |
| 1155 | 1169 |
| 1156 | 1170 |
| 1157 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1171 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
| 1158 BlockEntryInstr* to) const { | 1172 BlockEntryInstr* to) const { |
| 1159 return available_at_[to->postorder_number()]->Contains( | 1173 return available_at_[to->postorder_number()]->Contains( |
| 1160 from->postorder_number()); | 1174 from->postorder_number()); |
| 1161 } | 1175 } |
| 1162 | 1176 |
| 1163 } // namespace dart | 1177 } // namespace dart |
| OLD | NEW |