Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: src/a64/lithium-a64.cc

Issue 189963005: Revert "Handle non-power-of-2 divisors in division-like operations", "A64 tweaks for division-like … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/a64/lithium-a64.h ('k') | src/a64/lithium-codegen-a64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/lithium-a64.cc
diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
index cf89c09f5b2515d2dbc0b6cabe667b10245eb9ea..d2025fcb9a2ffb3d628a05b4f4c9a1a20ea3c0cb 100644
--- a/src/a64/lithium-a64.cc
+++ b/src/a64/lithium-a64.cc
@@ -1369,7 +1369,7 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
- ASSERT(instr->representation().IsInteger32());
+ ASSERT(instr->representation().IsSmiOrInteger32());
ASSERT(instr->left()->representation().Equals(instr->representation()));
ASSERT(instr->right()->representation().Equals(instr->representation()));
LOperand* dividend = UseRegister(instr->left());
@@ -1387,25 +1387,6 @@ LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
}
-LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
- ASSERT(instr->representation().IsInteger32());
- ASSERT(instr->left()->representation().Equals(instr->representation()));
- ASSERT(instr->right()->representation().Equals(instr->representation()));
- LOperand* dividend = UseRegister(instr->left());
- int32_t divisor = instr->right()->GetInteger32Constant();
- bool truncating = instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32);
- LOperand* temp = truncating ? NULL : TempRegister();
- LInstruction* result =
- DefineAsRegister(new(zone()) LDivByConstI(dividend, divisor, temp));
- bool can_deopt =
- divisor == 0 ||
- (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
- instr->left()->RangeCanInclude(0) && divisor < 0) ||
- !truncating;
- return can_deopt ? AssignEnvironment(result) : result;
-}
-
-
LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
ASSERT(instr->representation().IsSmiOrInteger32());
ASSERT(instr->left()->representation().Equals(instr->representation()));
@@ -1421,13 +1402,10 @@ LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
if (instr->representation().IsSmiOrInteger32()) {
- if (instr->RightIsPowerOf2()) {
- return DoDivByPowerOf2I(instr);
- } else if (instr->right()->IsConstant()) {
- return DoDivByConstI(instr);
- } else {
- return DoDivI(instr);
- }
+ // TODO(all): Add Smi support to DoDivI and turn this into a ternary.
+ if (instr->RightIsPowerOf2()) return DoDivByPowerOf2I(instr);
+ if (instr->representation().IsInteger32()) return DoDivI(instr);
+ return DoArithmeticT(Token::DIV, instr);
} else if (instr->representation().IsDouble()) {
return DoArithmeticD(Token::DIV, instr);
} else {
@@ -1736,9 +1714,6 @@ LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
- ASSERT(instr->representation().IsInteger32());
- ASSERT(instr->left()->representation().Equals(instr->representation()));
- ASSERT(instr->right()->representation().Equals(instr->representation()));
LOperand* dividend = UseRegisterAtStart(instr->left());
int32_t divisor = instr->right()->GetInteger32Constant();
LInstruction* result =
@@ -1750,22 +1725,6 @@ LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
}
-LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
- ASSERT(instr->representation().IsInteger32());
- ASSERT(instr->left()->representation().Equals(instr->representation()));
- ASSERT(instr->right()->representation().Equals(instr->representation()));
- LOperand* dividend = UseRegister(instr->left());
- int32_t divisor = instr->right()->GetInteger32Constant();
- LInstruction* result =
- DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor));
- bool can_deopt =
- divisor == 0 ||
- (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
- instr->left()->RangeCanInclude(0) && divisor < 0);
- return can_deopt ? AssignEnvironment(result) : result;
-}
-
-
LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
LOperand* dividend = UseRegister(instr->left());
LOperand* divisor = UseRegister(instr->right());
@@ -1780,7 +1739,8 @@ LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
if (instr->RightIsPowerOf2()) {
return DoFlooringDivByPowerOf2I(instr);
} else if (instr->right()->IsConstant()) {
- return DoFlooringDivByConstI(instr);
+ // TODO(svenpanne) Do something more efficient in this case.
+ return DoFlooringDivI(instr);
} else {
return DoFlooringDivI(instr);
}
@@ -1807,7 +1767,7 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
- ASSERT(instr->representation().IsInteger32());
+ ASSERT(instr->representation().IsSmiOrInteger32());
ASSERT(instr->left()->representation().Equals(instr->representation()));
ASSERT(instr->right()->representation().Equals(instr->representation()));
LOperand* dividend = UseRegisterAtStart(instr->left());
@@ -1821,23 +1781,6 @@ LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
}
-LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
- ASSERT(instr->representation().IsInteger32());
- ASSERT(instr->left()->representation().Equals(instr->representation()));
- ASSERT(instr->right()->representation().Equals(instr->representation()));
- LOperand* dividend = UseRegister(instr->left());
- int32_t divisor = instr->right()->GetInteger32Constant();
- LOperand* temp = TempRegister();
- LInstruction* result =
- DefineAsRegister(new(zone()) LModByConstI(dividend, divisor, temp));
- bool can_deopt =
- divisor == 0 ||
- (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
- instr->left()->CanBeNegative());
- return can_deopt ? AssignEnvironment(result) : result;
-}
-
-
LInstruction* LChunkBuilder::DoModI(HMod* instr) {
ASSERT(instr->representation().IsSmiOrInteger32());
ASSERT(instr->left()->representation().Equals(instr->representation()));
@@ -1855,13 +1798,10 @@ LInstruction* LChunkBuilder::DoModI(HMod* instr) {
LInstruction* LChunkBuilder::DoMod(HMod* instr) {
if (instr->representation().IsSmiOrInteger32()) {
- if (instr->RightIsPowerOf2()) {
- return DoModByPowerOf2I(instr);
- } else if (instr->right()->IsConstant()) {
- return DoModByConstI(instr);
- } else {
- return DoModI(instr);
- }
+ // TODO(all): Add Smi support to DoDivI and turn this into a ternary.
+ if (instr->RightIsPowerOf2()) return DoModByPowerOf2I(instr);
+ if (instr->representation().IsInteger32()) return DoModI(instr);
+ return DoArithmeticT(Token::MOD, instr);
} else if (instr->representation().IsDouble()) {
return DoArithmeticD(Token::MOD, instr);
} else {
« no previous file with comments | « src/a64/lithium-a64.h ('k') | src/a64/lithium-codegen-a64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698