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

Unified Diff: runtime/vm/dart_entry.cc

Issue 11360116: Pass closure object as first implicit argument to closure functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/dart_api_impl.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_entry.cc
===================================================================
--- runtime/vm/dart_entry.cc (revision 14694)
+++ runtime/vm/dart_entry.cc (working copy)
@@ -99,6 +99,14 @@
return error.raw();
}
}
+ // Set up arguments to include the closure as the first argument.
+ const int num_arguments = arguments.length() + 1;
+ GrowableArray<const Object*> args(num_arguments);
+ const Object& arg0 = Object::ZoneHandle(closure.raw());
+ args.Add(&arg0);
+ for (int i = 1; i < num_arguments; i++) {
+ args.Add(arguments[i - 1]);
+ }
// Now Call the invoke stub which will invoke the closure.
invokestub entrypoint = reinterpret_cast<invokestub>(
StubCode::InvokeDartCodeEntryPoint());
@@ -107,8 +115,8 @@
ASSERT(!code.IsNull());
return entrypoint(
code.EntryPoint(),
- ArgumentsDescriptor(arguments.length(), optional_arguments_names),
- arguments.data(),
+ ArgumentsDescriptor(num_arguments, optional_arguments_names),
+ args.data(),
context);
}
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698