OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // public API also uses MemoryBarrier at the public name for this fence. So, on | 56 // public API also uses MemoryBarrier at the public name for this fence. So, on |
57 // X64, undef it, and call its documented | 57 // X64, undef it, and call its documented |
58 // (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) | 58 // (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) |
59 // implementation directly. | 59 // implementation directly. |
60 #undef MemoryBarrier | 60 #undef MemoryBarrier |
61 #endif | 61 #endif |
62 | 62 |
63 namespace v8 { | 63 namespace v8 { |
64 namespace internal { | 64 namespace internal { |
65 | 65 |
| 66 typedef char Atomic8; |
66 typedef int32_t Atomic32; | 67 typedef int32_t Atomic32; |
67 #ifdef V8_HOST_ARCH_64_BIT | 68 #ifdef V8_HOST_ARCH_64_BIT |
68 // We need to be able to go between Atomic64 and AtomicWord implicitly. This | 69 // We need to be able to go between Atomic64 and AtomicWord implicitly. This |
69 // means Atomic64 and AtomicWord should be the same type on 64-bit. | 70 // means Atomic64 and AtomicWord should be the same type on 64-bit. |
70 #if defined(__ILP32__) | 71 #if defined(__ILP32__) |
71 typedef int64_t Atomic64; | 72 typedef int64_t Atomic64; |
72 #else | 73 #else |
73 typedef intptr_t Atomic64; | 74 typedef intptr_t Atomic64; |
74 #endif | 75 #endif |
75 #endif | 76 #endif |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory | 114 // semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory |
114 // access. | 115 // access. |
115 Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, | 116 Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, |
116 Atomic32 old_value, | 117 Atomic32 old_value, |
117 Atomic32 new_value); | 118 Atomic32 new_value); |
118 Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, | 119 Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, |
119 Atomic32 old_value, | 120 Atomic32 old_value, |
120 Atomic32 new_value); | 121 Atomic32 new_value); |
121 | 122 |
122 void MemoryBarrier(); | 123 void MemoryBarrier(); |
| 124 void NoBarrier_Store(volatile Atomic8* ptr, Atomic8 value); |
123 void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); | 125 void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); |
124 void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); | 126 void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); |
125 void Release_Store(volatile Atomic32* ptr, Atomic32 value); | 127 void Release_Store(volatile Atomic32* ptr, Atomic32 value); |
126 | 128 |
| 129 Atomic8 NoBarrier_Load(volatile const Atomic8* ptr); |
127 Atomic32 NoBarrier_Load(volatile const Atomic32* ptr); | 130 Atomic32 NoBarrier_Load(volatile const Atomic32* ptr); |
128 Atomic32 Acquire_Load(volatile const Atomic32* ptr); | 131 Atomic32 Acquire_Load(volatile const Atomic32* ptr); |
129 Atomic32 Release_Load(volatile const Atomic32* ptr); | 132 Atomic32 Release_Load(volatile const Atomic32* ptr); |
130 | 133 |
131 // 64-bit atomic operations (only available on 64-bit processors). | 134 // 64-bit atomic operations (only available on 64-bit processors). |
132 #ifdef V8_HOST_ARCH_64_BIT | 135 #ifdef V8_HOST_ARCH_64_BIT |
133 Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, | 136 Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
134 Atomic64 old_value, | 137 Atomic64 old_value, |
135 Atomic64 new_value); | 138 Atomic64 new_value); |
136 Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value); | 139 Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 #error "Atomic operations are not supported on your platform" | 175 #error "Atomic operations are not supported on your platform" |
173 #endif | 176 #endif |
174 | 177 |
175 // On some platforms we need additional declarations to make | 178 // On some platforms we need additional declarations to make |
176 // AtomicWord compatible with our other Atomic* types. | 179 // AtomicWord compatible with our other Atomic* types. |
177 #if defined(__APPLE__) || defined(__OpenBSD__) | 180 #if defined(__APPLE__) || defined(__OpenBSD__) |
178 #include "atomicops_internals_atomicword_compat.h" | 181 #include "atomicops_internals_atomicword_compat.h" |
179 #endif | 182 #endif |
180 | 183 |
181 #endif // V8_ATOMICOPS_H_ | 184 #endif // V8_ATOMICOPS_H_ |
OLD | NEW |