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

Unified Diff: src/compiler/machine-operator.cc

Issue 2623633003: [Atomics] Make Atomics.exchange a builtin using TF (Closed)
Patch Set: [Atomics] Make Atomics.exchange a builtin using TF Created 3 years, 11 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
Index: src/compiler/machine-operator.cc
diff --git a/src/compiler/machine-operator.cc b/src/compiler/machine-operator.cc
index 80310e1f5acbf19c89b4f50d9eaeb51f57ae7f4b..ec77e7ff20cd0793e69b792e366e1984c5d2dffa 100644
--- a/src/compiler/machine-operator.cc
+++ b/src/compiler/machine-operator.cc
@@ -80,6 +80,11 @@ MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) {
return OpParameter<MachineRepresentation>(op);
}
+MachineType AtomicExchangeRepresentationOf(Operator const* op) {
+ DCHECK_EQ(IrOpcode::kAtomicExchange, op->opcode());
+ return OpParameter<MachineType>(op);
+}
+
#define PURE_BINARY_OP_LIST_32(V) \
V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
@@ -634,6 +639,18 @@ struct MachineOperatorGlobalCache {
ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE)
#undef STORE
+#define ATOMIC_EXCHANGE(Type) \
+ struct AtomicExchange##Type##Operator : public Operator1<MachineType> { \
+ AtomicExchange##Type##Operator() \
+ : Operator1<MachineType>(IrOpcode::kAtomicExchange, \
+ Operator::kNoDeopt | Operator::kNoThrow, \
+ "AtomicExchange", 3, 1, 1, 1, 1, 0, \
+ MachineType::Type()) {} \
+ }; \
+ AtomicExchange##Type##Operator kAtomicExchange##Type;
+ ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE)
+#undef ATOMIC_EXCHANGE
+
struct DebugBreakOperator : public Operator {
DebugBreakOperator()
: Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0,
@@ -861,6 +878,17 @@ const Operator* MachineOperatorBuilder::AtomicStore(MachineRepresentation rep) {
return nullptr;
}
+const Operator* MachineOperatorBuilder::AtomicExchange(MachineType rep) {
+#define EXCHANGE(kRep) \
+ if (rep == MachineType::kRep()) { \
+ return &cache_.kAtomicExchange##kRep; \
+ }
+ ATOMIC_TYPE_LIST(EXCHANGE)
+#undef EXCHANGE
+ UNREACHABLE();
+ return nullptr;
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698