OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 ia32 independent of OS goes here. | 5 // CPU specific code for ia32 independent of OS goes here. |
6 | 6 |
7 #ifdef __GNUC__ | 7 #ifdef __GNUC__ |
8 #include "src/third_party/valgrind/valgrind.h" | 8 #include "src/third_party/valgrind/valgrind.h" |
9 #endif | 9 #endif |
10 | 10 |
11 #include "src/v8.h" | 11 #include "src/v8.h" |
12 | 12 |
13 #if V8_TARGET_ARCH_X87 | 13 #if V8_TARGET_ARCH_X87 |
14 | 14 |
15 #include "src/cpu.h" | 15 #include "src/assembler.h" |
16 #include "src/macro-assembler.h" | 16 #include "src/macro-assembler.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 void CPU::FlushICache(void* start, size_t size) { | 21 void CpuFeatures::FlushICache(void* start, size_t size) { |
22 // No need to flush the instruction cache on Intel. On Intel instruction | 22 // No need to flush the instruction cache on Intel. On Intel instruction |
23 // cache flushing is only necessary when multiple cores running the same | 23 // cache flushing is only necessary when multiple cores running the same |
24 // code simultaneously. V8 (and JavaScript) is single threaded and when code | 24 // code simultaneously. V8 (and JavaScript) is single threaded and when code |
25 // is patched on an intel CPU the core performing the patching will have its | 25 // is patched on an intel CPU the core performing the patching will have its |
26 // own instruction cache updated automatically. | 26 // own instruction cache updated automatically. |
27 | 27 |
28 // If flushing of the instruction cache becomes necessary Windows has the | 28 // If flushing of the instruction cache becomes necessary Windows has the |
29 // API function FlushInstructionCache. | 29 // API function FlushInstructionCache. |
30 | 30 |
31 // By default, valgrind only checks the stack for writes that might need to | 31 // By default, valgrind only checks the stack for writes that might need to |
32 // invalidate already cached translated code. This leads to random | 32 // invalidate already cached translated code. This leads to random |
33 // instability when code patches or moves are sometimes unnoticed. One | 33 // instability when code patches or moves are sometimes unnoticed. One |
34 // solution is to run valgrind with --smc-check=all, but this comes at a big | 34 // solution is to run valgrind with --smc-check=all, but this comes at a big |
35 // performance cost. We can notify valgrind to invalidate its cache. | 35 // performance cost. We can notify valgrind to invalidate its cache. |
36 #ifdef VALGRIND_DISCARD_TRANSLATIONS | 36 #ifdef VALGRIND_DISCARD_TRANSLATIONS |
37 unsigned res = VALGRIND_DISCARD_TRANSLATIONS(start, size); | 37 unsigned res = VALGRIND_DISCARD_TRANSLATIONS(start, size); |
38 USE(res); | 38 USE(res); |
39 #endif | 39 #endif |
40 } | 40 } |
41 | 41 |
42 } } // namespace v8::internal | 42 } } // namespace v8::internal |
43 | 43 |
44 #endif // V8_TARGET_ARCH_X87 | 44 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |