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

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

Issue 1170923004: Reland "MIPS64: Fix lithium arithmetic operations for integers to sign-extend result." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Include fix of removed EmitLoadRegister unsafe usage. Created 5 years, 6 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/mips64/lithium-mips64.h ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/lithium-mips64.cc
diff --git a/src/mips64/lithium-mips64.cc b/src/mips64/lithium-mips64.cc
index cf9605874944f6fc4026a07de0419f0763f40613..6cf6674102cda249a7e557f4b0766ef6ed5af9a6 100644
--- a/src/mips64/lithium-mips64.cc
+++ b/src/mips64/lithium-mips64.cc
@@ -1527,14 +1527,17 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) {
}
right_op = UseRegister(right);
}
- LMulI* mul = new(zone()) LMulI(left_op, right_op);
+ LInstruction* result =
+ instr->representation().IsSmi()
+ ? DefineAsRegister(new (zone()) LMulS(left_op, right_op))
+ : DefineAsRegister(new (zone()) LMulI(left_op, right_op));
if (right_op->IsConstantOperand()
? ((can_overflow && constant_value == -1) ||
(bailout_on_minus_zero && constant_value <= 0))
: (can_overflow || bailout_on_minus_zero)) {
- AssignEnvironment(mul);
+ AssignEnvironment(result);
}
- return DefineAsRegister(mul);
+ return result;
} else if (instr->representation().IsDouble()) {
if (kArchVariant == kMips64r2) {
@@ -1564,9 +1567,11 @@ LInstruction* LChunkBuilder::DoSub(HSub* instr) {
DCHECK(instr->left()->representation().Equals(instr->representation()));
DCHECK(instr->right()->representation().Equals(instr->representation()));
LOperand* left = UseRegisterAtStart(instr->left());
- LOperand* right = UseOrConstantAtStart(instr->right());
- LSubI* sub = new(zone()) LSubI(left, right);
- LInstruction* result = DefineAsRegister(sub);
+ LOperand* right = UseRegisterOrConstantAtStart(instr->right());
+ LInstruction* result =
+ instr->representation().IsSmi()
+ ? DefineAsRegister(new (zone()) LSubS(left, right))
+ : DefineAsRegister(new (zone()) LSubI(left, right));
if (instr->CheckFlag(HValue::kCanOverflow)) {
result = AssignEnvironment(result);
}
@@ -1594,8 +1599,10 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
DCHECK(instr->right()->representation().Equals(instr->representation()));
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = UseRegisterOrConstantAtStart(instr->BetterRightOperand());
- LAddI* add = new(zone()) LAddI(left, right);
- LInstruction* result = DefineAsRegister(add);
+ LInstruction* result =
+ instr->representation().IsSmi()
+ ? DefineAsRegister(new (zone()) LAddS(left, right))
+ : DefineAsRegister(new (zone()) LAddI(left, right));
if (instr->CheckFlag(HValue::kCanOverflow)) {
result = AssignEnvironment(result);
}
« no previous file with comments | « src/mips64/lithium-mips64.h ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698