 Chromium Code Reviews
 Chromium Code Reviews Issue 11299204:
  Improve constant propagation to handle InstantiateTypeArguments.  (Closed) 
  Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
    
  
    Issue 11299204:
  Improve constant propagation to handle InstantiateTypeArguments.  (Closed) 
  Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/| Index: runtime/vm/flow_graph_optimizer.cc | 
| =================================================================== | 
| --- runtime/vm/flow_graph_optimizer.cc (revision 15377) | 
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) | 
| @@ -3438,6 +3438,19 @@ | 
| void ConstantPropagator::VisitInstantiateTypeArguments( | 
| InstantiateTypeArgumentsInstr* instr) { | 
| + const Object& object = | 
| + instr->instantiator()->definition()->constant_value(); | 
| + if (IsNonConstant(object)) { | 
| 
Kevin Millikin (Google)
2012/11/28 07:57:25
If the value is unknown (bottom) it should not mov
 
Florian Schneider
2012/11/28 13:02:59
Thanks. Done.
 | 
| + SetValue(instr, non_constant_); | 
| + return; | 
| + } | 
| + if (!object.IsNull() && object.IsTypeArguments()) { | 
| 
srdjan
2012/11/30 00:49:54
You need to handle also the case for null otherwis
 
Florian Schneider
2012/12/04 11:40:09
Yes, that's a good suggestion. I'll add that case.
 | 
| + const TypeArguments& instantiator = TypeArguments::Cast(object); | 
| + if (instantiator.Length() == instr->type_arguments().Length()) { | 
| + SetValue(instr, instantiator); | 
| + return; | 
| + } | 
| + } | 
| SetValue(instr, non_constant_); | 
| } | 
| @@ -3713,7 +3726,8 @@ | 
| // TODO(kmillikin): Extend this to handle booleans, other number | 
| // types, etc. | 
| if ((defn != NULL) && | 
| - defn->constant_value().IsSmi() && | 
| + (defn->constant_value().IsSmi() || | 
| + defn->constant_value().IsTypeArguments()) && | 
| !defn->IsConstant() && | 
| !defn->IsPushArgument() && | 
| !defn->IsStoreIndexed() && |