32 #if V8_TARGET_ARCH_ARM64
41 bool CpuFeatures::initialized_ =
false;
43 unsigned CpuFeatures::supported_ = 0;
44 unsigned CpuFeatures::found_by_runtime_probing_only_ = 0;
45 unsigned CpuFeatures::cross_compile_ = 0;
48 unsigned CpuFeatures::dcache_line_size_ = 1;
49 unsigned CpuFeatures::icache_line_size_ = 1;
57 bool CPU::SupportsCrankshaft() {
62 void CPU::FlushICache(
void* address,
size_t length) {
77 uintptr_t start =
reinterpret_cast<uintptr_t
>(address);
84 uintptr_t dstart = start & ~(dsize - 1);
85 uintptr_t istart = start & ~(isize - 1);
86 uintptr_t end = start + length;
88 __asm__ __volatile__ (
98 "dc cvau, %[dline] \n\t"
99 "add %[dline], %[dline], %[dsize] \n\t"
100 "cmp %[dline], %[end] \n\t"
118 "ic ivau, %[iline] \n\t"
119 "add %[iline], %[iline], %[isize] \n\t"
120 "cmp %[iline], %[end] \n\t"
129 : [dline]
"+r" (dstart),
130 [iline]
"+r" (istart)
131 : [dsize]
"r" (dsize),
145 uint32_t cache_type_register = GetCacheType();
147 static const int kDCacheLineSizeShift = 16;
148 static const int kICacheLineSizeShift = 0;
149 static const uint32_t kDCacheLineSizeMask = 0xf << kDCacheLineSizeShift;
150 static const uint32_t kICacheLineSizeMask = 0xf << kICacheLineSizeShift;
154 uint32_t dcache_line_size_power_of_two =
155 (cache_type_register & kDCacheLineSizeMask) >> kDCacheLineSizeShift;
156 uint32_t icache_line_size_power_of_two =
157 (cache_type_register & kICacheLineSizeMask) >> kICacheLineSizeShift;
159 dcache_line_size_ = 1 << dcache_line_size_power_of_two;
160 icache_line_size_ = 1 << icache_line_size_power_of_two;
173 return dcache_line_size_;
179 return icache_line_size_;
183 uint32_t CpuFeatures::GetCacheType() {
189 uint32_t cache_type_register;
191 __asm__ __volatile__ (
"mrs %[ctr], ctr_el0"
192 : [ctr]
"=r" (cache_type_register));
193 return cache_type_register;
199 #endif // V8_TARGET_ARCH_ARM64
#define ASSERT(condition)
static unsigned dcache_line_size()
int CountSetBits(uint64_t value, int width)
static unsigned icache_line_size()