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

Unified Diff: src/runtime/runtime-atomics-intrinsics-inl.h

Issue 1550803006: Convert runtime atomics functions to inline asm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: update BUILD.gn, add *-inl.h and *.h to gyp as well Created 4 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
« no previous file with comments | « src/runtime/runtime-atomics-ia32-inl.h ('k') | src/runtime/runtime-atomics-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/runtime/runtime-atomics-ia32-inl.h ('k') | src/runtime/runtime-atomics-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698