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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 80 #if V8_HOST_ARCH_ARM64 |
81 class CacheLineSizes { | 81 class CacheLineSizes { |
82 public: | 82 public: |
83 CacheLineSizes() { | 83 CacheLineSizes() { |
84 #ifdef USE_SIMULATOR | 84 #ifdef USE_SIMULATOR |
85 cache_type_register_ = 0; | 85 cache_type_register_ = 0; |
86 #else | 86 #else |
87 // Copy the content of the cache type register to a core register. | 87 // Copy the content of the cache type register to a core register. |
88 __asm__ __volatile__("mrs %[ctr], ctr_el0" // NOLINT | 88 __asm__ __volatile__("mrs %x[ctr], ctr_el0" // NOLINT |
89 : [ctr] "=r"(cache_type_register_)); | 89 : [ctr] "=r"(cache_type_register_)); |
90 #endif | 90 #endif |
91 } | 91 } |
92 | 92 |
93 uint32_t icache_line_size() const { return ExtractCacheLineSize(0); } | 93 uint32_t icache_line_size() const { return ExtractCacheLineSize(0); } |
94 uint32_t dcache_line_size() const { return ExtractCacheLineSize(16); } | 94 uint32_t dcache_line_size() const { return ExtractCacheLineSize(16); } |
95 | 95 |
96 private: | 96 private: |
97 uint32_t ExtractCacheLineSize(int cache_line_size_shift) const { | 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 | 98 // The cache type register holds the size of cache lines in words as a |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 part_ = PPC_POWER5; | 726 part_ = PPC_POWER5; |
727 break; | 727 break; |
728 } | 728 } |
729 #endif // V8_OS_AIX | 729 #endif // V8_OS_AIX |
730 #endif // !USE_SIMULATOR | 730 #endif // !USE_SIMULATOR |
731 #endif // V8_HOST_ARCH_PPC | 731 #endif // V8_HOST_ARCH_PPC |
732 } | 732 } |
733 | 733 |
734 } // namespace base | 734 } // namespace base |
735 } // namespace v8 | 735 } // namespace v8 |
OLD | NEW |