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

Side by Side Diff: src/base/atomicops_internals_atomicword_compat.h

Issue 2912773002: Rename "NoBarrier" memory operations to "Relaxed". (Closed)
Patch Set: more Created 3 years, 6 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is an internal atomic implementation, use atomicops.h instead. 5 // This file is an internal atomic implementation, use atomicops.h instead.
6 6
7 #ifndef V8_BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ 7 #ifndef V8_BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
8 #define V8_BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ 8 #define V8_BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
9 9
10 // AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32, 10 // AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32,
11 // which in turn means int. On some LP32 platforms, intptr_t is an int, but 11 // which in turn means int. On some LP32 platforms, intptr_t is an int, but
12 // on others, it's a long. When AtomicWord and Atomic32 are based on different 12 // on others, it's a long. When AtomicWord and Atomic32 are based on different
13 // fundamental types, their pointers are incompatible. 13 // fundamental types, their pointers are incompatible.
14 // 14 //
15 // This file defines function overloads to allow both AtomicWord and Atomic32 15 // This file defines function overloads to allow both AtomicWord and Atomic32
16 // data to be used with this interface. 16 // data to be used with this interface.
17 // 17 //
18 // On LP64 platforms, AtomicWord and Atomic64 are both always long, 18 // On LP64 platforms, AtomicWord and Atomic64 are both always long,
19 // so this problem doesn't occur. 19 // so this problem doesn't occur.
20 20
21 #if !defined(V8_HOST_ARCH_64_BIT) 21 #if !defined(V8_HOST_ARCH_64_BIT)
22 22
23 namespace v8 { 23 namespace v8 {
24 namespace base { 24 namespace base {
25 25
26 inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr, 26 inline AtomicWord Relaxed_CompareAndSwap(volatile AtomicWord* ptr,
27 AtomicWord old_value, 27 AtomicWord old_value,
28 AtomicWord new_value) { 28 AtomicWord new_value) {
29 return NoBarrier_CompareAndSwap( 29 return Relaxed_CompareAndSwap(reinterpret_cast<volatile Atomic32*>(ptr),
30 reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value); 30 old_value, new_value);
31 } 31 }
32 32
33 inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr, 33 inline AtomicWord Relaxed_AtomicExchange(volatile AtomicWord* ptr,
34 AtomicWord new_value) { 34 AtomicWord new_value) {
35 return NoBarrier_AtomicExchange( 35 return Relaxed_AtomicExchange(reinterpret_cast<volatile Atomic32*>(ptr),
36 reinterpret_cast<volatile Atomic32*>(ptr), new_value); 36 new_value);
37 } 37 }
38 38
39 inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr, 39 inline AtomicWord Relaxed_AtomicIncrement(volatile AtomicWord* ptr,
40 AtomicWord increment) { 40 AtomicWord increment) {
41 return NoBarrier_AtomicIncrement( 41 return Relaxed_AtomicIncrement(reinterpret_cast<volatile Atomic32*>(ptr),
42 reinterpret_cast<volatile Atomic32*>(ptr), increment); 42 increment);
43 } 43 }
44 44
45 inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr, 45 inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr,
46 AtomicWord increment) { 46 AtomicWord increment) {
47 return Barrier_AtomicIncrement( 47 return Barrier_AtomicIncrement(
48 reinterpret_cast<volatile Atomic32*>(ptr), increment); 48 reinterpret_cast<volatile Atomic32*>(ptr), increment);
49 } 49 }
50 50
51 inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr, 51 inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
52 AtomicWord old_value, 52 AtomicWord old_value,
53 AtomicWord new_value) { 53 AtomicWord new_value) {
54 return v8::base::Acquire_CompareAndSwap( 54 return v8::base::Acquire_CompareAndSwap(
55 reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value); 55 reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
56 } 56 }
57 57
58 inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr, 58 inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
59 AtomicWord old_value, 59 AtomicWord old_value,
60 AtomicWord new_value) { 60 AtomicWord new_value) {
61 return v8::base::Release_CompareAndSwap( 61 return v8::base::Release_CompareAndSwap(
62 reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value); 62 reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
63 } 63 }
64 64
65 inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) { 65 inline void Relaxed_Store(volatile AtomicWord* ptr, AtomicWord value) {
66 NoBarrier_Store( 66 Relaxed_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
67 reinterpret_cast<volatile Atomic32*>(ptr), value);
68 } 67 }
69 68
70 inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) { 69 inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
71 return v8::base::Release_Store( 70 return v8::base::Release_Store(
72 reinterpret_cast<volatile Atomic32*>(ptr), value); 71 reinterpret_cast<volatile Atomic32*>(ptr), value);
73 } 72 }
74 73
75 inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) { 74 inline AtomicWord Relaxed_Load(volatile const AtomicWord* ptr) {
76 return NoBarrier_Load( 75 return Relaxed_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
77 reinterpret_cast<volatile const Atomic32*>(ptr));
78 } 76 }
79 77
80 inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) { 78 inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
81 return v8::base::Acquire_Load( 79 return v8::base::Acquire_Load(
82 reinterpret_cast<volatile const Atomic32*>(ptr)); 80 reinterpret_cast<volatile const Atomic32*>(ptr));
83 } 81 }
84 82
85 } // namespace base 83 } // namespace base
86 } // namespace v8 84 } // namespace v8
87 85
88 #endif // !defined(V8_HOST_ARCH_64_BIT) 86 #endif // !defined(V8_HOST_ARCH_64_BIT)
89 87
90 #endif // V8_BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ 88 #endif // V8_BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698