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 | 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 |
9 #if defined(HOST_ARCH_ARM) | 13 #if defined(HOST_ARCH_ARM) |
10 #include <sys/syscall.h> /* NOLINT */ | 14 #include <sys/syscall.h> /* NOLINT */ |
11 #include <unistd.h> /* NOLINT */ | 15 #include <unistd.h> /* NOLINT */ |
12 #endif | 16 #endif |
13 | 17 |
14 #include "vm/cpu.h" | |
15 | |
16 namespace dart { | 18 namespace dart { |
17 | 19 |
18 void CPU::FlushICache(uword start, uword size) { | 20 void CPU::FlushICache(uword start, uword size) { |
19 #if defined(HOST_ARCH_ARM) | 21 #if defined(HOST_ARCH_ARM) |
20 // Nothing to do. Flushing no instructions. | 22 // Nothing to do. Flushing no instructions. |
21 if (size == 0) { | 23 if (size == 0) { |
22 return; | 24 return; |
23 } | 25 } |
24 | 26 |
25 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the | 27 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the |
(...skipping 15 matching lines...) Expand all Loading... |
41 | 43 |
42 | 44 |
43 const char* CPU::Id() { | 45 const char* CPU::Id() { |
44 return | 46 return |
45 #if !defined(HOST_ARCH_ARM) | 47 #if !defined(HOST_ARCH_ARM) |
46 "sim" | 48 "sim" |
47 #endif // !defined(HOST_ARCH_ARM) | 49 #endif // !defined(HOST_ARCH_ARM) |
48 "arm"; | 50 "arm"; |
49 } | 51 } |
50 | 52 |
| 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 |
51 } // namespace dart | 100 } // namespace dart |
52 | 101 |
53 #endif // defined TARGET_ARCH_ARM | 102 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |