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

Unified Diff: runtime/vm/object.cc

Issue 51123003: VM: Fix checked mode crash (issue 13831). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 29679)
+++ runtime/vm/object.cc (working copy)
@@ -4224,7 +4224,9 @@
RawFunction* Function::implicit_closure_function() const {
- if (IsClosureFunction() || IsSignatureFunction()) {
+ if (IsClosureFunction() ||
+ IsSignatureFunction() ||
+ IsStaticInitializerFunction()) {
return Function::null();
}
const Object& obj = Object::Handle(raw_ptr()->data_);
@@ -5427,6 +5429,35 @@
}
+RawFunction* Function::NewStaticInitializer(const String& field_name,
+ const AbstractType& result_type,
+ const Class& cls,
+ intptr_t initializer_pos) {
+ const String& init_name =
+ String::Handle(Symbols::New(String::Handle(
+ String::Concat(Symbols::InitPrefix(), field_name))));
+ const Function& init_function = Function::ZoneHandle(
+ Function::New(init_name,
+ RawFunction::kStaticInitializer,
+ true, // static
+ false, // !const
+ false, // !abstract
+ false, // !external
+ cls,
+ initializer_pos));
+ init_function.set_result_type(result_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
+ // optimizing compiler can eliminate the call to the static initializer
+ // via constant folding.
+ init_function.set_is_visible(false);
+ init_function.set_is_optimizable(false);
+ init_function.set_is_inlinable(false);
+ return init_function.raw();
+}
+
+
const char* Function::ToCString() const {
const char* static_str = is_static() ? " static" : "";
const char* abstract_str = is_abstract() ? " abstract" : "";
@@ -5451,6 +5482,9 @@
case RawFunction::kImplicitSetter:
kind_str = " setter";
break;
+ case RawFunction::kStaticInitializer:
+ kind_str = " static-initializer";
+ break;
case RawFunction::kImplicitStaticFinalGetter:
kind_str = " static-final-getter";
break;
@@ -5522,6 +5556,9 @@
case RawFunction::kConstructor:
kind_string = "constructor";
break;
+ case RawFunction::kStaticInitializer:
+ kind_string = "static initializer";
+ break;
case RawFunction::kImplicitStaticFinalGetter:
kind_string = "static final getter";
break;
« runtime/vm/class_finalizer.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698