Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index bd33f1a2b7ee38eb0998d783445066d902abe59c..6a1cad27f15c2dcb3c6c6a7b419f00501efafe60 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -2460,10 +2460,16 @@ void HCompareIDAndBranch::InferRepresentation(HInferRepresentation* h_infer) { |
bool observed_integers = |
observed_input_representation(0).IsInteger32() && |
observed_input_representation(1).IsInteger32(); |
- bool inputs_are_not_doubles = |
- !left_rep.IsDouble() && !right_rep.IsDouble(); |
+ bool inputs_are_not_doubles = !left_rep.IsDouble() && !right_rep.IsDouble(); |
+ |
if (observed_integers && inputs_are_not_doubles) { |
- rep = Representation::Integer32(); |
+ rep = Representation::Smi(); |
+ if (left_rep.is_more_general_than(rep) && !left_rep.IsTagged()) { |
+ rep = Representation::Integer32(); |
+ } |
+ if (right_rep.is_more_general_than(rep) && !right_rep.IsTagged()) { |
+ rep = Representation::Integer32(); |
+ } |
} else { |
rep = Representation::Double(); |
// According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === |