From 4da15df0084d5a91eb51b97e6e61ab838fb650d3 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Thu, 13 Mar 2014 08:17:44 +0000 Subject: [PATCH] Remove uses of CanBeNegative() in HMod. BUG=v8:3204 LOG=y R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/195793016 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19878 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/a64/lithium-codegen-a64.cc | 2 +- src/arm/lithium-codegen-arm.cc | 2 +- src/hydrogen-instructions.cc | 4 ++++ src/hydrogen-instructions.h | 3 ++- src/ia32/lithium-codegen-ia32.cc | 2 +- src/x64/lithium-codegen-x64.cc | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc index 651f579670..4766fa55fd 100644 --- a/src/a64/lithium-codegen-a64.cc +++ b/src/a64/lithium-codegen-a64.cc @@ -4134,7 +4134,7 @@ void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) { HMod* hmod = instr->hydrogen(); int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); Label dividend_is_not_negative, done; - if (hmod->left()->CanBeNegative()) { + if (hmod->CheckFlag(HValue::kLeftCanBeNegative)) { __ Cmp(dividend, 0); __ B(pl, ÷nd_is_not_negative); // Note that this is correct even for kMinInt operands. diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 2b6c0a8407..49b7a334e8 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -1131,7 +1131,7 @@ void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) { HMod* hmod = instr->hydrogen(); int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); Label dividend_is_not_negative, done; - if (hmod->left()->CanBeNegative()) { + if (hmod->CheckFlag(HValue::kLeftCanBeNegative)) { __ cmp(dividend, Operand::Zero()); __ b(pl, ÷nd_is_not_negative); // Note that this is correct even for kMinInt operands. diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 45112fad06..2b64f89ab2 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -1865,6 +1865,10 @@ Range* HMod::InferRange(Zone* zone) { result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && left_can_be_negative); + if (!a->CanBeNegative()) { + ClearFlag(HValue::kLeftCanBeNegative); + } + if (!a->Includes(kMinInt) || !b->Includes(-1)) { ClearFlag(HValue::kCanOverflow); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 2097641b13..c70ac73ce5 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -623,6 +623,7 @@ class HValue : public ZoneObject { kBailoutOnMinusZero, kCanBeDivByZero, kLeftCanBeMinInt, + kLeftCanBeNegative, kAllowUndefinedAsNaN, kIsArguments, kTruncatingToInt32, @@ -855,7 +856,6 @@ class HValue : public ZoneObject { Range* range() const { return range_; } // TODO(svenpanne) We should really use the null object pattern here. bool HasRange() const { return range_ != NULL; } - bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } void AddNewRange(Range* r, Zone* zone); void RemoveLastAddedRange(); void ComputeInitialRange(Zone* zone); @@ -4860,6 +4860,7 @@ class HMod V8_FINAL : public HArithmeticBinaryOperation { HValue* right) : HArithmeticBinaryOperation(context, left, right) { SetFlag(kCanBeDivByZero); SetFlag(kCanOverflow); + SetFlag(kLeftCanBeNegative); } }; diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index addac8186d..f85ab3d601 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -1385,7 +1385,7 @@ void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) { HMod* hmod = instr->hydrogen(); int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); Label dividend_is_not_negative, done; - if (hmod->left()->CanBeNegative()) { + if (hmod->CheckFlag(HValue::kLeftCanBeNegative)) { __ test(dividend, dividend); __ j(not_sign, ÷nd_is_not_negative, Label::kNear); // Note that this is correct even for kMinInt operands. diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 51acede259..f350b07d5b 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -1004,7 +1004,7 @@ void LCodeGen::DoModByPowerOf2I(LModByPowerOf2I* instr) { HMod* hmod = instr->hydrogen(); int32_t mask = divisor < 0 ? -(divisor + 1) : (divisor - 1); Label dividend_is_not_negative, done; - if (hmod->left()->CanBeNegative()) { + if (hmod->CheckFlag(HValue::kLeftCanBeNegative)) { __ testl(dividend, dividend); __ j(not_sign, ÷nd_is_not_negative, Label::kNear); // Note that this is correct even for kMinInt operands.