v8 10.2.154 (node 18.16.0)
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/trace-trait.h"
13#include "v8config.h" // NOLINT(build/include_directory)
14
15namespace cppgc {
16
17class HeapHandle;
18
19namespace subtle {
20
27class HeapConsistency final {
28 public:
31
46 const void* slot, const void* value, WriteBarrierParams& params) {
47 return internal::WriteBarrier::GetWriteBarrierType(slot, value, params);
48 }
49
64 template <typename HeapHandleCallback>
66 GetWriteBarrierType(const void* slot, WriteBarrierParams& params,
67 HeapHandleCallback callback) {
68 return internal::WriteBarrier::GetWriteBarrierType(slot, params, callback);
69 }
70
84 GetWriteBarrierType(const void* value, WriteBarrierParams& params) {
86 }
87
97 const void* object) {
99 }
100
116 const WriteBarrierParams& params, const void* first_element,
117 size_t element_size, size_t number_of_elements,
118 TraceCallback trace_callback) {
120 params, first_element, element_size, number_of_elements,
121 trace_callback);
122 }
123
134 const void* object) {
136 }
137
148 const void* slot) {
150 }
151
160 const WriteBarrierParams& params, const void* inner_pointer) {
162 inner_pointer);
163 }
164
165 private:
166 HeapConsistency() = delete;
167};
168
179
180 public:
184 static bool IsGarbageCollectionAllowed(HeapHandle& heap_handle);
185
192 static void Enter(HeapHandle& heap_handle);
193
200 static void Leave(HeapHandle& heap_handle);
201
208 explicit DisallowGarbageCollectionScope(HeapHandle& heap_handle);
210
212 delete;
214 const DisallowGarbageCollectionScope&) = delete;
215
216 private:
217 HeapHandle& heap_handle_;
218};
219
229
230 public:
237 static void Enter(HeapHandle& heap_handle);
238
245 static void Leave(HeapHandle& heap_handle);
246
253 explicit NoGarbageCollectionScope(HeapHandle& heap_handle);
255
258
259 private:
260 HeapHandle& heap_handle_;
261};
262
263} // namespace subtle
264} // namespace cppgc
265
266#endif // INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
static V8_INLINE void GenerationalBarrierForSourceObject(const Params &params, const void *inner_pointer)
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 GenerationalBarrier(const Params &params, const void *slot)
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 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:15
void(*)(Visitor *visitor, const void *object) TraceCallback
Definition trace-trait.h:34
#define V8_EXPORT
Definition v8config.h:578
#define V8_INLINE
Definition v8config.h:425
#define V8_NODISCARD
Definition v8config.h:513