v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
cpu-x64.cc
Go to the documentation of this file.
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
3// found in the LICENSE file.
4
5// CPU specific code for x64 independent of OS goes here.
6
7#if V8_TARGET_ARCH_X64
8
10#if defined(__GNUC__) && !defined(__MINGW64__) && !defined(GOOGLE3)
11#include "third_party/valgrind/valgrind.h"
12#endif
13
14namespace v8 {
15namespace internal {
16
17void CpuFeatures::FlushICache(void* start, size_t size) {
18 // No need to flush the instruction cache on Intel. On Intel instruction
19 // cache flushing is only necessary when multiple cores running the same
20 // code simultaneously. V8 (and JavaScript) is single threaded and when code
21 // is patched on an intel CPU the core performing the patching will have its
22 // own instruction cache updated automatically.
23
24 // If flushing of the instruction cache becomes necessary Windows has the
25 // API function FlushInstructionCache.
26
27 // By default, valgrind only checks the stack for writes that might need to
28 // invalidate already cached translated code. This leads to random
29 // instability when code patches or moves are sometimes unnoticed. One
30 // solution is to run valgrind with --smc-check=all, but this comes at a big
31 // performance cost. We can notify valgrind to invalidate its cache.
32#ifdef VALGRIND_DISCARD_TRANSLATIONS
33 unsigned res = VALGRIND_DISCARD_TRANSLATIONS(start, size);
34 USE(res);
35#endif
36}
37
38} // namespace internal
39} // namespace v8
40
41#endif // V8_TARGET_ARCH_X64
static void FlushICache(void *start, size_t size)
Definition cpu-riscv.cc:15
int start
#define USE(...)
Definition macros.h:293