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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 namespace v8 {
6 namespace internal {
7 namespace atomics {
8
9 template <typename T>
10 inline T LoadSeqCst(T* p) {
11 T result;
12 __atomic_load(p, &result, __ATOMIC_SEQ_CST);
13 return result;
14 }
15
16
17 template <typename T>
18 inline void StoreSeqCst(T* p, T value) {
19 __atomic_store_n(p, value, __ATOMIC_SEQ_CST);
20 }
21
22
23 template <typename T>
24 inline T AddSeqCst(T* p, T value) {
25 return __atomic_fetch_add(p, value, __ATOMIC_SEQ_CST);
26 }
27
28
29 template <typename T>
30 inline T SubSeqCst(T* p, T value) {
31 return __atomic_fetch_sub(p, value, __ATOMIC_SEQ_CST);
32 }
33
34
35 template <typename T>
36 inline T AndSeqCst(T* p, T value) {
37 return __atomic_fetch_and(p, value, __ATOMIC_SEQ_CST);
38 }
39
40
41 template <typename T>
42 inline T OrSeqCst(T* p, T value) {
43 return __atomic_fetch_or(p, value, __ATOMIC_SEQ_CST);
44 }
45
46
47 template <typename T>
48 inline T XorSeqCst(T* p, T value) {
49 return __atomic_fetch_xor(p, value, __ATOMIC_SEQ_CST);
50 }
51
52
53 template <typename T>
54 inline T ExchangeSeqCst(T* p, T value) {
55 return __atomic_exchange_n(p, value, __ATOMIC_SEQ_CST);
56 }
57
58
59 template <typename T>
60 inline T CompareExchangeSeqCst(T* p, T oldval, T newval) {
61 (void)__atomic_compare_exchange_n(p, &oldval, newval, 0, __ATOMIC_SEQ_CST,
62 __ATOMIC_SEQ_CST);
63 return oldval;
64 }
65
66 } // namespace atomics
67 } // namespace internal
68 } // namespace v8
OLDNEW
« 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