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
3 // found in the LICENSE file.
5 // CPU specific code for ia32 independent of OS goes here.
8 #include "third_party/valgrind/valgrind.h"
13 #if V8_TARGET_ARCH_IA32
16 #include "macro-assembler.h"
21 void CPU::FlushICache(void* start, size_t size) {
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
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
26 // own instruction cache updated automatically.
28 // If flushing of the instruction cache becomes necessary Windows has the
29 // API function FlushInstructionCache.
31 // By default, valgrind only checks the stack for writes that might need to
32 // invalidate already cached translated code. This leads to random
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
35 // performance cost. We can notify valgrind to invalidate its cache.
36 #ifdef VALGRIND_DISCARD_TRANSLATIONS
37 unsigned res = VALGRIND_DISCARD_TRANSLATIONS(start, size);
42 } } // namespace v8::internal
44 #endif // V8_TARGET_ARCH_IA32