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

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

Issue 183803024: Adds support for ARMv6. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Added tests. Created 6 years, 9 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" 9 #include "vm/cpu.h"
10 #include "vm/cpuinfo.h" 10 #include "vm/cpuinfo.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #if !defined(HOST_ARCH_ARM) 47 #if !defined(HOST_ARCH_ARM)
48 "sim" 48 "sim"
49 #endif // !defined(HOST_ARCH_ARM) 49 #endif // !defined(HOST_ARCH_ARM)
50 "arm"; 50 "arm";
51 } 51 }
52 52
53 53
54 bool HostCPUFeatures::integer_division_supported_ = false; 54 bool HostCPUFeatures::integer_division_supported_ = false;
55 bool HostCPUFeatures::neon_supported_ = false; 55 bool HostCPUFeatures::neon_supported_ = false;
56 const char* HostCPUFeatures::hardware_ = NULL; 56 const char* HostCPUFeatures::hardware_ = NULL;
57 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown;
57 #if defined(DEBUG) 58 #if defined(DEBUG)
58 bool HostCPUFeatures::initialized_ = false; 59 bool HostCPUFeatures::initialized_ = false;
59 #endif 60 #endif
60 61
61 62
62 #if defined(HOST_ARCH_ARM) 63 #if defined(HOST_ARCH_ARM)
63 void HostCPUFeatures::InitOnce() { 64 void HostCPUFeatures::InitOnce() {
64 CpuInfo::InitOnce(); 65 CpuInfo::InitOnce();
65 hardware_ = CpuInfo::GetCpuModel(); 66 hardware_ = CpuInfo::GetCpuModel();
66 // Implements ARMv7. 67 // Check for ARMv6 or ARMv7. It can be in either the Processor or
67 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7")); 68 // Model information fields.
69 if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") ||
70 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) {
71 arm_version_ = ARMv6;
72 } else {
73 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") ||
74 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7"));
75 arm_version_ = ARMv7;
76 }
68 // Has floating point unit. 77 // Has floating point unit.
69 ASSERT(CpuInfo::FieldContains(kCpuInfoFeatures, "vfp")); 78 ASSERT(CpuInfo::FieldContains(kCpuInfoFeatures, "vfp"));
70 // Has integer division. 79 // Has integer division.
71 bool is_krait = CpuInfo::FieldContains(kCpuInfoModel, "QCT APQ8064"); 80 bool is_krait = CpuInfo::FieldContains(kCpuInfoHardware, "QCT APQ8064");
72 if (is_krait) { 81 if (is_krait) {
73 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7. 82 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7.
74 integer_division_supported_ = true; 83 integer_division_supported_ = true;
75 } else { 84 } else {
76 integer_division_supported_ = 85 integer_division_supported_ =
77 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva"); 86 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva");
78 } 87 }
79 neon_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "neon"); 88 neon_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "neon");
80 #if defined(DEBUG) 89 #if defined(DEBUG)
81 initialized_ = true; 90 initialized_ = true;
(...skipping 12 matching lines...) Expand all
94 CpuInfo::Cleanup(); 103 CpuInfo::Cleanup();
95 } 104 }
96 105
97 #else 106 #else
98 107
99 void HostCPUFeatures::InitOnce() { 108 void HostCPUFeatures::InitOnce() {
100 CpuInfo::InitOnce(); 109 CpuInfo::InitOnce();
101 hardware_ = CpuInfo::GetCpuModel(); 110 hardware_ = CpuInfo::GetCpuModel();
102 integer_division_supported_ = true; 111 integer_division_supported_ = true;
103 neon_supported_ = true; 112 neon_supported_ = true;
113 arm_version_ = ARMv7;
104 #if defined(DEBUG) 114 #if defined(DEBUG)
105 initialized_ = true; 115 initialized_ = true;
106 #endif 116 #endif
107 } 117 }
108 118
109 119
110 void HostCPUFeatures::Cleanup() { 120 void HostCPUFeatures::Cleanup() {
111 DEBUG_ASSERT(initialized_); 121 DEBUG_ASSERT(initialized_);
112 #if defined(DEBUG) 122 #if defined(DEBUG)
113 initialized_ = false; 123 initialized_ = false;
114 #endif 124 #endif
115 ASSERT(hardware_ != NULL); 125 ASSERT(hardware_ != NULL);
116 free(const_cast<char*>(hardware_)); 126 free(const_cast<char*>(hardware_));
117 hardware_ = NULL; 127 hardware_ = NULL;
118 CpuInfo::Cleanup(); 128 CpuInfo::Cleanup();
119 } 129 }
120 #endif // defined(HOST_ARCH_ARM) 130 #endif // defined(HOST_ARCH_ARM)
121 131
122 } // namespace dart 132 } // namespace dart
123 133
124 #endif // defined TARGET_ARCH_ARM 134 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698