OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 // The routines exported by this module are subtle. If you use them, even if | 5 // The routines exported by this module are subtle. If you use them, even if |
6 // you get the code right, it will depend on careful reasoning about atomicity | 6 // you get the code right, it will depend on careful reasoning about atomicity |
7 // and memory ordering; it will be less readable, and harder to maintain. If | 7 // and memory ordering; it will be less readable, and harder to maintain. If |
8 // you plan to use these routines, you should have a good reason, such as solid | 8 // you plan to use these routines, you should have a good reason, such as solid |
9 // evidence that performance would otherwise suffer, or there being no | 9 // evidence that performance would otherwise suffer, or there being no |
10 // alternative. You should assume only properties explicitly guaranteed by the | 10 // alternative. You should assume only properties explicitly guaranteed by the |
(...skipping 38 matching lines...) Loading... | |
49 // means Atomic64 and AtomicWord should be the same type on 64-bit. | 49 // means Atomic64 and AtomicWord should be the same type on 64-bit. |
50 #if defined(__ILP32__) | 50 #if defined(__ILP32__) |
51 typedef int64_t Atomic64; | 51 typedef int64_t Atomic64; |
52 #else | 52 #else |
53 typedef intptr_t Atomic64; | 53 typedef intptr_t Atomic64; |
54 #endif // defined(V8_HOST_ARCH_64_BIT) | 54 #endif // defined(V8_HOST_ARCH_64_BIT) |
55 #endif // defined(__native_client__) | 55 #endif // defined(__native_client__) |
56 | 56 |
57 // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or | 57 // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or |
58 // Atomic64 routines below, depending on your architecture. | 58 // Atomic64 routines below, depending on your architecture. |
59 #if V8_OS_AIX && V8_HOST_ARCH_32_BIT | |
60 typedef Atomic32 AtomicWord; | |
Sven Panne
2015/01/27 11:47:05
Hmmm, why do we need this?
michael_dawson
2015/01/29 00:08:29
It looks like this was to deal with the case menti
| |
61 #else | |
59 typedef intptr_t AtomicWord; | 62 typedef intptr_t AtomicWord; |
63 #endif | |
60 | 64 |
61 // Atomically execute: | 65 // Atomically execute: |
62 // result = *ptr; | 66 // result = *ptr; |
63 // if (*ptr == old_value) | 67 // if (*ptr == old_value) |
64 // *ptr = new_value; | 68 // *ptr = new_value; |
65 // return result; | 69 // return result; |
66 // | 70 // |
67 // I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". | 71 // I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". |
68 // Always return the old value of "*ptr" | 72 // Always return the old value of "*ptr" |
69 // | 73 // |
(...skipping 90 matching lines...) Loading... | |
160 #error "Atomic operations are not supported on your platform" | 164 #error "Atomic operations are not supported on your platform" |
161 #endif | 165 #endif |
162 | 166 |
163 // On some platforms we need additional declarations to make | 167 // On some platforms we need additional declarations to make |
164 // AtomicWord compatible with our other Atomic* types. | 168 // AtomicWord compatible with our other Atomic* types. |
165 #if defined(__APPLE__) || defined(__OpenBSD__) | 169 #if defined(__APPLE__) || defined(__OpenBSD__) |
166 #include "src/base/atomicops_internals_atomicword_compat.h" | 170 #include "src/base/atomicops_internals_atomicword_compat.h" |
167 #endif | 171 #endif |
168 | 172 |
169 #endif // V8_BASE_ATOMICOPS_H_ | 173 #endif // V8_BASE_ATOMICOPS_H_ |
OLD | NEW |