| 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 // 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // The cache type register holds the size of cache lines in words as a | 32 // The cache type register holds the size of cache lines in words as a |
| 33 // power of two. | 33 // power of two. |
| 34 return 4 << ((cache_type_register_ >> cache_line_size_shift) & 0xf); | 34 return 4 << ((cache_type_register_ >> cache_line_size_shift) & 0xf); |
| 35 } | 35 } |
| 36 | 36 |
| 37 uint32_t cache_type_register_; | 37 uint32_t cache_type_register_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 | 40 |
| 41 void CpuFeatures::FlushICache(void* address, size_t length) { | 41 void CpuFeatures::FlushICache(void* address, size_t length) { |
| 42 if (length == 0) return; | 42 #ifdef V8_HOST_ARCH_ARM64 |
| 43 | |
| 44 if (CpuFeatures::IsSupported(COHERENT_CACHE)) return; | |
| 45 | |
| 46 #ifdef USE_SIMULATOR | |
| 47 // TODO(all): consider doing some cache simulation to ensure every address | |
| 48 // run has been synced. | |
| 49 USE(address); | |
| 50 USE(length); | |
| 51 #else | |
| 52 // The code below assumes user space cache operations are allowed. The goal | 43 // The code below assumes user space cache operations are allowed. The goal |
| 53 // of this routine is to make sure the code generated is visible to the I | 44 // of this routine is to make sure the code generated is visible to the I |
| 54 // side of the CPU. | 45 // side of the CPU. |
| 55 | 46 |
| 56 uintptr_t start = reinterpret_cast<uintptr_t>(address); | 47 uintptr_t start = reinterpret_cast<uintptr_t>(address); |
| 57 // Sizes will be used to generate a mask big enough to cover a pointer. | 48 // Sizes will be used to generate a mask big enough to cover a pointer. |
| 58 CacheLineSizes sizes; | 49 CacheLineSizes sizes; |
| 59 uintptr_t dsize = sizes.dcache_line_size(); | 50 uintptr_t dsize = sizes.dcache_line_size(); |
| 60 uintptr_t isize = sizes.icache_line_size(); | 51 uintptr_t isize = sizes.icache_line_size(); |
| 61 // Cache line sizes are always a power of 2. | 52 // Cache line sizes are always a power of 2. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 "isb \n\t" | 99 "isb \n\t" |
| 109 : [dline] "+r" (dstart), | 100 : [dline] "+r" (dstart), |
| 110 [iline] "+r" (istart) | 101 [iline] "+r" (istart) |
| 111 : [dsize] "r" (dsize), | 102 : [dsize] "r" (dsize), |
| 112 [isize] "r" (isize), | 103 [isize] "r" (isize), |
| 113 [end] "r" (end) | 104 [end] "r" (end) |
| 114 // This code does not write to memory but without the dependency gcc might | 105 // This code does not write to memory but without the dependency gcc might |
| 115 // move this code before the code is generated. | 106 // move this code before the code is generated. |
| 116 : "cc", "memory" | 107 : "cc", "memory" |
| 117 ); // NOLINT | 108 ); // NOLINT |
| 118 #endif | 109 #endif // V8_HOST_ARCH_ARM64 |
| 119 } | 110 } |
| 120 | 111 |
| 121 } // namespace internal | 112 } // namespace internal |
| 122 } // namespace v8 | 113 } // namespace v8 |
| 123 | 114 |
| 124 #endif // V8_TARGET_ARCH_ARM64 | 115 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |