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

Unified Diff: runtime/vm/parser.cc

Issue 16835002: One more premature load-static node generation solved. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 23922)
+++ runtime/vm/parser.cc (working copy)
@@ -7525,8 +7525,23 @@
ASSERT(field.value() != Object::transition_sentinel().raw());
return new LiteralNode(ident_pos, Instance::ZoneHandle(field.value()));
}
- // Access the field directly.
- return new LoadStaticFieldNode(ident_pos, Field::ZoneHandle(field.raw()));
+ ASSERT(field.is_static());
+ const Class& field_owner = Class::ZoneHandle(field.owner());
+ const String& field_name = String::ZoneHandle(field.name());
+ const String& getter_name = String::Handle(Field::GetterName(field_name));
+ const Function& getter =
+ Function::Handle(field_owner.LookupStaticFunction(getter_name));
+ // Never load field directly if there is a getter (deterministic AST).
+ if (getter.IsNull()) {
+ return new LoadStaticFieldNode(ident_pos, Field::ZoneHandle(field.raw()));
+ } else {
+ ASSERT(getter.kind() == RawFunction::kConstImplicitGetter);
+ return new StaticGetterNode(ident_pos,
+ NULL, // Receiver.
+ false, // is_super_getter.
+ field_owner,
+ field_name);
+ }
}
@@ -8172,7 +8187,8 @@
field_owner,
field_name);
}
- } else if (value.raw() == Object::sentinel().raw()) {
+ }
hausner 2013/06/12 20:43:39 Why get rid of the else? I prefer it since it is e
srdjan 2013/06/12 21:32:08 Restored.
+ if (value.raw() == Object::sentinel().raw()) {
// This field has not been referenced yet and thus the value has
// not been evaluated. If the field is const, call the static getter method
// to evaluate the expression and canonicalize the value.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698