|
v8
9.0.257(node16.0.0)
V8 is Google's open source JavaScript engine
|
Go to the documentation of this file.
5 #ifndef INCLUDE_V8_CPPGC_H_
6 #define INCLUDE_V8_CPPGC_H_
12 #include "cppgc/custom-space.h"
13 #include "cppgc/heap-statistics.h"
14 #include "cppgc/internal/write-barrier.h"
15 #include "cppgc/visitor.h"
20 class AllocationHandle;
34 struct WrapperDescriptor
final {
40 using InternalFieldIndex =
int;
49 InternalFieldIndex wrappable_instance_index,
50 uint16_t embedder_id_for_garbage_collected)
167 template <
typename HeapHandleCallback>
170 WriteBarrierParams& params, HeapHandleCallback callback) {
177 cppgc::HeapHandle& handle = callback();
181 params
.heap = &handle;
183 params.type = cppgc::internal::WriteBarrier::Type::kMarking;
205 template <
typename HeapHandleCallback>
207 v8::
Local<
v8::
Object>& wrapper,
int wrapper_index,
const void* wrappable,
208 WriteBarrierParams& params, HeapHandleCallback callback) {
210 CheckWrapper(wrapper, wrapper_index, wrappable);
213 GetWriteBarrierTypeForExternallyReferencedObject(wrappable, params,
225 cppgc::HeapHandle& heap_handle,
229 DijkstraMarkingBarrierSlow(heap_handle, ref);
241 cppgc::HeapHandle& heap_handle,
242 const void* object) {
257 JSHeapConsistency() =
delete;
261 static void DijkstraMarkingBarrierSlow(
cppgc::HeapHandle&,
269 template <
typename T>
static constexpr uint16_t kUnknownEmbedderId
uint16_t embedder_id_for_garbage_collected
static bool IsMarking(const HeapHandle &heap_handle)
CppHeapCreateParams & operator=(const CppHeapCreateParams &)=delete
static std::unique_ptr< CppHeap > Create(v8::Platform *platform, const CppHeapCreateParams ¶ms)
static V8_INLINE WriteBarrierType GetWriteBarrierType(const TracedReferenceBase &ref, WriteBarrierParams ¶ms, HeapHandleCallback callback)
cppgc::HeapHandle & GetHeapHandle()
std::vector< std::unique_ptr< cppgc::CustomSpaceBase > > custom_spaces
InternalFieldIndex wrappable_type_index
WrapperDescriptor wrapper_descriptor
static bool IsAnyIncrementalOrConcurrentMarking()
JSVisitor(cppgc::Visitor::Key key)
static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams ¶ms, cppgc::HeapHandle &heap_handle, const void *object)
cppgc::HeapStatistics CollectStatistics(cppgc::HeapStatistics::DetailLevel detail_level)
cppgc::AllocationHandle & GetAllocationHandle()
static V8_INLINE WriteBarrierType GetWriteBarrierType(v8::Local< v8::Object > &wrapper, int wrapper_index, const void *wrappable, WriteBarrierParams ¶ms, HeapHandleCallback callback)
InternalFieldIndex wrappable_instance_index
bool IsEmptyThreadSafe() const
#define V8_LIKELY(condition)
virtual void Visit(const TracedReferenceBase &ref)
void Trace(const TracedReferenceBase &ref)
static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams ¶ms, cppgc::HeapHandle &heap_handle, const TracedReferenceBase &ref)
constexpr WrapperDescriptor(InternalFieldIndex wrappable_type_index, InternalFieldIndex wrappable_instance_index, uint16_t embedder_id_for_garbage_collected)
CppHeapCreateParams(const CppHeapCreateParams &)=delete
static V8_INLINE void DijkstraMarkingBarrier(const Params ¶ms, const void *object)
virtual ~CppHeap()=default
static void Trace(Visitor *visitor, const v8::TracedReference< T > *self)
friend struct cppgc::TraceTrait
friend class TracedReference
static V8_INLINE void GenerationalBarrier(const WriteBarrierParams ¶ms, const TracedReferenceBase &ref)
static void CheckParams(Type expected_type, const Params ¶ms)