| Index: runtime/vm/flow_graph_compiler_arm64.cc
|
| diff --git a/runtime/vm/flow_graph_compiler_arm64.cc b/runtime/vm/flow_graph_compiler_arm64.cc
|
| index d6ea4bcacdb7619e295543f57d8b13c8bc1e45c3..178482ab4a727eaa2c62db958671b6ebd3f1dffb 100644
|
| --- a/runtime/vm/flow_graph_compiler_arm64.cc
|
| +++ b/runtime/vm/flow_graph_compiler_arm64.cc
|
| @@ -1050,13 +1050,8 @@ void FlowGraphCompiler::CompileGraph() {
|
| // No such checking code is generated if only fixed parameters are declared,
|
| // unless we are in debug mode or unless we are compiling a closure.
|
| if (num_copied_params == 0) {
|
| -#ifdef DEBUG
|
| - ASSERT(!parsed_function().function().HasOptionalParameters());
|
| - const bool check_arguments = !flow_graph().IsCompiledForOsr();
|
| -#else
|
| const bool check_arguments =
|
| function.IsClosureFunction() && !flow_graph().IsCompiledForOsr();
|
| -#endif
|
| if (check_arguments) {
|
| __ Comment("Check argument count");
|
| // Check that exactly num_fixed arguments are passed in.
|
| @@ -1069,13 +1064,9 @@ void FlowGraphCompiler::CompileGraph() {
|
| __ CompareRegisters(R0, R1);
|
| __ b(&correct_num_arguments, EQ);
|
| __ Bind(&wrong_num_arguments);
|
| - if (function.IsClosureFunction()) {
|
| - __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
|
| - __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry());
|
| - // The noSuchMethod call may return to the caller, but not here.
|
| - } else {
|
| - __ Stop("Wrong number of arguments");
|
| - }
|
| + __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
|
| + __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry());
|
| + // The noSuchMethod call may return to the caller, but not here.
|
| __ Bind(&correct_num_arguments);
|
| }
|
| } else if (!flow_graph().IsCompiledForOsr()) {
|
| @@ -1409,7 +1400,12 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
|
| intptr_t deopt_id,
|
| TokenPosition token_pos,
|
| LocationSummary* locs) {
|
| - __ LoadObject(R4, arguments_descriptor);
|
| + ASSERT(!function.IsClosureFunction());
|
| + if (function.HasOptionalParameters()) {
|
| + __ LoadObject(R4, arguments_descriptor);
|
| + } else {
|
| + __ LoadImmediate(R4, 0); // GC safe smi zero because of stub.
|
| + }
|
| // Do not use the code from the function, but let the code be patched so that
|
| // we can record the outgoing edges to other code.
|
| GenerateStaticDartCall(deopt_id,
|
|
|