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

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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 355)
+++ runtime/vm/object.cc (working copy)
@@ -2337,15 +2337,6 @@
}
-bool Function::IsInStaticScope() const {
- Function& outer_function = Function::Handle(raw());
- while (outer_function.IsLocalFunction()) {
- outer_function = outer_function.parent_function();
- }
- return outer_function.is_static();
-}
-
-
void Function::set_name(const String& value) const {
ASSERT(value.IsSymbol());
StorePointer(&raw_ptr()->name_, value.raw());
@@ -2717,6 +2708,15 @@
}
+bool Function::IsImplicitClosureFunction() const {
+ if (!IsClosureFunction()) {
+ return false;
+ }
+ 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 +2757,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 +2830,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();
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698