Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/base/cpu.cc

Issue 1819913002: Version 5.0.71.21: Merge arm64 CacheLineSizes revert (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.0
Patch Set: update v8-version.h Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/cpu-arm64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 "=d"(cpu_info[3]) 70 "=d"(cpu_info[3])
71 : "a"(info_type), "c"(0)); 71 : "a"(info_type), "c"(0));
72 #endif // defined(__i386__) && defined(__pic__) 72 #endif // defined(__i386__) && defined(__pic__)
73 } 73 }
74 74
75 #endif // !V8_LIBC_MSVCRT 75 #endif // !V8_LIBC_MSVCRT
76 76
77 #elif V8_HOST_ARCH_ARM || V8_HOST_ARCH_ARM64 \ 77 #elif V8_HOST_ARCH_ARM || V8_HOST_ARCH_ARM64 \
78 || V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 78 || V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64
79 79
80 #if V8_HOST_ARCH_ARM64
81 class CacheLineSizes {
82 public:
83 CacheLineSizes() {
84 #ifdef USE_SIMULATOR
85 cache_type_register_ = 0;
86 #else
87 // Copy the content of the cache type register to a core register.
88 __asm__ __volatile__("mrs %[ctr], ctr_el0" // NOLINT
89 : [ctr] "=r"(cache_type_register_));
90 #endif
91 }
92
93 uint32_t icache_line_size() const { return ExtractCacheLineSize(0); }
94 uint32_t dcache_line_size() const { return ExtractCacheLineSize(16); }
95
96 private:
97 uint32_t ExtractCacheLineSize(int cache_line_size_shift) const {
98 // The cache type register holds the size of cache lines in words as a
99 // power of two.
100 return 4 << ((cache_type_register_ >> cache_line_size_shift) & 0xf);
101 }
102
103 uint32_t cache_type_register_;
104 };
105 #endif // V8_HOST_ARCH_ARM64
106
107 #if V8_OS_LINUX 80 #if V8_OS_LINUX
108 81
109 #if V8_HOST_ARCH_ARM 82 #if V8_HOST_ARCH_ARM
110 83
111 // See <uapi/asm/hwcap.h> kernel header. 84 // See <uapi/asm/hwcap.h> kernel header.
112 /* 85 /*
113 * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP 86 * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP
114 */ 87 */
115 #define HWCAP_SWP (1 << 0) 88 #define HWCAP_SWP (1 << 0)
116 #define HWCAP_HALF (1 << 1) 89 #define HWCAP_HALF (1 << 1)
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 char* part = cpu_info.ExtractField("CPU part"); 621 char* part = cpu_info.ExtractField("CPU part");
649 if (part != NULL) { 622 if (part != NULL) {
650 char* end; 623 char* end;
651 part_ = strtol(part, &end, 0); 624 part_ = strtol(part, &end, 0);
652 if (end == part) { 625 if (end == part) {
653 part_ = 0; 626 part_ = 0;
654 } 627 }
655 delete[] part; 628 delete[] part;
656 } 629 }
657 630
658 CacheLineSizes sizes;
659 icache_line_size_ = sizes.icache_line_size();
660 dcache_line_size_ = sizes.dcache_line_size();
661
662 #elif V8_HOST_ARCH_PPC 631 #elif V8_HOST_ARCH_PPC
663 632
664 #ifndef USE_SIMULATOR 633 #ifndef USE_SIMULATOR
665 #if V8_OS_LINUX 634 #if V8_OS_LINUX
666 // Read processor info from /proc/self/auxv. 635 // Read processor info from /proc/self/auxv.
667 char* auxv_cpu_type = NULL; 636 char* auxv_cpu_type = NULL;
668 FILE* fp = fopen("/proc/self/auxv", "r"); 637 FILE* fp = fopen("/proc/self/auxv", "r");
669 if (fp != NULL) { 638 if (fp != NULL) {
670 #if V8_TARGET_ARCH_PPC64 639 #if V8_TARGET_ARCH_PPC64
671 Elf64_auxv_t entry; 640 Elf64_auxv_t entry;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 part_ = PPC_POWER5; 695 part_ = PPC_POWER5;
727 break; 696 break;
728 } 697 }
729 #endif // V8_OS_AIX 698 #endif // V8_OS_AIX
730 #endif // !USE_SIMULATOR 699 #endif // !USE_SIMULATOR
731 #endif // V8_HOST_ARCH_PPC 700 #endif // V8_HOST_ARCH_PPC
732 } 701 }
733 702
734 } // namespace base 703 } // namespace base
735 } // namespace v8 704 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/cpu-arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698