Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index 4ba03785ec706b47db5e70c74b50857b4cc84ec6..7780eb35b41c63f2fbb9875105e75f5aed445b98 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -1293,15 +1293,15 @@ static void CreateLocalVarDescriptors(const ParsedFunction& parsed_function) { |
void Compiler::CompileStaticInitializer(const Field& field) { |
ASSERT(field.is_static()); |
- if (field.initializer() != Function::null()) { |
+ if (field.PrecompiledInitializer() != Function::null()) { |
// TODO(rmacnak): Investigate why this happens for _enum_names. |
OS::Print("Warning: Ignoring repeated request for initializer for %s\n", |
field.ToCString()); |
return; |
} |
- ASSERT(field.initializer() == Function::null()); |
- Thread* thread = Thread::Current(); |
- StackZone zone(thread); |
+ ASSERT(field.PrecompiledInitializer() == Function::null()); |
+ Isolate* isolate = Isolate::Current(); |
+ StackZone zone(isolate); |
ParsedFunction* parsed_function = Parser::ParseStaticFieldInitializer(field); |
@@ -1314,7 +1314,7 @@ void Compiler::CompileStaticInitializer(const Field& field) { |
Isolate::kNoDeoptId); |
const Function& initializer = parsed_function->function(); |
- field.set_initializer(initializer); |
+ field.SetPrecompiledInitializer(initializer); |
} |
@@ -1322,16 +1322,15 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { |
ASSERT(field.is_static()); |
// The VM sets the field's value to transiton_sentinel prior to |
// evaluating the initializer value. |
- ASSERT(field.value() == Object::transition_sentinel().raw()); |
+ ASSERT(field.StaticFieldValue() == Object::transition_sentinel().raw()); |
LongJumpScope jump; |
if (setjmp(*jump.Set()) == 0) { |
- Function& initializer = Function::Handle(field.initializer()); |
- |
// Under precompilation, the initializer may have already been compiled, in |
// which case use it. Under lazy compilation or early in precompilation, the |
// initializer has not yet been created, so create it now, but don't bother |
// remembering it because it won't be used again. |
- if (initializer.IsNull()) { |
+ Function& initializer = Function::Handle(); |
+ if (!field.HasPrecompiledInitializer()) { |
Thread* const thread = Thread::Current(); |
StackZone zone(thread); |
ParsedFunction* parsed_function = |
@@ -1348,6 +1347,8 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { |
CreateLocalVarDescriptors(*parsed_function); |
initializer = parsed_function->function().raw(); |
+ } else { |
+ initializer ^= field.PrecompiledInitializer(); |
} |
// Invoke the function to evaluate the expression. |
const Object& result = PassiveObject::Handle( |