1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_CODEGEN_ATOMIC_MEMORY_ORDER_H_ 6 #define V8_CODEGEN_ATOMIC_MEMORY_ORDER_H_ 7 8 #include <ostream> 9 10 #include "src/base/logging.h" 11 12 namespace v8 { 13 namespace internal { 14 15 // Atomic memory orders supported by the compiler. 16 enum class AtomicMemoryOrder : uint8_t { kAcqRel, kSeqCst }; 17 hash_value(AtomicMemoryOrder order)18inline size_t hash_value(AtomicMemoryOrder order) { 19 return static_cast<uint8_t>(order); 20 } 21 operator <<(std::ostream& os, AtomicMemoryOrder order)22inline std::ostream& operator<<(std::ostream& os, AtomicMemoryOrder order) { 23 switch (order) { 24 case AtomicMemoryOrder::kAcqRel: 25 return os << "kAcqRel"; 26 case AtomicMemoryOrder::kSeqCst: 27 return os << "kSeqCst"; 28 } 29 UNREACHABLE(); 30 } 31 32 } // namespace internal 33 } // namespace v8 34 35 #endif // V8_CODEGEN_ATOMIC_MEMORY_ORDER_H_ 36