Revision: 19831
Author:   [email protected]
Date:     Wed Mar 12 06:49:28 2014 UTC
Log:      Fixed range analysis for HMathFloorOfDiv.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Mar 11 13:34:01 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Mar 12 06:49:28 2014 UTC
@@ -1788,7 +1788,7 @@
 }


-Range* HDiv::InferRange(Zone* zone) {
+Range* HBinaryOperation::InferRangeForDiv(Zone* zone) {
   if (representation().IsInteger32()) {
     Range* a = left()->range();
     Range* b = right()->range();
@@ -1797,17 +1797,27 @@
                                   (a->CanBeMinusZero() ||
(a->CanBeZero() && b->CanBeNegative())));
     if (!a->Includes(kMinInt) || !b->Includes(-1)) {
-      ClearFlag(HValue::kCanOverflow);
+      ClearFlag(kCanOverflow);
     }

     if (!b->CanBeZero()) {
-      ClearFlag(HValue::kCanBeDivByZero);
+      ClearFlag(kCanBeDivByZero);
     }
     return result;
   } else {
     return HValue::InferRange(zone);
   }
 }
+
+
+Range* HDiv::InferRange(Zone* zone) {
+  return InferRangeForDiv(zone);
+}
+
+
+Range* HMathFloorOfDiv::InferRange(Zone* zone) {
+  return InferRangeForDiv(zone);
+}


 Range* HMod::InferRange(Zone* zone) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Mar 11 14:41:22 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Mar 12 06:49:28 2014 UTC
@@ -3762,6 +3762,9 @@

   DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)

+ protected:
+  Range* InferRangeForDiv(Zone* zone);
+
  private:
   bool IgnoreObservedOutputRepresentation(Representation current_rep);

@@ -4102,11 +4105,11 @@
     set_representation(Representation::Integer32());
     SetFlag(kUseGVN);
     SetFlag(kCanOverflow);
-    if (!right->IsConstant()) {
-      SetFlag(kCanBeDivByZero);
-    }
+    SetFlag(kCanBeDivByZero);
     SetFlag(kAllowUndefinedAsNaN);
   }
+
+  virtual Range* InferRange(Zone* zone) V8_OVERRIDE;

   virtual bool IsDeletable() const V8_OVERRIDE { return true; }
 };

--
--
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/d/optout.

Reply via email to