v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
object-poisoner.h
Go to the documentation of this file.
1// Copyright 2021 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_CPPGC_OBJECT_POISONER_H_
6#define V8_HEAP_CPPGC_OBJECT_POISONER_H_
7
13
14namespace cppgc {
15namespace internal {
16
17#ifdef V8_USE_ADDRESS_SANITIZER
18
19// Poisons the payload of unmarked objects.
20class UnmarkedObjectsPoisoner : public HeapVisitor<UnmarkedObjectsPoisoner> {
21 friend class HeapVisitor<UnmarkedObjectsPoisoner>;
22
23 private:
24 bool VisitHeapObjectHeader(HeapObjectHeader& header) {
25 if (header.IsFree() || header.IsMarked()) return true;
26
27 ASAN_POISON_MEMORY_REGION(header.ObjectStart(),
28 ObjectView<>(header).Size());
29 return true;
30 }
31};
32
33#endif // V8_USE_ADDRESS_SANITIZER
34
35} // namespace internal
36} // namespace cppgc
37
38#endif // V8_HEAP_CPPGC_OBJECT_POISONER_H_
#define ASAN_POISON_MEMORY_REGION(start, size)
Definition asan.h:64