| 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 |
| 11 #include "vm/assembler.h" | 11 #include "vm/assembler.h" |
| 12 #include "vm/constants_x64.h" | 12 #include "vm/constants_x64.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 | |
| 23 void CPU::FlushICache(uword start, uword size) { | 22 void CPU::FlushICache(uword start, uword size) { |
| 24 // Nothing to be done here. | 23 // Nothing to be done here. |
| 25 } | 24 } |
| 26 | 25 |
| 27 | |
| 28 const char* CPU::Id() { | 26 const char* CPU::Id() { |
| 29 return "x64"; | 27 return "x64"; |
| 30 } | 28 } |
| 31 | 29 |
| 32 | |
| 33 bool HostCPUFeatures::sse2_supported_ = true; | 30 bool HostCPUFeatures::sse2_supported_ = true; |
| 34 bool HostCPUFeatures::sse4_1_supported_ = false; | 31 bool HostCPUFeatures::sse4_1_supported_ = false; |
| 35 const char* HostCPUFeatures::hardware_ = NULL; | 32 const char* HostCPUFeatures::hardware_ = NULL; |
| 36 #if defined(DEBUG) | 33 #if defined(DEBUG) |
| 37 bool HostCPUFeatures::initialized_ = false; | 34 bool HostCPUFeatures::initialized_ = false; |
| 38 #endif | 35 #endif |
| 39 | 36 |
| 40 void HostCPUFeatures::InitOnce() { | 37 void HostCPUFeatures::InitOnce() { |
| 41 CpuInfo::InitOnce(); | 38 CpuInfo::InitOnce(); |
| 42 hardware_ = CpuInfo::GetCpuModel(); | 39 hardware_ = CpuInfo::GetCpuModel(); |
| 43 sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") || | 40 sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") || |
| 44 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1"); | 41 CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1"); |
| 45 | 42 |
| 46 #if defined(DEBUG) | 43 #if defined(DEBUG) |
| 47 initialized_ = true; | 44 initialized_ = true; |
| 48 #endif | 45 #endif |
| 49 } | 46 } |
| 50 | 47 |
| 51 | |
| 52 void HostCPUFeatures::Cleanup() { | 48 void HostCPUFeatures::Cleanup() { |
| 53 DEBUG_ASSERT(initialized_); | 49 DEBUG_ASSERT(initialized_); |
| 54 #if defined(DEBUG) | 50 #if defined(DEBUG) |
| 55 initialized_ = false; | 51 initialized_ = false; |
| 56 #endif | 52 #endif |
| 57 ASSERT(hardware_ != NULL); | 53 ASSERT(hardware_ != NULL); |
| 58 free(const_cast<char*>(hardware_)); | 54 free(const_cast<char*>(hardware_)); |
| 59 hardware_ = NULL; | 55 hardware_ = NULL; |
| 60 CpuInfo::Cleanup(); | 56 CpuInfo::Cleanup(); |
| 61 } | 57 } |
| 62 | 58 |
| 63 } // namespace dart | 59 } // namespace dart |
| 64 | 60 |
| 65 #endif // defined TARGET_ARCH_X64 | 61 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |