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

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

Issue 164183002: A64: Implement division in Lithium for smis (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 e32bb2dc4ad66bd2dc6c47bc7092dab9817dce5f..62e309f2e3c9c6e7d5079b6f4b812ed5249fbba4 100644
--- a/src/a64/lithium-a64.cc
+++ b/src/a64/lithium-a64.cc
@@ -1377,22 +1377,28 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
- if (instr->representation().IsInteger32()) {
- // TODO(all): Update this case to support smi inputs.
+ if (instr->representation().IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(instr->representation()));
ASSERT(instr->right()->representation().Equals(instr->representation()));
+
+ LOperand* dividend = UseRegister(instr->left());
+
if (instr->RightIsPowerOf2()) {
ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
- LOperand* value = UseRegisterAtStart(instr->left());
- LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL);
+ LOperand* divisor = UseConstant(instr->right());
+ LDivConstI* div = new(zone()) LDivConstI(dividend, divisor);
+ return AssignEnvironment(DefineAsRegister(div));
+ } else {
+ LOperand* divisor = UseRegister(instr->right());
+ LOperand* temp1 =
+ instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)
+ ? NULL : TempRegister();
+ LOperand* temp2 = instr->representation().IsSmi() ? TempRegister() : NULL;
+ LOperand* temp3 = instr->representation().IsSmi() ? TempRegister() : NULL;
+
+ LDivI* div = new(zone()) LDivI(dividend, divisor, temp1, temp2, temp3);
return AssignEnvironment(DefineAsRegister(div));
}
- LOperand* dividend = UseRegister(instr->left());
- LOperand* divisor = UseRegister(instr->right());
- LOperand* temp = instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)
- ? NULL : TempRegister();
- LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
- return AssignEnvironment(DefineAsRegister(div));
} else if (instr->representation().IsDouble()) {
return DoArithmeticD(Token::DIV, 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