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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11299204: Improve constant propagation to handle InstantiateTypeArguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 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() &&
« 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