Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 3eb4aa6c0e63de6dcba0cf5444387bf02e92904e..15456c6146202820d27136149e8495c1c5d4f31b 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -1568,6 +1568,15 @@ static HValue* SimplifiedDividendForMathFloorOfDiv(HValue* dividend) { |
HValue* HUnaryMathOperation::Canonicalize() { |
+ if (op() == kMathRound) { |
+ HValue* val = value(); |
+ if (val->IsChange()) val = HChange::cast(val)->value(); |
+ |
+ // If the input is integer32 then we replace the round instruction |
+ // with its input. |
+ if (val->representation().IsSmiOrInteger32()) return val; |
+ } |
+ |
if (op() == kMathFloor) { |
HValue* val = value(); |
if (val->IsChange()) val = HChange::cast(val)->value(); |
@@ -3657,7 +3666,11 @@ Representation HUnaryMathOperation::RepresentationFromInputs() { |
// If any of the actual input representation is more general than what we |
// have so far but not Tagged, use that representation instead. |
Representation input_rep = value()->representation(); |
- if (!input_rep.IsTagged()) rep = rep.generalize(input_rep); |
+ if (!input_rep.IsTagged()) { |
+ rep = rep.generalize(input_rep); |
+ } else if (flexible_int()) { |
+ rep = Representation::Integer32(); |
+ } |
return rep; |
} |