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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10830339: Propagate class ids using existing type propagation framework. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/il_printer.cc » ('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 10825)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -749,6 +749,12 @@
}
+// TODO(srdjan): Investigate if the propagated cid should be more specific.
+void FlowGraphTypePropagator::VisitPushArgument(PushArgumentInstr* push) {
+ if (!push->has_propagated_cid()) push->SetPropagatedCid(kDynamicCid);
+}
+
+
void FlowGraphTypePropagator::VisitBind(BindInstr* bind) {
// No need to propagate the input types of the bound computation, as long as
// PhiInstr's are handled as part of JoinEntryInstr.
@@ -764,6 +770,12 @@
if (changed) {
still_changing_ = true;
}
+ // Propagate class ids.
+ intptr_t cid = bind->computation()->ResultCid();
+ changed = bind->SetPropagatedCid(cid);
+ if (changed) {
+ still_changing_ = true;
+ }
}
}
@@ -779,6 +791,32 @@
if (changed) {
still_changing_ = true;
}
+
+ // Merge class ids: if any two inputs have different class ids then result
+ // is kDynamicCid.
+ intptr_t merged_cid = kIllegalCid;
+ for (intptr_t i = 0; i < phi->InputCount(); i++) {
+ // Result cid of UseVal can be kIllegalCid if the referred definition
+ // has not been visited yet.
+ intptr_t cid = phi->InputAt(i)->ResultCid();
+ if (cid == kIllegalCid) {
+ still_changing_ = true;
+ continue;
+ }
+ if (merged_cid == kIllegalCid) {
+ // First time set.
+ merged_cid = cid;
+ } else if (merged_cid != cid) {
+ merged_cid = kDynamicCid;
+ }
+ }
+ if (merged_cid == kIllegalCid) {
+ merged_cid = kDynamicCid;
+ }
+ changed = phi->SetPropagatedCid(merged_cid);
+ if (changed) {
+ still_changing_ = true;
+ }
}
@@ -802,6 +840,7 @@
if (changed) {
still_changing_ = true;
}
+ param->SetPropagatedCid(kDynamicCid);
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698