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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 25604003: Take representation into account in ConstantPropagator::VisitInstanceOfInstr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « 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
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index b9f6bd448cddce363f24ede44848f46bd9aa0e07..ef6b36f75c2b7be44b8e138b610ea8fd282c4945 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -6324,9 +6324,20 @@ void ConstantPropagator::VisitBooleanNegate(BooleanNegateInstr* instr) {
void ConstantPropagator::VisitInstanceOf(InstanceOfInstr* instr) {
- const Object& value = instr->value()->definition()->constant_value();
+ const Definition* def = instr->value()->definition();
+ const Object& value = def->constant_value();
if (IsNonConstant(value)) {
- SetValue(instr, non_constant_);
+ const AbstractType& checked_type = instr->type();
+ Representation rep = def->representation();
+ if ((checked_type.IsFloat32x4Type() && (rep == kUnboxedFloat32x4)) ||
+ (checked_type.IsUint32x4Type() && (rep == kUnboxedUint32x4)) ||
+ (checked_type.IsDoubleType() && (rep == kUnboxedDouble)) ||
+ (checked_type.IsIntType() && (rep == kUnboxedMint))) {
+ // The representation guarantees the type check to be true.
Florian Schneider 2013/10/03 09:06:55 Maybe add an ASSERT that the compile-type of instr
Cutch 2013/11/06 23:04:43 Done.
+ SetValue(instr, instr->negate_result() ? Bool::False() : Bool::True());
+ } else {
+ SetValue(instr, non_constant_);
+ }
} else if (IsConstant(value)) {
// TODO(kmillikin): Handle instanceof on constants.
SetValue(instr, non_constant_);
« 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