Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index 231202b57821bdcc657a92b397285952de0efd76..4bfae85d6ae3a25a57d9f2d854dde2cb64852f6a 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -1692,7 +1692,6 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { |
// Under lazy compilation initializer has not yet been created, so create |
// it now, but don't bother remembering it because it won't be used again. |
ASSERT(!field.HasPrecompiledInitializer()); |
- Function& initializer = Function::Handle(thread->zone()); |
{ |
#if !defined(PRODUCT) |
VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); |
@@ -1720,22 +1719,21 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { |
// Non-optimized code generator. |
DartCompilationPipeline pipeline; |
CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); |
- helper.Compile(&pipeline); |
- initializer = parsed_function->function().raw(); |
- Code::Handle(initializer.unoptimized_code()) |
- .set_var_descriptors(Object::empty_var_descriptors()); |
+ const Code& code = Code::Handle(helper.Compile(&pipeline)); |
Vyacheslav Egorov (Google)
2017/04/03 17:05:19
Maybe fix Compiler::ExecuteOnce(...) in the same w
kustermann
2017/04/03 17:35:18
Done.
|
+ if (!code.IsNull()) { |
+ const Function& initializer = parsed_function->function(); |
+ code.set_var_descriptors(Object::empty_var_descriptors()); |
+ // Invoke the function to evaluate the expression. |
+ return DartEntry::InvokeFunction(initializer, Object::empty_array()); |
+ } |
} |
- // Invoke the function to evaluate the expression. |
- return DartEntry::InvokeFunction(initializer, Object::empty_array()); |
- } else { |
- Thread* const thread = Thread::Current(); |
- StackZone zone(thread); |
- const Error& error = Error::Handle(thread->zone(), thread->sticky_error()); |
- thread->clear_sticky_error(); |
- return error.raw(); |
} |
- UNREACHABLE(); |
- return Object::null(); |
+ |
+ Thread* const thread = Thread::Current(); |
+ StackZone zone(thread); |
+ const Error& error = Error::Handle(thread->zone(), thread->sticky_error()); |
+ thread->clear_sticky_error(); |
+ return error.raw(); |
} |