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