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

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

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

Powered by Google App Engine
This is Rietveld 408576698