OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 128 matching lines...) Loading... |
139 const char* search_string = NULL; | 139 const char* search_string = NULL; |
140 // Simple detection of VFP at runtime for Linux. | 140 // Simple detection of VFP at runtime for Linux. |
141 // It is based on /proc/cpuinfo, which reveals hardware configuration | 141 // It is based on /proc/cpuinfo, which reveals hardware configuration |
142 // to user-space applications. According to ARM (mid 2009), no similar | 142 // to user-space applications. According to ARM (mid 2009), no similar |
143 // facility is universally available on the ARM architectures, | 143 // facility is universally available on the ARM architectures, |
144 // so it's up to individual OSes to provide such. | 144 // so it's up to individual OSes to provide such. |
145 switch (feature) { | 145 switch (feature) { |
146 case VFP3: | 146 case VFP3: |
147 search_string = "vfpv3"; | 147 search_string = "vfpv3"; |
148 break; | 148 break; |
| 149 case NEON: |
| 150 search_string = "neon"; |
| 151 break; |
149 case ARMv7: | 152 case ARMv7: |
150 search_string = "ARMv7"; | 153 search_string = "ARMv7"; |
151 break; | 154 break; |
152 case SUDIV: | 155 case SUDIV: |
153 search_string = "idiva"; | 156 search_string = "idiva"; |
154 break; | 157 break; |
155 case VFP32DREGS: | 158 case VFP32DREGS: |
156 // This case is handled specially below. | 159 // This case is handled specially below. |
157 break; | 160 break; |
158 default: | 161 default: |
(...skipping 34 matching lines...) Loading... |
193 } else if (CPUInfoContainsString("CPU implementer\t: 0x51")) { | 196 } else if (CPUInfoContainsString("CPU implementer\t: 0x51")) { |
194 cached_value = QUALCOMM_IMPLEMENTER; | 197 cached_value = QUALCOMM_IMPLEMENTER; |
195 } else { | 198 } else { |
196 cached_value = UNKNOWN_IMPLEMENTER; | 199 cached_value = UNKNOWN_IMPLEMENTER; |
197 } | 200 } |
198 use_cached_value = true; | 201 use_cached_value = true; |
199 return cached_value; | 202 return cached_value; |
200 } | 203 } |
201 | 204 |
202 | 205 |
| 206 CpuPart OS::GetCpuPart(CpuImplementer implementer) { |
| 207 static bool use_cached_value = false; |
| 208 static CpuPart cached_value = CPU_UNKNOWN; |
| 209 if (use_cached_value) { |
| 210 return cached_value; |
| 211 } |
| 212 if (implementer == ARM_IMPLEMENTER) { |
| 213 if (CPUInfoContainsString("CPU part\t: 0xc0f")) { |
| 214 cached_value = CORTEX_A15; |
| 215 } else if (CPUInfoContainsString("CPU part\t: 0xc0c")) { |
| 216 cached_value = CORTEX_A12; |
| 217 } else if (CPUInfoContainsString("CPU part\t: 0xc09")) { |
| 218 cached_value = CORTEX_A9; |
| 219 } else if (CPUInfoContainsString("CPU part\t: 0xc08")) { |
| 220 cached_value = CORTEX_A8; |
| 221 } else if (CPUInfoContainsString("CPU part\t: 0xc07")) { |
| 222 cached_value = CORTEX_A7; |
| 223 } else if (CPUInfoContainsString("CPU part\t: 0xc05")) { |
| 224 cached_value = CORTEX_A5; |
| 225 } else { |
| 226 cached_value = CPU_UNKNOWN; |
| 227 } |
| 228 } else { |
| 229 cached_value = CPU_UNKNOWN; |
| 230 } |
| 231 use_cached_value = true; |
| 232 return cached_value; |
| 233 } |
| 234 |
| 235 |
203 bool OS::ArmUsingHardFloat() { | 236 bool OS::ArmUsingHardFloat() { |
204 // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify | 237 // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify |
205 // the Floating Point ABI used (PCS stands for Procedure Call Standard). | 238 // the Floating Point ABI used (PCS stands for Procedure Call Standard). |
206 // We use these as well as a couple of other defines to statically determine | 239 // We use these as well as a couple of other defines to statically determine |
207 // what FP ABI used. | 240 // what FP ABI used. |
208 // GCC versions 4.4 and below don't support hard-fp. | 241 // GCC versions 4.4 and below don't support hard-fp. |
209 // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or | 242 // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or |
210 // __ARM_PCS_VFP. | 243 // __ARM_PCS_VFP. |
211 | 244 |
212 #define GCC_VERSION (__GNUC__ * 10000 \ | 245 #define GCC_VERSION (__GNUC__ * 10000 \ |
(...skipping 774 matching lines...) Loading... |
987 limit_mutex = CreateMutex(); | 1020 limit_mutex = CreateMutex(); |
988 } | 1021 } |
989 | 1022 |
990 | 1023 |
991 void OS::TearDown() { | 1024 void OS::TearDown() { |
992 delete limit_mutex; | 1025 delete limit_mutex; |
993 } | 1026 } |
994 | 1027 |
995 | 1028 |
996 } } // namespace v8::internal | 1029 } } // namespace v8::internal |
OLD | NEW |