Chromium Code Reviews| Index: src/cpu.cc |
| diff --git a/src/cpu.cc b/src/cpu.cc |
| index 2bf51a7f6c09498186e602fa1e8c3276af31883f..a4798b969d901a832bbe80d6642a17d79df77c20 100644 |
| --- a/src/cpu.cc |
| +++ b/src/cpu.cc |
| @@ -33,6 +33,9 @@ |
| #if V8_OS_POSIX |
| #include <unistd.h> // sysconf() |
| #endif |
| +#if V8_OS_QNX |
| +#include <sys/syspage.h> // cpuinfo |
| +#endif |
| #include <algorithm> |
| #include <cctype> |
| @@ -78,6 +81,8 @@ static V8_INLINE void __cpuid(int cpu_info[4], int info_type) { |
| #elif V8_HOST_ARCH_ARM || V8_HOST_ARCH_MIPS |
| +#if !V8_OS_QNX |
| + |
| #if V8_HOST_ARCH_ARM |
|
Benedikt Meurer
2013/11/15 11:49:59
Better change this #if to #if V8_HOST_ARCH_ARM &&
c.truta
2013/11/18 13:36:32
I couldn't change it all the way to #if V8_HOST_AR
|
| // See <uapi/asm/hwcap.h> kernel header. |
| @@ -249,6 +254,8 @@ static bool HasListItem(const char* list, const char* item) { |
| return false; |
| } |
| +#endif // !V8_OS_QNX |
| + |
| #endif // V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 |
| CPU::CPU() : stepping_(0), |
| @@ -328,7 +335,34 @@ CPU::CPU() : stepping_(0), |
| has_sahf_ = (cpu_info[2] & 0x00000001) != 0; |
| #endif |
| } |
| + |
| #elif V8_HOST_ARCH_ARM |
| + |
| +#if V8_OS_QNX |
| + |
| + uint32_t cpu_flags = SYSPAGE_ENTRY(cpuinfo)->flags; |
| + if (cpu_flags & ARM_CPU_FLAG_V7) { |
| + architecture_ = 7; |
| + has_thumbee_ = true; |
| + } else if (cpu_flags & ARM_CPU_FLAG_V6) { |
| + architecture_ = 6; |
| + // QNX doesn't say if ThumbEE is available. |
| + // Assume false for the architectures older than ARMv7. |
| + } |
| + ASSERT(architecture_ >= 6); |
| + has_fpu_ = (cpu_flags & CPU_FLAG_FPU) != 0; |
| + has_vfp_ = has_fpu_; |
| + if (cpu_flags & ARM_CPU_FLAG_NEON) { |
| + has_neon_ = true; |
| + has_vfp3_ = has_vfp_; |
| +#ifdef ARM_CPU_FLAG_VFP_D32 |
| + has_vfp3_d32_ = (cpu_flags & ARM_CPU_FLAG_VFP_D32) != 0; |
| +#endif |
| + } |
| + has_idiva_ = (cpu_flags & ARM_CPU_FLAG_IDIV) != 0; |
| + |
| +#else // !V8_OS_QNX |
|
Benedikt Meurer
2013/11/15 11:49:59
Use #elif V8_OS_LINUX here.
|
| + |
| CPUInfo cpu_info; |
| // Extract implementor from the "CPU implementer" field. |
| @@ -438,7 +472,11 @@ CPU::CPU() : stepping_(0), |
| // We don't support any FPUs other than VFP. |
| has_fpu_ = has_vfp_; |
| + |
| +#endif // V8_OS_QNX |
| + |
| #elif V8_HOST_ARCH_MIPS |
| + |
| // Simple detection of FPU at runtime for Linux. |
| // It is based on /proc/cpuinfo, which reveals hardware configuration |
| // to user-space applications. According to MIPS (early 2010), no similar |
| @@ -448,6 +486,7 @@ CPU::CPU() : stepping_(0), |
| char* cpu_model = cpu_info.ExtractField("cpu model"); |
| has_fpu_ = HasListItem(cpu_model, "FPU"); |
| delete[] cpu_model; |
| + |
| #endif |
| } |