| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/cpu_arm64.h" | 9 #include "vm/cpu_arm64.h" |
| 10 | 10 |
| 11 #include "vm/cpuinfo.h" | 11 #include "vm/cpuinfo.h" |
| 12 #include "vm/simulator.h" | 12 #include "vm/simulator.h" |
| 13 | 13 |
| 14 #if !defined(USING_SIMULATOR) | 14 #if !defined(USING_SIMULATOR) |
| 15 #if !defined(HOST_OS_FUCHSIA) | 15 #if !defined(HOST_OS_FUCHSIA) |
| 16 #include <sys/syscall.h> /* NOLINT */ | 16 #include <sys/syscall.h> /* NOLINT */ |
| 17 #endif | 17 #endif |
| 18 #include <unistd.h> /* NOLINT */ | 18 #include <unistd.h> /* NOLINT */ |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 void CPU::FlushICache(uword start, uword size) { | 23 void CPU::FlushICache(uword start, uword size) { |
| 24 #if HOST_OS_IOS | 24 #if HOST_OS_IOS |
| 25 // Precompilation never patches code so there should be no I cache flushes. | 25 // Precompilation never patches code so there should be no I cache flushes. |
| 26 UNREACHABLE(); | 26 UNREACHABLE(); |
| 27 #endif | 27 #endif |
| 28 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 char* beg = reinterpret_cast<char*>(start); | 40 char* beg = reinterpret_cast<char*>(start); |
| 41 char* end = reinterpret_cast<char*>(start + size); | 41 char* end = reinterpret_cast<char*>(start + size); |
| 42 ::__clear_cache(beg, end); | 42 ::__clear_cache(beg, end); |
| 43 #else | 43 #else |
| 44 #error FlushICache only tested/supported on Android, Fuchsia, and Linux | 44 #error FlushICache only tested/supported on Android, Fuchsia, and Linux |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #endif | 47 #endif |
| 48 } | 48 } |
| 49 | 49 |
| 50 | |
| 51 const char* CPU::Id() { | 50 const char* CPU::Id() { |
| 52 return | 51 return |
| 53 #if defined(USING_SIMULATOR) | 52 #if defined(USING_SIMULATOR) |
| 54 "sim" | 53 "sim" |
| 55 #endif // !defined(HOST_ARCH_ARM64) | 54 #endif // !defined(HOST_ARCH_ARM64) |
| 56 "arm64"; | 55 "arm64"; |
| 57 } | 56 } |
| 58 | 57 |
| 59 | |
| 60 const char* HostCPUFeatures::hardware_ = NULL; | 58 const char* HostCPUFeatures::hardware_ = NULL; |
| 61 #if defined(DEBUG) | 59 #if defined(DEBUG) |
| 62 bool HostCPUFeatures::initialized_ = false; | 60 bool HostCPUFeatures::initialized_ = false; |
| 63 #endif | 61 #endif |
| 64 | 62 |
| 65 | |
| 66 #if !defined(USING_SIMULATOR) | 63 #if !defined(USING_SIMULATOR) |
| 67 void HostCPUFeatures::InitOnce() { | 64 void HostCPUFeatures::InitOnce() { |
| 68 CpuInfo::InitOnce(); | 65 CpuInfo::InitOnce(); |
| 69 hardware_ = CpuInfo::GetCpuModel(); | 66 hardware_ = CpuInfo::GetCpuModel(); |
| 70 #if defined(DEBUG) | 67 #if defined(DEBUG) |
| 71 initialized_ = true; | 68 initialized_ = true; |
| 72 #endif | 69 #endif |
| 73 } | 70 } |
| 74 | 71 |
| 75 | |
| 76 void HostCPUFeatures::Cleanup() { | 72 void HostCPUFeatures::Cleanup() { |
| 77 DEBUG_ASSERT(initialized_); | 73 DEBUG_ASSERT(initialized_); |
| 78 #if defined(DEBUG) | 74 #if defined(DEBUG) |
| 79 initialized_ = false; | 75 initialized_ = false; |
| 80 #endif | 76 #endif |
| 81 ASSERT(hardware_ != NULL); | 77 ASSERT(hardware_ != NULL); |
| 82 free(const_cast<char*>(hardware_)); | 78 free(const_cast<char*>(hardware_)); |
| 83 hardware_ = NULL; | 79 hardware_ = NULL; |
| 84 CpuInfo::Cleanup(); | 80 CpuInfo::Cleanup(); |
| 85 } | 81 } |
| 86 | 82 |
| 87 #else // !defined(USING_SIMULATOR) | 83 #else // !defined(USING_SIMULATOR) |
| 88 | 84 |
| 89 void HostCPUFeatures::InitOnce() { | 85 void HostCPUFeatures::InitOnce() { |
| 90 CpuInfo::InitOnce(); | 86 CpuInfo::InitOnce(); |
| 91 hardware_ = CpuInfo::GetCpuModel(); | 87 hardware_ = CpuInfo::GetCpuModel(); |
| 92 #if defined(DEBUG) | 88 #if defined(DEBUG) |
| 93 initialized_ = true; | 89 initialized_ = true; |
| 94 #endif | 90 #endif |
| 95 } | 91 } |
| 96 | 92 |
| 97 | |
| 98 void HostCPUFeatures::Cleanup() { | 93 void HostCPUFeatures::Cleanup() { |
| 99 DEBUG_ASSERT(initialized_); | 94 DEBUG_ASSERT(initialized_); |
| 100 #if defined(DEBUG) | 95 #if defined(DEBUG) |
| 101 initialized_ = false; | 96 initialized_ = false; |
| 102 #endif | 97 #endif |
| 103 ASSERT(hardware_ != NULL); | 98 ASSERT(hardware_ != NULL); |
| 104 free(const_cast<char*>(hardware_)); | 99 free(const_cast<char*>(hardware_)); |
| 105 hardware_ = NULL; | 100 hardware_ = NULL; |
| 106 CpuInfo::Cleanup(); | 101 CpuInfo::Cleanup(); |
| 107 } | 102 } |
| 108 #endif // !defined(USING_SIMULATOR) | 103 #endif // !defined(USING_SIMULATOR) |
| 109 | 104 |
| 110 } // namespace dart | 105 } // namespace dart |
| 111 | 106 |
| 112 #endif // defined TARGET_ARCH_ARM64 | 107 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |