v8  10.1.124 (node 18.2.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]);
}
V8_INLINE T * MakeGarbageCollected(AllocationHandle &handle, Args &&... args)
Definition: allocation.h:278
constexpr AdditionalBytes(size_t bytes)
Definition: allocation.h:221

Definition at line 220 of file allocation.h.

Constructor & Destructor Documentation

◆ AdditionalBytes()

constexpr AdditionalBytes ( size_t  bytes)
inlineexplicitconstexpr

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