Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 6496fa8eeb9d96bd3e9e0e0a7827ce41619377fa..f2dc33038024e900318782ef9ef97010ede21722 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -2232,9 +2232,6 @@ Representation HBinaryOperation::RepresentationFromInputs() { |
// Determine the worst case of observed input representations and |
// the currently assumed output representation. |
Representation rep = representation(); |
- if (observed_output_representation_.is_more_general_than(rep)) { |
- rep = observed_output_representation_; |
- } |
for (int i = 1; i <= 2; ++i) { |
Representation input_rep = observed_input_representation(i); |
if (input_rep.is_more_general_than(rep)) rep = input_rep; |
@@ -2252,6 +2249,21 @@ Representation HBinaryOperation::RepresentationFromInputs() { |
right()->CheckFlag(kFlexibleRepresentation)) { |
rep = right_rep; |
} |
+ // Consider observed output representation, but ignore it if it's Double, |
+ // this instruction is not a division, and all its uses are truncating |
+ // to Integer32. |
+ if (observed_output_representation_.is_more_general_than(rep)) { |
Sven Panne
2013/04/22 13:52:29
Simplifying this a bit and extracting a predicate
Jakob Kummerow
2013/04/22 15:24:41
Done.
|
+ bool ignore = false; |
+ if (observed_output_representation_.IsDouble() && |
+ rep.IsInteger32() && |
+ // TODO(jkummerow): remove the Div blacklisting when the Div |
+ // instruction has learned not to deopt when the remainder is |
+ // non-zero but all uses are truncating. |
+ !this->IsDiv()) { |
+ ignore = CheckUsesForFlag(kTruncatingToInt32); |
+ } |
+ if (!ignore) rep = observed_output_representation_; |
+ } |
return rep; |
} |