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

Unified Diff: runtime/vm/compiler.cc

Issue 1133633002: Eagerly create local var descriptors for artificially created methods (they cannot be regularly par… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698