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

Unified Diff: runtime/vm/code_generator.cc

Issue 8234016: Inline allocation of implicit closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 348)
+++ runtime/vm/code_generator.cc (working copy)
@@ -222,11 +222,11 @@
// Allocate a new closure.
// Arg0: local function.
// TODO(regis): Arg1: type arguments of the closure.
-// TODO(regis): Arg2: type arguments of the instantiator.
// Return value: newly allocated closure.
DEFINE_RUNTIME_ENTRY(AllocateClosure, 1) {
ASSERT(arguments.Count() == kAllocateClosureRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.At(0));
+ ASSERT(function.IsClosureFunction() && !function.IsImplicitClosureFunction());
// TODO(regis): Process type arguments unless the closure is static.
// The current context was saved in the Isolate structure when entering the
// runtime.
@@ -245,7 +245,8 @@
ObjectStore* object_store = Isolate::Current()->object_store();
ASSERT(object_store != NULL);
const Function& function = Function::CheckedHandle(arguments.At(0));
- ASSERT(function.is_static()); // Closure functions are always static for now.
+ ASSERT(function.IsImplicitClosureFunction());
+ ASSERT(function.is_static());
const Context& context = Context::Handle(object_store->empty_context());
arguments.SetReturn(Closure::Handle(Closure::New(function, context)));
}
@@ -255,13 +256,13 @@
// Arg0: local function.
// Arg1: receiver object.
// TODO(regis): Arg2: type arguments of the closure.
-// TODO(regis): Arg3: type arguments of the instantiator.
// Return value: newly allocated closure.
DEFINE_RUNTIME_ENTRY(AllocateImplicitClosure, 2) {
ASSERT(arguments.Count() ==
kAllocateImplicitClosureRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.At(0));
- ASSERT(function.is_static()); // Closure functions are always static for now.
+ ASSERT(function.IsImplicitClosureFunction());
+ ASSERT(!function.is_static());
const Instance& receiver = Instance::CheckedHandle(arguments.At(1));
Context& context = Context::Handle();
context = Context::New(1);

Powered by Google App Engine
This is Rietveld 408576698