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

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

Issue 2651203006: wtf/Atomics.h: Remove Android/ARM kernel helpers. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 #if CPU(X86) || CPU(X86_64) 260 #if CPU(X86) || CPU(X86_64)
261 // Only compiler barrier is needed. 261 // Only compiler barrier is needed.
262 #if COMPILER(MSVC) 262 #if COMPILER(MSVC)
263 // Starting from Visual Studio 2005 compiler guarantees acquire and release 263 // Starting from Visual Studio 2005 compiler guarantees acquire and release
264 // semantics for operations on volatile variables. See MSDN entry for 264 // semantics for operations on volatile variables. See MSDN entry for
265 // MemoryBarrier macro. 265 // MemoryBarrier macro.
266 #define MEMORY_BARRIER() 266 #define MEMORY_BARRIER()
267 #else 267 #else
268 #define MEMORY_BARRIER() __asm__ __volatile__("" : : : "memory") 268 #define MEMORY_BARRIER() __asm__ __volatile__("" : : : "memory")
269 #endif 269 #endif
270 #elif CPU(ARM) && OS(ANDROID)
271 // On ARM __sync_synchronize generates dmb which is very expensive on single
272 // core devices which don't actually need it. Avoid the cost by calling into
273 // kuser_memory_barrier helper.
274 inline void memoryBarrier() {
275 // Note: This is a function call, which is also an implicit compiler barrier.
276 typedef void (*KernelMemoryBarrierFunc)();
277 ((KernelMemoryBarrierFunc)0xffff0fa0)();
278 }
279 #define MEMORY_BARRIER() memoryBarrier()
280 #else 270 #else
281 // Fallback to the compiler intrinsic on all other platforms. 271 // Fallback to the compiler intrinsic on all other platforms.
282 #define MEMORY_BARRIER() __sync_synchronize() 272 #define MEMORY_BARRIER() __sync_synchronize()
283 #endif 273 #endif
284 274
285 ALWAYS_INLINE void releaseStore(volatile int* ptr, int value) { 275 ALWAYS_INLINE void releaseStore(volatile int* ptr, int value) {
286 MEMORY_BARRIER(); 276 MEMORY_BARRIER();
287 *ptr = value; 277 *ptr = value;
288 } 278 }
289 ALWAYS_INLINE void releaseStore(volatile unsigned* ptr, unsigned value) { 279 ALWAYS_INLINE void releaseStore(volatile unsigned* ptr, unsigned value) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 using WTF::noBarrierLoad; 393 using WTF::noBarrierLoad;
404 using WTF::noBarrierStore; 394 using WTF::noBarrierStore;
405 395
406 // These methods allow loading from and storing to poisoned memory. Only 396 // These methods allow loading from and storing to poisoned memory. Only
407 // use these methods if you know what you are doing since they will 397 // use these methods if you know what you are doing since they will
408 // silence use-after-poison errors from ASan. 398 // silence use-after-poison errors from ASan.
409 using WTF::asanUnsafeAcquireLoad; 399 using WTF::asanUnsafeAcquireLoad;
410 using WTF::asanUnsafeReleaseStore; 400 using WTF::asanUnsafeReleaseStore;
411 401
412 #endif // Atomics_h 402 #endif // Atomics_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698