OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/cpu_ia32.h" | 9 #include "vm/cpu_ia32.h" |
10 | 10 |
11 #include "vm/assembler.h" | 11 #include "vm/assembler.h" |
12 #include "vm/constants_ia32.h" | 12 #include "vm/constants_ia32.h" |
13 #include "vm/cpuinfo.h" | 13 #include "vm/cpuinfo.h" |
14 #include "vm/heap.h" | 14 #include "vm/heap.h" |
15 #include "vm/isolate.h" | 15 #include "vm/isolate.h" |
16 #include "vm/object.h" | 16 #include "vm/object.h" |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); | 20 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); |
21 | 21 |
22 void CPU::FlushICache(uword start, uword size) { | 22 void CPU::FlushICache(uword start, uword size) { |
23 // Nothing to be done here. | 23 // Nothing to be done here. |
24 } | 24 } |
25 | 25 |
26 | |
27 const char* CPU::Id() { | 26 const char* CPU::Id() { |
28 return "ia32"; | 27 return "ia32"; |
29 } | 28 } |
30 | 29 |
31 | |
32 bool HostCPUFeatures::sse2_supported_ = false; | 30 bool HostCPUFeatures::sse2_supported_ = false; |
33 bool HostCPUFeatures::sse4_1_supported_ = false; | 31 bool HostCPUFeatures::sse4_1_supported_ = false; |
34 const char* HostCPUFeatures::hardware_ = NULL; | 32 const char* HostCPUFeatures::hardware_ = NULL; |
35 #if defined(DEBUG) | 33 #if defined(DEBUG) |
36 bool HostCPUFeatures::initialized_ = false; | 34 bool HostCPUFeatures::initialized_ = false; |
37 #endif | 35 #endif |
38 | 36 |
39 void HostCPUFeatures::InitOnce() { | 37 void HostCPUFeatures::InitOnce() { |
40 CpuInfo::InitOnce(); | 38 CpuInfo::InitOnce(); |
41 | 39 |
42 hardware_ = CpuInfo::GetCpuModel(); | 40 hardware_ = CpuInfo::GetCpuModel(); |
43 sse2_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse2"); | 41 sse2_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse2"); |
44 sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") || | 42 sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") || |
45 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1"); | 43 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1"); |
46 | 44 |
47 #if defined(DEBUG) | 45 #if defined(DEBUG) |
48 initialized_ = true; | 46 initialized_ = true; |
49 #endif | 47 #endif |
50 } | 48 } |
51 | 49 |
52 | |
53 void HostCPUFeatures::Cleanup() { | 50 void HostCPUFeatures::Cleanup() { |
54 DEBUG_ASSERT(initialized_); | 51 DEBUG_ASSERT(initialized_); |
55 #if defined(DEBUG) | 52 #if defined(DEBUG) |
56 initialized_ = false; | 53 initialized_ = false; |
57 #endif | 54 #endif |
58 ASSERT(hardware_ != NULL); | 55 ASSERT(hardware_ != NULL); |
59 free(const_cast<char*>(hardware_)); | 56 free(const_cast<char*>(hardware_)); |
60 hardware_ = NULL; | 57 hardware_ = NULL; |
61 CpuInfo::Cleanup(); | 58 CpuInfo::Cleanup(); |
62 } | 59 } |
63 | 60 |
64 } // namespace dart | 61 } // namespace dart |
65 | 62 |
66 #endif // defined TARGET_ARCH_IA32 | 63 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |