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

Side by Side Diff: runtime/vm/flow_graph_inliner.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_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 DEBUG_ASSERT(caller_graph_->ValidateUseLists()); 123 DEBUG_ASSERT(caller_graph_->ValidateUseLists());
124 124
125 // Remove push arguments of the call. 125 // Remove push arguments of the call.
126 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { 126 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
127 PushArgumentInstr* push = call->ArgumentAt(i); 127 PushArgumentInstr* push = call->ArgumentAt(i);
128 push->ReplaceUsesWith(push->value()->definition()); 128 push->ReplaceUsesWith(push->value()->definition());
129 push->RemoveFromGraph(); 129 push->RemoveFromGraph();
130 } 130 }
131 131
132 // Replace formal parameters with actuals. 132 // Replace formal parameters with actuals.
133 for (intptr_t i = 0; i < arguments->length(); ++i) { 133 intptr_t j = 0;
Kevin Millikin (Google) 2012/09/19 11:49:29 j ==> arg_index or arg_idx or the like.
134 Value* val = callee_graph->graph_entry()->start_env()->ValueAt(i); 134 for (intptr_t i = 0;
135 ParameterInstr* param = val->definition()->AsParameter(); 135 i < callee_graph->graph_entry()->initial_definitions().length();
136 ASSERT(param != NULL); 136 ++i) {
137 param->ReplaceUsesWith((*arguments)[i]->definition()); 137 ParameterInstr* param =
138 callee_graph->graph_entry()->initial_definitions()[i]->AsParameter();
139 if (param != NULL) {
140 param->ReplaceUsesWith((*arguments)[j++]->definition());
141 }
138 } 142 }
143 ASSERT(j == arguments->length());
139 144
140 // Replace callee's null constant with caller's null constant. 145 // Replace callee's null constant with caller's null constant.
141 callee_graph->graph_entry()->constant_null()->ReplaceUsesWith( 146 callee_graph->graph_entry()->constant_null()->ReplaceUsesWith(
142 caller_graph_->graph_entry()->constant_null()); 147 caller_graph_->graph_entry()->constant_null());
143 148
144 TRACE_INLINING(OS::Print(" Success\n")); 149 TRACE_INLINING(OS::Print(" Success\n"));
145 150
146 // Build succeeded so we restore the bailout jump. 151 // Build succeeded so we restore the bailout jump.
147 inlined_ = true; 152 inlined_ = true;
148 isolate->set_long_jump_base(base); 153 isolate->set_long_jump_base(base);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (FLAG_trace_inlining && FLAG_print_flow_graph) { 244 if (FLAG_trace_inlining && FLAG_print_flow_graph) {
240 OS::Print("After Inlining of %s\n", flow_graph_-> 245 OS::Print("After Inlining of %s\n", flow_graph_->
241 parsed_function().function().ToFullyQualifiedCString()); 246 parsed_function().function().ToFullyQualifiedCString());
242 FlowGraphPrinter printer(*flow_graph_); 247 FlowGraphPrinter printer(*flow_graph_);
243 printer.PrintBlocks(); 248 printer.PrintBlocks();
244 } 249 }
245 } 250 }
246 } 251 }
247 252
248 } // namespace dart 253 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698