Index: runtime/vm/flow_graph_compiler_mips.cc |
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc |
index 580acf3b55dade7a60843c21f7d8fbce1d4b19eb..a6f3f140b01644166b9414d6b0f95220dceb7bab 100644 |
--- a/runtime/vm/flow_graph_compiler_mips.cc |
+++ b/runtime/vm/flow_graph_compiler_mips.cc |
@@ -1072,13 +1072,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. |
@@ -1091,13 +1086,9 @@ void FlowGraphCompiler::CompileGraph() { |
ArgumentsDescriptor::positional_count_offset())); |
__ beq(T0, T1, &correct_num_arguments); |
__ Bind(&wrong_num_arguments); |
- if (function.IsClosureFunction()) { |
- __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack. |
- __ Branch(*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. |
+ __ Branch(*StubCode::CallClosureNoSuchMethod_entry()); |
+ // The noSuchMethod call may return to the caller, but not here. |
__ Bind(&correct_num_arguments); |
} |
} else if (!flow_graph().IsCompiledForOsr()) { |
@@ -1435,7 +1426,12 @@ void FlowGraphCompiler::EmitOptimizedStaticCall( |
TokenPosition token_pos, |
LocationSummary* locs) { |
__ Comment("StaticCall"); |
- __ LoadObject(S4, arguments_descriptor); |
+ ASSERT(!function.IsClosureFunction()); |
+ if (function.HasOptionalParameters()) { |
+ __ LoadObject(S4, arguments_descriptor); |
+ } else { |
+ __ LoadImmediate(S4, 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, |