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

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

Issue 142663004: Reverts refactoring of CPU feature detection for (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
« no previous file with comments | « runtime/vm/cpu_arm.h ('k') | runtime/vm/cpu_ia32.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 // 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
13 #if defined(HOST_ARCH_ARM) 9 #if defined(HOST_ARCH_ARM)
14 #include <sys/syscall.h> /* NOLINT */ 10 #include <sys/syscall.h> /* NOLINT */
15 #include <unistd.h> /* NOLINT */ 11 #include <unistd.h> /* NOLINT */
16 #endif 12 #endif
17 13
14 #include "vm/cpu.h"
15
18 namespace dart { 16 namespace dart {
19 17
20 void CPU::FlushICache(uword start, uword size) { 18 void CPU::FlushICache(uword start, uword size) {
21 #if defined(HOST_ARCH_ARM) 19 #if defined(HOST_ARCH_ARM)
22 // Nothing to do. Flushing no instructions. 20 // Nothing to do. Flushing no instructions.
23 if (size == 0) { 21 if (size == 0) {
24 return; 22 return;
25 } 23 }
26 24
27 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the 25 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the
(...skipping 15 matching lines...) Expand all
43 41
44 42
45 const char* CPU::Id() { 43 const char* CPU::Id() {
46 return 44 return
47 #if !defined(HOST_ARCH_ARM) 45 #if !defined(HOST_ARCH_ARM)
48 "sim" 46 "sim"
49 #endif // !defined(HOST_ARCH_ARM) 47 #endif // !defined(HOST_ARCH_ARM)
50 "arm"; 48 "arm";
51 } 49 }
52 50
53
54 bool HostCPUFeatures::integer_division_supported_ = false;
55 bool HostCPUFeatures::neon_supported_ = false;
56 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();
65 hardware_ = CpuInfo::GetCpuModel();
66 // Implements ARMv7.
67 ASSERT(CpuInfo::FieldContainsById(CpuInfo::kCpuInfoProcessor, "ARMv7"));
68 // Has floating point unit.
69 ASSERT(CpuInfo::FieldContainsById(CpuInfo::kCpuInfoFeatures, "vfp"));
70 // Has integer division.
71 bool is_krait =
72 CpuInfo::FieldContainsById(CpuInfo::kCpuInfoModel, "QCT APQ8064");
73 if (is_krait) {
74 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7.
75 integer_division_supported_ = true;
76 } else {
77 integer_division_supported_ =
78 CpuInfo::FieldContainsById(CpuInfo::kCpuInfoFeatures, "idiva");
79 }
80 neon_supported_ =
81 CpuInfo::FieldContainsById(CpuInfo::kCpuInfoFeatures, "neon");
82 #if defined(DEBUG)
83 initialized_ = true;
84 #endif
85 }
86
87 #else
88
89 void HostCPUFeatures::InitOnce() {
90 CpuInfo::InitOnce();
91 hardware_ = CpuInfo::GetCpuModel();
92 integer_division_supported_ = true;
93 neon_supported_ = true;
94 #if defined(DEBUG)
95 initialized_ = true;
96 #endif
97 }
98 #endif // defined(HOST_ARCH_ARM)
99
100 } // namespace dart 51 } // namespace dart
101 52
102 #endif // defined TARGET_ARCH_ARM 53 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/cpu_arm.h ('k') | runtime/vm/cpu_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698