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

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

Issue 13932005: Refactor the code for making inlining decisions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { 202 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
203 VerifyUseListsInInstruction(it.Current()); 203 VerifyUseListsInInstruction(it.Current());
204 } 204 }
205 } 205 }
206 return true; // Return true so we can ASSERT validation. 206 return true; // Return true so we can ASSERT validation.
207 } 207 }
208 #endif // DEBUG 208 #endif // DEBUG
209 209
210 210
211 void FlowGraph::ComputeSSA(intptr_t next_virtual_register_number, 211 void FlowGraph::ComputeSSA(
212 GrowableArray<Definition*>* inlining_parameters) { 212 intptr_t next_virtual_register_number,
213 ZoneGrowableArray<Definition*>* inlining_parameters) {
213 ASSERT((next_virtual_register_number == 0) || (inlining_parameters != NULL)); 214 ASSERT((next_virtual_register_number == 0) || (inlining_parameters != NULL));
214 current_ssa_temp_index_ = next_virtual_register_number; 215 current_ssa_temp_index_ = next_virtual_register_number;
215 GrowableArray<BitVector*> dominance_frontier; 216 GrowableArray<BitVector*> dominance_frontier;
216 ComputeDominators(&dominance_frontier); 217 ComputeDominators(&dominance_frontier);
217 InsertPhis(preorder_, assigned_vars_, dominance_frontier); 218 InsertPhis(preorder_, assigned_vars_, dominance_frontier);
218 GrowableArray<PhiInstr*> live_phis; 219 GrowableArray<PhiInstr*> live_phis;
219 // Rename uses to reference inserted phis where appropriate. 220 // Rename uses to reference inserted phis where appropriate.
220 // Collect phis that reach a non-environment use. 221 // Collect phis that reach a non-environment use.
221 Rename(&live_phis, inlining_parameters); 222 Rename(&live_phis, inlining_parameters);
222 // Propagate alive mark transitively from alive phis and then remove 223 // Propagate alive mark transitively from alive phis and then remove
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 worklist.Add(block); 393 worklist.Add(block);
393 } 394 }
394 } 395 }
395 } 396 }
396 } 397 }
397 } 398 }
398 } 399 }
399 400
400 401
401 void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis, 402 void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
402 GrowableArray<Definition*>* inlining_parameters) { 403 ZoneGrowableArray<Definition*>* inlining_parameters) {
403 // TODO(fschneider): Support catch-entry. 404 // TODO(fschneider): Support catch-entry.
404 if (graph_entry_->SuccessorCount() > 1) { 405 if (graph_entry_->SuccessorCount() > 1) {
405 Bailout("Catch-entry support in SSA."); 406 Bailout("Catch-entry support in SSA.");
406 } 407 }
407 408
408 // Initial renaming environment. 409 // Initial renaming environment.
409 GrowableArray<Definition*> env(variable_count()); 410 GrowableArray<Definition*> env(variable_count());
410 411
411 // Add global constants to the initial definitions. 412 // Add global constants to the initial definitions.
412 constant_null_ = 413 constant_null_ =
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 for (ForwardInstructionIterator it(preorder_[i]); 692 for (ForwardInstructionIterator it(preorder_[i]);
692 !it.Done(); 693 !it.Done();
693 it.Advance()) { 694 it.Advance()) {
694 ++size; 695 ++size;
695 } 696 }
696 } 697 }
697 return size; 698 return size;
698 } 699 }
699 700
700 } // namespace dart 701 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698