| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 : stepping_(0), | 305 : stepping_(0), |
| 306 model_(0), | 306 model_(0), |
| 307 ext_model_(0), | 307 ext_model_(0), |
| 308 family_(0), | 308 family_(0), |
| 309 ext_family_(0), | 309 ext_family_(0), |
| 310 type_(0), | 310 type_(0), |
| 311 implementer_(0), | 311 implementer_(0), |
| 312 architecture_(0), | 312 architecture_(0), |
| 313 variant_(-1), | 313 variant_(-1), |
| 314 part_(0), | 314 part_(0), |
| 315 icache_line_size_(UNKNOWN_CACHE_LINE_SIZE), |
| 316 dcache_line_size_(UNKNOWN_CACHE_LINE_SIZE), |
| 315 has_fpu_(false), | 317 has_fpu_(false), |
| 316 has_cmov_(false), | 318 has_cmov_(false), |
| 317 has_sahf_(false), | 319 has_sahf_(false), |
| 318 has_mmx_(false), | 320 has_mmx_(false), |
| 319 has_sse_(false), | 321 has_sse_(false), |
| 320 has_sse2_(false), | 322 has_sse2_(false), |
| 321 has_sse3_(false), | 323 has_sse3_(false), |
| 322 has_ssse3_(false), | 324 has_ssse3_(false), |
| 323 has_sse41_(false), | 325 has_sse41_(false), |
| 324 has_sse42_(false), | 326 has_sse42_(false), |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 #if V8_TARGET_ARCH_PPC64 | 639 #if V8_TARGET_ARCH_PPC64 |
| 638 Elf64_auxv_t entry; | 640 Elf64_auxv_t entry; |
| 639 #else | 641 #else |
| 640 Elf32_auxv_t entry; | 642 Elf32_auxv_t entry; |
| 641 #endif | 643 #endif |
| 642 for (;;) { | 644 for (;;) { |
| 643 size_t n = fread(&entry, sizeof(entry), 1, fp); | 645 size_t n = fread(&entry, sizeof(entry), 1, fp); |
| 644 if (n == 0 || entry.a_type == AT_NULL) { | 646 if (n == 0 || entry.a_type == AT_NULL) { |
| 645 break; | 647 break; |
| 646 } | 648 } |
| 647 if (entry.a_type == AT_PLATFORM) { | 649 switch (entry.a_type) { |
| 648 auxv_cpu_type = reinterpret_cast<char*>(entry.a_un.a_val); | 650 case AT_PLATFORM: |
| 649 break; | 651 auxv_cpu_type = reinterpret_cast<char*>(entry.a_un.a_val); |
| 652 break; |
| 653 case AT_ICACHEBSIZE: |
| 654 icache_line_size_ = entry.a_un.a_val; |
| 655 break; |
| 656 case AT_DCACHEBSIZE: |
| 657 dcache_line_size_ = entry.a_un.a_val; |
| 658 break; |
| 650 } | 659 } |
| 651 } | 660 } |
| 652 fclose(fp); | 661 fclose(fp); |
| 653 } | 662 } |
| 654 | 663 |
| 655 part_ = -1; | 664 part_ = -1; |
| 656 if (auxv_cpu_type) { | 665 if (auxv_cpu_type) { |
| 657 if (strcmp(auxv_cpu_type, "power8") == 0) { | 666 if (strcmp(auxv_cpu_type, "power8") == 0) { |
| 658 part_ = PPC_POWER8; | 667 part_ = PPC_POWER8; |
| 659 } else if (strcmp(auxv_cpu_type, "power7") == 0) { | 668 } else if (strcmp(auxv_cpu_type, "power7") == 0) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 686 part_ = PPC_POWER5; | 695 part_ = PPC_POWER5; |
| 687 break; | 696 break; |
| 688 } | 697 } |
| 689 #endif // V8_OS_AIX | 698 #endif // V8_OS_AIX |
| 690 #endif // !USE_SIMULATOR | 699 #endif // !USE_SIMULATOR |
| 691 #endif // V8_HOST_ARCH_PPC | 700 #endif // V8_HOST_ARCH_PPC |
| 692 } | 701 } |
| 693 | 702 |
| 694 } // namespace base | 703 } // namespace base |
| 695 } // namespace v8 | 704 } // namespace v8 |
| OLD | NEW |