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

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

Issue 136303012: Updates refactoring of 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
« no previous file with comments | « runtime/vm/cpu.h ('k') | runtime/vm/cpu_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 void Cleanup();
25 static const char* hardware() {
26 DEBUG_ASSERT(initialized_);
27 return hardware_;
28 }
29 static bool integer_division_supported() {
30 DEBUG_ASSERT(initialized_);
31 return integer_division_supported_;
32 }
33 static bool neon_supported() {
34 DEBUG_ASSERT(initialized_);
35 return neon_supported_;
36 }
37
38 #if !defined(HOST_ARCH_ARM)
39 static void set_integer_division_supported(bool supported) {
40 DEBUG_ASSERT(initialized_);
41 integer_division_supported_ = supported;
42 }
43 static void set_neon_supported(bool supported) {
44 DEBUG_ASSERT(initialized_);
45 neon_supported_ = supported;
46 }
47 #endif // !defined(HOST_ARCH_ARM)
48
49 private:
50 static const char* hardware_;
51 static bool integer_division_supported_;
52 static bool neon_supported_;
53 #if defined(DEBUG)
54 static bool initialized_;
55 #endif
56 };
57
58 class TargetCPUFeatures : public AllStatic {
59 public:
60 static void InitOnce() {
61 HostCPUFeatures::InitOnce();
62 }
63 static void Cleanup() {
64 HostCPUFeatures::Cleanup();
65 }
66 static bool double_truncate_round_supported() {
67 return false;
68 }
69 static bool integer_division_supported() {
70 return HostCPUFeatures::integer_division_supported();
71 }
72 static bool neon_supported() {
73 return HostCPUFeatures::neon_supported();
74 }
75 static const char* hardware() {
76 return HostCPUFeatures::hardware();
77 }
78 };
79
80 } // namespace dart
81
82 #endif // VM_CPU_ARM_H_
OLDNEW
« no previous file with comments | « runtime/vm/cpu.h ('k') | runtime/vm/cpu_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698