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

Side by Side Diff: src/core/SkCpu.cpp

Issue 2138073002: Clean up hyper-local SkCpu feature test experiment. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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 | « src/core/SkCpu.h ('k') | src/core/SkHalf.h » ('j') | 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 2016 Google Inc. 2 * Copyright 2016 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 #define SkCpu_IMPL
9 #include "SkCpu.h" 8 #include "SkCpu.h"
10 #include "SkOnce.h" 9 #include "SkOnce.h"
11 10
12 #if defined(SK_CPU_X86) 11 #if defined(SK_CPU_X86)
13 #if defined(SK_BUILD_FOR_WIN32) 12 #if defined(SK_BUILD_FOR_WIN32)
14 #include <intrin.h> 13 #include <intrin.h>
15 static void cpuid (uint32_t abcd[4]) { __cpuid ((int*)abcd, 1); } 14 static void cpuid (uint32_t abcd[4]) { __cpuid ((int*)abcd, 1); }
16 static void cpuid7(uint32_t abcd[4]) { __cpuidex((int*)abcd, 7, 0); } 15 static void cpuid7(uint32_t abcd[4]) { __cpuidex((int*)abcd, 7, 0); }
17 static uint64_t xgetbv(uint32_t xcr) { return _xgetbv(xcr); } 16 static uint64_t xgetbv(uint32_t xcr) { return _xgetbv(xcr); }
18 #else 17 #else
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return features; 71 return features;
73 } 72 }
74 73
75 #else 74 #else
76 static uint32_t read_cpu_features() { 75 static uint32_t read_cpu_features() {
77 return 0; 76 return 0;
78 } 77 }
79 78
80 #endif 79 #endif
81 80
82 #if defined(_MSC_VER) 81 uint32_t SkCpu::gCachedFeatures = 0;
83 const uint32_t SkCpu::gCachedFeatures = read_cpu_features();
84 82
85 void SkCpu::CacheRuntimeFeatures() {} 83 void SkCpu::CacheRuntimeFeatures() {
86 84 static SkOnce once;
87 #else 85 once([] { gCachedFeatures = read_cpu_features(); });
88 uint32_t SkCpu::gCachedFeatures = 0; 86 }
89
90 void SkCpu::CacheRuntimeFeatures() {
91 static SkOnce once;
92 once([] { gCachedFeatures = read_cpu_features(); });
93 }
94
95 #endif
OLDNEW
« no previous file with comments | « src/core/SkCpu.h ('k') | src/core/SkHalf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698