Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: runtime/vm/assembler_x64.cc

Issue 11416136: Only require SSE2 at minimum hardware requirement. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comment Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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;
23 bool CPUFeatures::sse4_1_supported_ = false; 22 bool CPUFeatures::sse4_1_supported_ = false;
24 #ifdef DEBUG 23 #ifdef DEBUG
25 bool CPUFeatures::initialized_ = false; 24 bool CPUFeatures::initialized_ = false;
26 #endif 25 #endif
27 26
28 bool CPUFeatures::sse3_supported() {
29 DEBUG_ASSERT(initialized_);
30 return sse3_supported_;
31 }
32
33
34 bool CPUFeatures::sse4_1_supported() { 27 bool CPUFeatures::sse4_1_supported() {
35 DEBUG_ASSERT(initialized_); 28 DEBUG_ASSERT(initialized_);
36 return sse4_1_supported_ && FLAG_use_sse41; 29 return sse4_1_supported_ && FLAG_use_sse41;
37 } 30 }
38 31
39 32
40 #define __ assembler. 33 #define __ assembler.
41 34
42 void CPUFeatures::InitOnce() { 35 void CPUFeatures::InitOnce() {
43 Assembler assembler; 36 Assembler assembler;
(...skipping 12 matching lines...) Expand all
56 __ popq(RBX); 49 __ popq(RBX);
57 __ popq(RBP); 50 __ popq(RBP);
58 __ ret(); 51 __ ret();
59 52
60 const Code& code = 53 const Code& code =
61 Code::Handle(Code::FinalizeCode("DetectCPUFeatures", &assembler)); 54 Code::Handle(Code::FinalizeCode("DetectCPUFeatures", &assembler));
62 Instructions& instructions = Instructions::Handle(code.instructions()); 55 Instructions& instructions = Instructions::Handle(code.instructions());
63 typedef uint64_t (*DetectCPUFeatures)(); 56 typedef uint64_t (*DetectCPUFeatures)();
64 uint64_t features = 57 uint64_t features =
65 reinterpret_cast<DetectCPUFeatures>(instructions.EntryPoint())(); 58 reinterpret_cast<DetectCPUFeatures>(instructions.EntryPoint())();
66 sse3_supported_ = (features & kSSE3BitMask) != 0;
67 sse4_1_supported_ = (features & kSSE4_1BitMask) != 0; 59 sse4_1_supported_ = (features & kSSE4_1BitMask) != 0;
68 #ifdef DEBUG 60 #ifdef DEBUG
69 initialized_ = true; 61 initialized_ = true;
70 #endif 62 #endif
71 } 63 }
72 64
73 #undef __ 65 #undef __
74 66
75 67
76 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { 68 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 2110
2119 const char* Assembler::XmmRegisterName(XmmRegister reg) { 2111 const char* Assembler::XmmRegisterName(XmmRegister reg) {
2120 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 2112 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
2121 return xmm_reg_names[reg]; 2113 return xmm_reg_names[reg];
2122 } 2114 }
2123 2115
2124 2116
2125 } // namespace dart 2117 } // namespace dart
2126 2118
2127 #endif // defined TARGET_ARCH_X64 2119 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698