v8  9.0.257(node16.0.0)
V8 is Google's open source JavaScript engine
AdditionalBytes Struct Reference

#include <allocation.h>

Public Member Functions

constexpr AdditionalBytes (size_t bytes)
 

Data Fields

const size_t value
 

Detailed Description

Passed to MakeGarbageCollected to specify how many bytes should be appended to the allocated object.

Example:

class InlinedArray final : public GarbageCollected<InlinedArray> {
public:
explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}
void Trace(Visitor*) const {}
size_t size;
char* byte_array;
};
auto* inlined_array = MakeGarbageCollected<InlinedArray(
GetAllocationHandle(), AdditionalBytes(4), 4);
for (size_t i = 0; i < 4; i++) {
Process(inlined_array->byte_array[i]);
}

Definition at line 143 of file allocation.h.

Constructor & Destructor Documentation

◆ AdditionalBytes()

constexpr AdditionalBytes ( size_t  bytes)
inlineexplicitconstexpr

Definition at line 144 of file allocation.h.

References AdditionalBytes::value.

Field Documentation

◆ value

const size_t value

The documentation for this struct was generated from the following file:
cppgc::MakeGarbageCollected
T * MakeGarbageCollected(AllocationHandle &handle, Args &&... args)
Definition: allocation.h:201
cppgc::AdditionalBytes::AdditionalBytes
constexpr AdditionalBytes(size_t bytes)
Definition: allocation.h:144