Chromium Code Reviews| Index: runtime/vm/compiler.cc |
| =================================================================== |
| --- runtime/vm/compiler.cc (revision 39313) |
| +++ runtime/vm/compiler.cc (working copy) |
| @@ -929,6 +929,39 @@ |
| } |
| +RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { |
| + ASSERT(field.is_static()); |
|
srdjan
2014/08/19 18:49:38
Do you want to check if it was not already initial
hausner
2014/08/19 20:54:00
That check is done in compiled code. We only get h
|
| + // The VM sets the field's value to transiton_sentinel prior to |
| + // evaluating the initializer value. |
| + ASSERT(field.value() == Object::transition_sentinel().raw()); |
| + Isolate* isolate = Isolate::Current(); |
| + StackZone zone(isolate); |
| + LongJumpScope jump; |
| + if (setjmp(*jump.Set()) == 0) { |
| + ParsedFunction* parsed_function = |
| + Parser::ParseStaticFieldInitializer(field); |
| + |
| + parsed_function->AllocateVariables(); |
| + // Non-optimized code generator. |
| + CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); |
| + |
| + // Invoke the function to evaluate the expression. |
| + const Function& initializer = parsed_function->function(); |
| + const Object& result = Object::Handle( |
| + DartEntry::InvokeFunction(initializer, Object::empty_array())); |
| + return result.raw(); |
| + } else { |
| + const Error& error = |
| + Error::Handle(isolate, isolate->object_store()->sticky_error()); |
| + isolate->object_store()->clear_sticky_error(); |
| + return error.raw(); |
| + } |
| + UNREACHABLE(); |
| + return Object::null(); |
| +} |
| + |
| + |
| + |
| RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { |
| Isolate* isolate = Isolate::Current(); |
| LongJumpScope jump; |
| @@ -959,7 +992,7 @@ |
| // Manually generated AST, do not recompile. |
| func.SetIsOptimizable(false); |
| - // We compile the function here, even though InvokeStatic() below |
| + // We compile the function here, even though InvokeFunction() below |
| // would compile func automatically. We are checking fewer invariants |
| // here. |
| ParsedFunction* parsed_function = new ParsedFunction(isolate, func); |