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

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

Issue 12316065: Set instruction/use_index when adding an input to an IL instruction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 years, 10 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.cc ('k') | runtime/vm/flow_graph_optimizer.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_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // If the call has uses, create a phi of the returns. 198 // If the call has uses, create a phi of the returns.
199 if (call->HasUses()) { 199 if (call->HasUses()) {
200 // Environment count: length before call - argument count (+ return) 200 // Environment count: length before call - argument count (+ return)
201 intptr_t env_count = call->env()->Length() - call->ArgumentCount(); 201 intptr_t env_count = call->env()->Length() - call->ArgumentCount();
202 // Add a phi of the return values. 202 // Add a phi of the return values.
203 join->InsertPhi(env_count, env_count + 1); 203 join->InsertPhi(env_count, env_count + 1);
204 PhiInstr* phi = join->phis()->Last(); 204 PhiInstr* phi = join->phis()->Last();
205 phi->set_ssa_temp_index(caller_graph->alloc_ssa_temp_index()); 205 phi->set_ssa_temp_index(caller_graph->alloc_ssa_temp_index());
206 phi->mark_alive(); 206 phi->mark_alive();
207 for (intptr_t i = 0; i < num_exits; ++i) { 207 for (intptr_t i = 0; i < num_exits; ++i) {
208 Value* value = ValueAt(i); 208 phi->SetInputAt(i, ValueAt(i));
209 phi->SetInputAt(i, value);
210 value->set_instruction(phi);
211 value->set_use_index(i);
212 } 209 }
213 // Replace uses of the call with the phi. 210 // Replace uses of the call with the phi.
214 call->ReplaceUsesWith(phi); 211 call->ReplaceUsesWith(phi);
215 } else { 212 } else {
216 // In the case that the result is unused, remove the return value uses 213 // In the case that the result is unused, remove the return value uses
217 // from their definition's use list. 214 // from their definition's use list.
218 for (intptr_t i = 0; i < num_exits; ++i) { 215 for (intptr_t i = 0; i < num_exits; ++i) {
219 ValueAt(i)->RemoveFromUseList(); 216 ValueAt(i)->RemoveFromUseList();
220 } 217 }
221 } 218 }
(...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3264 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3268 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3265 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3269 OS::SNPrint(chars, len, kFormat, function_name, reason); 3266 OS::SNPrint(chars, len, kFormat, function_name, reason);
3270 const Error& error = Error::Handle( 3267 const Error& error = Error::Handle(
3271 LanguageError::New(String::Handle(String::New(chars)))); 3268 LanguageError::New(String::Handle(String::New(chars))));
3272 Isolate::Current()->long_jump_base()->Jump(1, error); 3269 Isolate::Current()->long_jump_base()->Jump(1, error);
3273 } 3270 }
3274 3271
3275 3272
3276 } // namespace dart 3273 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698