OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/cpu_dbc.h" | 9 #include "vm/cpu_dbc.h" |
10 | 10 |
11 #include "vm/cpuinfo.h" | 11 #include "vm/cpuinfo.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 void CPU::FlushICache(uword start, uword size) { | 15 void CPU::FlushICache(uword start, uword size) { |
16 // Nothing to do. | 16 // Nothing to do. |
17 } | 17 } |
18 | 18 |
19 | |
20 const char* CPU::Id() { | 19 const char* CPU::Id() { |
21 return "dbc"; | 20 return "dbc"; |
22 } | 21 } |
23 | 22 |
24 | |
25 const char* HostCPUFeatures::hardware_ = NULL; | 23 const char* HostCPUFeatures::hardware_ = NULL; |
26 #if defined(DEBUG) | 24 #if defined(DEBUG) |
27 bool HostCPUFeatures::initialized_ = false; | 25 bool HostCPUFeatures::initialized_ = false; |
28 #endif | 26 #endif |
29 | 27 |
30 void HostCPUFeatures::InitOnce() { | 28 void HostCPUFeatures::InitOnce() { |
31 CpuInfo::InitOnce(); | 29 CpuInfo::InitOnce(); |
32 hardware_ = CpuInfo::GetCpuModel(); | 30 hardware_ = CpuInfo::GetCpuModel(); |
33 #if defined(DEBUG) | 31 #if defined(DEBUG) |
34 initialized_ = true; | 32 initialized_ = true; |
35 #endif | 33 #endif |
36 } | 34 } |
37 | 35 |
38 | |
39 void HostCPUFeatures::Cleanup() { | 36 void HostCPUFeatures::Cleanup() { |
40 DEBUG_ASSERT(initialized_); | 37 DEBUG_ASSERT(initialized_); |
41 #if defined(DEBUG) | 38 #if defined(DEBUG) |
42 initialized_ = false; | 39 initialized_ = false; |
43 #endif | 40 #endif |
44 ASSERT(hardware_ != NULL); | 41 ASSERT(hardware_ != NULL); |
45 free(const_cast<char*>(hardware_)); | 42 free(const_cast<char*>(hardware_)); |
46 hardware_ = NULL; | 43 hardware_ = NULL; |
47 CpuInfo::Cleanup(); | 44 CpuInfo::Cleanup(); |
48 } | 45 } |
49 | 46 |
50 } // namespace dart | 47 } // namespace dart |
51 | 48 |
52 #endif // defined TARGET_ARCH_DBC | 49 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |