Fixed range analysis for HMathFloorOfDiv.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/195133002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19831 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 55c232aa
...@@ -1788,7 +1788,7 @@ Range* HMul::InferRange(Zone* zone) { ...@@ -1788,7 +1788,7 @@ Range* HMul::InferRange(Zone* zone) {
} }
Range* HDiv::InferRange(Zone* zone) { Range* HBinaryOperation::InferRangeForDiv(Zone* zone) {
if (representation().IsInteger32()) { if (representation().IsInteger32()) {
Range* a = left()->range(); Range* a = left()->range();
Range* b = right()->range(); Range* b = right()->range();
...@@ -1797,11 +1797,11 @@ Range* HDiv::InferRange(Zone* zone) { ...@@ -1797,11 +1797,11 @@ Range* HDiv::InferRange(Zone* zone) {
(a->CanBeMinusZero() || (a->CanBeMinusZero() ||
(a->CanBeZero() && b->CanBeNegative()))); (a->CanBeZero() && b->CanBeNegative())));
if (!a->Includes(kMinInt) || !b->Includes(-1)) { if (!a->Includes(kMinInt) || !b->Includes(-1)) {
ClearFlag(HValue::kCanOverflow); ClearFlag(kCanOverflow);
} }
if (!b->CanBeZero()) { if (!b->CanBeZero()) {
ClearFlag(HValue::kCanBeDivByZero); ClearFlag(kCanBeDivByZero);
} }
return result; return result;
} else { } else {
...@@ -1810,6 +1810,16 @@ Range* HDiv::InferRange(Zone* zone) { ...@@ -1810,6 +1810,16 @@ Range* HDiv::InferRange(Zone* zone) {
} }
Range* HDiv::InferRange(Zone* zone) {
return InferRangeForDiv(zone);
}
Range* HMathFloorOfDiv::InferRange(Zone* zone) {
return InferRangeForDiv(zone);
}
Range* HMod::InferRange(Zone* zone) { Range* HMod::InferRange(Zone* zone) {
if (representation().IsInteger32()) { if (representation().IsInteger32()) {
Range* a = left()->range(); Range* a = left()->range();
......
...@@ -3762,6 +3762,9 @@ class HBinaryOperation : public HTemplateInstruction<3> { ...@@ -3762,6 +3762,9 @@ class HBinaryOperation : public HTemplateInstruction<3> {
DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)
protected:
Range* InferRangeForDiv(Zone* zone);
private: private:
bool IgnoreObservedOutputRepresentation(Representation current_rep); bool IgnoreObservedOutputRepresentation(Representation current_rep);
...@@ -4102,12 +4105,12 @@ class HMathFloorOfDiv V8_FINAL : public HBinaryOperation { ...@@ -4102,12 +4105,12 @@ class HMathFloorOfDiv V8_FINAL : public HBinaryOperation {
set_representation(Representation::Integer32()); set_representation(Representation::Integer32());
SetFlag(kUseGVN); SetFlag(kUseGVN);
SetFlag(kCanOverflow); SetFlag(kCanOverflow);
if (!right->IsConstant()) { SetFlag(kCanBeDivByZero);
SetFlag(kCanBeDivByZero);
}
SetFlag(kAllowUndefinedAsNaN); SetFlag(kAllowUndefinedAsNaN);
} }
virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
virtual bool IsDeletable() const V8_OVERRIDE { return true; } virtual bool IsDeletable() const V8_OVERRIDE { return true; }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment