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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 14969019: A load static of an initialized static final field can be converted to its value, as long as it is … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/flow_graph_optimizer.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 22591)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -4444,8 +4444,8 @@
const GrowableArray<BlockEntryInstr*>& ignored)
: FlowGraphVisitor(ignored),
graph_(graph),
- unknown_(Object::transition_sentinel()),
- non_constant_(Object::sentinel()),
+ unknown_(Object::unknown_constant()),
+ non_constant_(Object::non_constant()),
reachable_(new BitVector(graph->preorder().length())),
definition_marks_(new BitVector(graph->max_virtual_register_number())),
block_worklist_(),
@@ -4882,6 +4882,15 @@
void ConstantPropagator::VisitLoadStaticField(LoadStaticFieldInstr* instr) {
+ const Field& field = instr->field();
+ ASSERT(field.is_static());
+ if (field.is_final()) {
+ Instance& obj = Instance::Handle(field.value());
+ if (obj.IsSmi() || obj.IsOld()) {
+ SetValue(instr, obj);
+ return;
+ }
+ }
SetValue(instr, non_constant_);
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698