| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 #if defined(USING_SIMULATOR) | 84 #if defined(USING_SIMULATOR) |
| 85 #if defined(TARGET_ARCH_ARM_5TE) | 85 #if defined(TARGET_ARCH_ARM_5TE) |
| 86 DEFINE_FLAG(bool, sim_use_hardfp, false, "Use the softfp ABI."); | 86 DEFINE_FLAG(bool, sim_use_hardfp, false, "Use the softfp ABI."); |
| 87 #else | 87 #else |
| 88 DEFINE_FLAG(bool, sim_use_hardfp, true, "Use the softfp ABI."); | 88 DEFINE_FLAG(bool, sim_use_hardfp, true, "Use the softfp ABI."); |
| 89 #endif | 89 #endif |
| 90 #endif | 90 #endif |
| 91 | 91 |
| 92 void CPU::FlushICache(uword start, uword size) { | 92 void CPU::FlushICache(uword start, uword size) { |
| 93 #if TARGET_OS_IOS | 93 #if HOST_OS_IOS |
| 94 // Precompilation never patches code so there should be no I cache flushes. | 94 // Precompilation never patches code so there should be no I cache flushes. |
| 95 UNREACHABLE(); | 95 UNREACHABLE(); |
| 96 #endif | 96 #endif |
| 97 | 97 |
| 98 #if !defined(USING_SIMULATOR) && !TARGET_OS_IOS | 98 #if !defined(USING_SIMULATOR) && !HOST_OS_IOS |
| 99 // Nothing to do. Flushing no instructions. | 99 // Nothing to do. Flushing no instructions. |
| 100 if (size == 0) { | 100 if (size == 0) { |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 | 103 |
| 104 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the | 104 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the |
| 105 // library call cacheflush from unistd.h on Android: | 105 // library call cacheflush from unistd.h on Android: |
| 106 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ | 106 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ |
| 107 #if defined(__linux__) && !defined(ANDROID) | 107 #if defined(__linux__) && !defined(ANDROID) |
| 108 extern void __clear_cache(char*, char*); | 108 extern void __clear_cache(char*, char*); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 133 bool HostCPUFeatures::hardfp_supported_ = false; | 133 bool HostCPUFeatures::hardfp_supported_ = false; |
| 134 const char* HostCPUFeatures::hardware_ = NULL; | 134 const char* HostCPUFeatures::hardware_ = NULL; |
| 135 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; | 135 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; |
| 136 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; | 136 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; |
| 137 #if defined(DEBUG) | 137 #if defined(DEBUG) |
| 138 bool HostCPUFeatures::initialized_ = false; | 138 bool HostCPUFeatures::initialized_ = false; |
| 139 #endif | 139 #endif |
| 140 | 140 |
| 141 | 141 |
| 142 #if !defined(USING_SIMULATOR) | 142 #if !defined(USING_SIMULATOR) |
| 143 #if TARGET_OS_IOS | 143 #if HOST_OS_IOS |
| 144 void HostCPUFeatures::InitOnce() { | 144 void HostCPUFeatures::InitOnce() { |
| 145 // TODO(24743): Actually check the CPU features and fail if we're missing | 145 // TODO(24743): Actually check the CPU features and fail if we're missing |
| 146 // something assumed in a precompiled snapshot. | 146 // something assumed in a precompiled snapshot. |
| 147 hardware_ = ""; | 147 hardware_ = ""; |
| 148 // When the VM is targetted to ARMv7, pretend that the CPU is ARMv7 even if | 148 // When the VM is targetted to ARMv7, pretend that the CPU is ARMv7 even if |
| 149 // the CPU is actually AArch64. | 149 // the CPU is actually AArch64. |
| 150 arm_version_ = ARMv7; | 150 arm_version_ = ARMv7; |
| 151 // Always assume we have floating point unit since we dont support ARMv6 in | 151 // Always assume we have floating point unit since we dont support ARMv6 in |
| 152 // this path. | 152 // this path. |
| 153 vfp_supported_ = FLAG_use_vfp; | 153 vfp_supported_ = FLAG_use_vfp; |
| 154 integer_division_supported_ = FLAG_use_integer_division; | 154 integer_division_supported_ = FLAG_use_integer_division; |
| 155 neon_supported_ = FLAG_use_neon; | 155 neon_supported_ = FLAG_use_neon; |
| 156 hardfp_supported_ = true; | 156 hardfp_supported_ = true; |
| 157 #if defined(DEBUG) | 157 #if defined(DEBUG) |
| 158 initialized_ = true; | 158 initialized_ = true; |
| 159 #endif | 159 #endif |
| 160 } | 160 } |
| 161 #else // TARGET_OS_IOS | 161 #else // HOST_OS_IOS |
| 162 void HostCPUFeatures::InitOnce() { | 162 void HostCPUFeatures::InitOnce() { |
| 163 bool is_arm64 = false; | 163 bool is_arm64 = false; |
| 164 CpuInfo::InitOnce(); | 164 CpuInfo::InitOnce(); |
| 165 hardware_ = CpuInfo::GetCpuModel(); | 165 hardware_ = CpuInfo::GetCpuModel(); |
| 166 | 166 |
| 167 // Check for ARMv5TE, ARMv6, ARMv7, or aarch64. | 167 // Check for ARMv5TE, ARMv6, ARMv7, or aarch64. |
| 168 // It can be in either the Processor or Model information fields. | 168 // It can be in either the Processor or Model information fields. |
| 169 if (CpuInfo::FieldContains(kCpuInfoProcessor, "aarch64") || | 169 if (CpuInfo::FieldContains(kCpuInfoProcessor, "aarch64") || |
| 170 CpuInfo::FieldContains(kCpuInfoModel, "aarch64") || | 170 CpuInfo::FieldContains(kCpuInfoModel, "aarch64") || |
| 171 CpuInfo::FieldContains(kCpuInfoArchitecture, "8") || | 171 CpuInfo::FieldContains(kCpuInfoArchitecture, "8") || |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 #if defined(__ARM_PCS_VFP) | 231 #if defined(__ARM_PCS_VFP) |
| 232 hardfp_supported_ = true; | 232 hardfp_supported_ = true; |
| 233 #else | 233 #else |
| 234 hardfp_supported_ = false; | 234 hardfp_supported_ = false; |
| 235 #endif | 235 #endif |
| 236 | 236 |
| 237 #if defined(DEBUG) | 237 #if defined(DEBUG) |
| 238 initialized_ = true; | 238 initialized_ = true; |
| 239 #endif | 239 #endif |
| 240 } | 240 } |
| 241 #endif // TARGET_OS_IOS | 241 #endif // HOST_OS_IOS |
| 242 | 242 |
| 243 void HostCPUFeatures::Cleanup() { | 243 void HostCPUFeatures::Cleanup() { |
| 244 DEBUG_ASSERT(initialized_); | 244 DEBUG_ASSERT(initialized_); |
| 245 #if defined(DEBUG) | 245 #if defined(DEBUG) |
| 246 initialized_ = false; | 246 initialized_ = false; |
| 247 #endif | 247 #endif |
| 248 ASSERT(hardware_ != NULL); | 248 ASSERT(hardware_ != NULL); |
| 249 free(const_cast<char*>(hardware_)); | 249 free(const_cast<char*>(hardware_)); |
| 250 hardware_ = NULL; | 250 hardware_ = NULL; |
| 251 CpuInfo::Cleanup(); | 251 CpuInfo::Cleanup(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 ASSERT(hardware_ != NULL); | 283 ASSERT(hardware_ != NULL); |
| 284 free(const_cast<char*>(hardware_)); | 284 free(const_cast<char*>(hardware_)); |
| 285 hardware_ = NULL; | 285 hardware_ = NULL; |
| 286 CpuInfo::Cleanup(); | 286 CpuInfo::Cleanup(); |
| 287 } | 287 } |
| 288 #endif // !defined(USING_SIMULATOR) | 288 #endif // !defined(USING_SIMULATOR) |
| 289 | 289 |
| 290 } // namespace dart | 290 } // namespace dart |
| 291 | 291 |
| 292 #endif // defined TARGET_ARCH_ARM | 292 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |