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