Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10939031: Replace start_env with initial_definitions in GraphEntryInstr. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
119 if ((phi != NULL) && (phi->GetPropagatedCid() == kDoubleCid)) { 119 if ((phi != NULL) && (phi->GetPropagatedCid() == kDoubleCid)) {
120 phi->set_representation(kUnboxedDouble); 120 phi->set_representation(kUnboxedDouble);
121 } 121 }
122 } 122 }
123 } 123 }
124 } 124 }
125 125
126 // Process all instructions and insert conversions where needed. 126 // Process all instructions and insert conversions where needed.
127 GraphEntryInstr* graph_entry = block_order_[0]->AsGraphEntry(); 127 GraphEntryInstr* graph_entry = block_order_[0]->AsGraphEntry();
128 128
129 // Visit incoming parameters. 129 // Visit incoming parameters and constants.
130 for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) { 130 for (intptr_t i = 0; i < graph_entry->initial_definitions().length(); i++) {
131 Value* val = graph_entry->start_env()->ValueAt(i); 131 InsertConversionsFor(graph_entry->initial_definitions()[i]);
132 InsertConversionsFor(val->definition());
133 } 132 }
134 133
135 for (intptr_t i = 0; i < block_order_.length(); ++i) { 134 for (intptr_t i = 0; i < block_order_.length(); ++i) {
136 BlockEntryInstr* entry = block_order_[i]; 135 BlockEntryInstr* entry = block_order_[i];
137 136
138 JoinEntryInstr* join_entry = entry->AsJoinEntry(); 137 JoinEntryInstr* join_entry = entry->AsJoinEntry();
139 if ((join_entry != NULL) && (join_entry->phis() != NULL)) { 138 if ((join_entry != NULL) && (join_entry->phis() != NULL)) {
140 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) { 139 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) {
141 PhiInstr* phi = (*join_entry->phis())[i]; 140 PhiInstr* phi = (*join_entry->phis())[i];
142 if ((phi != NULL) && (phi->is_alive())) { 141 if ((phi != NULL) && (phi->is_alive())) {
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 instr->value(), 1290 instr->value(),
1292 instr->type(), 1291 instr->type(),
1293 name, 1292 name,
1294 /* eliminated = */ true); 1293 /* eliminated = */ true);
1295 } 1294 }
1296 } 1295 }
1297 } 1296 }
1298 1297
1299 1298
1300 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) { 1299 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) {
1301 if (graph_entry->start_env() == NULL) {
1302 return;
1303 }
1304 // Visit incoming parameters. 1300 // Visit incoming parameters.
1305 for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) { 1301 for (intptr_t i = 0; i < graph_entry->initial_definitions().length(); i++) {
1306 Value* val = graph_entry->start_env()->ValueAt(i); 1302 ParameterInstr* param =
1307 ParameterInstr* param = val->definition()->AsParameter(); 1303 graph_entry->initial_definitions()[i]->AsParameter();
1308 if (param != NULL) { 1304 if (param != NULL) VisitParameter(param);
1309 ASSERT(param->index() == i);
1310 VisitParameter(param);
1311 }
1312 } 1305 }
1313 } 1306 }
1314 1307
1315 1308
1316 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) { 1309 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) {
1317 if (join_entry->phis() != NULL) { 1310 if (join_entry->phis() != NULL) {
1318 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) { 1311 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) {
1319 PhiInstr* phi = (*join_entry->phis())[i]; 1312 PhiInstr* phi = (*join_entry->phis())[i];
1320 if (phi != NULL) { 1313 if (phi != NULL) {
1321 VisitPhi(phi); 1314 VisitPhi(phi);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 DirectChainedHashMap<Definition*> child_map(*map); // Copy map. 1772 DirectChainedHashMap<Definition*> child_map(*map); // Copy map.
1780 OptimizeRecursive(child, &child_map); 1773 OptimizeRecursive(child, &child_map);
1781 } else { 1774 } else {
1782 OptimizeRecursive(child, map); // Reuse map for the last child. 1775 OptimizeRecursive(child, map); // Reuse map for the last child.
1783 } 1776 }
1784 } 1777 }
1785 } 1778 }
1786 1779
1787 1780
1788 } // namespace dart 1781 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698