| Index: runtime/vm/flow_graph_builder.cc
|
| diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
|
| index 726487b1bcb7d07fe51d3914819cd44349a74c7f..221cdcb06565848917cd6f141932258a09c3d03f 100644
|
| --- a/runtime/vm/flow_graph_builder.cc
|
| +++ b/runtime/vm/flow_graph_builder.cc
|
| @@ -2297,11 +2297,21 @@ void FlowGraphBuilder::BuildGraph(bool for_optimized, bool use_ssa) {
|
| GrowableArray<intptr_t> parent;
|
| GrowableArray<BitVector*> assigned_vars;
|
|
|
| - const intptr_t fixed_parameter_count =
|
| - parsed_function_.function().num_fixed_parameters();
|
| - const intptr_t variable_count = fixed_parameter_count +
|
| - parsed_function_.copied_parameter_count() +
|
| - parsed_function_.stack_local_count();
|
| + // Either all parameters are fixed (none are named) or they are all copied.
|
| + // This could change, so we keep fixed/copied counts separate.
|
| + intptr_t fixed_parameter_count; // This is really the "non-copied" count.
|
| + intptr_t copied_parameter_count;
|
| + if (parsed_function_.copied_parameter_count() > 0) {
|
| + fixed_parameter_count = 0;
|
| + copied_parameter_count = parsed_function_.copied_parameter_count();
|
| + } else {
|
| + fixed_parameter_count = parsed_function_.function().num_fixed_parameters();
|
| + copied_parameter_count = 0;
|
| + }
|
| + const intptr_t stack_local_count = parsed_function_.stack_local_count();
|
| + const intptr_t variable_count =
|
| + stack_local_count + fixed_parameter_count + copied_parameter_count;
|
| +
|
| // Perform a depth-first traversal of the graph to build preorder and
|
| // postorder block orders.
|
| graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor.
|
| @@ -2337,7 +2347,7 @@ void FlowGraphBuilder::BuildGraph(bool for_optimized, bool use_ssa) {
|
| assigned_vars,
|
| variable_count,
|
| dominance_frontier);
|
| - Rename(variable_count);
|
| + Rename(stack_local_count, fixed_parameter_count, copied_parameter_count);
|
| }
|
| if (FLAG_print_flow_graph || (Dart::flow_graph_writer() != NULL)) {
|
| intptr_t length = postorder_block_entries_.length();
|
| @@ -2539,26 +2549,24 @@ void FlowGraphBuilder::InsertPhis(
|
| }
|
|
|
|
|
| -void FlowGraphBuilder::Rename(intptr_t var_count) {
|
| - // TODO(fschneider): Store var_count in the FlowGraphBuilder instead of
|
| +void FlowGraphBuilder::Rename(intptr_t stack_local_count,
|
| + intptr_t fixed_parameter_count,
|
| + intptr_t copied_parameter_count) {
|
| + // TODO(fschneider): Store counts in the FlowGraphBuilder instead of
|
| // passing it around.
|
| // TODO(fschneider): Support catch-entry.
|
| if (graph_entry_->SuccessorCount() > 1) {
|
| Bailout("Catch-entry support in SSA.");
|
| }
|
| - // TODO(fschneider): Support copied parameters.
|
| - if (parsed_function().copied_parameter_count() != 0) {
|
| - Bailout("Copied parameter support in SSA");
|
| - }
|
| - ASSERT(var_count == (parsed_function().stack_local_count() +
|
| - parsed_function().function().num_fixed_parameters()));
|
| +
|
| + const intptr_t parameter_count =
|
| + fixed_parameter_count + copied_parameter_count;
|
| + const intptr_t variable_count = parameter_count + stack_local_count;
|
|
|
| // Initialize start environment.
|
| - GrowableArray<Value*> start_env(var_count);
|
| + GrowableArray<Value*> start_env(variable_count);
|
| intptr_t i = 0;
|
| - const intptr_t fixed_parameter_count =
|
| - parsed_function().function().num_fixed_parameters();
|
| - for (; i < fixed_parameter_count; ++i) {
|
| + for (; i < parameter_count; ++i) {
|
| ParameterInstr* param = new ParameterInstr(i);
|
| param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
|
| start_env.Add(new UseVal(param));
|
| @@ -2566,7 +2574,7 @@ void FlowGraphBuilder::Rename(intptr_t var_count) {
|
|
|
| // All locals are initialized with #null.
|
| Value* null_value = new ConstantVal(Object::ZoneHandle());
|
| - for (; i < var_count; i++) {
|
| + for (; i < variable_count; i++) {
|
| start_env.Add(null_value);
|
| }
|
| graph_entry_->set_start_env(
|
| @@ -2574,9 +2582,9 @@ void FlowGraphBuilder::Rename(intptr_t var_count) {
|
|
|
| BlockEntryInstr* normal_entry = graph_entry_->SuccessorAt(0);
|
| ASSERT(normal_entry != NULL); // Must have entry.
|
| - GrowableArray<Value*> env(var_count);
|
| + GrowableArray<Value*> env(variable_count);
|
| env.AddArray(start_env);
|
| - RenameRecursive(normal_entry, &env, var_count, fixed_parameter_count);
|
| + RenameRecursive(normal_entry, &env, variable_count, fixed_parameter_count);
|
| }
|
|
|
|
|
|
|