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

Side by Side Diff: base/atomicops.h

Issue 1211903003: Remove old/unused atomicops code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: also remove _gcc.h Created 5 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 // For atomic operations on reference counts, see atomic_refcount.h. 5 // For atomic operations on reference counts, see atomic_refcount.h.
6 // For atomic operations on sequence numbers, see atomic_sequence_num.h. 6 // For atomic operations on sequence numbers, see atomic_sequence_num.h.
7 7
8 // The routines exported by this module are subtle. If you use them, even if 8 // The routines exported by this module are subtle. If you use them, even if
9 // you get the code right, it will depend on careful reasoning about atomicity 9 // you get the code right, it will depend on careful reasoning about atomicity
10 // and memory ordering; it will be less readable, and harder to maintain. If 10 // and memory ordering; it will be less readable, and harder to maintain. If
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void Acquire_Store(volatile Atomic64* ptr, Atomic64 value); 137 void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
138 void Release_Store(volatile Atomic64* ptr, Atomic64 value); 138 void Release_Store(volatile Atomic64* ptr, Atomic64 value);
139 Atomic64 NoBarrier_Load(volatile const Atomic64* ptr); 139 Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
140 Atomic64 Acquire_Load(volatile const Atomic64* ptr); 140 Atomic64 Acquire_Load(volatile const Atomic64* ptr);
141 Atomic64 Release_Load(volatile const Atomic64* ptr); 141 Atomic64 Release_Load(volatile const Atomic64* ptr);
142 #endif // ARCH_CPU_64_BITS 142 #endif // ARCH_CPU_64_BITS
143 143
144 } // namespace subtle 144 } // namespace subtle
145 } // namespace base 145 } // namespace base
146 146
147 // The following x86 CPU features are used in atomicops_internals_x86_gcc.h, but
148 // this file is duplicated inside of Chrome: protobuf and tcmalloc rely on the
149 // struct being present at link time. Some parts of Chrome can currently use the
150 // portable interface whereas others still use GCC one. The include guards are
151 // the same as in atomicops_internals_x86_gcc.cc.
152 #if defined(__i386__) || defined(__x86_64__)
153 // This struct is not part of the public API of this module; clients may not
154 // use it. (However, it's exported via BASE_EXPORT because clients implicitly
155 // do use it at link time by inlining these functions.)
156 // Features of this x86. Values may not be correct before main() is run,
157 // but are set conservatively.
158 struct AtomicOps_x86CPUFeatureStruct {
159 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence
160 // after acquire compare-and-swap.
161 // The following fields are unused by Chrome's base implementation but are
162 // still used by copies of the same code in other parts of the code base. This
163 // causes an ODR violation, and the other code is likely reading invalid
164 // memory.
165 // TODO(jfb) Delete these fields once the rest of the Chrome code base doesn't
166 // depend on them.
167 bool has_sse2; // Processor has SSE2.
168 bool has_cmpxchg16b; // Processor supports cmpxchg16b instruction.
169 };
170 BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct
171 AtomicOps_Internalx86CPUFeatures;
172 #endif
173
174 // Try to use a portable implementation based on C++11 atomics. 147 // Try to use a portable implementation based on C++11 atomics.
175 // 148 //
176 // Some toolchains support C++11 language features without supporting library 149 // Some toolchains support C++11 language features without supporting library
177 // features (recent compiler, older STL). Whitelist libstdc++ and libc++ that we 150 // features (recent compiler, older STL). Whitelist libstdc++ and libc++ that we
178 // know will have <atomic> when compiling C++11. 151 // know will have <atomic> when compiling C++11.
179 #if ((__cplusplus >= 201103L) && \ 152 #if ((__cplusplus >= 201103L) && \
180 ((defined(__GLIBCXX__) && (__GLIBCXX__ > 20110216)) || \ 153 ((defined(__GLIBCXX__) && (__GLIBCXX__ > 20110216)) || \
181 (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER >= 11)))) 154 (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER >= 11))))
182 # include "base/atomicops_internals_portable.h" 155 # include "base/atomicops_internals_portable.h"
183 #else // Otherwise use a platform specific implementation. 156 #else // Otherwise use a platform specific implementation.
184 # if defined(THREAD_SANITIZER) 157 # if defined(THREAD_SANITIZER)
185 # error "Thread sanitizer must use the portable atomic operations" 158 # error "Thread sanitizer must use the portable atomic operations"
186 # elif (defined(OS_WIN) && defined(COMPILER_MSVC) && \ 159 # elif (defined(OS_WIN) && defined(COMPILER_MSVC) && \
187 defined(ARCH_CPU_X86_FAMILY)) 160 defined(ARCH_CPU_X86_FAMILY))
188 # include "base/atomicops_internals_x86_msvc.h" 161 # include "base/atomicops_internals_x86_msvc.h"
189 # elif defined(OS_MACOSX) 162 # elif defined(OS_MACOSX)
190 # include "base/atomicops_internals_mac.h" 163 # include "base/atomicops_internals_mac.h"
191 # elif defined(OS_NACL)
192 # include "base/atomicops_internals_gcc.h"
193 # elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARMEL)
194 # include "base/atomicops_internals_arm_gcc.h"
195 # elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM64)
196 # include "base/atomicops_internals_arm64_gcc.h"
197 # elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
198 # include "base/atomicops_internals_x86_gcc.h"
199 # elif (defined(COMPILER_GCC) && \
200 (defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_MIPS64_FAMILY)))
201 # include "base/atomicops_internals_mips_gcc.h"
202 # else 164 # else
203 # error "Atomic operations are not supported on your platform" 165 # error "Atomic operations are not supported on your platform"
204 # endif 166 # endif
205 #endif // Portable / non-portable includes. 167 #endif // Portable / non-portable includes.
206 168
207 // On some platforms we need additional declarations to make 169 // On some platforms we need additional declarations to make
208 // AtomicWord compatible with our other Atomic* types. 170 // AtomicWord compatible with our other Atomic* types.
209 #if defined(OS_MACOSX) || defined(OS_OPENBSD) 171 #if defined(OS_MACOSX) || defined(OS_OPENBSD)
210 #include "base/atomicops_internals_atomicword_compat.h" 172 #include "base/atomicops_internals_atomicword_compat.h"
211 #endif 173 #endif
212 174
213 #endif // BASE_ATOMICOPS_H_ 175 #endif // BASE_ATOMICOPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698