OLD | NEW |
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/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/cpu_arm.h" | 9 #include "vm/cpu_arm.h" |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 char* end = reinterpret_cast<char*>(start + size); | 110 char* end = reinterpret_cast<char*>(start + size); |
111 ::__clear_cache(beg, end); | 111 ::__clear_cache(beg, end); |
112 #elif defined(ANDROID) | 112 #elif defined(ANDROID) |
113 cacheflush(start, start + size, 0); | 113 cacheflush(start, start + size, 0); |
114 #else | 114 #else |
115 #error FlushICache only tested/supported on Linux and Android | 115 #error FlushICache only tested/supported on Linux and Android |
116 #endif | 116 #endif |
117 #endif | 117 #endif |
118 } | 118 } |
119 | 119 |
120 | |
121 const char* CPU::Id() { | 120 const char* CPU::Id() { |
122 return | 121 return |
123 #if defined(USING_SIMULATOR) | 122 #if defined(USING_SIMULATOR) |
124 "sim" | 123 "sim" |
125 #endif // defined(USING_SIMULATOR) | 124 #endif // defined(USING_SIMULATOR) |
126 "arm"; | 125 "arm"; |
127 } | 126 } |
128 | 127 |
129 | |
130 bool HostCPUFeatures::integer_division_supported_ = false; | 128 bool HostCPUFeatures::integer_division_supported_ = false; |
131 bool HostCPUFeatures::vfp_supported_ = false; | 129 bool HostCPUFeatures::vfp_supported_ = false; |
132 bool HostCPUFeatures::neon_supported_ = false; | 130 bool HostCPUFeatures::neon_supported_ = false; |
133 bool HostCPUFeatures::hardfp_supported_ = false; | 131 bool HostCPUFeatures::hardfp_supported_ = false; |
134 const char* HostCPUFeatures::hardware_ = NULL; | 132 const char* HostCPUFeatures::hardware_ = NULL; |
135 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; | 133 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; |
136 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; | 134 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; |
137 #if defined(DEBUG) | 135 #if defined(DEBUG) |
138 bool HostCPUFeatures::initialized_ = false; | 136 bool HostCPUFeatures::initialized_ = false; |
139 #endif | 137 #endif |
140 | 138 |
141 | |
142 #if !defined(USING_SIMULATOR) | 139 #if !defined(USING_SIMULATOR) |
143 #if HOST_OS_IOS | 140 #if HOST_OS_IOS |
144 void HostCPUFeatures::InitOnce() { | 141 void HostCPUFeatures::InitOnce() { |
145 // TODO(24743): Actually check the CPU features and fail if we're missing | 142 // TODO(24743): Actually check the CPU features and fail if we're missing |
146 // something assumed in a precompiled snapshot. | 143 // something assumed in a precompiled snapshot. |
147 hardware_ = ""; | 144 hardware_ = ""; |
148 // When the VM is targetted to ARMv7, pretend that the CPU is ARMv7 even if | 145 // When the VM is targetted to ARMv7, pretend that the CPU is ARMv7 even if |
149 // the CPU is actually AArch64. | 146 // the CPU is actually AArch64. |
150 arm_version_ = ARMv7; | 147 arm_version_ = ARMv7; |
151 // Always assume we have floating point unit since we don't support ARMv6 in | 148 // Always assume we have floating point unit since we don't support ARMv6 in |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 274 |
278 integer_division_supported_ = FLAG_use_integer_division; | 275 integer_division_supported_ = FLAG_use_integer_division; |
279 vfp_supported_ = FLAG_use_vfp; | 276 vfp_supported_ = FLAG_use_vfp; |
280 neon_supported_ = FLAG_use_vfp && FLAG_use_neon; | 277 neon_supported_ = FLAG_use_vfp && FLAG_use_neon; |
281 hardfp_supported_ = FLAG_sim_use_hardfp; | 278 hardfp_supported_ = FLAG_sim_use_hardfp; |
282 #if defined(DEBUG) | 279 #if defined(DEBUG) |
283 initialized_ = true; | 280 initialized_ = true; |
284 #endif | 281 #endif |
285 } | 282 } |
286 | 283 |
287 | |
288 void HostCPUFeatures::Cleanup() { | 284 void HostCPUFeatures::Cleanup() { |
289 DEBUG_ASSERT(initialized_); | 285 DEBUG_ASSERT(initialized_); |
290 #if defined(DEBUG) | 286 #if defined(DEBUG) |
291 initialized_ = false; | 287 initialized_ = false; |
292 #endif | 288 #endif |
293 ASSERT(hardware_ != NULL); | 289 ASSERT(hardware_ != NULL); |
294 free(const_cast<char*>(hardware_)); | 290 free(const_cast<char*>(hardware_)); |
295 hardware_ = NULL; | 291 hardware_ = NULL; |
296 CpuInfo::Cleanup(); | 292 CpuInfo::Cleanup(); |
297 } | 293 } |
298 #endif // !defined(USING_SIMULATOR) | 294 #endif // !defined(USING_SIMULATOR) |
299 | 295 |
300 } // namespace dart | 296 } // namespace dart |
301 | 297 |
302 #endif // defined TARGET_ARCH_ARM | 298 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |