v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
cppgc::subtle Namespace Reference

Classes

class  DisallowGarbageCollectionScope
 
class  HeapConsistency
 
class  HeapState
 
class  NoGarbageCollectionScope
 
struct  ObjectSizeTrait
 
struct  ObjectSizeTrait< T, false >
 
struct  ObjectSizeTrait< T, true >
 

Typedefs

template<typename T >
using CrossThreadPersistent
 
template<typename T >
using WeakCrossThreadPersistent
 
template<typename T >
using UncompressedMember
 

Functions

template<typename T >
void FreeUnreferencedObject (HeapHandle &heap_handle, T &object)
 
template<typename T >
bool Resize (T &object, AdditionalBytes additional_bytes)
 

Typedef Documentation

◆ CrossThreadPersistent

template<typename T >
using cppgc::subtle::CrossThreadPersistent
Initial value:
internal::BasicCrossThreadPersistent<
T, internal::StrongCrossThreadPersistentPolicy>
#define T

DO NOT USE: Has known caveats, see below.

CrossThreadPersistent allows retaining objects from threads other than the thread the owning heap is operating on.

Known caveats:

  • Does not protect the heap owning an object from terminating.
  • Reaching transitively through the graph is unsupported as objects may be moved concurrently on the thread owning the object.

Definition at line 445 of file cross-thread-persistent.h.

◆ UncompressedMember

template<typename T >
using cppgc::subtle::UncompressedMember
Initial value:
internal::BasicMember<
T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy,
internal::DefaultMemberCheckingPolicy, internal::RawPointer>

UncompressedMember. Use with care in hot paths that would otherwise cause many decompression cycles.

Definition at line 599 of file member.h.

◆ WeakCrossThreadPersistent

template<typename T >
using cppgc::subtle::WeakCrossThreadPersistent
Initial value:
internal::BasicCrossThreadPersistent<
T, internal::WeakCrossThreadPersistentPolicy>

DO NOT USE: Has known caveats, see below.

CrossThreadPersistent allows weakly retaining objects from threads other than the thread the owning heap is operating on.

Known caveats:

  • Does not protect the heap owning an object from terminating.
  • Reaching transitively through the graph is unsupported as objects may be moved concurrently on the thread owning the object.

Definition at line 460 of file cross-thread-persistent.h.

Function Documentation

◆ FreeUnreferencedObject()

template<typename T >
void cppgc::subtle::FreeUnreferencedObject ( HeapHandle & heap_handle,
T & object )

Informs the garbage collector that object can be immediately reclaimed. The destructor may not be invoked immediately but only on next garbage collection.

It is up to the embedder to guarantee that no other object holds a reference to object after calling FreeUnreferencedObject(). In case such a reference exists, it's use results in a use-after-free.

To aid in using the API, FreeUnreferencedObject() may be called from destructors on objects that would be reclaimed in the same garbage collection cycle.

Parameters
heap_handleThe corresponding heap.
objectReference to an object that is of type GarbageCollected and should be immediately reclaimed.

Definition at line 61 of file explicit-management.h.

◆ Resize()

template<typename T >
bool cppgc::subtle::Resize ( T & object,
AdditionalBytes additional_bytes )

Tries to resize object of type T with additional bytes on top of sizeof(T). Resizing is only useful with trailing inlined storage, see e.g. MakeGarbageCollected(AllocationHandle&, AdditionalBytes).

Resize() performs growing or shrinking as needed and may skip the operation for internal reasons, see return value.

It is up to the embedder to guarantee that in case of shrinking a larger object down, the reclaimed area is not used anymore. Any subsequent use results in a use-after-free.

The object must be live when calling Resize().

Parameters
objectReference to an object that is of type GarbageCollected and should be resized.
additional_bytesBytes in addition to sizeof(T) that the object should provide.
Returns
true when the operation was successful and the result can be relied on, and false otherwise.

Definition at line 90 of file explicit-management.h.