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

Side by Side Diff: runtime/vm/cpu_arm.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_ARM_H_
6 #define VM_CPU_ARM_H_
7
8 #include "vm/allocation.h"
9 #include "vm/simulator.h"
10
11 namespace dart {
12
13 // TargetCPUFeatures gives CPU features for the architecture that we are
14 // generating code for. HostCPUFeatures gives the CPU features for the
15 // architecture that we are actually running on. When the architectures
16 // are the same, TargetCPUFeatures will query HostCPUFeatures. When they are
17 // different (i.e. we are running in a simulator), HostCPUFeatures will
18 // additionally mock the options needed for the target architecture so that
19 // they may be altered for testing.
20
21 class HostCPUFeatures: public AllStatic {
22 public:
23 static void InitOnce();
24 static char* hardware() {
25 DEBUG_ASSERT(initialized_);
26 return hardware_;
27 }
28 static bool integer_division_supported() {
29 DEBUG_ASSERT(initialized_);
30 return integer_division_supported_;
31 }
32 static bool neon_supported() {
33 DEBUG_ASSERT(initialized_);
34 return neon_supported_;
35 }
36
37 #if !defined(HOST_ARCH_ARM)
38 static void set_integer_division_supported(bool supported) {
39 DEBUG_ASSERT(initialized_);
40 integer_division_supported_ = supported;
41 }
42 static void set_neon_supported(bool supported) {
43 DEBUG_ASSERT(initialized_);
44 neon_supported_ = supported;
45 }
46 #endif // !defined(HOST_ARCH_ARM)
47
48 private:
49 static char* hardware_;
50 static bool integer_division_supported_;
51 static bool neon_supported_;
52 #if defined(DEBUG)
53 static bool initialized_;
54 #endif
55 };
56
57 class TargetCPUFeatures : public AllStatic {
58 public:
59 static void InitOnce() {
60 HostCPUFeatures::InitOnce();
61 }
62
63 static bool double_truncate_round_supported() {
64 return false;
65 }
66 static bool integer_division_supported() {
67 return HostCPUFeatures::integer_division_supported();
68 }
69 static bool neon_supported() {
70 return HostCPUFeatures::neon_supported();
71 }
72 };
73
74 } // namespace dart
75
76 #endif // VM_CPU_ARM_H_
OLDNEW
« no previous file with comments | « runtime/vm/cpu.h ('k') | runtime/vm/cpu_arm.cc » ('j') | runtime/vm/cpuinfo_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698