![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
#include <v8-array-buffer.h>
Classes | |
class | Allocator |
Static Public Member Functions | |
static MaybeLocal< ArrayBuffer > | MaybeNew (Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized) |
static Local< ArrayBuffer > | New (Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized) |
static Local< ArrayBuffer > | New (Isolate *isolate, std::shared_ptr< BackingStore > backing_store) |
static std::unique_ptr< BackingStore > | NewBackingStore (Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized, BackingStoreOnFailureMode on_failure=BackingStoreOnFailureMode::kOutOfMemory) |
static std::unique_ptr< BackingStore > | NewBackingStore (void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data) |
static std::unique_ptr< BackingStore > | NewResizableBackingStore (size_t byte_length, size_t max_byte_length) |
static V8_INLINE ArrayBuffer * | Cast (Value *value) |
![]() | |
static V8_INLINE int | InternalFieldCount (const PersistentBase< Object > &object) |
static V8_INLINE int | InternalFieldCount (const BasicTracedReference< Object > &object) |
static V8_INLINE void * | GetAlignedPointerFromInternalField (const PersistentBase< Object > &object, int index) |
static V8_INLINE void * | GetAlignedPointerFromInternalField (const BasicTracedReference< Object > &object, int index) |
template<CppHeapPointerTag tag, typename T = void> | |
static V8_INLINE T * | Unwrap (v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper) |
template<CppHeapPointerTag tag, typename T = void> | |
static V8_INLINE T * | Unwrap (v8::Isolate *isolate, const PersistentBase< Object > &wrapper) |
template<CppHeapPointerTag tag, typename T = void> | |
static V8_INLINE T * | Unwrap (v8::Isolate *isolate, const BasicTracedReference< Object > &wrapper) |
template<typename T = void> | |
static V8_INLINE T * | Unwrap (v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, CppHeapPointerTagRange tag_range) |
template<typename T = void> | |
static V8_INLINE T * | Unwrap (v8::Isolate *isolate, const PersistentBase< Object > &wrapper, CppHeapPointerTagRange tag_range) |
template<typename T = void> | |
static V8_INLINE T * | Unwrap (v8::Isolate *isolate, const BasicTracedReference< Object > &wrapper, CppHeapPointerTagRange tag_range) |
template<CppHeapPointerTag tag> | |
static V8_INLINE void | Wrap (v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, void *wrappable) |
template<CppHeapPointerTag tag> | |
static V8_INLINE void | Wrap (v8::Isolate *isolate, const PersistentBase< Object > &wrapper, void *wrappable) |
template<CppHeapPointerTag tag> | |
static V8_INLINE void | Wrap (v8::Isolate *isolate, const BasicTracedReference< Object > &wrapper, void *wrappable) |
static V8_INLINE void | Wrap (v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, void *wrappable, CppHeapPointerTag tag) |
static V8_INLINE void | Wrap (v8::Isolate *isolate, const PersistentBase< Object > &wrapper, void *wrappable, CppHeapPointerTag tag) |
static V8_INLINE void | Wrap (v8::Isolate *isolate, const BasicTracedReference< Object > &wrapper, void *wrappable, CppHeapPointerTag tag) |
static V8_INLINE MaybeLocal< Context > | GetCreationContext (v8::Isolate *isolate, const PersistentBase< Object > &object) |
static V8_INLINE MaybeLocal< Context > | GetCreationContext (const PersistentBase< Object > &object) |
static V8_INLINE Isolate * | GetIsolate (const TracedReference< Object > &handle) |
static Local< Object > | New (Isolate *isolate) |
static Local< Object > | New (Isolate *isolate, Local< Value > prototype_or_null, Local< Name > *names, Local< Value > *values, size_t length) |
static V8_INLINE Object * | Cast (Value *obj) |
![]() | |
template<class T > | |
static V8_INLINE Value * | Cast (T *value) |
Static Public Attributes | |
static constexpr int | kInternalFieldCount |
static constexpr int | kEmbedderFieldCount = kInternalFieldCount |
static constexpr size_t | kMaxByteLength |
Private Member Functions | |
ArrayBuffer () | |
Static Private Member Functions | |
static void | CheckCast (Value *obj) |
Friends | |
class | TypedArray |
Additional Inherited Members | |
![]() | |
Local< Value > | prototype |
An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
Definition at line 131 of file v8-array-buffer.h.
|
private |
size_t v8::ArrayBuffer::ByteLength | ( | ) | const |
|
inlinestatic |
Definition at line 380 of file v8-array-buffer.h.
|
staticprivate |
void * v8::ArrayBuffer::Data | ( | ) | const |
More efficient shortcut for GetBackingStore()->Data(). The returned pointer is valid as long as the ArrayBuffer is alive.
Definition at line 4039 of file api.cc.
Detaches this ArrayBuffer and all its views (typed arrays). Detaching sets the byte length of the buffer and all typed arrays to zero, preventing JavaScript from ever accessing underlying backing store. ArrayBuffer should have been externalized and must be detachable. Returns Nothing if the key didn't pass the [[ArrayBufferDetachKey]] check, Just(true) otherwise.
Definition at line 8959 of file api.cc.
std::shared_ptr< v8::BackingStore > v8::ArrayBuffer::GetBackingStore | ( | ) |
Get a shared pointer to the backing store of this array buffer. This pointer coordinates the lifetime management of the internal storage with any live ArrayBuffers on the heap, even across isolates. The embedder should not attempt to manage lifetime of the storage through other means.
The returned shared pointer will not be empty, even if the ArrayBuffer has been detached. Use |WasDetached| to tell if it has been detached instead.
Definition at line 4028 of file api.cc.
bool v8::ArrayBuffer::IsDetachable | ( | ) | const |
Returns true if this ArrayBuffer may be detached.
Definition at line 8944 of file api.cc.
bool v8::ArrayBuffer::IsResizableByUserJavaScript | ( | ) | const |
More efficient shortcut for GetBackingStore()->IsResizableByUserJavaScript().
Definition at line 4043 of file api.cc.
size_t v8::ArrayBuffer::MaxByteLength | ( | ) | const |
|
static |
Attempt to create a new ArrayBuffer. Allocate |byte_length| bytes. Allocated memory will be owned by a created ArrayBuffer and will be deallocated when it is garbage-collected, unless the object is externalized. If allocation fails, the Maybe returned will be empty.
Definition at line 9021 of file api.cc.
|
static |
Create a new ArrayBuffer. Allocate |byte_length| bytes, which are either zero-initialized or uninitialized. Allocated memory will be owned by a created ArrayBuffer and will be deallocated when it is garbage-collected, unless the object is externalized.
Definition at line 9044 of file api.cc.
|
static |
Create a new ArrayBuffer with an existing backing store. The created array keeps a reference to the backing store until the array is garbage collected. Note that the IsExternal bit does not affect this reference from the array to the backing store.
In future IsExternal bit will be removed. Until then the bit is set as follows. If the backing store does not own the underlying buffer, then the array is created in externalized state. Otherwise, the array is created in internalized state. In the latter case the array can be transitioned to the externalized state using Externalize(backing_store).
Definition at line 9062 of file api.cc.
|
static |
Returns a new standalone BackingStore that is allocated using the array buffer allocator of the isolate. The allocation can either be zero initialized, or uninitialized. The result can be later passed to ArrayBuffer::New.
If the allocator returns nullptr, then the function may cause GCs in the given isolate and re-try the allocation.
If GCs do not help and on_failure is kOutOfMemory, then the function will crash with an out-of-memory error.
Otherwise if GCs do not help (or the allocation is too large for GCs to help) and on_failure is kReturnNull, then a null result is returned.
|
static |
Returns a new standalone BackingStore that takes over the ownership of the given buffer. The destructor of the BackingStore invokes the given deleter callback.
The result can be later passed to ArrayBuffer::New. The raw pointer to the buffer must not be passed again to any V8 API function.
Definition at line 9109 of file api.cc.
|
static |
Returns a new resizable standalone BackingStore that is allocated using the array buffer allocator of the isolate. The result can be later passed to ArrayBuffer::New.
|byte_length| must be <= |max_byte_length|.
This function is usable without an isolate. Unlike |NewBackingStore| calls with an isolate, GCs cannot be triggered, and there are no retries. Allocation failure will cause the function to crash with an out-of-memory error.
Definition at line 9130 of file api.cc.
v8::ArrayBuffer::V8_DEPRECATED | ( | "Use the version which takes a key parameter (passing a null handle is " "ok)." | ) |
Detaches this ArrayBuffer and all its views (typed arrays). Detaching sets the byte length of the buffer and all typed arrays to zero, preventing JavaScript from ever accessing underlying backing store. ArrayBuffer should have been externalized and must be detachable.
bool v8::ArrayBuffer::WasDetached | ( | ) | const |
Returns true if this ArrayBuffer has been detached.
Definition at line 8948 of file api.cc.
|
friend |
Definition at line 405 of file v8-array-buffer.h.
|
staticconstexpr |
Definition at line 389 of file v8-array-buffer.h.
|
staticconstexpr |
Definition at line 387 of file v8-array-buffer.h.
|
staticconstexpr |
Definition at line 398 of file v8-array-buffer.h.