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

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

Issue 9235064: Merge 10518 into 3.7. This adds an Android-specific version of cacheflush call. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.7/
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/version.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 59
60 void CPU::FlushICache(void* start, size_t size) { 60 void CPU::FlushICache(void* start, size_t size) {
61 // Nothing to do, flushing no instructions. 61 // Nothing to do, flushing no instructions.
62 if (size == 0) { 62 if (size == 0) {
63 return; 63 return;
64 } 64 }
65 65
66 #if !defined (USE_SIMULATOR) 66 #if !defined (USE_SIMULATOR)
67 #if defined(ANDROID)
68 // Bionic cacheflush can typically run in userland, avoiding kernel call.
69 char *end = reinterpret_cast<char *>(start) + size;
70 cacheflush(
71 reinterpret_cast<intptr_t>(start), reinterpret_cast<intptr_t>(end), 0);
72 #else // ANDROID
67 int res; 73 int res;
68
69 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall. 74 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall.
70 res = syscall(__NR_cacheflush, start, size, ICACHE); 75 res = syscall(__NR_cacheflush, start, size, ICACHE);
71
72 if (res) { 76 if (res) {
73 V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache"); 77 V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache");
74 } 78 }
75 79 #endif // ANDROID
76 #else // USE_SIMULATOR. 80 #else // USE_SIMULATOR.
77 // Not generating mips instructions for C-code. This means that we are 81 // Not generating mips instructions for C-code. This means that we are
78 // building a mips emulator based target. We should notify the simulator 82 // building a mips emulator based target. We should notify the simulator
79 // that the Icache was flushed. 83 // that the Icache was flushed.
80 // None of this code ends up in the snapshot so there are no issues 84 // None of this code ends up in the snapshot so there are no issues
81 // around whether or not to generate the code when building snapshots. 85 // around whether or not to generate the code when building snapshots.
82 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size); 86 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size);
83 #endif // USE_SIMULATOR. 87 #endif // USE_SIMULATOR.
84 } 88 }
85 89
86 90
87 void CPU::DebugBreak() { 91 void CPU::DebugBreak() {
88 #ifdef __mips 92 #ifdef __mips
89 asm volatile("break"); 93 asm volatile("break");
90 #endif // #ifdef __mips 94 #endif // #ifdef __mips
91 } 95 }
92 96
93 97
94 } } // namespace v8::internal 98 } } // namespace v8::internal
95 99
96 #endif // V8_TARGET_ARCH_MIPS 100 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698