| OLD | NEW |
| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 GrowableArray<Definition*>* inlining_parameters) { | 501 GrowableArray<Definition*>* inlining_parameters) { |
| 502 // TODO(fschneider): Support catch-entry. | 502 // TODO(fschneider): Support catch-entry. |
| 503 if (graph_entry_->SuccessorCount() > 1) { | 503 if (graph_entry_->SuccessorCount() > 1) { |
| 504 Bailout("Catch-entry support in SSA."); | 504 Bailout("Catch-entry support in SSA."); |
| 505 } | 505 } |
| 506 | 506 |
| 507 // Initial renaming environment. | 507 // Initial renaming environment. |
| 508 GrowableArray<Definition*> env(variable_count()); | 508 GrowableArray<Definition*> env(variable_count()); |
| 509 | 509 |
| 510 // Add global constants to the initial definitions. | 510 // Add global constants to the initial definitions. |
| 511 ConstantInstr* constant_null = | 511 constant_null_ = |
| 512 AddConstantToInitialDefinitions(Object::ZoneHandle()); | 512 AddConstantToInitialDefinitions(Object::ZoneHandle()); |
| 513 | 513 |
| 514 // Add parameters to the initial definitions and renaming environment. | 514 // Add parameters to the initial definitions and renaming environment. |
| 515 if (inlining_parameters != NULL) { | 515 if (inlining_parameters != NULL) { |
| 516 // Use known parameters. | 516 // Use known parameters. |
| 517 ASSERT(parameter_count() == inlining_parameters->length()); | 517 ASSERT(parameter_count() == inlining_parameters->length()); |
| 518 for (intptr_t i = 0; i < parameter_count(); ++i) { | 518 for (intptr_t i = 0; i < parameter_count(); ++i) { |
| 519 Definition* defn = (*inlining_parameters)[i]; | 519 Definition* defn = (*inlining_parameters)[i]; |
| 520 defn->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. | 520 defn->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. |
| 521 AddToInitialDefinitions(defn); | 521 AddToInitialDefinitions(defn); |
| 522 env.Add(defn); | 522 env.Add(defn); |
| 523 } | 523 } |
| 524 } else { | 524 } else { |
| 525 // Create new parameters. | 525 // Create new parameters. |
| 526 for (intptr_t i = 0; i < parameter_count(); ++i) { | 526 for (intptr_t i = 0; i < parameter_count(); ++i) { |
| 527 ParameterInstr* param = new ParameterInstr(i, graph_entry_); | 527 ParameterInstr* param = new ParameterInstr(i, graph_entry_); |
| 528 param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. | 528 param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. |
| 529 AddToInitialDefinitions(param); | 529 AddToInitialDefinitions(param); |
| 530 env.Add(param); | 530 env.Add(param); |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 // Initialize all locals with #null in the renaming environment. | 534 // Initialize all locals with #null in the renaming environment. |
| 535 for (intptr_t i = parameter_count(); i < variable_count(); ++i) { | 535 for (intptr_t i = parameter_count(); i < variable_count(); ++i) { |
| 536 env.Add(constant_null); | 536 env.Add(constant_null()); |
| 537 } | 537 } |
| 538 | 538 |
| 539 BlockEntryInstr* normal_entry = graph_entry_->SuccessorAt(0); | 539 BlockEntryInstr* normal_entry = graph_entry_->SuccessorAt(0); |
| 540 ASSERT(normal_entry != NULL); // Must have entry. | 540 ASSERT(normal_entry != NULL); // Must have entry. |
| 541 RenameRecursive(normal_entry, &env, live_phis); | 541 RenameRecursive(normal_entry, &env, live_phis); |
| 542 } | 542 } |
| 543 | 543 |
| 544 | 544 |
| 545 void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry, | 545 void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry, |
| 546 GrowableArray<Definition*>* env, | 546 GrowableArray<Definition*>* env, |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 !it.Done(); | 1006 !it.Done(); |
| 1007 it.Advance()) { | 1007 it.Advance()) { |
| 1008 ++size; | 1008 ++size; |
| 1009 } | 1009 } |
| 1010 } | 1010 } |
| 1011 return size; | 1011 return size; |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 | 1014 |
| 1015 } // namespace dart | 1015 } // namespace dart |
| OLD | NEW |