Reviewers: Sven Panne,

Message:
PTAL.

Description:
Ignore observed Double output in binary operations when all uses are truncating
to Integer32

BUG=v8:2424

Please review this at https://codereview.chromium.org/14320021/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/hydrogen-instructions.cc


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)) {
+    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;
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to