Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Unified Diff: runtime/vm/flow_graph_compiler_mips.cc

Issue 19200002: Change resolving of instance methods to check early for name mismatch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698