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

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

Issue 292433008: Allows unboxed doubles to be disabled. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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_arm.h ('k') | runtime/vm/disassembler_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
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
7 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
8 7
8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/cpuinfo.h" 10 #include "vm/cpuinfo.h"
11 #include "vm/heap.h"
12 #include "vm/isolate.h"
13 #include "vm/object.h"
11 #include "vm/simulator.h" 14 #include "vm/simulator.h"
15 #include "vm/thread.h"
12 16
13 #if defined(HOST_ARCH_ARM) 17 #if defined(HOST_ARCH_ARM)
14 #include <sys/syscall.h> /* NOLINT */ 18 #include <sys/syscall.h> /* NOLINT */
15 #include <unistd.h> /* NOLINT */ 19 #include <unistd.h> /* NOLINT */
16 #endif 20 #endif
17 21
18 namespace dart { 22 namespace dart {
19 23
24 DEFINE_FLAG(bool, use_vfp, true, "Use vfp instructions if supported");
25 DEFINE_FLAG(bool, use_neon, true, "Use neon instructions if supported");
26 #if !defined(HOST_ARCH_ARM)
27 DEFINE_FLAG(bool, sim_use_armv7, true, "Use all ARMv7 instructions");
28 DEFINE_FLAG(bool, sim_use_armv5te, false, "Restrict to ARMv5TE instructions");
29 DEFINE_FLAG(bool, sim_use_armv6, false, "Restrict to ARMv6 instructions");
30 #endif
31
20 void CPU::FlushICache(uword start, uword size) { 32 void CPU::FlushICache(uword start, uword size) {
21 #if defined(HOST_ARCH_ARM) 33 #if defined(HOST_ARCH_ARM)
22 // Nothing to do. Flushing no instructions. 34 // Nothing to do. Flushing no instructions.
23 if (size == 0) { 35 if (size == 0) {
24 return; 36 return;
25 } 37 }
26 38
27 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the 39 // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the
28 // library call cacheflush from unistd.h on Android: 40 // library call cacheflush from unistd.h on Android:
29 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ 41 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/
(...skipping 15 matching lines...) Expand all
45 const char* CPU::Id() { 57 const char* CPU::Id() {
46 return 58 return
47 #if !defined(HOST_ARCH_ARM) 59 #if !defined(HOST_ARCH_ARM)
48 "sim" 60 "sim"
49 #endif // !defined(HOST_ARCH_ARM) 61 #endif // !defined(HOST_ARCH_ARM)
50 "arm"; 62 "arm";
51 } 63 }
52 64
53 65
54 bool HostCPUFeatures::integer_division_supported_ = false; 66 bool HostCPUFeatures::integer_division_supported_ = false;
67 bool HostCPUFeatures::vfp_supported_ = false;
55 bool HostCPUFeatures::neon_supported_ = false; 68 bool HostCPUFeatures::neon_supported_ = false;
56 const char* HostCPUFeatures::hardware_ = NULL; 69 const char* HostCPUFeatures::hardware_ = NULL;
57 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; 70 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown;
58 #if defined(DEBUG) 71 #if defined(DEBUG)
59 bool HostCPUFeatures::initialized_ = false; 72 bool HostCPUFeatures::initialized_ = false;
60 #endif 73 #endif
61 74
62 75
63 #if defined(HOST_ARCH_ARM) 76 #if defined(HOST_ARCH_ARM)
64 void HostCPUFeatures::InitOnce() { 77 void HostCPUFeatures::InitOnce() {
65 CpuInfo::InitOnce(); 78 CpuInfo::InitOnce();
66 hardware_ = CpuInfo::GetCpuModel(); 79 hardware_ = CpuInfo::GetCpuModel();
67 // Check for ARMv6 or ARMv7. It can be in either the Processor or 80
81 // Has floating point unit.
82 vfp_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "vfp") &&
83 FLAG_use_vfp;
84
85 // Check for ARMv5, ARMv6 or ARMv7. It can be in either the Processor or
68 // Model information fields. 86 // Model information fields.
69 if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") || 87 if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARM926EJ-S") ||
70 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) { 88 CpuInfo::FieldContains(kCpuInfoModel, "ARM926EJ-S")) {
89 // Lego Mindstorm EV3.
90 arm_version_ = ARMv5TE;
91 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") ||
92 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) {
93 // Raspberry Pi, etc.
71 arm_version_ = ARMv6; 94 arm_version_ = ARMv6;
72 } else { 95 } else {
73 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") || 96 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") ||
74 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7")); 97 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7"));
75 arm_version_ = ARMv7; 98 arm_version_ = ARMv7;
76 } 99 }
77 // Has floating point unit. 100
78 ASSERT(CpuInfo::FieldContains(kCpuInfoFeatures, "vfp"));
79 // Has integer division. 101 // Has integer division.
80 bool is_krait = CpuInfo::FieldContains(kCpuInfoHardware, "QCT APQ8064"); 102 bool is_krait = CpuInfo::FieldContains(kCpuInfoHardware, "QCT APQ8064");
81 if (is_krait) { 103 if (is_krait) {
82 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7. 104 // Special case for Qualcomm Krait CPUs in Nexus 4 and 7.
83 integer_division_supported_ = true; 105 integer_division_supported_ = true;
84 } else { 106 } else {
85 integer_division_supported_ = 107 integer_division_supported_ =
86 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva"); 108 CpuInfo::FieldContains(kCpuInfoFeatures, "idiva");
87 } 109 }
88 neon_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "neon"); 110 neon_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "neon") &&
111 FLAG_use_vfp && FLAG_use_neon;
89 #if defined(DEBUG) 112 #if defined(DEBUG)
90 initialized_ = true; 113 initialized_ = true;
91 #endif 114 #endif
92 } 115 }
93 116
94 117
95 void HostCPUFeatures::Cleanup() { 118 void HostCPUFeatures::Cleanup() {
96 DEBUG_ASSERT(initialized_); 119 DEBUG_ASSERT(initialized_);
97 #if defined(DEBUG) 120 #if defined(DEBUG)
98 initialized_ = false; 121 initialized_ = false;
99 #endif 122 #endif
100 ASSERT(hardware_ != NULL); 123 ASSERT(hardware_ != NULL);
101 free(const_cast<char*>(hardware_)); 124 free(const_cast<char*>(hardware_));
102 hardware_ = NULL; 125 hardware_ = NULL;
103 CpuInfo::Cleanup(); 126 CpuInfo::Cleanup();
104 } 127 }
105 128
106 #else 129 #else
107 130
108 void HostCPUFeatures::InitOnce() { 131 void HostCPUFeatures::InitOnce() {
109 CpuInfo::InitOnce(); 132 CpuInfo::InitOnce();
110 hardware_ = CpuInfo::GetCpuModel(); 133 hardware_ = CpuInfo::GetCpuModel();
134 vfp_supported_ = FLAG_use_vfp;
135 neon_supported_ = FLAG_use_vfp && FLAG_use_neon;
111 integer_division_supported_ = true; 136 integer_division_supported_ = true;
112 neon_supported_ = true; 137 if (FLAG_sim_use_armv5te) {
113 arm_version_ = ARMv7; 138 arm_version_ = ARMv5TE;
139 } else if (FLAG_sim_use_armv6) {
140 arm_version_ = ARMv6;
141 } else if (FLAG_sim_use_armv7) {
142 arm_version_ = ARMv7;
143 }
114 #if defined(DEBUG) 144 #if defined(DEBUG)
115 initialized_ = true; 145 initialized_ = true;
116 #endif 146 #endif
117 } 147 }
118 148
119 149
120 void HostCPUFeatures::Cleanup() { 150 void HostCPUFeatures::Cleanup() {
121 DEBUG_ASSERT(initialized_); 151 DEBUG_ASSERT(initialized_);
122 #if defined(DEBUG) 152 #if defined(DEBUG)
123 initialized_ = false; 153 initialized_ = false;
124 #endif 154 #endif
125 ASSERT(hardware_ != NULL); 155 ASSERT(hardware_ != NULL);
126 free(const_cast<char*>(hardware_)); 156 free(const_cast<char*>(hardware_));
127 hardware_ = NULL; 157 hardware_ = NULL;
128 CpuInfo::Cleanup(); 158 CpuInfo::Cleanup();
129 } 159 }
130 #endif // defined(HOST_ARCH_ARM) 160 #endif // defined(HOST_ARCH_ARM)
131 161
132 } // namespace dart 162 } // namespace dart
133 163
134 #endif // defined TARGET_ARCH_ARM 164 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/cpu_arm.h ('k') | runtime/vm/disassembler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698