| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } | 1078 } |
| 1079 } | 1079 } |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 | 1082 |
| 1083 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) { | 1083 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) { |
| 1084 if (graph_entry->start_env() == NULL) { | 1084 if (graph_entry->start_env() == NULL) { |
| 1085 return; | 1085 return; |
| 1086 } | 1086 } |
| 1087 // Visit incoming parameters. | 1087 // Visit incoming parameters. |
| 1088 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { | 1088 for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) { |
| 1089 Value* val = graph_entry->start_env()->values()[i]; | 1089 Value* val = graph_entry->start_env()->ValueAt(i); |
| 1090 ParameterInstr* param = val->definition()->AsParameter(); | 1090 ParameterInstr* param = val->definition()->AsParameter(); |
| 1091 if (param != NULL) { | 1091 if (param != NULL) { |
| 1092 ASSERT(param->index() == i); | 1092 ASSERT(param->index() == i); |
| 1093 VisitParameter(param); | 1093 VisitParameter(param); |
| 1094 } | 1094 } |
| 1095 } | 1095 } |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 | 1098 |
| 1099 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) { | 1099 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 DirectChainedHashMap<Definition*> child_map(*map); // Copy map. | 1366 DirectChainedHashMap<Definition*> child_map(*map); // Copy map. |
| 1367 OptimizeRecursive(child, &child_map); | 1367 OptimizeRecursive(child, &child_map); |
| 1368 } else { | 1368 } else { |
| 1369 OptimizeRecursive(child, map); // Reuse map for the last child. | 1369 OptimizeRecursive(child, map); // Reuse map for the last child. |
| 1370 } | 1370 } |
| 1371 } | 1371 } |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 | 1374 |
| 1375 } // namespace dart | 1375 } // namespace dart |
| OLD | NEW |