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

#include <allocation.h>

Collaboration diagram for cppgc::AdditionalBytes:

Public Member Functions

constexpr AdditionalBytes (size_t bytes)
 

Public Attributes

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:276
constexpr AdditionalBytes(size_t bytes)
Definition allocation.h:219

Definition at line 218 of file allocation.h.

Constructor & Destructor Documentation

◆ AdditionalBytes()

cppgc::AdditionalBytes::AdditionalBytes ( size_t bytes)
inlineexplicitconstexpr

Definition at line 219 of file allocation.h.

Member Data Documentation

◆ value

const size_t cppgc::AdditionalBytes::value

Definition at line 220 of file allocation.h.


The documentation for this struct was generated from the following file: