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

Side by Side Diff: include/core/SkOnce.h

Issue 143423004: ARM Skia NEON patches - 35 - First AArch64 support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkOnce_DEFINED 8 #ifndef SkOnce_DEFINED
9 #define SkOnce_DEFINED 9 #define SkOnce_DEFINED
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 inline static void compiler_barrier() { 54 inline static void compiler_barrier() {
55 _ReadWriteBarrier(); 55 _ReadWriteBarrier();
56 } 56 }
57 #else 57 #else
58 inline static void compiler_barrier() { 58 inline static void compiler_barrier() {
59 asm volatile("" : : : "memory"); 59 asm volatile("" : : : "memory");
60 } 60 }
61 #endif 61 #endif
62 62
63 inline static void full_barrier_on_arm() { 63 inline static void full_barrier_on_arm() {
64 #ifdef SK_CPU_ARM 64 #if (defined(SK_CPU_ARM) && SK_ARM_ARCH >= 7) || defined(SK_CPU_ARM64)
65 # if SK_ARM_ARCH >= 7 65 asm volatile("dmb ish" : : : "memory");
66 asm volatile("dmb" : : : "memory"); 66 #elif defined(SK_CPU_ARM)
67 # else
68 asm volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); 67 asm volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory");
69 # endif
70 #endif 68 #endif
71 } 69 }
72 70
73 // On every platform, we issue a compiler barrier to prevent it from reordering 71 // On every platform, we issue a compiler barrier to prevent it from reordering
74 // code. That's enough for platforms like x86 where release and acquire 72 // code. That's enough for platforms like x86 where release and acquire
75 // barriers are no-ops. On other platforms we may need to be more careful; 73 // barriers are no-ops. On other platforms we may need to be more careful;
76 // ARM, in particular, needs real code for both acquire and release. We use a 74 // ARM, in particular, needs real code for both acquire and release. We use a
77 // full barrier, which acts as both, because that the finest precision ARM 75 // full barrier, which acts as both, because that the finest precision ARM
78 // provides. 76 // provides.
79 77
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // 129 //
132 // The release barrier in sk_once_slow guaranteed that once->done = true 130 // The release barrier in sk_once_slow guaranteed that once->done = true
133 // happens after f(arg), so by syncing to once->done = true here we're 131 // happens after f(arg), so by syncing to once->done = true here we're
134 // forcing ourselves to also wait until the effects of f(arg) are readble. 132 // forcing ourselves to also wait until the effects of f(arg) are readble.
135 acquire_barrier(); 133 acquire_barrier();
136 } 134 }
137 135
138 #undef SK_ANNOTATE_BENIGN_RACE 136 #undef SK_ANNOTATE_BENIGN_RACE
139 137
140 #endif // SkOnce_DEFINED 138 #endif // SkOnce_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698