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

Side by Side Diff: Source/wtf/Atomics.h

Issue 1145073002: Move AddressSanitizer.h to wtf/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix non-Oilpan compilation Created 5 years, 7 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 | « Source/wtf/AddressSanitizer.h ('k') | Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2010, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 12 matching lines...) Expand all
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef Atomics_h 30 #ifndef Atomics_h
31 #define Atomics_h 31 #define Atomics_h
32 32
33 #include "wtf/AddressSanitizer.h"
33 #include "wtf/Assertions.h" 34 #include "wtf/Assertions.h"
34 #include "wtf/CPU.h" 35 #include "wtf/CPU.h"
35 36
36 #include <stdint.h> 37 #include <stdint.h>
37 38
38 #if COMPILER(MSVC) 39 #if COMPILER(MSVC)
39 #include <windows.h> 40 #include <windows.h>
40 #endif 41 #endif
41 42
42 #if defined(THREAD_SANITIZER) 43 #if defined(THREAD_SANITIZER)
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 257 }
257 ALWAYS_INLINE void* acquireLoad(void* volatile const* ptr) 258 ALWAYS_INLINE void* acquireLoad(void* volatile const* ptr)
258 { 259 {
259 void* value = *ptr; 260 void* value = *ptr;
260 MEMORY_BARRIER(); 261 MEMORY_BARRIER();
261 return value; 262 return value;
262 } 263 }
263 264
264 #if defined(ADDRESS_SANITIZER) 265 #if defined(ADDRESS_SANITIZER)
265 266
266 // FIXME: See comment on NO_SANITIZE_ADDRESS in platform/heap/AddressSanitizer.h 267 NO_SANITIZE_ADDRESS ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned* ptr, unsigned value)
267 #if !OS(WIN) || COMPILER(CLANG)
268 #define NO_SANITIZE_ADDRESS_ATOMICS __attribute__((no_sanitize_address))
269 #else
270 #define NO_SANITIZE_ADDRESS_ATOMICS
271 #endif
272
273 NO_SANITIZE_ADDRESS_ATOMICS ALWAYS_INLINE void asanUnsafeReleaseStore(volatile u nsigned* ptr, unsigned value)
274 { 268 {
275 MEMORY_BARRIER(); 269 MEMORY_BARRIER();
276 *ptr = value; 270 *ptr = value;
277 } 271 }
278 272
279 NO_SANITIZE_ADDRESS_ATOMICS ALWAYS_INLINE unsigned asanUnsafeAcquireLoad(volatil e const unsigned* ptr) 273 NO_SANITIZE_ADDRESS ALWAYS_INLINE unsigned asanUnsafeAcquireLoad(volatile const unsigned* ptr)
280 { 274 {
281 unsigned value = *ptr; 275 unsigned value = *ptr;
282 MEMORY_BARRIER(); 276 MEMORY_BARRIER();
283 return value; 277 return value;
284 } 278 }
285 279
286 #undef NO_SANITIZE_ADDRESS_ATOMICS
287
288 #endif // defined(ADDRESS_SANITIZER) 280 #endif // defined(ADDRESS_SANITIZER)
289 281
290 #undef MEMORY_BARRIER 282 #undef MEMORY_BARRIER
291 283
292 #endif 284 #endif
293 285
294 #if !defined(ADDRESS_SANITIZER) 286 #if !defined(ADDRESS_SANITIZER)
295 287
296 ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned* ptr, unsigned value ) 288 ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned* ptr, unsigned value )
297 { 289 {
(...skipping 18 matching lines...) Expand all
316 using WTF::acquireLoad; 308 using WTF::acquireLoad;
317 using WTF::releaseStore; 309 using WTF::releaseStore;
318 310
319 // These methods allow loading from and storing to poisoned memory. Only 311 // These methods allow loading from and storing to poisoned memory. Only
320 // use these methods if you know what you are doing since they will 312 // use these methods if you know what you are doing since they will
321 // silence use-after-poison errors from ASan. 313 // silence use-after-poison errors from ASan.
322 using WTF::asanUnsafeAcquireLoad; 314 using WTF::asanUnsafeAcquireLoad;
323 using WTF::asanUnsafeReleaseStore; 315 using WTF::asanUnsafeReleaseStore;
324 316
325 #endif // Atomics_h 317 #endif // Atomics_h
OLDNEW
« no previous file with comments | « Source/wtf/AddressSanitizer.h ('k') | Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698