OLD | NEW |
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 { | 312 { |
313 *ptr = value; | 313 *ptr = value; |
314 } | 314 } |
315 | 315 |
316 ALWAYS_INLINE float noBarrierLoad(volatile const float* ptr) | 316 ALWAYS_INLINE float noBarrierLoad(volatile const float* ptr) |
317 { | 317 { |
318 float value = *ptr; | 318 float value = *ptr; |
319 return value; | 319 return value; |
320 } | 320 } |
321 | 321 |
| 322 ALWAYS_INLINE void noBarrierStore(volatile int* ptr, int value) |
| 323 { |
| 324 *ptr = value; |
| 325 } |
| 326 |
| 327 ALWAYS_INLINE int noBarrierLoad(volatile const int* ptr) |
| 328 { |
| 329 int value = *ptr; |
| 330 return value; |
| 331 } |
| 332 |
322 #if defined(ADDRESS_SANITIZER) | 333 #if defined(ADDRESS_SANITIZER) |
323 | 334 |
324 NO_SANITIZE_ADDRESS ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned*
ptr, unsigned value) | 335 NO_SANITIZE_ADDRESS ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned*
ptr, unsigned value) |
325 { | 336 { |
326 MEMORY_BARRIER(); | 337 MEMORY_BARRIER(); |
327 *ptr = value; | 338 *ptr = value; |
328 } | 339 } |
329 | 340 |
330 NO_SANITIZE_ADDRESS ALWAYS_INLINE unsigned asanUnsafeAcquireLoad(volatile const
unsigned* ptr) | 341 NO_SANITIZE_ADDRESS ALWAYS_INLINE unsigned asanUnsafeAcquireLoad(volatile const
unsigned* ptr) |
331 { | 342 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 using WTF::noBarrierLoad; | 378 using WTF::noBarrierLoad; |
368 using WTF::noBarrierStore; | 379 using WTF::noBarrierStore; |
369 | 380 |
370 // These methods allow loading from and storing to poisoned memory. Only | 381 // These methods allow loading from and storing to poisoned memory. Only |
371 // use these methods if you know what you are doing since they will | 382 // use these methods if you know what you are doing since they will |
372 // silence use-after-poison errors from ASan. | 383 // silence use-after-poison errors from ASan. |
373 using WTF::asanUnsafeAcquireLoad; | 384 using WTF::asanUnsafeAcquireLoad; |
374 using WTF::asanUnsafeReleaseStore; | 385 using WTF::asanUnsafeReleaseStore; |
375 | 386 |
376 #endif // Atomics_h | 387 #endif // Atomics_h |
OLD | NEW |