Index: src/hydrogen-instructions.cc |
=================================================================== |
--- src/hydrogen-instructions.cc (revision 11385) |
+++ src/hydrogen-instructions.cc (working copy) |
@@ -870,6 +870,17 @@ |
} |
+HValue* HBitNot::Canonicalize() { |
+ // Optimize ~~x, a common pattern used for ToInt32(x). |
+ if (value()->IsBitNot()) { |
+ HValue* result = HBitNot::cast(value())->value(); |
+ ASSERT(result->representation().IsInteger32()); |
+ return result; |
+ } |
+ return this; |
+} |
+ |
+ |
HValue* HAdd::Canonicalize() { |
if (!representation().IsInteger32()) return this; |
if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); |