diff options
author | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-10 14:00:06 +0000 |
---|---|---|
committer | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-10 14:00:06 +0000 |
commit | 2054dc1f8712c4dc4d369281503ed4b7f3fedb8e (patch) | |
tree | 264504c3c2c0eb4134b0aa00d8fbf94a6c7f5cb6 /base/atomicops.h | |
parent | 9dad791e0ad45e09311bf4a9d89b21c57a6ecb10 (diff) | |
download | chromium_src-2054dc1f8712c4dc4d369281503ed4b7f3fedb8e.zip chromium_src-2054dc1f8712c4dc4d369281503ed4b7f3fedb8e.tar.gz chromium_src-2054dc1f8712c4dc4d369281503ed4b7f3fedb8e.tar.bz2 |
Improve the implementation of atomic operations on Linux/ARM (including Android/ARM).
The previous patch at:
https://chromiumcodereview.appspot.com/10831358
actually regressed the performance of atomic operations on Linux/ARM systems, because
the GCC intrinsics (e.g. __sync_fetch_and_add) are very poorly implemented at the
moment (and also always provide a full barrier, even when the caller doesn't need it).
This replaces the implementation with a better version which:
- Uses inline assembly and LDRES/STREX instructions on ARMv6+, or the old
kernel helper cmpxchg implementation on ARMv5.
- Still uses the kernel helper memory barrier to optimize for single core
devices on ARMv6 and ARMv7, or ARMv5 binaries running on devices with
a higher architecture number.
- Provide truly barrier free compare-and-swap, swap and atomic-inc
operations.
On tested Android/ARM devices, this speeds up atomic increments by x2 to x3.
This indirectly speeds up other operations relying on it (e.g. scoped_refptr<>
or base::Bind()). For details, see:
https://docs.google.com/a/chromium.org/spreadsheet/ccc?key=0Arp73PHrzcIQdGNUd1NGYWlfY0dKWS1EZ2V6RThhZXc&usp=sharing
BUG=234215
Review URL: https://chromiumcodereview.appspot.com/16335007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/atomicops.h')
-rw-r--r-- | base/atomicops.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/base/atomicops.h b/base/atomicops.h index 27a8714..7f03492 100644 --- a/base/atomicops.h +++ b/base/atomicops.h @@ -143,9 +143,10 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); #include "base/atomicops_internals_x86_msvc.h" #elif defined(OS_MACOSX) #include "base/atomicops_internals_mac.h" -#elif (defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY)) || \ - defined(OS_NACL) +#elif defined(OS_NACL) #include "base/atomicops_internals_gcc.h" +#elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY) +#include "base/atomicops_internals_arm_gcc.h" #elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) #include "base/atomicops_internals_x86_gcc.h" #elif defined(COMPILER_GCC) && defined(ARCH_CPU_MIPS_FAMILY) |