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

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

Issue 1339673002: PPC: Make FlushICache part of Assembler(Base) and take Isolate as parameter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/codegen-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 #include "src/simulator.h" // for cache flushing.
12 11
13 namespace v8 { 12 namespace v8 {
14 namespace internal { 13 namespace internal {
15 14
16 void CpuFeatures::FlushICache(void* buffer, size_t size) { 15 void CpuFeatures::FlushICache(void* buffer, size_t size) {
17 // Nothing to do flushing no instructions. 16 #if !defined(USE_SIMULATOR)
18 if (size == 0) {
19 return;
20 }
21
22 #if defined(USE_SIMULATOR)
23 // Not generating PPC instructions for C-code. This means that we are
24 // building an PPC emulator based target. We should notify the simulator
25 // that the Icache was flushed.
26 // None of this code ends up in the snapshot so there are no issues
27 // around whether or not to generate the code when building snapshots.
28 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), buffer, size);
29 #else
30
31 if (CpuFeatures::IsSupported(INSTR_AND_DATA_CACHE_COHERENCY)) { 17 if (CpuFeatures::IsSupported(INSTR_AND_DATA_CACHE_COHERENCY)) {
32 __asm__ __volatile__( 18 __asm__ __volatile__(
33 "sync \n" 19 "sync \n"
34 "icbi 0, %0 \n" 20 "icbi 0, %0 \n"
35 "isync \n" 21 "isync \n"
36 : /* no output */ 22 : /* no output */
37 : "r"(buffer) 23 : "r"(buffer)
38 : "memory"); 24 : "memory");
39 return; 25 return;
40 } 26 }
41 27
42 const int kCacheLineSize = CpuFeatures::cache_line_size(); 28 const int kCacheLineSize = CpuFeatures::cache_line_size();
43 intptr_t mask = kCacheLineSize - 1; 29 intptr_t mask = kCacheLineSize - 1;
44 byte *start = 30 byte *start =
45 reinterpret_cast<byte *>(reinterpret_cast<intptr_t>(buffer) & ~mask); 31 reinterpret_cast<byte *>(reinterpret_cast<intptr_t>(buffer) & ~mask);
46 byte *end = static_cast<byte *>(buffer) + size; 32 byte *end = static_cast<byte *>(buffer) + size;
47 for (byte *pointer = start; pointer < end; pointer += kCacheLineSize) { 33 for (byte *pointer = start; pointer < end; pointer += kCacheLineSize) {
48 __asm__( 34 __asm__(
49 "dcbf 0, %0 \n" 35 "dcbf 0, %0 \n"
50 "sync \n" 36 "sync \n"
51 "icbi 0, %0 \n" 37 "icbi 0, %0 \n"
52 "isync \n" 38 "isync \n"
53 : /* no output */ 39 : /* no output */
54 : "r"(pointer)); 40 : "r"(pointer));
55 } 41 }
56 42
57 #endif // USE_SIMULATOR 43 #endif // !USE_SIMULATOR
58 } 44 }
59 } // namespace internal 45 } // namespace internal
60 } // namespace v8 46 } // namespace v8
61 47
62 #endif // V8_TARGET_ARCH_PPC 48 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/codegen-ppc.cc ('k') | src/ppc/macro-assembler-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698