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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 ALWAYS_INLINE unsigned acquireLoad(volatile const unsigned* ptr) | 181 ALWAYS_INLINE unsigned acquireLoad(volatile const unsigned* ptr) |
182 { | 182 { |
183 unsigned value = *ptr; | 183 unsigned value = *ptr; |
184 MEMORY_BARRIER(); | 184 MEMORY_BARRIER(); |
185 return value; | 185 return value; |
186 } | 186 } |
187 | 187 |
188 #if defined(ADDRESS_SANITIZER) | 188 #if defined(ADDRESS_SANITIZER) |
189 | 189 |
190 __attribute__((no_sanitize_address)) ALWAYS_INLINE void asanUnsafeReleaseStore(v
olatile unsigned* ptr, unsigned value) | 190 // FIXME: See comment on NO_SANITIZE_ADDRESS in platform/heap/AddressSanitizer.h |
| 191 #if !OS(WIN) || COMPILER(CLANG) |
| 192 #define NO_SANITIZE_ADDRESS_ATOMICS __attribute__((no_sanitize_address)) |
| 193 #else |
| 194 #define NO_SANITIZE_ADDRESS_ATOMICS |
| 195 #endif |
| 196 |
| 197 NO_SANITIZE_ADDRESS_ATOMICS ALWAYS_INLINE void asanUnsafeReleaseStore(volatile u
nsigned* ptr, unsigned value) |
191 { | 198 { |
192 MEMORY_BARRIER(); | 199 MEMORY_BARRIER(); |
193 *ptr = value; | 200 *ptr = value; |
194 } | 201 } |
195 | 202 |
196 __attribute__((no_sanitize_address)) ALWAYS_INLINE unsigned asanUnsafeAcquireLoa
d(volatile const unsigned* ptr) | 203 NO_SANITIZE_ADDRESS_ATOMICS ALWAYS_INLINE unsigned asanUnsafeAcquireLoad(volatil
e const unsigned* ptr) |
197 { | 204 { |
198 unsigned value = *ptr; | 205 unsigned value = *ptr; |
199 MEMORY_BARRIER(); | 206 MEMORY_BARRIER(); |
200 return value; | 207 return value; |
201 } | 208 } |
202 | 209 |
| 210 #undef NO_SANITIZE_ADDRESS_ATOMICS |
| 211 |
203 #endif // defined(ADDRESS_SANITIZER) | 212 #endif // defined(ADDRESS_SANITIZER) |
204 | 213 |
205 #undef MEMORY_BARRIER | 214 #undef MEMORY_BARRIER |
206 | 215 |
207 #endif | 216 #endif |
208 | 217 |
209 #if !defined(ADDRESS_SANITIZER) | 218 #if !defined(ADDRESS_SANITIZER) |
210 | 219 |
211 ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned* ptr, unsigned value
) | 220 ALWAYS_INLINE void asanUnsafeReleaseStore(volatile unsigned* ptr, unsigned value
) |
212 { | 221 { |
(...skipping 18 matching lines...) Expand all Loading... |
231 using WTF::acquireLoad; | 240 using WTF::acquireLoad; |
232 using WTF::releaseStore; | 241 using WTF::releaseStore; |
233 | 242 |
234 // These methods allow loading from and storing to poisoned memory. Only | 243 // These methods allow loading from and storing to poisoned memory. Only |
235 // use these methods if you know what you are doing since they will | 244 // use these methods if you know what you are doing since they will |
236 // silence use-after-poison errors from ASan. | 245 // silence use-after-poison errors from ASan. |
237 using WTF::asanUnsafeAcquireLoad; | 246 using WTF::asanUnsafeAcquireLoad; |
238 using WTF::asanUnsafeReleaseStore; | 247 using WTF::asanUnsafeReleaseStore; |
239 | 248 |
240 #endif // Atomics_h | 249 #endif // Atomics_h |
OLD | NEW |