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

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

Issue 602943002: Allows arm cpu feature detection to detect arm64 cpus. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | « no previous file | tools/gyp/configurations_android.gypi » ('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 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/cpuinfo.h" 10 #include "vm/cpuinfo.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const char* HostCPUFeatures::hardware_ = NULL; 70 const char* HostCPUFeatures::hardware_ = NULL;
71 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; 71 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown;
72 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; 72 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8;
73 #if defined(DEBUG) 73 #if defined(DEBUG)
74 bool HostCPUFeatures::initialized_ = false; 74 bool HostCPUFeatures::initialized_ = false;
75 #endif 75 #endif
76 76
77 77
78 #if defined(HOST_ARCH_ARM) 78 #if defined(HOST_ARCH_ARM)
79 void HostCPUFeatures::InitOnce() { 79 void HostCPUFeatures::InitOnce() {
80 bool is_arm64 = false;
80 CpuInfo::InitOnce(); 81 CpuInfo::InitOnce();
81 hardware_ = CpuInfo::GetCpuModel(); 82 hardware_ = CpuInfo::GetCpuModel();
82 83
83 // Has floating point unit. 84 // Check for ARMv5TE, ARMv6, ARMv7, or aarch64.
84 vfp_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "vfp") && 85 // It can be in either the Processor or Model information fields.
85 FLAG_use_vfp; 86 if (CpuInfo::FieldContains(kCpuInfoProcessor, "aarch64") ||
86 87 CpuInfo::FieldContains(kCpuInfoModel, "aarch64")) {
87 // Check for ARMv5TE, ARMv6 or ARMv7. It can be in either the Processor or 88 // pretend that this arm64 cpu is really an ARMv7
88 // Model information fields. 89 arm_version_ = ARMv7;
89 if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARM926EJ-S") || 90 is_arm64 = true;
90 CpuInfo::FieldContains(kCpuInfoModel, "ARM926EJ-S")) { 91 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARM926EJ-S") ||
92 CpuInfo::FieldContains(kCpuInfoModel, "ARM926EJ-S")) {
91 // Lego Mindstorm EV3. 93 // Lego Mindstorm EV3.
92 arm_version_ = ARMv5TE; 94 arm_version_ = ARMv5TE;
93 // On ARMv5, the PC read offset in an STR or STM instruction is either 8 or 95 // On ARMv5, the PC read offset in an STR or STM instruction is either 8 or
94 // 12 bytes depending on the implementation. On the Mindstorm EV3 it is 12 96 // 12 bytes depending on the implementation. On the Mindstorm EV3 it is 12
95 // bytes. 97 // bytes.
96 store_pc_read_offset_ = 12; 98 store_pc_read_offset_ = 12;
97 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "Feroceon 88FR131") || 99 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "Feroceon 88FR131") ||
98 CpuInfo::FieldContains(kCpuInfoModel, "Feroceon 88FR131")) { 100 CpuInfo::FieldContains(kCpuInfoModel, "Feroceon 88FR131")) {
99 // This is for the DGBox. For the time-being, assume it is similar to the 101 // This is for the DGBox. For the time-being, assume it is similar to the
100 // Lego Mindstorm. 102 // Lego Mindstorm.
101 arm_version_ = ARMv5TE; 103 arm_version_ = ARMv5TE;
102 // TODO(zra): Verify with DGLogik that this is correct. 104 // TODO(zra): Verify with DGLogik that this is correct.
103 store_pc_read_offset_ = 12; 105 store_pc_read_offset_ = 12;
104 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") || 106 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") ||
105 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) { 107 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) {
106 // Raspberry Pi, etc. 108 // Raspberry Pi, etc.
107 arm_version_ = ARMv6; 109 arm_version_ = ARMv6;
108 } else { 110 } else {
109 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") || 111 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") ||
110 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7")); 112 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7"));
111 arm_version_ = ARMv7; 113 arm_version_ = ARMv7;
112 } 114 }
113 115
116 // Has floating point unit.
117 vfp_supported_ =
118 (CpuInfo::FieldContains(kCpuInfoFeatures, "vfp") || is_arm64) &&
119 FLAG_use_vfp;
120
114 // Has integer division. 121 // Has integer division.
115 bool is_krait = CpuInfo::FieldContains(kCpuInfoHardware, "QCT APQ8064"); 122 bool is_krait = CpuInfo::FieldContains(kCpuInfoHardware, "QCT APQ8064");
116 if (is_krait) { 123 if (is_krait) {
117 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7. 124 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7.
118 integer_division_supported_ = true; 125 integer_division_supported_ = true;
119 } else { 126 } else {
120 integer_division_supported_ = 127 integer_division_supported_ =
121 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva"); 128 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva") || is_arm64;
122 } 129 }
123 neon_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "neon") && 130 neon_supported_ =
124 FLAG_use_vfp && FLAG_use_neon; 131 (CpuInfo::FieldContains(kCpuInfoFeatures, "neon") || is_arm64) &&
132 FLAG_use_vfp && FLAG_use_neon;
125 133
126 // Use the cross-compiler's predefined macros to determine whether we should 134 // Use the cross-compiler's predefined macros to determine whether we should
127 // use the hard or soft float ABI. 135 // use the hard or soft float ABI.
128 #if defined(__ARM_PCS_VFP) 136 #if defined(__ARM_PCS_VFP)
129 hardfp_supported_ = true; 137 hardfp_supported_ = true;
130 #else 138 #else
131 hardfp_supported_ = false; 139 hardfp_supported_ = false;
132 #endif 140 #endif
133 141
134 #if defined(DEBUG) 142 #if defined(DEBUG)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 ASSERT(hardware_ != NULL); 188 ASSERT(hardware_ != NULL);
181 free(const_cast<char*>(hardware_)); 189 free(const_cast<char*>(hardware_));
182 hardware_ = NULL; 190 hardware_ = NULL;
183 CpuInfo::Cleanup(); 191 CpuInfo::Cleanup();
184 } 192 }
185 #endif // defined(HOST_ARCH_ARM) 193 #endif // defined(HOST_ARCH_ARM)
186 194
187 } // namespace dart 195 } // namespace dart
188 196
189 #endif // defined TARGET_ARCH_ARM 197 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | tools/gyp/configurations_android.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698