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

Unified Diff: dart/runtime/vm/object.cc

Issue 57813002: Version 0.8.10.3 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | « dart/runtime/vm/object.h ('k') | dart/runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/runtime/vm/object.cc
===================================================================
--- dart/runtime/vm/object.cc (revision 29802)
+++ dart/runtime/vm/object.cc (working copy)
@@ -4227,6 +4227,21 @@
}
+RawField* Function::saved_static_field() const {
+ ASSERT(kind() == RawFunction::kStaticInitializer);
+ const Object& obj = Object::Handle(raw_ptr()->data_);
+ ASSERT(obj.IsField());
+ return Field::Cast(obj).raw();
+}
+
+
+void Function::set_saved_static_field(const Field& value) const {
+ ASSERT(kind() == RawFunction::kStaticInitializer);
+ ASSERT(raw_ptr()->data_ == Object::null());
+ set_data(value);
+}
+
+
RawFunction* Function::parent_function() const {
if (IsClosureFunction()) {
const Object& obj = Object::Handle(raw_ptr()->data_);
@@ -5454,10 +5469,9 @@
}
-RawFunction* Function::NewStaticInitializer(const String& field_name,
- const AbstractType& result_type,
- const Class& cls,
- intptr_t initializer_pos) {
+RawFunction* Function::NewStaticInitializer(const Field& field) {
+ ASSERT(field.is_static());
+ const String& field_name = String::Handle(field.name());
const String& init_name =
String::Handle(Symbols::New(String::Handle(
String::Concat(Symbols::InitPrefix(), field_name))));
@@ -5468,9 +5482,9 @@
false, // !const
false, // !abstract
false, // !external
- cls,
- initializer_pos));
- init_function.set_result_type(result_type);
+ Class::Handle(field.owner()),
+ field.token_pos()));
+ init_function.set_result_type(AbstractType::Handle(field.type()));
// Static initializer functions are generated by the VM and are therfore
// hidden from the user. Since they are only executed once, we avoid
// optimizing and inlining them. After the field is initialized, the
@@ -5479,6 +5493,7 @@
init_function.set_is_visible(false);
init_function.set_is_optimizable(false);
init_function.set_is_inlinable(false);
+ init_function.set_saved_static_field(field);
return init_function.raw();
}
« no previous file with comments | « dart/runtime/vm/object.h ('k') | dart/runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698