| Index: runtime/vm/flow_graph_compiler_x64.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_compiler_x64.cc (revision 14694)
|
| +++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
|
| @@ -627,17 +627,15 @@
|
| void FlowGraphCompiler::CopyParameters() {
|
| __ Comment("Copy parameters");
|
| const Function& function = parsed_function().function();
|
| - const bool is_native_instance_closure =
|
| - function.is_native() && function.IsImplicitInstanceClosureFunction();
|
| LocalScope* scope = parsed_function().node_sequence()->scope();
|
| const int num_fixed_params = function.num_fixed_parameters();
|
| const int num_opt_pos_params = function.NumOptionalPositionalParameters();
|
| - int num_opt_named_params = function.NumOptionalNamedParameters();
|
| + const int num_opt_named_params = function.NumOptionalNamedParameters();
|
| const int num_params =
|
| num_fixed_params + num_opt_pos_params + num_opt_named_params;
|
| - int implicit_this_param_pos = is_native_instance_closure ? -1 : 0;
|
| + ASSERT(function.NumParameters() == num_params);
|
| ASSERT(parsed_function().first_parameter_index() ==
|
| - ParsedFunction::kFirstLocalSlotIndex + implicit_this_param_pos);
|
| + ParsedFunction::kFirstLocalSlotIndex);
|
|
|
| // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
|
| // where num_pos_args is the number of positional arguments passed in.
|
| @@ -668,19 +666,12 @@
|
|
|
| // Let RDI point to the last copied positional argument, i.e. to
|
| // fp[ParsedFunction::kFirstLocalSlotIndex - (num_pos_args - 1)].
|
| - const int index =
|
| - ParsedFunction::kFirstLocalSlotIndex + 1 + implicit_this_param_pos;
|
| - // First copy captured receiver if function is an implicit native closure.
|
| - if (is_native_instance_closure) {
|
| - __ movq(RAX, FieldAddress(CTX, Context::variable_offset(0)));
|
| - __ movq(Address(RBP, (index * kWordSize)), RAX);
|
| - }
|
| + const int index = ParsedFunction::kFirstLocalSlotIndex + 1;
|
| __ SmiUntag(RCX);
|
| __ movq(RAX, RCX);
|
| __ negq(RAX);
|
| // -num_pos_args is in RAX.
|
| - // (ParsedFunction::kFirstLocalSlotIndex + 1 + implicit_this_param_pos)
|
| - // is in index.
|
| + // (ParsedFunction::kFirstLocalSlotIndex + 1) is in index.
|
| __ leaq(RDI, Address(RBP, RAX, TIMES_8, (index * kWordSize)));
|
| Label loop, loop_condition;
|
| __ jmp(&loop_condition, Assembler::kNearJump);
|
| @@ -756,8 +747,8 @@
|
| // We do not use the final allocation index of the variable here, i.e.
|
| // scope->VariableAt(i)->index(), because captured variables still need
|
| // to be copied to the context that is not yet allocated.
|
| - intptr_t computed_param_pos = (ParsedFunction::kFirstLocalSlotIndex -
|
| - param_pos + implicit_this_param_pos);
|
| + const intptr_t computed_param_pos =
|
| + ParsedFunction::kFirstLocalSlotIndex - param_pos;
|
| const Address param_addr(RBP, (computed_param_pos * kWordSize));
|
| __ movq(param_addr, RAX);
|
| __ Bind(&next_parameter);
|
| @@ -767,7 +758,8 @@
|
| // Check that RDI now points to the null terminator in the array descriptor.
|
| __ cmpq(Address(RDI, 0), raw_null);
|
| __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
|
| - } else if (num_opt_pos_params > 0) {
|
| + } else {
|
| + ASSERT(num_opt_pos_params > 0);
|
| // Number of positional args is the second Smi in descriptor array (R10).
|
| __ movq(RCX, FieldAddress(R10, Array::data_offset() + (1 * kWordSize)));
|
| __ SmiUntag(RCX);
|
| @@ -787,8 +779,8 @@
|
| // We do not use the final allocation index of the variable here, i.e.
|
| // scope->VariableAt(i)->index(), because captured variables still need
|
| // to be copied to the context that is not yet allocated.
|
| - intptr_t computed_param_pos = (ParsedFunction::kFirstLocalSlotIndex -
|
| - param_pos + implicit_this_param_pos);
|
| + const intptr_t computed_param_pos =
|
| + ParsedFunction::kFirstLocalSlotIndex - param_pos;
|
| const Address param_addr(RBP, (computed_param_pos * kWordSize));
|
| __ movq(param_addr, RAX);
|
| __ Bind(&next_parameter);
|
| @@ -799,9 +791,6 @@
|
| // Check that RCX equals RBX, i.e. no named arguments passed.
|
| __ cmpq(RCX, RBX);
|
| __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
|
| - } else {
|
| - ASSERT(is_native_instance_closure);
|
| - __ jmp(&all_arguments_processed, Assembler::kNearJump);
|
| }
|
|
|
| __ Bind(&wrong_num_arguments);
|
|
|