Index: runtime/vm/flow_graph_compiler_ia32.cc |
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc |
index 786855747bc1bf0201385e6ef968f810f426ace7..4fc56289945941232880efcb6680f97c62a59c4e 100644 |
--- a/runtime/vm/flow_graph_compiler_ia32.cc |
+++ b/runtime/vm/flow_graph_compiler_ia32.cc |
@@ -1054,13 +1054,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. |
@@ -1074,13 +1069,9 @@ void FlowGraphCompiler::CompileGraph() { |
__ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); |
__ Bind(&wrong_num_arguments); |
- if (function.IsClosureFunction()) { |
- __ LeaveFrame(); // The arguments are still on the stack. |
- __ Jmp(*StubCode::CallClosureNoSuchMethod_entry()); |
- // The noSuchMethod call may return to the caller, but not here. |
- } else { |
- __ Stop("Wrong number of arguments"); |
- } |
+ __ LeaveFrame(); // The arguments are still on the stack. |
+ __ Jmp(*StubCode::CallClosureNoSuchMethod_entry()); |
+ // The noSuchMethod call may return to the caller, but not here. |
__ Bind(&correct_num_arguments); |
} |
} else if (!flow_graph().IsCompiledForOsr()) { |
@@ -1357,7 +1348,11 @@ void FlowGraphCompiler::EmitOptimizedStaticCall( |
intptr_t deopt_id, |
TokenPosition token_pos, |
LocationSummary* locs) { |
- __ LoadObject(EDX, arguments_descriptor); |
+ if (function.HasOptionalParameters()) { |
+ __ LoadObject(EDX, arguments_descriptor); |
+ } else { |
+ __ xorl(EDX, EDX); // 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. |
GenerateDartCall(deopt_id, |