| Index: src/runtime/runtime-atomics-intrinsics-inl.h
|
| diff --git a/src/runtime/runtime-atomics-intrinsics-inl.h b/src/runtime/runtime-atomics-intrinsics-inl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e6788ad63211e7de595b3c2ce919e33336fa552c
|
| --- /dev/null
|
| +++ b/src/runtime/runtime-atomics-intrinsics-inl.h
|
| @@ -0,0 +1,68 @@
|
| +// Copyright 2016 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +namespace v8 {
|
| +namespace internal {
|
| +namespace atomics {
|
| +
|
| +template <typename T>
|
| +inline T LoadSeqCst(T* p) {
|
| + T result;
|
| + __atomic_load(p, &result, __ATOMIC_SEQ_CST);
|
| + return result;
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline void StoreSeqCst(T* p, T value) {
|
| + __atomic_store_n(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T AddSeqCst(T* p, T value) {
|
| + return __atomic_fetch_add(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T SubSeqCst(T* p, T value) {
|
| + return __atomic_fetch_sub(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T AndSeqCst(T* p, T value) {
|
| + return __atomic_fetch_and(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T OrSeqCst(T* p, T value) {
|
| + return __atomic_fetch_or(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T XorSeqCst(T* p, T value) {
|
| + return __atomic_fetch_xor(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T ExchangeSeqCst(T* p, T value) {
|
| + return __atomic_exchange_n(p, value, __ATOMIC_SEQ_CST);
|
| +}
|
| +
|
| +
|
| +template <typename T>
|
| +inline T CompareExchangeSeqCst(T* p, T oldval, T newval) {
|
| + (void)__atomic_compare_exchange_n(p, &oldval, newval, 0, __ATOMIC_SEQ_CST,
|
| + __ATOMIC_SEQ_CST);
|
| + return oldval;
|
| +}
|
| +
|
| +} // namespace atomics
|
| +} // namespace internal
|
| +} // namespace v8
|
|
|