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

Side by Side Diff: src/arm64/cpu-arm64.cc

Issue 1806853002: Revert "Detect cache line size on Linux for PPC hosts." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/assembler-arm64.cc ('k') | src/assembler.h » ('j') | 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 // CPU specific code for arm independent of OS goes here. 5 // CPU specific code for arm independent of OS goes here.
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/arm64/utils-arm64.h" 9 #include "src/arm64/utils-arm64.h"
10 #include "src/assembler.h" 10 #include "src/assembler.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 class CacheLineSizes {
16 public:
17 CacheLineSizes() {
18 #ifdef USE_SIMULATOR
19 cache_type_register_ = 0;
20 #else
21 // Copy the content of the cache type register to a core register.
22 __asm__ __volatile__("mrs %[ctr], ctr_el0" // NOLINT
23 : [ctr] "=r"(cache_type_register_));
24 #endif
25 }
26
27 uint32_t icache_line_size() const { return ExtractCacheLineSize(0); }
28 uint32_t dcache_line_size() const { return ExtractCacheLineSize(16); }
29
30 private:
31 uint32_t ExtractCacheLineSize(int cache_line_size_shift) const {
32 // The cache type register holds the size of cache lines in words as a
33 // power of two.
34 return 4 << ((cache_type_register_ >> cache_line_size_shift) & 0xf);
35 }
36
37 uint32_t cache_type_register_;
38 };
39
15 void CpuFeatures::FlushICache(void* address, size_t length) { 40 void CpuFeatures::FlushICache(void* address, size_t length) {
16 #ifdef V8_HOST_ARCH_ARM64 41 #ifdef V8_HOST_ARCH_ARM64
17 // The code below assumes user space cache operations are allowed. The goal 42 // The code below assumes user space cache operations are allowed. The goal
18 // of this routine is to make sure the code generated is visible to the I 43 // of this routine is to make sure the code generated is visible to the I
19 // side of the CPU. 44 // side of the CPU.
20 45
21 uintptr_t start = reinterpret_cast<uintptr_t>(address); 46 uintptr_t start = reinterpret_cast<uintptr_t>(address);
22 // Sizes will be used to generate a mask big enough to cover a pointer. 47 // Sizes will be used to generate a mask big enough to cover a pointer.
23 uintptr_t dsize = CpuFeatures::dcache_line_size(); 48 CacheLineSizes sizes;
24 uintptr_t isize = CpuFeatures::icache_line_size(); 49 uintptr_t dsize = sizes.dcache_line_size();
50 uintptr_t isize = sizes.icache_line_size();
25 // Cache line sizes are always a power of 2. 51 // Cache line sizes are always a power of 2.
26 DCHECK(CountSetBits(dsize, 64) == 1); 52 DCHECK(CountSetBits(dsize, 64) == 1);
27 DCHECK(CountSetBits(isize, 64) == 1); 53 DCHECK(CountSetBits(isize, 64) == 1);
28 uintptr_t dstart = start & ~(dsize - 1); 54 uintptr_t dstart = start & ~(dsize - 1);
29 uintptr_t istart = start & ~(isize - 1); 55 uintptr_t istart = start & ~(isize - 1);
30 uintptr_t end = start + length; 56 uintptr_t end = start + length;
31 57
32 __asm__ __volatile__ ( // NOLINT 58 __asm__ __volatile__ ( // NOLINT
33 // Clean every line of the D cache containing the target data. 59 // Clean every line of the D cache containing the target data.
34 "0: \n\t" 60 "0: \n\t"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // move this code before the code is generated. 105 // move this code before the code is generated.
80 : "cc", "memory" 106 : "cc", "memory"
81 ); // NOLINT 107 ); // NOLINT
82 #endif // V8_HOST_ARCH_ARM64 108 #endif // V8_HOST_ARCH_ARM64
83 } 109 }
84 110
85 } // namespace internal 111 } // namespace internal
86 } // namespace v8 112 } // namespace v8
87 113
88 #endif // V8_TARGET_ARCH_ARM64 114 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/assembler-arm64.cc ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698