Reviewers: Sven Panne,
Message:
PTAL
Description:
Remove uses of CanBeNegative() in HMod.
BUG=v8:3204
LOG=y
Please review this at https://codereview.chromium.org/195793016/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+10, -5 lines):
M src/a64/lithium-codegen-a64.cc
M src/arm/lithium-codegen-arm.cc
M src/hydrogen-instructions.h
M src/hydrogen-instructions.cc
M src/ia32/lithium-codegen-ia32.cc
M src/x64/lithium-codegen-x64.cc
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index
651f5796704fd73daa48736d2b5715fb551efff2..4766fa55fd078d3ad2d902732094fec8dc38cc0e
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.
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
2b6c0a8407e79df676f5ff667ffc4309afa65ea1..49b7a334e8ba744f84313c44f68c2857cc3e9ce4
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.
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
45112fad0648cb2c0c836ebabdf89a3a3949d1eb..2b64f89ab28f7228f4ec2cbad69e6435b4132de1
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);
}
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
2097641b131816faabd7c47251b59ea0776977cd..c70ac73ce569919a51438a739effd7517cfdb12c
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);
}
};
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
addac8186dda20e5a4c6bbc4d2e9e46cf7209b49..f85ab3d601ea36adaf1c61b3c9e082e66025a150
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.
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
51acede259a4efd3f2cd6a23f13ca71fe0311552..f350b07d5bfc64ea2acb0330bcb8569eefdfeaa8
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.
--
--
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.