| 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
| 11 #include "vm/runtime_entry.h" | 11 #include "vm/runtime_entry.h" |
| 12 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 17 DEFINE_FLAG(bool, code_comments, false, | 17 DEFINE_FLAG(bool, code_comments, false, |
| 18 "Include comments into code and disassembly"); | 18 "Include comments into code and disassembly"); |
| 19 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); | 19 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); |
| 20 | 20 |
| 21 | 21 |
| 22 bool CPUFeatures::sse3_supported_ = false; | 22 bool CPUFeatures::sse2_supported_ = false; |
| 23 bool CPUFeatures::sse4_1_supported_ = false; | 23 bool CPUFeatures::sse4_1_supported_ = false; |
| 24 #ifdef DEBUG | 24 #ifdef DEBUG |
| 25 bool CPUFeatures::initialized_ = false; | 25 bool CPUFeatures::initialized_ = false; |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 bool CPUFeatures::sse3_supported() { | 28 |
| 29 bool CPUFeatures::sse2_supported() { |
| 29 DEBUG_ASSERT(initialized_); | 30 DEBUG_ASSERT(initialized_); |
| 30 return sse3_supported_; | 31 return sse2_supported_; |
| 31 } | 32 } |
| 32 | 33 |
| 33 | 34 |
| 34 bool CPUFeatures::sse4_1_supported() { | 35 bool CPUFeatures::sse4_1_supported() { |
| 35 DEBUG_ASSERT(initialized_); | 36 DEBUG_ASSERT(initialized_); |
| 36 return sse4_1_supported_ && FLAG_use_sse41; | 37 return sse4_1_supported_ && FLAG_use_sse41; |
| 37 } | 38 } |
| 38 | 39 |
| 39 | 40 |
| 40 #define __ assembler. | 41 #define __ assembler. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 __ popl(EBX); | 54 __ popl(EBX); |
| 54 __ popl(EBP); | 55 __ popl(EBP); |
| 55 __ ret(); | 56 __ ret(); |
| 56 | 57 |
| 57 const Code& code = | 58 const Code& code = |
| 58 Code::Handle(Code::FinalizeCode("DetectCPUFeatures", &assembler)); | 59 Code::Handle(Code::FinalizeCode("DetectCPUFeatures", &assembler)); |
| 59 Instructions& instructions = Instructions::Handle(code.instructions()); | 60 Instructions& instructions = Instructions::Handle(code.instructions()); |
| 60 typedef uint64_t (*DetectCPUFeatures)(); | 61 typedef uint64_t (*DetectCPUFeatures)(); |
| 61 uint64_t features = | 62 uint64_t features = |
| 62 reinterpret_cast<DetectCPUFeatures>(instructions.EntryPoint())(); | 63 reinterpret_cast<DetectCPUFeatures>(instructions.EntryPoint())(); |
| 63 sse3_supported_ = (features & kSSE3BitMask) != 0; | 64 sse2_supported_ = (features & kSSE2BitMask) != 0; |
| 64 sse4_1_supported_ = (features & kSSE4_1BitMask) != 0; | 65 sse4_1_supported_ = (features & kSSE4_1BitMask) != 0; |
| 65 #ifdef DEBUG | 66 #ifdef DEBUG |
| 66 initialized_ = true; | 67 initialized_ = true; |
| 67 #endif | 68 #endif |
| 68 } | 69 } |
| 69 | 70 |
| 70 #undef __ | 71 #undef __ |
| 71 | 72 |
| 72 | 73 |
| 73 class DirectCallRelocation : public AssemblerFixup { | 74 class DirectCallRelocation : public AssemblerFixup { |
| (...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 | 2035 |
| 2035 const char* Assembler::XmmRegisterName(XmmRegister reg) { | 2036 const char* Assembler::XmmRegisterName(XmmRegister reg) { |
| 2036 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2037 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 2037 return xmm_reg_names[reg]; | 2038 return xmm_reg_names[reg]; |
| 2038 } | 2039 } |
| 2039 | 2040 |
| 2040 | 2041 |
| 2041 } // namespace dart | 2042 } // namespace dart |
| 2042 | 2043 |
| 2043 #endif // defined TARGET_ARCH_IA32 | 2044 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |