This is required to have sign-extended int32 arithmetic operations by re-landing:
https://codereview.chromium.org/
1161713003
TEST=cctest/test-api/ArrayBuffer_JSInternalToExternal
BUG=
Review URL: https://codereview.chromium.org/
1153263012
Cr-Commit-Position: refs/heads/master@{#28845}
}
+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();
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),
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)) {
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())
#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
V(AccessArgumentsAt) \
V(AddI) \
+ V(AddE) \
V(Allocate) \
V(AllocateBlockContext) \
V(ApplyArguments) \
};
+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) {