v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
zapping.h
Go to the documentation of this file.
1// Copyright 2023 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#ifndef V8_HEAP_ZAPPING_H_
6#define V8_HEAP_ZAPPING_H_
7
8#include <cstdint>
9
10#include "include/v8-internal.h"
11#include "src/base/macros.h"
12#include "src/common/globals.h"
13#include "src/flags/flags.h"
14
15namespace v8::internal::heap {
16
17// Zapping is needed for verify heap, and always done in debug builds.
18inline bool ShouldZapGarbage() {
19#ifdef DEBUG
20 return true;
21#else
22#ifdef VERIFY_HEAP
23 return v8_flags.verify_heap;
24#else
25 return false;
26#endif
27#endif
28}
29
30inline uintptr_t ZapValue() {
31 return v8_flags.clear_free_memory ? kClearedFreeMemoryValue : kZapValue;
32}
33
34// Zaps a contiguous block of regular memory [start..(start+size_in_bytes)[ with
35// a given zap value.
36void ZapBlock(Address start, size_t size_in_bytes, uintptr_t zap_value);
37
38// Zaps a contiguous block of code memory [start..(start+size_in_bytes)[ with
39// kCodeZapValue.
40V8_EXPORT_PRIVATE void ZapCodeBlock(Address start, int size_in_bytes);
41
42} // namespace v8::internal::heap
43
44#endif // V8_HEAP_ZAPPING_H_
int start
void ZapBlock(Address start, size_t size, uintptr_t zap_value)
Definition zapping.cc:26
void ZapCodeBlock(Address start, int size_in_bytes)
Definition zapping.cc:14
uintptr_t ZapValue()
Definition zapping.h:30
bool ShouldZapGarbage()
Definition zapping.h:18
constexpr uint32_t kZapValue
Definition globals.h:1005
constexpr uint32_t kClearedFreeMemoryValue
Definition globals.h:1004
V8_EXPORT_PRIVATE FlagValues v8_flags
#define V8_EXPORT_PRIVATE
Definition macros.h:460