| Index: runtime/vm/flow_graph_compiler_mips.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_compiler_mips.cc (revision 25039)
|
| +++ runtime/vm/flow_graph_compiler_mips.cc (working copy)
|
| @@ -905,6 +905,11 @@
|
|
|
| // Copy or initialize optional named arguments.
|
| Label all_arguments_processed;
|
| +#ifdef DEBUG
|
| + const bool check_correct_named_args = true;
|
| +#else
|
| + const bool check_correct_named_args = function.IsClosureFunction();
|
| +#endif
|
| if (num_opt_named_params > 0) {
|
| __ Comment("There are named parameters");
|
| // Start by alphabetically sorting the names of the optional parameters.
|
| @@ -974,10 +979,13 @@
|
| }
|
| delete[] opt_param;
|
| delete[] opt_param_position;
|
| - // Check that T0 now points to the null terminator in the array descriptor.
|
| - __ lw(T3, Address(T0));
|
| - __ BranchEqual(T3, reinterpret_cast<int32_t>(Object::null()),
|
| - &all_arguments_processed);
|
| + if (check_correct_named_args) {
|
| + // Check that T0 now points to the null terminator in the arguments
|
| + // descriptor.
|
| + __ lw(T3, Address(T0));
|
| + __ BranchEqual(T3, reinterpret_cast<int32_t>(Object::null()),
|
| + &all_arguments_processed);
|
| + }
|
| } else {
|
| ASSERT(num_opt_pos_params > 0);
|
| __ Comment("There are optional positional parameters");
|
| @@ -1003,26 +1011,29 @@
|
| __ sw(T3, Address(FP, computed_param_pos * kWordSize));
|
| __ Bind(&next_parameter);
|
| }
|
| - __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
|
| - __ SmiUntag(T1);
|
| - // Check that T2 equals T1, i.e. no named arguments passed.
|
| - __ beq(T2, T1, &all_arguments_processed);
|
| + if (check_correct_named_args) {
|
| + __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
|
| + __ SmiUntag(T1);
|
| + // Check that T2 equals T1, i.e. no named arguments passed.
|
| + __ beq(T2, T1, &all_arguments_processed);
|
| + }
|
| }
|
|
|
| __ Bind(&wrong_num_arguments);
|
| - // Invoke noSuchMethod function passing the original name of the function.
|
| - // If the function is a closure function, use "call" as the original name.
|
| - const String& name = String::Handle(
|
| - function.IsClosureFunction() ? Symbols::Call().raw() : function.name());
|
| - const int kNumArgsChecked = 1;
|
| - const ICData& ic_data = ICData::ZoneHandle(
|
| - ICData::New(function, name, Object::null_array(),
|
| - Isolate::kNoDeoptId, kNumArgsChecked));
|
| - __ LoadObject(S5, ic_data);
|
| - __ LeaveDartFrame(); // The arguments are still on the stack.
|
| - __ Branch(&StubCode::CallNoSuchMethodFunctionLabel());
|
| - // The noSuchMethod call may return to the caller, but not here.
|
| - __ break_(0);
|
| + if (function.IsClosureFunction()) {
|
| + // Invoke noSuchMethod function passing "call" as the original name.
|
| + const int kNumArgsChecked = 1;
|
| + const ICData& ic_data = ICData::ZoneHandle(
|
| + ICData::New(function, Symbols::Call(), Object::null_array(),
|
| + Isolate::kNoDeoptId, kNumArgsChecked));
|
| + __ LoadObject(S5, ic_data);
|
| + __ LeaveDartFrame(); // The arguments are still on the stack.
|
| + __ Branch(&StubCode::CallNoSuchMethodFunctionLabel());
|
| + // The noSuchMethod call may return to the caller, but not here.
|
| + __ break_(0);
|
| + } else if (check_correct_named_args) {
|
| + __ Stop("Wrong arguments");
|
| + }
|
|
|
| __ Bind(&all_arguments_processed);
|
| // Nullify originally passed arguments only after they have been copied and
|
|
|