Reviewers: danno, Jakob, paul.l..., akos.palfi.imgtec, balazs.kilvady,
Description:
MIPS64: Implement AddE lithium instruction to separate integer and address
arithmetic.
This is required to have sign-extended arithmetic int32 operations and
reland:
https://codereview.chromium.org/1161713003
TEST=cctest/test-api/ArrayBuffer_JSInternalToExternal
BUG=
Please review this at https://codereview.chromium.org/1153263012/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+33, -14 lines):
M src/mips64/lithium-codegen-mips64.cc
M src/mips64/lithium-mips64.h
M src/mips64/lithium-mips64.cc
Index: src/mips64/lithium-codegen-mips64.cc
diff --git a/src/mips64/lithium-codegen-mips64.cc
b/src/mips64/lithium-codegen-mips64.cc
index
7ee8b64a4d1fb5c087ecc0c67de12e4679fb995b..4ca54d6a2bb32cb37ad01653fe0a4294559ebf03
100644
--- a/src/mips64/lithium-codegen-mips64.cc
+++ b/src/mips64/lithium-codegen-mips64.cc
@@ -1889,6 +1889,17 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar*
instr) {
}
+void LCodeGen::DoAddE(LAddE* instr) {
+ LOperand* result = instr->result();
+ LOperand* left = instr->left();
+ LOperand* right = instr->right();
+
+ DCHECK(!instr->hydrogen()->CheckFlag(HValue::kCanOverflow));
+ DCHECK(right->IsRegister() || right->IsConstantOperand());
+ __ Daddu(ToRegister(result), ToRegister(left), ToOperand(right));
+}
+
+
void LCodeGen::DoAddI(LAddI* instr) {
LOperand* left = instr->left();
LOperand* right = instr->right();
@@ -1896,18 +1907,12 @@ void LCodeGen::DoAddI(LAddI* instr) {
bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
if (!can_overflow) {
- if (right->IsStackSlot()) {
- Register right_reg = EmitLoadRegister(right, at);
- __ Daddu(ToRegister(result), ToRegister(left), Operand(right_reg));
- } else {
- DCHECK(right->IsRegister() || right->IsConstantOperand());
- __ Daddu(ToRegister(result), ToRegister(left), ToOperand(right));
- }
+ DCHECK(right->IsRegister());
+ __ Daddu(ToRegister(result), ToRegister(left), ToOperand(right));
} else { // can_overflow.
Register overflow = scratch0();
Register scratch = scratch1();
- if (right->IsStackSlot() ||
- right->IsConstantOperand()) {
+ if (right->IsConstantOperand()) {
Register right_reg = EmitLoadRegister(right, scratch);
__ AdduAndCheckForOverflow(ToRegister(result),
ToRegister(left),
Index: src/mips64/lithium-mips64.cc
diff --git a/src/mips64/lithium-mips64.cc b/src/mips64/lithium-mips64.cc
index
67921a996f8b2f4fc4494ef905d027615c0d1ab8..cf9605874944f6fc4026a07de0419f0763f40613
100644
--- a/src/mips64/lithium-mips64.cc
+++ b/src/mips64/lithium-mips64.cc
@@ -1593,7 +1593,7 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
DCHECK(instr->left()->representation().Equals(instr->representation()));
DCHECK(instr->right()->representation().Equals(instr->representation()));
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
- LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
+ LOperand* right =
UseRegisterOrConstantAtStart(instr->BetterRightOperand());
LAddI* add = new(zone()) LAddI(left, right);
LInstruction* result = DefineAsRegister(add);
if (instr->CheckFlag(HValue::kCanOverflow)) {
@@ -1605,10 +1605,8 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
DCHECK(instr->right()->representation().IsInteger32());
DCHECK(!instr->CheckFlag(HValue::kCanOverflow));
LOperand* left = UseRegisterAtStart(instr->left());
- LOperand* right = UseOrConstantAtStart(instr->right());
- LAddI* add = new(zone()) LAddI(left, right);
- LInstruction* result = DefineAsRegister(add);
- return result;
+ LOperand* right = UseRegisterOrConstantAtStart(instr->right());
+ return DefineAsRegister(new (zone()) LAddE(left, right));
} else if (instr->representation().IsDouble()) {
if (kArchVariant == kMips64r2) {
if (instr->left()->IsMul())
Index: src/mips64/lithium-mips64.h
diff --git a/src/mips64/lithium-mips64.h b/src/mips64/lithium-mips64.h
index
fa1c2d2b4347ef3927d104862294a9ba5b15480c..6928ae4b06a5549e041352cbd6c199086b6adc07
100644
--- a/src/mips64/lithium-mips64.h
+++ b/src/mips64/lithium-mips64.h
@@ -20,6 +20,7 @@ class LCodeGen;
#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
V(AccessArgumentsAt) \
V(AddI) \
+ V(AddE) \
V(Allocate) \
V(AllocateBlockContext) \
V(ApplyArguments) \
@@ -1421,6 +1422,21 @@ class LSeqStringSetChar final : public
LTemplateInstruction<1, 4, 0> {
};
+class LAddE final : public LTemplateInstruction<1, 2, 0> {
+ public:
+ LAddE(LOperand* left, LOperand* right) {
+ inputs_[0] = left;
+ inputs_[1] = right;
+ }
+
+ LOperand* left() { return inputs_[0]; }
+ LOperand* right() { return inputs_[1]; }
+
+ DECLARE_CONCRETE_INSTRUCTION(AddE, "add-e")
+ DECLARE_HYDROGEN_ACCESSOR(Add)
+};
+
+
class LAddI final : public LTemplateInstruction<1, 2, 0> {
public:
LAddI(LOperand* left, LOperand* right) {
--
--
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.