| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/base/cpu.h" | 5 #include "src/base/cpu.h" |
| 6 | 6 |
| 7 #if V8_LIBC_MSVCRT | 7 #if V8_LIBC_MSVCRT |
| 8 #include <intrin.h> // __cpuid() | 8 #include <intrin.h> // __cpuid() |
| 9 #endif | 9 #endif |
| 10 #if V8_OS_LINUX | 10 #if V8_OS_LINUX |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 #elif V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 | 589 #elif V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 |
| 590 | 590 |
| 591 // Simple detection of FPU at runtime for Linux. | 591 // Simple detection of FPU at runtime for Linux. |
| 592 // It is based on /proc/cpuinfo, which reveals hardware configuration | 592 // It is based on /proc/cpuinfo, which reveals hardware configuration |
| 593 // to user-space applications. According to MIPS (early 2010), no similar | 593 // to user-space applications. According to MIPS (early 2010), no similar |
| 594 // facility is universally available on the MIPS architectures, | 594 // facility is universally available on the MIPS architectures, |
| 595 // so it's up to individual OSes to provide such. | 595 // so it's up to individual OSes to provide such. |
| 596 CPUInfo cpu_info; | 596 CPUInfo cpu_info; |
| 597 char* cpu_model = cpu_info.ExtractField("cpu model"); | 597 char* cpu_model = cpu_info.ExtractField("cpu model"); |
| 598 has_fpu_ = HasListItem(cpu_model, "FPU"); | 598 has_fpu_ = HasListItem(cpu_model, "FPU"); |
| 599 char* ASEs = cpu_info.ExtractField("ASEs implemented"); |
| 600 has_msa_ = HasListItem(ASEs, "msa"); |
| 599 delete[] cpu_model; | 601 delete[] cpu_model; |
| 602 delete[] ASEs; |
| 600 #ifdef V8_HOST_ARCH_MIPS | 603 #ifdef V8_HOST_ARCH_MIPS |
| 601 is_fp64_mode_ = __detect_fp64_mode(); | 604 is_fp64_mode_ = __detect_fp64_mode(); |
| 602 architecture_ = __detect_mips_arch_revision(); | 605 architecture_ = __detect_mips_arch_revision(); |
| 603 #endif | 606 #endif |
| 604 | 607 |
| 605 #elif V8_HOST_ARCH_ARM64 | 608 #elif V8_HOST_ARCH_ARM64 |
| 606 | 609 |
| 607 CPUInfo cpu_info; | 610 CPUInfo cpu_info; |
| 608 | 611 |
| 609 // Extract implementor from the "CPU implementer" field. | 612 // Extract implementor from the "CPU implementer" field. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 part_ = PPC_POWER5; | 713 part_ = PPC_POWER5; |
| 711 break; | 714 break; |
| 712 } | 715 } |
| 713 #endif // V8_OS_AIX | 716 #endif // V8_OS_AIX |
| 714 #endif // !USE_SIMULATOR | 717 #endif // !USE_SIMULATOR |
| 715 #endif // V8_HOST_ARCH_PPC | 718 #endif // V8_HOST_ARCH_PPC |
| 716 } | 719 } |
| 717 | 720 |
| 718 } // namespace base | 721 } // namespace base |
| 719 } // namespace v8 | 722 } // namespace v8 |
| OLD | NEW |