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

Side by Side Diff: runtime/vm/cpu_x64.h

Issue 120723003: Refactors CPU feature detection. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_CPU_X64_H_
6 #define VM_CPU_X64_H_
7
8 #include "vm/allocation.h"
9 #include "vm/flags.h"
10
11 namespace dart {
12
13 DECLARE_FLAG(bool, use_sse41);
14
15 class HostCPUFeatures : public AllStatic {
16 public:
17 static void InitOnce();
18 static char* hardware() {
19 DEBUG_ASSERT(initialized_);
20 return hardware_;
21 }
22 static bool sse2_supported() {
23 DEBUG_ASSERT(initialized_);
24 return sse2_supported_;
25 }
26 static bool sse4_1_supported() {
27 DEBUG_ASSERT(initialized_);
28 return sse4_1_supported_ && FLAG_use_sse41;
29 }
30
31 private:
32 static const uint64_t kSSE2BitMask = static_cast<uint64_t>(1) << 26;
33 static const uint64_t kSSE4_1BitMask = static_cast<uint64_t>(1) << 51;
34 static char* hardware_;
35 static bool sse2_supported_;
36 static bool sse4_1_supported_;
37 #if defined(DEBUG)
38 static bool initialized_;
39 #endif
40 };
41
42 class TargetCPUFeatures : public AllStatic {
43 public:
44 static void InitOnce() { HostCPUFeatures::InitOnce(); }
45 static char* hardware() {
46 return HostCPUFeatures::hardware();
47 }
48 static bool sse2_supported() {
49 return HostCPUFeatures::sse2_supported();
50 }
51 static bool sse4_1_supported() {
52 return HostCPUFeatures::sse4_1_supported();
53 }
54 static bool double_truncate_round_supported() {
55 return false;
56 }
57 };
58
59 } // namespace dart
60
61 #endif // VM_CPU_X64_H_
OLDNEW
« no previous file with comments | « runtime/vm/cpu_mips.cc ('k') | runtime/vm/cpu_x64.cc » ('j') | runtime/vm/cpuinfo_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698