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

Side by Side Diff: runtime/vm/cpu_arm.cc

Issue 136303012: Updates refactoring of CPU feature detection (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 6
7 #if defined(TARGET_ARCH_ARM) 7 #if defined(TARGET_ARCH_ARM)
8 8
9 #include "vm/cpu.h"
10 #include "vm/cpuinfo.h"
11 #include "vm/simulator.h"
12
9 #if defined(HOST_ARCH_ARM) 13 #if defined(HOST_ARCH_ARM)
10 #include <sys/syscall.h> /* NOLINT */ 14 #include <sys/syscall.h> /* NOLINT */
11 #include <unistd.h> /* NOLINT */ 15 #include <unistd.h> /* NOLINT */
12 #endif 16 #endif
13 17
14 #include "vm/cpu.h"
15
16 namespace dart { 18 namespace dart {
17 19
18 void CPU::FlushICache(uword start, uword size) { 20 void CPU::FlushICache(uword start, uword size) {
19 #if defined(HOST_ARCH_ARM) 21 #if defined(HOST_ARCH_ARM)
20 // Nothing to do. Flushing no instructions. 22 // Nothing to do. Flushing no instructions.
21 if (size == 0) { 23 if (size == 0) {
22 return; 24 return;
23 } 25 }
24 26
25 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the 27 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the
(...skipping 15 matching lines...) Expand all
41 43
42 44
43 const char* CPU::Id() { 45 const char* CPU::Id() {
44 return 46 return
45 #if !defined(HOST_ARCH_ARM) 47 #if !defined(HOST_ARCH_ARM)
46 "sim" 48 "sim"
47 #endif // !defined(HOST_ARCH_ARM) 49 #endif // !defined(HOST_ARCH_ARM)
48 "arm"; 50 "arm";
49 } 51 }
50 52
53
54 bool HostCPUFeatures::integer_division_supported_ = false;
55 bool HostCPUFeatures::neon_supported_ = false;
56 const char* HostCPUFeatures::hardware_ = NULL;
57 #if defined(DEBUG)
58 bool HostCPUFeatures::initialized_ = false;
59 #endif
60
61
62 #if defined(HOST_ARCH_ARM)
63 void HostCPUFeatures::InitOnce() {
64 CpuInfo::InitOnce(kCpuInfoSystem);
65 hardware_ = CpuInfo::GetCpuModel();
66 // Implements ARMv7.
67 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7"));
68 // Has floating point unit.
69 ASSERT(CpuInfo::FieldContains(kCpuInfoFeatures, "vfp"));
70 // Has integer division.
71 bool is_krait = CpuInfo::FieldContains(kCpuInfoModel, "QCT APQ8064");
72 if (is_krait) {
73 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7.
74 integer_division_supported_ = true;
75 } else {
76 integer_division_supported_ =
77 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva");
78 }
79 neon_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "neon");
80 #if defined(DEBUG)
81 initialized_ = true;
82 #endif
83 }
84
85 #else
86
87 void HostCPUFeatures::InitOnce() {
88 CpuInfo::InitOnce(kCpuInfoDefault);
89 hardware_ = CpuInfo::GetCpuModel();
90 integer_division_supported_ = true;
91 neon_supported_ = true;
92 #if defined(DEBUG)
93 initialized_ = true;
94 #endif
95 }
96 #endif // defined(HOST_ARCH_ARM)
97
51 } // namespace dart 98 } // namespace dart
52 99
53 #endif // defined TARGET_ARCH_ARM 100 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698