11cb0ef41Sopenharmony_ci// Copyright 2021 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_CODEGEN_ATOMIC_MEMORY_ORDER_H_ 61cb0ef41Sopenharmony_ci#define V8_CODEGEN_ATOMIC_MEMORY_ORDER_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <ostream> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#include "src/base/logging.h" 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cinamespace v8 { 131cb0ef41Sopenharmony_cinamespace internal { 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci// Atomic memory orders supported by the compiler. 161cb0ef41Sopenharmony_cienum class AtomicMemoryOrder : uint8_t { kAcqRel, kSeqCst }; 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciinline size_t hash_value(AtomicMemoryOrder order) { 191cb0ef41Sopenharmony_ci return static_cast<uint8_t>(order); 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciinline std::ostream& operator<<(std::ostream& os, AtomicMemoryOrder order) { 231cb0ef41Sopenharmony_ci switch (order) { 241cb0ef41Sopenharmony_ci case AtomicMemoryOrder::kAcqRel: 251cb0ef41Sopenharmony_ci return os << "kAcqRel"; 261cb0ef41Sopenharmony_ci case AtomicMemoryOrder::kSeqCst: 271cb0ef41Sopenharmony_ci return os << "kSeqCst"; 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci UNREACHABLE(); 301cb0ef41Sopenharmony_ci} 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci} // namespace internal 331cb0ef41Sopenharmony_ci} // namespace v8 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci#endif // V8_CODEGEN_ATOMIC_MEMORY_ORDER_H_ 36