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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 11564029: Implement Function.apply in vm (issue 5670). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_x64.cc
===================================================================
--- runtime/vm/flow_graph_compiler_x64.cc (revision 16173)
+++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
@@ -902,7 +902,7 @@
// We check the number of passed arguments when we have to copy them due to
// the presence of optional parameters.
// No such checking code is generated if only fixed parameters are declared,
- // unless we are debug mode or unless we are compiling a closure.
+ // unless we are in debug mode or unless we are compiling a closure.
LocalVariable* saved_args_desc_var =
parsed_function().GetSavedArgumentsDescriptorVar();
if (num_copied_params == 0) {
@@ -914,11 +914,17 @@
#endif
if (check_arguments) {
__ Comment("Check argument count");
- // Check that num_fixed <= argc <= num_params.
- Label argc_in_range;
+ // Check that exactly num_fixed arguments are passed in.
+ Label correct_num_arguments, wrong_num_arguments;
__ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
__ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params)));
- __ j(EQUAL, &argc_in_range, Assembler::kNearJump);
+ __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
+ __ cmpq(RAX,
+ FieldAddress(R10,
+ ArgumentsDescriptor::positional_count_offset()));
+ __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
+
+ __ Bind(&wrong_num_arguments);
if (function.IsClosureFunction()) {
if (StackSize() != 0) {
// We need to unwind the space we reserved for locals and copied
@@ -955,7 +961,7 @@
} else {
__ Stop("Wrong number of arguments");
}
- __ Bind(&argc_in_range);
+ __ Bind(&correct_num_arguments);
}
// The arguments descriptor is never saved in the absence of optional
// parameters, since any argument definition test would always yield true.
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698