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_OS_MACOS) | 6 #if !defined(HOST_OS_MACOS) |
7 #include "vm/cpuid.h" | 7 #include "vm/cpuid.h" |
8 | 8 |
9 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) | 9 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) |
10 // GetCpuId() on Windows, __get_cpuid() on Linux | 10 // GetCpuId() on Windows, __get_cpuid() on Linux |
11 #if defined(TARGET_OS_WINDOWS) | 11 #if defined(HOST_OS_WINDOWS) |
12 #include <intrin.h> // NOLINT | 12 #include <intrin.h> // NOLINT |
13 #else | 13 #else |
14 #include <cpuid.h> // NOLINT | 14 #include <cpuid.h> // NOLINT |
15 #endif | 15 #endif |
16 #endif | 16 #endif |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 bool CpuId::sse2_ = false; | 20 bool CpuId::sse2_ = false; |
21 bool CpuId::sse41_ = false; | 21 bool CpuId::sse41_ = false; |
22 const char* CpuId::id_string_ = NULL; | 22 const char* CpuId::id_string_ = NULL; |
23 const char* CpuId::brand_string_ = NULL; | 23 const char* CpuId::brand_string_ = NULL; |
24 | 24 |
25 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) | 25 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) |
26 | 26 |
27 void CpuId::GetCpuId(int32_t level, uint32_t info[4]) { | 27 void CpuId::GetCpuId(int32_t level, uint32_t info[4]) { |
28 #if defined(TARGET_OS_WINDOWS) | 28 #if defined(HOST_OS_WINDOWS) |
29 // The documentation for __cpuid is at: | 29 // The documentation for __cpuid is at: |
30 // http://msdn.microsoft.com/en-us/library/hskdteyh(v=vs.90).aspx | 30 // http://msdn.microsoft.com/en-us/library/hskdteyh(v=vs.90).aspx |
31 __cpuid(reinterpret_cast<int*>(info), level); | 31 __cpuid(reinterpret_cast<int*>(info), level); |
32 #else | 32 #else |
33 __get_cpuid(level, &info[0], &info[1], &info[2], &info[3]); | 33 __get_cpuid(level, &info[0], &info[1], &info[2], &info[3]); |
34 #endif | 34 #endif |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 void CpuId::InitOnce() { | 38 void CpuId::InitOnce() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 default: { | 107 default: { |
108 UNREACHABLE(); | 108 UNREACHABLE(); |
109 return NULL; | 109 return NULL; |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 114 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
115 } // namespace dart | 115 } // namespace dart |
116 | 116 |
117 #endif // !defined(TARGET_OS_MACOS) | 117 #endif // !defined(HOST_OS_MACOS) |
OLD | NEW |