Index: src/hydrogen-instructions.cc |
=================================================================== |
--- src/hydrogen-instructions.cc (revision 10863) |
+++ src/hydrogen-instructions.cc (working copy) |
@@ -285,6 +285,14 @@ |
} |
+bool HValue::CheckUsesForFlag(Flag f) { |
+ for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
+ if (!it.value()->CheckFlag(f)) return false; |
+ } |
+ return true; |
+} |
+ |
+ |
HUseIterator::HUseIterator(HUseListNode* head) : next_(head) { |
Advance(); |
} |
@@ -831,12 +839,12 @@ |
HValue* HConstant::Canonicalize() { |
- return HasNoUses() && !IsBlockEntry() ? NULL : this; |
+ return HasNoUses() ? NULL : this; |
} |
HValue* HTypeof::Canonicalize() { |
- return HasNoUses() && !IsBlockEntry() ? NULL : this; |
+ return HasNoUses() ? NULL : this; |
} |
@@ -858,6 +866,20 @@ |
} |
+HValue* HAdd::Canonicalize() { |
+ if (!representation().IsInteger32()) return this; |
+ if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); |
+ return this; |
+} |
+ |
+ |
+HValue* HSub::Canonicalize() { |
+ if (!representation().IsInteger32()) return this; |
+ if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); |
+ return this; |
+} |
+ |
+ |
HValue* HChange::Canonicalize() { |
return (from().Equals(to())) ? value() : this; |
} |