Loading...
Searching...
No Matches
heap-consistency.h
Go to the documentation of this file.
1// Copyright 2020 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 INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
6#define INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
7
8#include <cstddef>
9
11#include "cppgc/macros.h"
12#include "cppgc/member.h"
13#include "cppgc/trace-trait.h"
14#include "v8config.h" // NOLINT(build/include_directory)
15
16namespace cppgc {
17
18class HeapHandle;
19
20namespace subtle {
21
28class HeapConsistency final {
29 public:
32
47 const void* slot, const void* value, WriteBarrierParams& params) {
48 return internal::WriteBarrier::GetWriteBarrierType(slot, value, params);
49 }
50
64 template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
65 typename CheckingPolicy, typename StorageType>
67 const internal::BasicMember<T, WeaknessTag, WriteBarrierPolicy,
68 CheckingPolicy, StorageType>& value,
69 WriteBarrierParams& params) {
71 value.GetRawSlot(), value.GetRawStorage(), params);
72 }
73
88 template <typename HeapHandleCallback>
90 GetWriteBarrierType(const void* slot, WriteBarrierParams& params,
91 HeapHandleCallback callback) {
92 return internal::WriteBarrier::GetWriteBarrierType(slot, params, callback);
93 }
94
108 GetWriteBarrierType(const void* value, WriteBarrierParams& params) {
110 }
111
121 const void* object) {
123 }
124
140 const WriteBarrierParams& params, const void* first_element,
141 size_t element_size, size_t number_of_elements,
142 TraceCallback trace_callback) {
144 params, first_element, element_size, number_of_elements,
145 trace_callback);
146 }
147
158 const void* object) {
160 }
161
172 const void* slot) {
175 slot);
176 }
177
188 const WriteBarrierParams& params, const void* uncompressed_slot) {
190 internal::WriteBarrier::GenerationalBarrierType::
191 kPreciseUncompressedSlot>(params, uncompressed_slot);
192 }
193
202 const WriteBarrierParams& params, const void* inner_pointer) {
205 params, inner_pointer);
206 }
207
208 private:
209 HeapConsistency() = delete;
210};
211
222
223 public:
227 static bool IsGarbageCollectionAllowed(HeapHandle& heap_handle);
228
235 static void Enter(HeapHandle& heap_handle);
236
243 static void Leave(HeapHandle& heap_handle);
244
253
255 delete;
257 const DisallowGarbageCollectionScope&) = delete;
258
259 private:
260 HeapHandle& heap_handle_;
261};
262
272
273 public:
280 static void Enter(HeapHandle& heap_handle);
281
288 static void Leave(HeapHandle& heap_handle);
289
296 explicit NoGarbageCollectionScope(HeapHandle& heap_handle);
298
301
302 private:
303 HeapHandle& heap_handle_;
304};
305
306} // namespace subtle
307} // namespace cppgc
308
309#endif // INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
Definition: heap-handle.h:21
Definition: member.h:77
Type
Definition: write-barrier.h:41
static Type GetWriteBarrierType(const void *slot, const void *value, Params &params)
Definition: write-barrier.h:388
static void DijkstraMarkingBarrierRange(const Params &params, const void *first_element, size_t element_size, size_t number_of_elements, TraceCallback trace_callback)
Definition: write-barrier.h:431
static void GenerationalBarrier(const Params &params, const void *slot)
Definition: write-barrier.h:105
static void SteeleMarkingBarrier(const Params &params, const void *object)
Definition: write-barrier.h:442
static void DijkstraMarkingBarrier(const Params &params, const void *object)
Definition: write-barrier.h:419
Definition: heap-consistency.h:220
DisallowGarbageCollectionScope(HeapHandle &heap_handle)
static bool IsGarbageCollectionAllowed(HeapHandle &heap_handle)
static void Leave(HeapHandle &heap_handle)
DisallowGarbageCollectionScope(const DisallowGarbageCollectionScope &)=delete
DisallowGarbageCollectionScope & operator=(const DisallowGarbageCollectionScope &)=delete
static void Enter(HeapHandle &heap_handle)
Definition: heap-consistency.h:28
static WriteBarrierType GetWriteBarrierType(const internal::BasicMember< T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy, StorageType > &value, WriteBarrierParams &params)
Definition: heap-consistency.h:66
static void DijkstraWriteBarrierRange(const WriteBarrierParams &params, const void *first_element, size_t element_size, size_t number_of_elements, TraceCallback trace_callback)
Definition: heap-consistency.h:139
static void GenerationalBarrier(const WriteBarrierParams &params, const void *slot)
Definition: heap-consistency.h:171
static void GenerationalBarrierForUncompressedSlot(const WriteBarrierParams &params, const void *uncompressed_slot)
Definition: heap-consistency.h:187
static WriteBarrierType GetWriteBarrierType(const void *value, WriteBarrierParams &params)
Definition: heap-consistency.h:108
static WriteBarrierType GetWriteBarrierType(const void *slot, WriteBarrierParams &params, HeapHandleCallback callback)
Definition: heap-consistency.h:90
static void GenerationalBarrierForSourceObject(const WriteBarrierParams &params, const void *inner_pointer)
Definition: heap-consistency.h:201
internal::WriteBarrier::Type WriteBarrierType
Definition: heap-consistency.h:31
static void DijkstraWriteBarrier(const WriteBarrierParams &params, const void *object)
Definition: heap-consistency.h:120
static WriteBarrierType GetWriteBarrierType(const void *slot, const void *value, WriteBarrierParams &params)
Definition: heap-consistency.h:46
static void SteeleWriteBarrier(const WriteBarrierParams &params, const void *object)
Definition: heap-consistency.h:157
Definition: heap-consistency.h:270
NoGarbageCollectionScope & operator=(const NoGarbageCollectionScope &)=delete
static void Leave(HeapHandle &heap_handle)
static void Enter(HeapHandle &heap_handle)
NoGarbageCollectionScope(const NoGarbageCollectionScope &)=delete
NoGarbageCollectionScope(HeapHandle &heap_handle)
#define CPPGC_STACK_ALLOCATED()
Definition: macros.h:29
Definition: allocation.h:38
void(*)(Visitor *visitor, const void *object) TraceCallback
Definition: trace-trait.h:38
Definition: write-barrier.h:53
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_NODISCARD
Definition: v8config.h:682