| 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/hash_map.h" | 10 #include "vm/hash_map.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 phi->set_representation(kUnboxedDouble); | 119 phi->set_representation(kUnboxedDouble); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Process all instructions and insert conversions where needed. | 125 // Process all instructions and insert conversions where needed. |
| 126 GraphEntryInstr* graph_entry = block_order_[0]->AsGraphEntry(); | 126 GraphEntryInstr* graph_entry = block_order_[0]->AsGraphEntry(); |
| 127 | 127 |
| 128 // Visit incoming parameters. | 128 // Visit incoming parameters. |
| 129 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { | 129 for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) { |
| 130 Value* val = graph_entry->start_env()->values()[i]; | 130 Value* val = graph_entry->start_env()->ValueAt(i); |
| 131 InsertConversionsFor(val->definition()); | 131 InsertConversionsFor(val->definition()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 134 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| 135 BlockEntryInstr* entry = block_order_[i]; | 135 BlockEntryInstr* entry = block_order_[i]; |
| 136 | 136 |
| 137 JoinEntryInstr* join_entry = entry->AsJoinEntry(); | 137 JoinEntryInstr* join_entry = entry->AsJoinEntry(); |
| 138 if ((join_entry != NULL) && (join_entry->phis() != NULL)) { | 138 if ((join_entry != NULL) && (join_entry->phis() != NULL)) { |
| 139 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) { | 139 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) { |
| 140 PhiInstr* phi = (*join_entry->phis())[i]; | 140 PhiInstr* phi = (*join_entry->phis())[i]; |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 } | 1014 } |
| 1015 } | 1015 } |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 | 1018 |
| 1019 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) { | 1019 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) { |
| 1020 if (graph_entry->start_env() == NULL) { | 1020 if (graph_entry->start_env() == NULL) { |
| 1021 return; | 1021 return; |
| 1022 } | 1022 } |
| 1023 // Visit incoming parameters. | 1023 // Visit incoming parameters. |
| 1024 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { | 1024 for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) { |
| 1025 Value* val = graph_entry->start_env()->values()[i]; | 1025 Value* val = graph_entry->start_env()->ValueAt(i); |
| 1026 ParameterInstr* param = val->definition()->AsParameter(); | 1026 ParameterInstr* param = val->definition()->AsParameter(); |
| 1027 if (param != NULL) { | 1027 if (param != NULL) { |
| 1028 ASSERT(param->index() == i); | 1028 ASSERT(param->index() == i); |
| 1029 VisitParameter(param); | 1029 VisitParameter(param); |
| 1030 } | 1030 } |
| 1031 } | 1031 } |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 | 1034 |
| 1035 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) { | 1035 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 DirectChainedHashMap<Definition*> child_map(*map); // Copy map. | 1249 DirectChainedHashMap<Definition*> child_map(*map); // Copy map. |
| 1250 OptimizeRecursive(child, &child_map); | 1250 OptimizeRecursive(child, &child_map); |
| 1251 } else { | 1251 } else { |
| 1252 OptimizeRecursive(child, map); // Reuse map for the last child. | 1252 OptimizeRecursive(child, map); // Reuse map for the last child. |
| 1253 } | 1253 } |
| 1254 } | 1254 } |
| 1255 } | 1255 } |
| 1256 | 1256 |
| 1257 | 1257 |
| 1258 } // namespace dart | 1258 } // namespace dart |
| OLD | NEW |