Revision: 14381
Author:   [email protected]
Date:     Mon Apr 22 09:31:16 2013
Log: Ignore observed Double output in binary operations when all uses are truncating to Integer32

BUG=v8:2424

Review URL: https://codereview.chromium.org/14320021
http://code.google.com/p/v8/source/detail?r=14381

Modified:
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Apr 22 01:00:28 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Apr 22 09:31:16 2013
@@ -2226,15 +2226,26 @@
   new_rep = RepresentationFromUses();
   UpdateRepresentation(new_rep, h_infer, "uses");
 }
+
+
+bool HBinaryOperation::IgnoreObservedOutputRepresentation(
+    Representation current_rep) {
+  return observed_output_representation_.IsDouble() &&
+         current_rep.IsInteger32() &&
+         // Mul in Integer32 mode would be too precise.
+         !this->IsMul() &&
+         // TODO(jkummerow): Remove blacklisting of Div when the Div
+         // instruction has learned not to deopt when the remainder is
+         // non-zero but all uses are truncating.
+         !this->IsDiv() &&
+         CheckUsesForFlag(kTruncatingToInt32);
+}


 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 +2263,13 @@
       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) &&
+      !IgnoreObservedOutputRepresentation(rep)) {
+    rep = observed_output_representation_;
+  }
   return rep;
 }

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Apr 19 09:46:13 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Apr 22 09:31:16 2013
@@ -3455,6 +3455,8 @@
   DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)

  private:
+  bool IgnoreObservedOutputRepresentation(Representation current_rep);
+
   Representation observed_input_representation_[2];
   Representation observed_output_representation_;
 };

--
--
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