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

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

Issue 2649703002: [Atomics] Make Atomics.compareExchange a builtin using TF (Closed)
Patch Set: rebase and move cmpxchg to builtins-sharedarraybuffer-gen.cc Created 3 years, 9 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 b2f6eb732e2e6cdad1d38480e49103863c82fcd2..f05e3dc120e1aea033e049e058560e0a0d22344d 100644
--- a/src/compiler/machine-operator.cc
+++ b/src/compiler/machine-operator.cc
@@ -85,6 +85,11 @@ MachineType AtomicExchangeRepresentationOf(Operator const* op) {
return OpParameter<MachineType>(op);
}
+MachineType AtomicCompareExchangeRepresentationOf(Operator const* op) {
+ DCHECK_EQ(IrOpcode::kAtomicCompareExchange, 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) \
@@ -607,6 +612,19 @@ struct MachineOperatorGlobalCache {
ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE)
#undef ATOMIC_EXCHANGE
+#define ATOMIC_COMPARE_EXCHANGE(Type) \
+ struct AtomicCompareExchange##Type##Operator \
+ : public Operator1<MachineType> { \
+ AtomicCompareExchange##Type##Operator() \
+ : Operator1<MachineType>(IrOpcode::kAtomicCompareExchange, \
+ Operator::kNoDeopt | Operator::kNoThrow, \
+ "AtomicCompareExchange", 4, 1, 1, 1, 1, 0, \
+ MachineType::Type()) {} \
+ }; \
+ AtomicCompareExchange##Type##Operator kAtomicCompareExchange##Type;
+ ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
+#undef ATOMIC_COMPARE_EXCHANGE
+
// The {BitcastWordToTagged} operator must not be marked as pure (especially
// not idempotent), because otherwise the splitting logic in the Scheduler
// might decide to split these operators, thus potentially creating live
@@ -874,6 +892,17 @@ const Operator* MachineOperatorBuilder::AtomicExchange(MachineType rep) {
return nullptr;
}
+const Operator* MachineOperatorBuilder::AtomicCompareExchange(MachineType rep) {
+#define COMPARE_EXCHANGE(kRep) \
+ if (rep == MachineType::kRep()) { \
+ return &cache_.kAtomicCompareExchange##kRep; \
+ }
+ ATOMIC_TYPE_LIST(COMPARE_EXCHANGE)
+#undef COMPARE_EXCHANGE
+ UNREACHABLE();
+ return nullptr;
+}
+
#define SIMD_LANE_OPS(Type, lane_count) \
const Operator* MachineOperatorBuilder::Type##ExtractLane( \
int32_t lane_index) { \

Powered by Google App Engine
This is Rietveld 408576698