|
|
|||
File indexing completed on 2026-09-20 09:15:47
0001 // Copyright 2021 the V8 project authors. All rights reserved. 0002 // Use of this source code is governed by a BSD-style license that can be 0003 // found in the LICENSE file. 0004 0005 #ifndef INCLUDE_V8_ARRAY_BUFFER_H_ 0006 #define INCLUDE_V8_ARRAY_BUFFER_H_ 0007 0008 #include <stddef.h> 0009 0010 #include <memory> 0011 0012 #include "v8-local-handle.h" // NOLINT(build/include_directory) 0013 #include "v8-memory-span.h" // NOLINT(build/include_directory) 0014 #include "v8-object.h" // NOLINT(build/include_directory) 0015 #include "v8-platform.h" // NOLINT(build/include_directory) 0016 #include "v8config.h" // NOLINT(build/include_directory) 0017 0018 namespace v8 { 0019 0020 class SharedArrayBuffer; 0021 0022 #if defined(V8_COMPRESS_POINTERS) && \ 0023 !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE) 0024 class IsolateGroup; 0025 #endif 0026 0027 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 0028 // Defined using gn arg `v8_array_buffer_internal_field_count`. 0029 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 0030 #endif 0031 0032 enum class ArrayBufferCreationMode { kInternalized, kExternalized }; 0033 enum class BackingStoreInitializationMode { kZeroInitialized, kUninitialized }; 0034 enum class BackingStoreOnFailureMode { kReturnNull, kOutOfMemory }; 0035 0036 /** 0037 * A wrapper around the backing store (i.e. the raw memory) of an array buffer. 0038 * See a document linked in http://crbug.com/v8/9908 for more information. 0039 * 0040 * The allocation and destruction of backing stores is generally managed by 0041 * V8. Clients should always use standard C++ memory ownership types (i.e. 0042 * std::unique_ptr and std::shared_ptr) to manage lifetimes of backing stores 0043 * properly, since V8 internal objects may alias backing stores. 0044 * 0045 * This object does not keep the underlying |ArrayBuffer::Allocator| alive by 0046 * default. Use Isolate::CreateParams::array_buffer_allocator_shared when 0047 * creating the Isolate to make it hold a reference to the allocator itself. 0048 */ 0049 class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase { 0050 public: 0051 ~BackingStore(); 0052 0053 /** 0054 * Return a pointer to the beginning of the memory block for this backing 0055 * store. The pointer is only valid as long as this backing store object 0056 * lives. 0057 */ 0058 void* Data() const; 0059 0060 /** 0061 * The length (in bytes) of this backing store. 0062 */ 0063 size_t ByteLength() const; 0064 0065 /** 0066 * The maximum length (in bytes) that this backing store may grow to. 0067 * 0068 * If this backing store was created for a resizable ArrayBuffer or a growable 0069 * SharedArrayBuffer, it is >= ByteLength(). Otherwise it is == 0070 * ByteLength(). 0071 */ 0072 size_t MaxByteLength() const; 0073 0074 /** 0075 * Indicates whether the backing store was created for an ArrayBuffer or 0076 * a SharedArrayBuffer. 0077 */ 0078 bool IsShared() const; 0079 0080 /** 0081 * Indicates whether the backing store is immutable. 0082 */ 0083 bool IsImmutable() const; 0084 0085 /** 0086 * Indicates whether the backing store was created for a resizable ArrayBuffer 0087 * or a growable SharedArrayBuffer, and thus may be resized by user JavaScript 0088 * code. 0089 */ 0090 bool IsResizableByUserJavaScript() const; 0091 0092 /** 0093 * Prevent implicit instantiation of operator delete with size_t argument. 0094 * The size_t argument would be incorrect because ptr points to the 0095 * internal BackingStore object. 0096 */ 0097 void operator delete(void* ptr) { ::operator delete(ptr); } 0098 0099 /** 0100 * This callback is used only if the memory block for a BackingStore cannot be 0101 * allocated with an ArrayBuffer::Allocator. In such cases the destructor of 0102 * the BackingStore invokes the callback to free the memory block. 0103 */ 0104 using DeleterCallback = void (*)(void* data, size_t length, 0105 void* deleter_data); 0106 0107 /** 0108 * If the memory block of a BackingStore is static or is managed manually, 0109 * then this empty deleter along with nullptr deleter_data can be passed to 0110 * ArrayBuffer::NewBackingStore to indicate that. 0111 * 0112 * The manually managed case should be used with caution and only when it 0113 * is guaranteed that the memory block freeing happens after detaching its 0114 * ArrayBuffer. 0115 */ 0116 static void EmptyDeleter(void* data, size_t length, void* deleter_data); 0117 0118 private: 0119 /** 0120 * See [Shared]ArrayBuffer::GetBackingStore and 0121 * [Shared]ArrayBuffer::NewBackingStore. 0122 */ 0123 BackingStore(); 0124 }; 0125 0126 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) 0127 // Use v8::BackingStore::DeleterCallback instead. 0128 using BackingStoreDeleterCallback = void (*)(void* data, size_t length, 0129 void* deleter_data); 0130 0131 #endif 0132 0133 /** 0134 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). 0135 */ 0136 class V8_EXPORT ArrayBuffer : public Object { 0137 public: 0138 /** 0139 * A thread-safe allocator that V8 uses to allocate |ArrayBuffer|'s memory. 0140 * The allocator is a global V8 setting. It has to be set via 0141 * Isolate::CreateParams. 0142 * 0143 * Memory allocated through this allocator by V8 is accounted for as external 0144 * memory by V8. Note that V8 keeps track of the memory for all internalized 0145 * |ArrayBuffer|s. Responsibility for tracking external memory (using 0146 * Isolate::AdjustAmountOfExternalAllocatedMemory) is handed over to the 0147 * embedder upon externalization and taken over upon internalization (creating 0148 * an internalized buffer from an existing buffer). 0149 * 0150 * Note that it is unsafe to call back into V8 from any of the allocator 0151 * functions. 0152 */ 0153 class V8_EXPORT Allocator { 0154 public: 0155 virtual ~Allocator() = default; 0156 0157 /** 0158 * Allocate |length| bytes. Return nullptr if allocation is not successful. 0159 * Memory should be initialized to zeroes. 0160 */ 0161 virtual void* Allocate(size_t length) = 0; 0162 0163 /** 0164 * Allocate |length| bytes. Return nullptr if allocation is not successful. 0165 * Memory does not have to be initialized. 0166 */ 0167 virtual void* AllocateUninitialized(size_t length) = 0; 0168 0169 /** 0170 * Free the memory block of size |length|, pointed to by |data|. 0171 * That memory is guaranteed to be previously allocated by |Allocate|. 0172 */ 0173 virtual void Free(void* data, size_t length) = 0; 0174 0175 /** 0176 * Returns a size_t that determines the largest ArrayBuffer that can be 0177 * allocated. Override if your Allocator is more restrictive than the 0178 * default. Will only be called once, and the value returned will be 0179 * cached. 0180 * Should not return a value that is larger than kMaxByteLength. 0181 */ 0182 virtual size_t MaxAllocationSize() const { return kMaxByteLength; } 0183 0184 /** 0185 * ArrayBuffer allocation mode. kNormal is a malloc/free style allocation, 0186 * while kReservation is for larger allocations with the ability to set 0187 * access permissions. 0188 */ 0189 enum class AllocationMode { kNormal, kReservation }; 0190 0191 /** 0192 * Returns page allocator used by this Allocator instance. 0193 * 0194 * When the sandbox used by Allocator it is expected that this returns 0195 * sandbox's page allocator. 0196 * Otherwise, it should return system page allocator. 0197 */ 0198 virtual PageAllocator* GetPageAllocator() { return nullptr; } 0199 0200 #if defined(V8_COMPRESS_POINTERS) && \ 0201 !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE) 0202 /** 0203 * Convenience allocator. 0204 * 0205 * When the sandbox is enabled, this allocator will allocate its backing 0206 * memory inside the sandbox that belongs to the passed isolate group. 0207 * Otherwise, it will rely on malloc/free. 0208 * 0209 * Caller takes ownership, i.e. the returned object needs to be freed using 0210 * |delete allocator| once it is no longer in use. 0211 */ 0212 static Allocator* NewDefaultAllocator(const IsolateGroup& group); 0213 #endif // defined(V8_COMPRESS_POINTERS) && 0214 // !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE) 0215 0216 /** 0217 * Convenience allocator. 0218 * 0219 * When the sandbox is enabled, this allocator will allocate its backing 0220 * memory inside the default global sandbox. Otherwise, it will rely on 0221 * malloc/free. 0222 * 0223 * Caller takes ownership, i.e. the returned object needs to be freed using 0224 * |delete allocator| once it is no longer in use. 0225 */ 0226 static Allocator* NewDefaultAllocator(); 0227 }; 0228 0229 /** 0230 * Data length in bytes. 0231 */ 0232 size_t ByteLength() const; 0233 0234 /** 0235 * Maximum length in bytes. 0236 */ 0237 size_t MaxByteLength() const; 0238 0239 /** 0240 * Attempt to create a new ArrayBuffer. Allocate |byte_length| bytes. 0241 * Allocated memory will be owned by a created ArrayBuffer and 0242 * will be deallocated when it is garbage-collected, 0243 * unless the object is externalized. If allocation fails, the Maybe 0244 * returned will be empty. 0245 */ 0246 static MaybeLocal<ArrayBuffer> MaybeNew( 0247 Isolate* isolate, size_t byte_length, 0248 BackingStoreInitializationMode initialization_mode = 0249 BackingStoreInitializationMode::kZeroInitialized); 0250 0251 /** 0252 * Create a new ArrayBuffer. Allocate |byte_length| bytes, which are either 0253 * zero-initialized or uninitialized. Allocated memory will be owned by a 0254 * created ArrayBuffer and will be deallocated when it is garbage-collected, 0255 * unless the object is externalized. 0256 */ 0257 static Local<ArrayBuffer> New( 0258 Isolate* isolate, size_t byte_length, 0259 BackingStoreInitializationMode initialization_mode = 0260 BackingStoreInitializationMode::kZeroInitialized); 0261 0262 /** 0263 * Create a new ArrayBuffer with an existing backing store. 0264 * The created array keeps a reference to the backing store until the array 0265 * is garbage collected. Note that the IsExternal bit does not affect this 0266 * reference from the array to the backing store. 0267 * 0268 * In future IsExternal bit will be removed. Until then the bit is set as 0269 * follows. If the backing store does not own the underlying buffer, then 0270 * the array is created in externalized state. Otherwise, the array is created 0271 * in internalized state. In the latter case the array can be transitioned 0272 * to the externalized state using Externalize(backing_store). 0273 */ 0274 static Local<ArrayBuffer> New(Isolate* isolate, 0275 std::shared_ptr<BackingStore> backing_store); 0276 0277 /** 0278 * Returns a new standalone BackingStore that is allocated using the array 0279 * buffer allocator of the isolate. The allocation can either be zero 0280 * initialized, or uninitialized. The result can be later passed to 0281 * ArrayBuffer::New. 0282 * 0283 * If the allocator returns nullptr, then the function may cause GCs in the 0284 * given isolate and re-try the allocation. 0285 * 0286 * If GCs do not help and on_failure is kOutOfMemory, then the 0287 * function will crash with an out-of-memory error. 0288 * 0289 * Otherwise if GCs do not help (or the allocation is too large for GCs to 0290 * help) and on_failure is kReturnNull, then a null result is returned. 0291 */ 0292 static std::unique_ptr<BackingStore> NewBackingStore( 0293 Isolate* isolate, size_t byte_length, 0294 BackingStoreInitializationMode initialization_mode = 0295 BackingStoreInitializationMode::kZeroInitialized, 0296 BackingStoreOnFailureMode on_failure = 0297 BackingStoreOnFailureMode::kOutOfMemory); 0298 0299 /** 0300 * Returns a new standalone BackingStore that takes over the ownership of 0301 * the given buffer. The destructor of the BackingStore invokes the given 0302 * deleter callback. 0303 * 0304 * The result can be later passed to ArrayBuffer::New. The raw pointer 0305 * to the buffer must not be passed again to any V8 API function. 0306 */ 0307 static std::unique_ptr<BackingStore> NewBackingStore( 0308 void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, 0309 void* deleter_data); 0310 0311 /** 0312 * Returns a new resizable standalone BackingStore that is allocated using the 0313 * array buffer allocator of the isolate. The result can be later passed to 0314 * ArrayBuffer::New. 0315 * 0316 * |byte_length| must be <= |max_byte_length|. 0317 * 0318 * This function is usable without an isolate. Unlike |NewBackingStore| calls 0319 * with an isolate, GCs cannot be triggered, and there are no 0320 * retries. Allocation failure will cause the function to crash with an 0321 * out-of-memory error. 0322 */ 0323 static std::unique_ptr<BackingStore> NewResizableBackingStore( 0324 size_t byte_length, size_t max_byte_length); 0325 0326 /** 0327 * Returns true if this ArrayBuffer may be detached. 0328 */ 0329 bool IsDetachable() const; 0330 0331 /** 0332 * Returns true if this ArrayBuffer has been detached. 0333 */ 0334 bool WasDetached() const; 0335 0336 /** 0337 * Returns true if this ArrayBuffer is immutable. 0338 */ 0339 bool IsImmutable() const; 0340 0341 /** 0342 * Detaches this ArrayBuffer and all its views (typed arrays). 0343 * Detaching sets the byte length of the buffer and all typed arrays to zero, 0344 * preventing JavaScript from ever accessing underlying backing store. 0345 * ArrayBuffer should have been externalized and must be detachable. 0346 */ 0347 V8_DEPRECATED( 0348 "Use the version which takes a key parameter (passing a null handle is " 0349 "ok).") 0350 void Detach(); 0351 0352 /** 0353 * Detaches this ArrayBuffer and all its views (typed arrays). 0354 * Detaching sets the byte length of the buffer and all typed arrays to zero, 0355 * preventing JavaScript from ever accessing underlying backing store. 0356 * ArrayBuffer should have been externalized and must be detachable. Returns 0357 * Nothing if the key didn't pass the [[ArrayBufferDetachKey]] check, 0358 * Just(true) otherwise. 0359 */ 0360 V8_WARN_UNUSED_RESULT Maybe<bool> Detach(v8::Local<v8::Value> key); 0361 0362 /** 0363 * Sets the ArrayBufferDetachKey. 0364 */ 0365 void SetDetachKey(v8::Local<v8::Value> key); 0366 0367 /** 0368 * Get a shared pointer to the backing store of this array buffer. This 0369 * pointer coordinates the lifetime management of the internal storage 0370 * with any live ArrayBuffers on the heap, even across isolates. The embedder 0371 * should not attempt to manage lifetime of the storage through other means. 0372 * 0373 * The returned shared pointer will not be empty, even if the ArrayBuffer has 0374 * been detached. Use |WasDetached| to tell if it has been detached instead. 0375 */ 0376 std::shared_ptr<BackingStore> GetBackingStore(); 0377 0378 /** 0379 * More efficient shortcut for 0380 * GetBackingStore()->IsResizableByUserJavaScript(). 0381 */ 0382 bool IsResizableByUserJavaScript() const; 0383 0384 /** 0385 * More efficient shortcut for GetBackingStore()->Data(). The returned pointer 0386 * is valid as long as the ArrayBuffer is alive. 0387 */ 0388 void* Data() const; 0389 0390 V8_INLINE static ArrayBuffer* Cast(Value* value) { 0391 #ifdef V8_ENABLE_CHECKS 0392 CheckCast(value); 0393 #endif 0394 return static_cast<ArrayBuffer*>(value); 0395 } 0396 0397 static constexpr int kInternalFieldCount = 0398 V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; 0399 static constexpr int kEmbedderFieldCount = kInternalFieldCount; 0400 0401 #if V8_ENABLE_SANDBOX 0402 static constexpr size_t kMaxByteLength = 0403 internal::kMaxSafeBufferSizeForSandbox; 0404 #elif V8_HOST_ARCH_32_BIT 0405 static constexpr size_t kMaxByteLength = std::numeric_limits<int>::max(); 0406 #else 0407 // The maximum safe integer (2^53 - 1). 0408 static constexpr size_t kMaxByteLength = 0409 static_cast<size_t>((uint64_t{1} << 53) - 1); 0410 #endif 0411 0412 private: 0413 ArrayBuffer(); 0414 static void CheckCast(Value* obj); 0415 friend class TypedArray; 0416 }; 0417 0418 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 0419 // Defined using gn arg `v8_array_buffer_view_internal_field_count`. 0420 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 0421 #endif 0422 0423 /** 0424 * A base class for an instance of one of "views" over ArrayBuffer, 0425 * including TypedArrays and DataView (ES6 draft 15.13). 0426 */ 0427 class V8_EXPORT ArrayBufferView : public Object { 0428 public: 0429 /** 0430 * Returns underlying ArrayBuffer. 0431 */ 0432 Local<ArrayBuffer> Buffer(); 0433 /** 0434 * Byte offset in |Buffer|. 0435 */ 0436 size_t ByteOffset(); 0437 /** 0438 * Size of a view in bytes. 0439 */ 0440 size_t ByteLength(); 0441 0442 /** 0443 * Copy the contents of the ArrayBufferView's buffer to an embedder defined 0444 * memory without additional overhead that calling ArrayBufferView::Buffer 0445 * might incur. 0446 * 0447 * Will write at most min(|byte_length|, ByteLength) bytes starting at 0448 * ByteOffset of the underlying buffer to the memory starting at |dest|. 0449 * Returns the number of bytes actually written. 0450 */ 0451 size_t CopyContents(void* dest, size_t byte_length); 0452 0453 /** 0454 * Returns the contents of the ArrayBufferView's buffer as a MemorySpan. If 0455 * the contents are on the V8 heap, they get copied into `storage`. Otherwise 0456 * a view into the off-heap backing store is returned. The provided storage 0457 * should be at least as large as the maximum on-heap size of a TypedArray, 0458 * was defined in gn with `typed_array_max_size_in_heap`. The default value is 0459 * 64 bytes. 0460 */ 0461 v8::MemorySpan<uint8_t> GetContents(v8::MemorySpan<uint8_t> storage); 0462 0463 /** 0464 * Returns true if ArrayBufferView's backing ArrayBuffer has already been 0465 * allocated. 0466 */ 0467 bool HasBuffer() const; 0468 0469 V8_INLINE static ArrayBufferView* Cast(Value* value) { 0470 #ifdef V8_ENABLE_CHECKS 0471 CheckCast(value); 0472 #endif 0473 return static_cast<ArrayBufferView*>(value); 0474 } 0475 0476 static constexpr int kInternalFieldCount = 0477 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; 0478 static const int kEmbedderFieldCount = kInternalFieldCount; 0479 0480 private: 0481 ArrayBufferView(); 0482 static void CheckCast(Value* obj); 0483 }; 0484 0485 /** 0486 * An instance of DataView constructor (ES6 draft 15.13.7). 0487 */ 0488 class V8_EXPORT DataView : public ArrayBufferView { 0489 public: 0490 static Local<DataView> New(Local<ArrayBuffer> array_buffer, 0491 size_t byte_offset, size_t length); 0492 static Local<DataView> New(Local<SharedArrayBuffer> shared_array_buffer, 0493 size_t byte_offset, size_t length); 0494 V8_INLINE static DataView* Cast(Value* value) { 0495 #ifdef V8_ENABLE_CHECKS 0496 CheckCast(value); 0497 #endif 0498 return static_cast<DataView*>(value); 0499 } 0500 0501 private: 0502 DataView(); 0503 static void CheckCast(Value* obj); 0504 }; 0505 0506 /** 0507 * An instance of the built-in SharedArrayBuffer constructor. 0508 */ 0509 class V8_EXPORT SharedArrayBuffer : public Object { 0510 public: 0511 /** 0512 * Data length in bytes. 0513 */ 0514 size_t ByteLength() const; 0515 0516 /** 0517 * Maximum length in bytes. 0518 */ 0519 size_t MaxByteLength() const; 0520 0521 /** 0522 * Create a new SharedArrayBuffer. Allocate |byte_length| bytes, which are 0523 * either zero-initialized or uninitialized. Allocated memory will be owned by 0524 * a created SharedArrayBuffer and will be deallocated when it is 0525 * garbage-collected, unless the object is externalized. 0526 */ 0527 static Local<SharedArrayBuffer> New( 0528 Isolate* isolate, size_t byte_length, 0529 BackingStoreInitializationMode initialization_mode = 0530 BackingStoreInitializationMode::kZeroInitialized); 0531 0532 /** 0533 * Create a new SharedArrayBuffer. Allocate |byte_length| bytes, which are 0534 * either zero-initialized or uninitialized. Allocated memory will be owned by 0535 * a created SharedArrayBuffer and will be deallocated when it is 0536 * garbage-collected, unless the object is externalized. If allocation 0537 * fails, the Maybe returned will be empty. 0538 */ 0539 static MaybeLocal<SharedArrayBuffer> MaybeNew( 0540 Isolate* isolate, size_t byte_length, 0541 BackingStoreInitializationMode initialization_mode = 0542 BackingStoreInitializationMode::kZeroInitialized); 0543 0544 /** 0545 * Create a new SharedArrayBuffer with an existing backing store. 0546 * The created array keeps a reference to the backing store until the array 0547 * is garbage collected. Note that the IsExternal bit does not affect this 0548 * reference from the array to the backing store. 0549 * 0550 * In future IsExternal bit will be removed. Until then the bit is set as 0551 * follows. If the backing store does not own the underlying buffer, then 0552 * the array is created in externalized state. Otherwise, the array is created 0553 * in internalized state. In the latter case the array can be transitioned 0554 * to the externalized state using Externalize(backing_store). 0555 */ 0556 static Local<SharedArrayBuffer> New( 0557 Isolate* isolate, std::shared_ptr<BackingStore> backing_store); 0558 0559 /** 0560 * Returns a new standalone BackingStore that is allocated using the array 0561 * buffer allocator of the isolate. The allocation can either be zero 0562 * initialized, or uninitialized. The result can be later passed to 0563 * SharedArrayBuffer::New. 0564 * 0565 * If the allocator returns nullptr, then the function may cause GCs in the 0566 * given isolate and re-try the allocation. 0567 * 0568 * If on_failure is kOutOfMemory and GCs do not help, then the function will 0569 * crash with an out-of-memory error. 0570 * 0571 * Otherwise, if on_failure is kReturnNull and GCs do not help (or the 0572 * byte_length is so large that the allocation cannot succeed), then a null 0573 * result is returned. 0574 */ 0575 static std::unique_ptr<BackingStore> NewBackingStore( 0576 Isolate* isolate, size_t byte_length, 0577 BackingStoreInitializationMode initialization_mode = 0578 BackingStoreInitializationMode::kZeroInitialized, 0579 BackingStoreOnFailureMode on_failure = 0580 BackingStoreOnFailureMode::kOutOfMemory); 0581 0582 /** 0583 * Returns a new standalone BackingStore that takes over the ownership of 0584 * the given buffer. The destructor of the BackingStore invokes the given 0585 * deleter callback. 0586 * 0587 * The result can be later passed to SharedArrayBuffer::New. The raw pointer 0588 * to the buffer must not be passed again to any V8 functions. 0589 */ 0590 static std::unique_ptr<BackingStore> NewBackingStore( 0591 void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, 0592 void* deleter_data); 0593 0594 /** 0595 * Get a shared pointer to the backing store of this array buffer. This 0596 * pointer coordinates the lifetime management of the internal storage 0597 * with any live ArrayBuffers on the heap, even across isolates. The embedder 0598 * should not attempt to manage lifetime of the storage through other means. 0599 */ 0600 std::shared_ptr<BackingStore> GetBackingStore(); 0601 0602 /** 0603 * More efficient shortcut for GetBackingStore()->Data(). The returned pointer 0604 * is valid as long as the ArrayBuffer is alive. 0605 */ 0606 void* Data() const; 0607 0608 V8_INLINE static SharedArrayBuffer* Cast(Value* value) { 0609 #ifdef V8_ENABLE_CHECKS 0610 CheckCast(value); 0611 #endif 0612 return static_cast<SharedArrayBuffer*>(value); 0613 } 0614 0615 static constexpr int kInternalFieldCount = 0616 V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; 0617 0618 private: 0619 SharedArrayBuffer(); 0620 static void CheckCast(Value* obj); 0621 }; 0622 0623 } // namespace v8 0624 0625 #endif // INCLUDE_V8_ARRAY_BUFFER_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|