Commit 4e668f8e authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

Clean up visitors for Atomic operations

Bug: v8:6532, v8:7570
Change-Id: Ieca502a6a13449ea65e47fb43f0e3d7cb5a09a7d
Reviewed-on: https://chromium-review.googlesource.com/1031176
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52926}
parent 77aba17a
...@@ -2157,7 +2157,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) { ...@@ -2157,7 +2157,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) {
Emit(code, 1, outputs, input_count, inputs, arraysize(temps), temps); Emit(code, 1, outputs, input_count, inputs, arraysize(temps), temps);
} }
void InstructionSelector::VisitAtomicBinaryOperation( void InstructionSelector::VisitWord32AtomicBinaryOperation(
Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op, Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op,
ArchOpcode uint16_op, ArchOpcode word32_op) { ArchOpcode uint16_op, ArchOpcode word32_op) {
ArmOperandGenerator g(this); ArmOperandGenerator g(this);
...@@ -2197,7 +2197,7 @@ void InstructionSelector::VisitAtomicBinaryOperation( ...@@ -2197,7 +2197,7 @@ void InstructionSelector::VisitAtomicBinaryOperation(
#define VISIT_ATOMIC_BINOP(op) \ #define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \ void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \ VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \ node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \ kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \
kWord32Atomic##op##Word32); \ kWord32Atomic##op##Word32); \
......
...@@ -2161,6 +2161,23 @@ void VisitAtomicStore(InstructionSelector* selector, Node* node, ...@@ -2161,6 +2161,23 @@ void VisitAtomicStore(InstructionSelector* selector, Node* node,
temps); temps);
} }
void VisitAtomicBinop(InstructionSelector* selector, Node* node,
ArchOpcode opcode) {
Arm64OperandGenerator g(selector);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* value = node->InputAt(2);
AddressingMode addressing_mode = kMode_MRR;
InstructionOperand inputs[] = {g.UseRegister(base), g.UseRegister(index),
g.UseUniqueRegister(value)};
InstructionOperand outputs[] = {g.DefineAsRegister(node)};
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister(),
g.TempRegister()};
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
selector->Emit(code, arraysize(outputs), outputs, arraysize(inputs), inputs,
arraysize(temps), temps);
}
} // namespace } // namespace
void InstructionSelector::VisitWordCompareZero(Node* user, Node* value, void InstructionSelector::VisitWordCompareZero(Node* user, Node* value,
...@@ -2765,13 +2782,9 @@ void InstructionSelector::VisitWord64AtomicCompareExchange(Node* node) { ...@@ -2765,13 +2782,9 @@ void InstructionSelector::VisitWord64AtomicCompareExchange(Node* node) {
VisitAtomicCompareExchange(this, node, opcode); VisitAtomicCompareExchange(this, node, opcode);
} }
void InstructionSelector::VisitAtomicBinaryOperation( void InstructionSelector::VisitWord32AtomicBinaryOperation(
Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op, Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op,
ArchOpcode uint16_op, ArchOpcode word32_op) { ArchOpcode uint16_op, ArchOpcode word32_op) {
Arm64OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* value = node->InputAt(2);
ArchOpcode opcode = kArchNop; ArchOpcode opcode = kArchNop;
MachineType type = AtomicOpRepresentationOf(node->op()); MachineType type = AtomicOpRepresentationOf(node->op());
if (type == MachineType::Int8()) { if (type == MachineType::Int8()) {
...@@ -2788,24 +2801,12 @@ void InstructionSelector::VisitAtomicBinaryOperation( ...@@ -2788,24 +2801,12 @@ void InstructionSelector::VisitAtomicBinaryOperation(
UNREACHABLE(); UNREACHABLE();
return; return;
} }
VisitAtomicBinop(this, node, opcode);
AddressingMode addressing_mode = kMode_MRR;
InstructionOperand inputs[3];
size_t input_count = 0;
inputs[input_count++] = g.UseRegister(base);
inputs[input_count++] = g.UseRegister(index);
inputs[input_count++] = g.UseUniqueRegister(value);
InstructionOperand outputs[1];
outputs[0] = g.DefineAsRegister(node);
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister(),
g.TempRegister()};
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
Emit(code, 1, outputs, input_count, inputs, arraysize(temps), temps);
} }
#define VISIT_ATOMIC_BINOP(op) \ #define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \ void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \ VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \ node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \ kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \
kWord32Atomic##op##Word32); \ kWord32Atomic##op##Word32); \
...@@ -2820,10 +2821,6 @@ VISIT_ATOMIC_BINOP(Xor) ...@@ -2820,10 +2821,6 @@ VISIT_ATOMIC_BINOP(Xor)
void InstructionSelector::VisitWord64AtomicBinaryOperation( void InstructionSelector::VisitWord64AtomicBinaryOperation(
Node* node, ArchOpcode uint8_op, ArchOpcode uint16_op, ArchOpcode uint32_op, Node* node, ArchOpcode uint8_op, ArchOpcode uint16_op, ArchOpcode uint32_op,
ArchOpcode uint64_op) { ArchOpcode uint64_op) {
Arm64OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* value = node->InputAt(2);
ArchOpcode opcode = kArchNop; ArchOpcode opcode = kArchNop;
MachineType type = AtomicOpRepresentationOf(node->op()); MachineType type = AtomicOpRepresentationOf(node->op());
if (type == MachineType::Uint8()) { if (type == MachineType::Uint8()) {
...@@ -2838,19 +2835,7 @@ void InstructionSelector::VisitWord64AtomicBinaryOperation( ...@@ -2838,19 +2835,7 @@ void InstructionSelector::VisitWord64AtomicBinaryOperation(
UNREACHABLE(); UNREACHABLE();
return; return;
} }
VisitAtomicBinop(this, node, opcode);
AddressingMode addressing_mode = kMode_MRR;
InstructionOperand inputs[3];
size_t input_count = 0;
inputs[input_count++] = g.UseRegister(base);
inputs[input_count++] = g.UseRegister(index);
inputs[input_count++] = g.UseUniqueRegister(value);
InstructionOperand outputs[1];
outputs[0] = g.DefineAsRegister(node);
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister(),
g.TempRegister()};
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
Emit(code, 1, outputs, input_count, inputs, arraysize(temps), temps);
} }
#define VISIT_ATOMIC_BINOP(op) \ #define VISIT_ATOMIC_BINOP(op) \
......
...@@ -1665,7 +1665,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) { ...@@ -1665,7 +1665,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) {
Emit(code, 1, outputs, input_count, inputs); Emit(code, 1, outputs, input_count, inputs);
} }
void InstructionSelector::VisitAtomicBinaryOperation( void InstructionSelector::VisitWord32AtomicBinaryOperation(
Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op, Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op,
ArchOpcode uint16_op, ArchOpcode word32_op) { ArchOpcode uint16_op, ArchOpcode word32_op) {
IA32OperandGenerator g(this); IA32OperandGenerator g(this);
...@@ -1715,7 +1715,7 @@ void InstructionSelector::VisitAtomicBinaryOperation( ...@@ -1715,7 +1715,7 @@ void InstructionSelector::VisitAtomicBinaryOperation(
#define VISIT_ATOMIC_BINOP(op) \ #define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \ void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \ VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \ node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \ kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \
kWord32Atomic##op##Word32); \ kWord32Atomic##op##Word32); \
......
...@@ -653,9 +653,11 @@ class V8_EXPORT_PRIVATE InstructionSelector final { ...@@ -653,9 +653,11 @@ class V8_EXPORT_PRIVATE InstructionSelector final {
void MarkPairProjectionsAsWord32(Node* node); void MarkPairProjectionsAsWord32(Node* node);
bool IsSourcePositionUsed(Node* node); bool IsSourcePositionUsed(Node* node);
void VisitAtomicBinaryOperation(Node* node, ArchOpcode int8_op, void VisitWord32AtomicBinaryOperation(Node* node, ArchOpcode int8_op,
ArchOpcode uint8_op, ArchOpcode int16_op, ArchOpcode uint8_op,
ArchOpcode uint16_op, ArchOpcode word32_op); ArchOpcode int16_op,
ArchOpcode uint16_op,
ArchOpcode word32_op);
void VisitWord64AtomicBinaryOperation(Node* node, ArchOpcode uint8_op, void VisitWord64AtomicBinaryOperation(Node* node, ArchOpcode uint8_op,
ArchOpcode uint16_op, ArchOpcode uint16_op,
ArchOpcode uint32_op, ArchOpcode uint32_op,
......
...@@ -1851,7 +1851,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) { ...@@ -1851,7 +1851,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) {
Emit(code, 1, outputs, input_count, inputs, 3, temp); Emit(code, 1, outputs, input_count, inputs, 3, temp);
} }
void InstructionSelector::VisitAtomicBinaryOperation( void InstructionSelector::VisitWord32AtomicBinaryOperation(
Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op, Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op,
ArchOpcode uint16_op, ArchOpcode word32_op) { ArchOpcode uint16_op, ArchOpcode word32_op) {
MipsOperandGenerator g(this); MipsOperandGenerator g(this);
...@@ -1894,7 +1894,7 @@ void InstructionSelector::VisitAtomicBinaryOperation( ...@@ -1894,7 +1894,7 @@ void InstructionSelector::VisitAtomicBinaryOperation(
#define VISIT_ATOMIC_BINOP(op) \ #define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \ void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \ VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \ node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \ kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \
kWord32Atomic##op##Word32); \ kWord32Atomic##op##Word32); \
......
...@@ -2515,7 +2515,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) { ...@@ -2515,7 +2515,7 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) {
Emit(code, 1, outputs, input_count, inputs, 3, temp); Emit(code, 1, outputs, input_count, inputs, 3, temp);
} }
void InstructionSelector::VisitAtomicBinaryOperation( void InstructionSelector::VisitWord32AtomicBinaryOperation(
Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op, Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op,
ArchOpcode uint16_op, ArchOpcode word32_op) { ArchOpcode uint16_op, ArchOpcode word32_op) {
Mips64OperandGenerator g(this); Mips64OperandGenerator g(this);
...@@ -2558,7 +2558,7 @@ void InstructionSelector::VisitAtomicBinaryOperation( ...@@ -2558,7 +2558,7 @@ void InstructionSelector::VisitAtomicBinaryOperation(
#define VISIT_ATOMIC_BINOP(op) \ #define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \ void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \ VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \ node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \ kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \
kWord32Atomic##op##Word32); \ kWord32Atomic##op##Word32); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment