| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // without vfp. | 154 // without vfp. |
| 155 if (CPUInfoContainsString("vfp") && CPUInfoContainsString("neon")) { | 155 if (CPUInfoContainsString("vfp") && CPUInfoContainsString("neon")) { |
| 156 return true; | 156 return true; |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 return false; | 160 return false; |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 |
| 164 // Simple helper function to detect whether the C code is compiled with | |
| 165 // option -mfloat-abi=hard. The register d0 is loaded with 1.0 and the register | |
| 166 // pair r0, r1 is loaded with 0.0. If -mfloat-abi=hard is pased to GCC then | |
| 167 // calling this will return 1.0 and otherwise 0.0. | |
| 168 static void ArmUsingHardFloatHelper() { | |
| 169 asm("mov r0, #0":::"r0"); | |
| 170 #if defined(__VFP_FP__) && !defined(__SOFTFP__) | |
| 171 // Load 0x3ff00000 into r1 using instructions available in both ARM | |
| 172 // and Thumb mode. | |
| 173 asm("mov r1, #3":::"r1"); | |
| 174 asm("mov r2, #255":::"r2"); | |
| 175 asm("lsl r1, r1, #8":::"r1"); | |
| 176 asm("orr r1, r1, r2":::"r1"); | |
| 177 asm("lsl r1, r1, #20":::"r1"); | |
| 178 // For vmov d0, r0, r1 use ARM mode. | |
| 179 #ifdef __thumb__ | |
| 180 asm volatile( | |
| 181 "@ Enter ARM Mode \n\t" | |
| 182 " adr r3, 1f \n\t" | |
| 183 " bx r3 \n\t" | |
| 184 " .ALIGN 4 \n\t" | |
| 185 " .ARM \n" | |
| 186 "1: vmov d0, r0, r1 \n\t" | |
| 187 "@ Enter THUMB Mode\n\t" | |
| 188 " adr r3, 2f+1 \n\t" | |
| 189 " bx r3 \n\t" | |
| 190 " .THUMB \n" | |
| 191 "2: \n\t":::"r3"); | |
| 192 #else | |
| 193 asm("vmov d0, r0, r1"); | |
| 194 #endif // __thumb__ | |
| 195 #endif // defined(__VFP_FP__) && !defined(__SOFTFP__) | |
| 196 asm("mov r1, #0":::"r1"); | |
| 197 } | |
| 198 | |
| 199 | |
| 200 bool OS::ArmUsingHardFloat() { | 164 bool OS::ArmUsingHardFloat() { |
| 201 // Cast helper function from returning void to returning double. | 165 // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify |
| 202 typedef double (*F)(); | 166 // the Floating Point ABI used (PCS stands for Procedure Call Standard). |
| 203 F f = FUNCTION_CAST<F>(FUNCTION_ADDR(ArmUsingHardFloatHelper)); | 167 // We use these as well as a couple of other defines to statically determine |
| 204 return f() == 1.0; | 168 // what FP ABI used. |
| 169 // GCC versions 4.4 and below don't support hard-fp. |
| 170 // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or |
| 171 // __ARM_PCS_VFP. |
| 172 |
| 173 #define GCC_VERSION (__GNUC__ * 10000 \ |
| 174 + __GNUC_MINOR__ * 100 \ |
| 175 + __GNUC_PATCHLEVEL__) |
| 176 #if GCC_VERSION >= 40600 |
| 177 #if defined(__ARM_PCS_VFP) |
| 178 return true; |
| 179 #else |
| 180 return false; |
| 181 #endif |
| 182 |
| 183 #elif GCC_VERSION < 40500 |
| 184 return false; |
| 185 |
| 186 #else |
| 187 #if defined(__ARM_PCS_VFP) |
| 188 return true; |
| 189 #elif defined(__ARM_PCS) || defined(__SOFTFP) || !defined(__VFP_FP__) |
| 190 return false; |
| 191 #else |
| 192 #error "Your version of GCC does not report the FP ABI compiled for." \ |
| 193 "Please report it on this issue" \ |
| 194 "http://code.google.com/p/v8/issues/detail?id=2140" |
| 195 |
| 196 #endif |
| 197 #endif |
| 198 #undef GCC_VERSION |
| 205 } | 199 } |
| 200 |
| 206 #endif // def __arm__ | 201 #endif // def __arm__ |
| 207 | 202 |
| 208 | 203 |
| 209 #ifdef __mips__ | 204 #ifdef __mips__ |
| 210 bool OS::MipsCpuHasFeature(CpuFeature feature) { | 205 bool OS::MipsCpuHasFeature(CpuFeature feature) { |
| 211 const char* search_string = NULL; | 206 const char* search_string = NULL; |
| 212 const char* file_name = "/proc/cpuinfo"; | 207 const char* file_name = "/proc/cpuinfo"; |
| 213 // Simple detection of FPU at runtime for Linux. | 208 // Simple detection of FPU at runtime for Linux. |
| 214 // It is based on /proc/cpuinfo, which reveals hardware configuration | 209 // It is based on /proc/cpuinfo, which reveals hardware configuration |
| 215 // to user-space applications. According to MIPS (early 2010), no similar | 210 // to user-space applications. According to MIPS (early 2010), no similar |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 | 1279 |
| 1285 | 1280 |
| 1286 void Sampler::Stop() { | 1281 void Sampler::Stop() { |
| 1287 ASSERT(IsActive()); | 1282 ASSERT(IsActive()); |
| 1288 SignalSender::RemoveActiveSampler(this); | 1283 SignalSender::RemoveActiveSampler(this); |
| 1289 SetActive(false); | 1284 SetActive(false); |
| 1290 } | 1285 } |
| 1291 | 1286 |
| 1292 | 1287 |
| 1293 } } // namespace v8::internal | 1288 } } // namespace v8::internal |
| OLD | NEW |