v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
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_
static V8_INLINE void GenerationalBarrier(const Params &params, const void *slot)
static V8_INLINE void DijkstraMarkingBarrier(const Params &params, const void *object)
static V8_INLINE Type GetWriteBarrierType(const void *slot, const void *value, Params &params)
static V8_INLINE void SteeleMarkingBarrier(const Params &params, const void *object)
static V8_INLINE void DijkstraMarkingBarrierRange(const Params &params, const void *first_element, size_t element_size, size_t number_of_elements, TraceCallback trace_callback)
static void Enter(HeapHandle &heap_handle)
DisallowGarbageCollectionScope(const DisallowGarbageCollectionScope &)=delete
static bool IsGarbageCollectionAllowed(HeapHandle &heap_handle)
DisallowGarbageCollectionScope(HeapHandle &heap_handle)
DisallowGarbageCollectionScope & operator=(const DisallowGarbageCollectionScope &)=delete
static void Leave(HeapHandle &heap_handle)
internal::WriteBarrier::Type WriteBarrierType
static V8_INLINE WriteBarrierType GetWriteBarrierType(const void *slot, const void *value, WriteBarrierParams &params)
static V8_INLINE void GenerationalBarrier(const WriteBarrierParams &params, const void *slot)
static V8_INLINE void SteeleWriteBarrier(const WriteBarrierParams &params, const void *object)
static V8_INLINE WriteBarrierType GetWriteBarrierType(const void *value, WriteBarrierParams &params)
static V8_INLINE void GenerationalBarrierForUncompressedSlot(const WriteBarrierParams &params, const void *uncompressed_slot)
static V8_INLINE WriteBarrierType GetWriteBarrierType(const internal::BasicMember< T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy, StorageType > &value, WriteBarrierParams &params)
static V8_INLINE void DijkstraWriteBarrier(const WriteBarrierParams &params, const void *object)
static V8_INLINE WriteBarrierType GetWriteBarrierType(const void *slot, WriteBarrierParams &params, HeapHandleCallback callback)
static V8_INLINE void GenerationalBarrierForSourceObject(const WriteBarrierParams &params, const void *inner_pointer)
static V8_INLINE void DijkstraWriteBarrierRange(const WriteBarrierParams &params, const void *first_element, size_t element_size, size_t number_of_elements, TraceCallback trace_callback)
NoGarbageCollectionScope & operator=(const NoGarbageCollectionScope &)=delete
static void Enter(HeapHandle &heap_handle)
NoGarbageCollectionScope(const NoGarbageCollectionScope &)=delete
NoGarbageCollectionScope(HeapHandle &heap_handle)
static void Leave(HeapHandle &heap_handle)
#define CPPGC_STACK_ALLOCATED()
Definition macros.h:29
void(*)(Visitor *visitor, const void *object) TraceCallback
Definition trace-trait.h:38
#define V8_EXPORT
Definition v8config.h:753
#define V8_INLINE
Definition v8config.h:477
#define V8_NODISCARD
Definition v8config.h:650