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_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/cpu_x64.h" | 9 #include "vm/cpu_x64.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 bool HostCPUFeatures::sse2_supported_ = true; | 33 bool HostCPUFeatures::sse2_supported_ = true; |
34 bool HostCPUFeatures::sse4_1_supported_ = false; | 34 bool HostCPUFeatures::sse4_1_supported_ = false; |
35 const char* HostCPUFeatures::hardware_ = NULL; | 35 const char* HostCPUFeatures::hardware_ = NULL; |
36 #if defined(DEBUG) | 36 #if defined(DEBUG) |
37 bool HostCPUFeatures::initialized_ = false; | 37 bool HostCPUFeatures::initialized_ = false; |
38 #endif | 38 #endif |
39 | 39 |
40 void HostCPUFeatures::InitOnce() { | 40 void HostCPUFeatures::InitOnce() { |
41 CpuInfo::InitOnce(); | 41 CpuInfo::InitOnce(); |
42 hardware_ = CpuInfo::GetCpuModel(); | 42 hardware_ = CpuInfo::GetCpuModel(); |
43 sse4_1_supported_ = | 43 sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") || |
44 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") || | 44 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1"); |
45 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1"); | |
46 | 45 |
47 #if defined(DEBUG) | 46 #if defined(DEBUG) |
48 initialized_ = true; | 47 initialized_ = true; |
49 #endif | 48 #endif |
50 } | 49 } |
51 | 50 |
52 | 51 |
53 void HostCPUFeatures::Cleanup() { | 52 void HostCPUFeatures::Cleanup() { |
54 DEBUG_ASSERT(initialized_); | 53 DEBUG_ASSERT(initialized_); |
55 #if defined(DEBUG) | 54 #if defined(DEBUG) |
56 initialized_ = false; | 55 initialized_ = false; |
57 #endif | 56 #endif |
58 ASSERT(hardware_ != NULL); | 57 ASSERT(hardware_ != NULL); |
59 free(const_cast<char*>(hardware_)); | 58 free(const_cast<char*>(hardware_)); |
60 hardware_ = NULL; | 59 hardware_ = NULL; |
61 CpuInfo::Cleanup(); | 60 CpuInfo::Cleanup(); |
62 } | 61 } |
63 | 62 |
64 } // namespace dart | 63 } // namespace dart |
65 | 64 |
66 #endif // defined TARGET_ARCH_X64 | 65 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |