| Index: runtime/vm/compiler.cc
|
| ===================================================================
|
| --- runtime/vm/compiler.cc (revision 45599)
|
| +++ runtime/vm/compiler.cc (working copy)
|
| @@ -1134,15 +1134,17 @@
|
| const Function& function = Function::Handle(code.function());
|
| ParsedFunction* parsed_function = new ParsedFunction(
|
| Thread::Current(), Function::ZoneHandle(function.raw()));
|
| - LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle();
|
| - if (function.IsIrregexpFunction()) {
|
| - UNREACHABLE(); // Special parsing needed, not yet implemented.
|
| - } else {
|
| - Parser::ParseFunction(parsed_function);
|
| - parsed_function->AllocateVariables();
|
| - var_descs =
|
| - parsed_function->node_sequence()->scope()->GetVarDescriptors(function);
|
| - }
|
| + LocalVarDescriptors& var_descs =
|
| + LocalVarDescriptors::Handle(code.var_descriptors());
|
| + ASSERT(var_descs.IsNull());
|
| + // IsIrregexpFunction have eager var descriptors generation.
|
| + ASSERT(!function.IsIrregexpFunction());
|
| + // Parser should not produce any errors, therefore no LongJumpScope needed.
|
| + Parser::ParseFunction(parsed_function);
|
| + parsed_function->AllocateVariables();
|
| + var_descs = parsed_function->node_sequence()->scope()->
|
| + GetVarDescriptors(function);
|
| + ASSERT(!var_descs.IsNull());
|
| code.set_var_descriptors(var_descs);
|
| }
|
|
|
| @@ -1194,6 +1196,14 @@
|
| }
|
|
|
|
|
| +static void CreateLocalVarDescriptors(const ParsedFunction& parsed_function) {
|
| + const Function& func = parsed_function.function();
|
| + LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle();
|
| + var_descs = parsed_function.node_sequence()->scope()->GetVarDescriptors(func);
|
| + Code::Handle(func.unoptimized_code()).set_var_descriptors(var_descs);
|
| +}
|
| +
|
| +
|
| RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
|
| ASSERT(field.is_static());
|
| // The VM sets the field's value to transiton_sentinel prior to
|
| @@ -1213,6 +1223,8 @@
|
| parsed_function,
|
| false,
|
| Isolate::kNoDeoptId);
|
| + // Eagerly create local var descriptors.
|
| + CreateLocalVarDescriptors(*parsed_function);
|
|
|
| // Invoke the function to evaluate the expression.
|
| const Function& initializer = parsed_function->function();
|
| @@ -1282,6 +1294,8 @@
|
| false,
|
| Isolate::kNoDeoptId);
|
|
|
| + // Eagerly create local var descriptors.
|
| + CreateLocalVarDescriptors(*parsed_function);
|
| const Object& result = PassiveObject::Handle(
|
| DartEntry::InvokeFunction(func, Object::empty_array()));
|
| return result.raw();
|
|
|