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

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: Review comments 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
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 instr->value(), 1281 instr->value(),
1283 instr->type(), 1282 instr->type(),
1284 name, 1283 name,
1285 /* eliminated = */ true); 1284 /* eliminated = */ true);
1286 } 1285 }
1287 } 1286 }
1288 } 1287 }
1289 1288
1290 1289
1291 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) { 1290 void FlowGraphTypePropagator::VisitGraphEntry(GraphEntryInstr* graph_entry) {
1292 if (graph_entry->start_env() == NULL) {
1293 return;
1294 }
1295 // Visit incoming parameters. 1291 // Visit incoming parameters.
1296 for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) { 1292 for (intptr_t i = 0; i < graph_entry->initial_definitions()->length(); i++) {
1297 Value* val = graph_entry->start_env()->ValueAt(i); 1293 ParameterInstr* param =
1298 ParameterInstr* param = val->definition()->AsParameter(); 1294 (*graph_entry->initial_definitions())[i]->AsParameter();
1299 if (param != NULL) { 1295 if (param != NULL) VisitParameter(param);
1300 ASSERT(param->index() == i);
1301 VisitParameter(param);
1302 }
1303 } 1296 }
1304 } 1297 }
1305 1298
1306 1299
1307 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) { 1300 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join_entry) {
1308 if (join_entry->phis() != NULL) { 1301 if (join_entry->phis() != NULL) {
1309 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) { 1302 for (intptr_t i = 0; i < join_entry->phis()->length(); ++i) {
1310 PhiInstr* phi = (*join_entry->phis())[i]; 1303 PhiInstr* phi = (*join_entry->phis())[i];
1311 if (phi != NULL) { 1304 if (phi != NULL) {
1312 VisitPhi(phi); 1305 VisitPhi(phi);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 DirectChainedHashMap<Definition*> child_map(*map); // Copy map. 1763 DirectChainedHashMap<Definition*> child_map(*map); // Copy map.
1771 OptimizeRecursive(child, &child_map); 1764 OptimizeRecursive(child, &child_map);
1772 } else { 1765 } else {
1773 OptimizeRecursive(child, map); // Reuse map for the last child. 1766 OptimizeRecursive(child, map); // Reuse map for the last child.
1774 } 1767 }
1775 } 1768 }
1776 } 1769 }
1777 1770
1778 1771
1779 } // namespace dart 1772 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698