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

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

Issue 1643363002: 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, 10 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/ppc/assembler-ppc.cc ('k') | src/ppc/macro-assembler-ppc.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 ppc independent of OS goes here. 5 // CPU specific code for ppc independent of OS goes here.
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 void CpuFeatures::FlushICache(void* buffer, size_t size) { 15 void CpuFeatures::FlushICache(void* buffer, size_t size) {
16 #if !defined(USE_SIMULATOR) 16 #if !defined(USE_SIMULATOR)
17 if (CpuFeatures::IsSupported(INSTR_AND_DATA_CACHE_COHERENCY)) { 17 if (CpuFeatures::IsSupported(INSTR_AND_DATA_CACHE_COHERENCY)) {
18 __asm__ __volatile__( 18 __asm__ __volatile__(
19 "sync \n" 19 "sync \n"
20 "icbi 0, %0 \n" 20 "icbi 0, %0 \n"
21 "isync \n" 21 "isync \n"
22 : /* no output */ 22 : /* no output */
23 : "r"(buffer) 23 : "r"(buffer)
24 : "memory"); 24 : "memory");
25 return; 25 return;
26 } 26 }
27 27
28 const int kCacheLineSize = CpuFeatures::cache_line_size(); 28 const int kCacheLineSize = CpuFeatures::icache_line_size();
29 intptr_t mask = kCacheLineSize - 1; 29 intptr_t mask = kCacheLineSize - 1;
30 byte *start = 30 byte *start =
31 reinterpret_cast<byte *>(reinterpret_cast<intptr_t>(buffer) & ~mask); 31 reinterpret_cast<byte *>(reinterpret_cast<intptr_t>(buffer) & ~mask);
32 byte *end = static_cast<byte *>(buffer) + size; 32 byte *end = static_cast<byte *>(buffer) + size;
33 for (byte *pointer = start; pointer < end; pointer += kCacheLineSize) { 33 for (byte *pointer = start; pointer < end; pointer += kCacheLineSize) {
34 __asm__( 34 __asm__(
35 "dcbf 0, %0 \n" 35 "dcbf 0, %0 \n"
36 "sync \n" 36 "sync \n"
37 "icbi 0, %0 \n" 37 "icbi 0, %0 \n"
38 "isync \n" 38 "isync \n"
39 : /* no output */ 39 : /* no output */
40 : "r"(pointer)); 40 : "r"(pointer));
41 } 41 }
42 42
43 #endif // !USE_SIMULATOR 43 #endif // !USE_SIMULATOR
44 } 44 }
45 } // namespace internal 45 } // namespace internal
46 } // namespace v8 46 } // namespace v8
47 47
48 #endif // V8_TARGET_ARCH_PPC 48 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/assembler-ppc.cc ('k') | src/ppc/macro-assembler-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698