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

Unified Diff: runtime/vm/object.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/object.cc
===================================================================
--- runtime/vm/object.cc (revision 348)
+++ runtime/vm/object.cc (working copy)
@@ -2717,6 +2717,15 @@
}
+bool Function::IsImplicitClosureFunction() const {
+ if (kind() != RawFunction::kClosureFunction) {
+ return false;
+ }
siva 2011/10/11 21:00:46 if (!IsClosureFunction()) { return false; } ins
regis 2011/10/11 23:40:19 Done.
+ const Function& parent = Function::Handle(parent_function());
+ return parent.raw_ptr()->implicit_closure_function_ == raw();
+}
+
+
RawFunction* Function::New() {
const Class& function_class = Class::Handle(Object::function_class());
RawObject* raw = Object::Allocate(function_class,
@@ -2757,7 +2766,7 @@
const Function& result = Function::Handle(
Function::New(name,
RawFunction::kClosureFunction,
- /* is_static = */ true,
+ /* is_static = */ parent.is_static(),
/* is_const = */ false,
token_index));
result.set_parent_function(parent);
@@ -2830,6 +2839,7 @@
ASSERT(Class::Handle(closure_function.signature_class()).IsNull());
closure_function.set_signature_class(signature_class);
set_implicit_closure_function(closure_function);
+ ASSERT(closure_function.IsImplicitClosureFunction());
return closure_function.raw();
}

Powered by Google App Engine
This is Rietveld 408576698