v8  9.4.146 (node 16.13.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]);
}
T * MakeGarbageCollected(AllocationHandle &handle, Args &&... args)
Definition: allocation.h:205
constexpr AdditionalBytes(size_t bytes)
Definition: allocation.h:148

Definition at line 147 of file allocation.h.

Constructor & Destructor Documentation

◆ AdditionalBytes()

constexpr AdditionalBytes ( size_t  bytes)
inlineexplicitconstexpr

Definition at line 148 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: