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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11416340: Improve and fix constant propagation for type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 15685)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -3547,15 +3547,23 @@
instr->instantiator()->definition()->constant_value();
if (IsNonConstant(object)) {
SetValue(instr, non_constant_);
- } else if (IsConstant(object)) {
- if (!object.IsNull() &&
+ return;
+ }
+ if (IsConstant(object)) {
+ const intptr_t len = instr->type_arguments().Length();
+ if (instr->type_arguments().IsRawInstantiatedRaw(len) &&
+ object.IsNull()) {
+ SetValue(instr, object);
+ return;
+ }
+ if (instr->type_arguments().IsUninstantiatedIdentity() &&
+ !object.IsNull() &&
object.IsTypeArguments() &&
- (TypeArguments::Cast(object).Length() ==
- instr->type_arguments().Length())) {
+ (TypeArguments::Cast(object).Length() == len)) {
SetValue(instr, object);
- } else {
- SetValue(instr, non_constant_);
+ return;
}
+ SetValue(instr, non_constant_);
}
}
@@ -3832,6 +3840,7 @@
// types, etc.
if ((defn != NULL) &&
(defn->constant_value().IsSmi() ||
+ defn->constant_value().IsNull() ||
defn->constant_value().IsTypeArguments()) &&
!defn->IsConstant() &&
!defn->IsPushArgument() &&
« 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