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

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

Issue 1480623002: Never call CpuFeatures::FlushICache directly (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years 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/mips64/codegen-mips64.cc ('k') | src/mips64/macro-assembler-mips64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include <sys/syscall.h> 7 #include <sys/syscall.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #ifdef __mips 10 #ifdef __mips
11 #include <asm/cachectl.h> 11 #include <asm/cachectl.h>
12 #endif // #ifdef __mips 12 #endif // #ifdef __mips
13 13
14 #if V8_TARGET_ARCH_MIPS64 14 #if V8_TARGET_ARCH_MIPS64
15 15
16 #include "src/assembler.h" 16 #include "src/assembler.h"
17 #include "src/macro-assembler.h" 17 #include "src/macro-assembler.h"
18 18
19 #include "src/simulator.h" // For cache flushing. 19 #include "src/simulator.h" // For cache flushing.
20 20
21 namespace v8 { 21 namespace v8 {
22 namespace internal { 22 namespace internal {
23 23
24 24
25 void CpuFeatures::FlushICache(void* start, size_t size) { 25 void CpuFeatures::FlushICache(void* start, size_t size) {
26 #if !defined(USE_SIMULATOR)
26 // Nothing to do, flushing no instructions. 27 // Nothing to do, flushing no instructions.
27 if (size == 0) { 28 if (size == 0) {
28 return; 29 return;
29 } 30 }
30 31
31 #if !defined (USE_SIMULATOR)
32 #if defined(ANDROID) && !defined(__LP64__) 32 #if defined(ANDROID) && !defined(__LP64__)
33 // Bionic cacheflush can typically run in userland, avoiding kernel call. 33 // Bionic cacheflush can typically run in userland, avoiding kernel call.
34 char *end = reinterpret_cast<char *>(start) + size; 34 char *end = reinterpret_cast<char *>(start) + size;
35 cacheflush( 35 cacheflush(
36 reinterpret_cast<intptr_t>(start), reinterpret_cast<intptr_t>(end), 0); 36 reinterpret_cast<intptr_t>(start), reinterpret_cast<intptr_t>(end), 0);
37 #else // ANDROID 37 #else // ANDROID
38 int res; 38 int res;
39 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall. 39 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall.
40 res = syscall(__NR_cacheflush, start, size, ICACHE); 40 res = syscall(__NR_cacheflush, start, size, ICACHE);
41 if (res) { 41 if (res) {
42 V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache"); 42 V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache");
43 } 43 }
44 #endif // ANDROID 44 #endif // ANDROID
45 #else // USE_SIMULATOR. 45 #endif // !USE_SIMULATOR.
46 // Not generating mips instructions for C-code. This means that we are
47 // building a mips emulator based target. We should notify the simulator
48 // that the Icache was flushed.
49 // None of this code ends up in the snapshot so there are no issues
50 // around whether or not to generate the code when building snapshots.
51 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size);
52 #endif // USE_SIMULATOR.
53 } 46 }
54 47
55 } // namespace internal 48 } // namespace internal
56 } // namespace v8 49 } // namespace v8
57 50
58 #endif // V8_TARGET_ARCH_MIPS64 51 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/codegen-mips64.cc ('k') | src/mips64/macro-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698