libv8-node 20.12.1.0-arm64-darwin → 22.5.1.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +24 -5
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +16 -6
- data/vendor/v8/include/cppgc/internal/caged-heap.h +12 -5
- data/vendor/v8/include/cppgc/internal/gc-info.h +82 -91
- data/vendor/v8/include/cppgc/internal/member-storage.h +16 -8
- data/vendor/v8/include/cppgc/member.h +25 -0
- data/vendor/v8/include/cppgc/persistent.h +4 -0
- data/vendor/v8/include/cppgc/platform.h +6 -1
- data/vendor/v8/include/cppgc/sentinel-pointer.h +7 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -78
- data/vendor/v8/include/cppgc/trace-trait.h +8 -0
- data/vendor/v8/include/cppgc/type-traits.h +25 -4
- data/vendor/v8/include/cppgc/visitor.h +82 -4
- data/vendor/v8/include/libplatform/libplatform.h +7 -1
- data/vendor/v8/include/v8-array-buffer.h +6 -0
- data/vendor/v8/include/v8-callbacks.h +57 -19
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +58 -32
- data/vendor/v8/include/v8-embedder-heap.h +31 -3
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +15 -9
- data/vendor/v8/include/v8-fast-api-calls.h +58 -31
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +135 -30
- data/vendor/v8/include/v8-function.h +6 -0
- data/vendor/v8/include/v8-handle-base.h +137 -0
- data/vendor/v8/include/v8-inspector.h +35 -13
- data/vendor/v8/include/v8-internal.h +510 -71
- data/vendor/v8/include/v8-isolate.h +176 -100
- data/vendor/v8/include/v8-local-handle.h +383 -112
- data/vendor/v8/include/v8-memory-span.h +157 -2
- data/vendor/v8/include/v8-message.h +22 -3
- data/vendor/v8/include/v8-metrics.h +1 -0
- data/vendor/v8/include/v8-object.h +98 -77
- data/vendor/v8/include/v8-persistent-handle.h +68 -90
- data/vendor/v8/include/v8-platform.h +191 -23
- data/vendor/v8/include/v8-primitive.h +12 -8
- data/vendor/v8/include/v8-profiler.h +16 -2
- data/vendor/v8/include/v8-script.h +88 -14
- data/vendor/v8/include/v8-snapshot.h +96 -22
- data/vendor/v8/include/v8-source-location.h +92 -0
- data/vendor/v8/include/v8-statistics.h +31 -10
- data/vendor/v8/include/v8-template.h +410 -131
- data/vendor/v8/include/v8-traced-handle.h +108 -90
- data/vendor/v8/include/v8-typed-array.h +115 -7
- data/vendor/v8/include/v8-unwinder.h +1 -1
- data/vendor/v8/include/v8-util.h +23 -20
- data/vendor/v8/include/v8-value-serializer.h +14 -0
- data/vendor/v8/include/v8-value.h +105 -3
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8config.h +54 -20
- metadata +5 -3
@@ -27,14 +27,20 @@ namespace internal {
|
|
27
27
|
|
28
28
|
class BasicTracedReferenceExtractor;
|
29
29
|
|
30
|
-
enum class
|
30
|
+
enum class TracedReferenceStoreMode {
|
31
31
|
kInitializingStore,
|
32
32
|
kAssigningStore,
|
33
33
|
};
|
34
34
|
|
35
|
+
enum class TracedReferenceHandling {
|
36
|
+
kDefault, // See EmbedderRootsHandler::IsRoot().
|
37
|
+
kDroppable
|
38
|
+
};
|
39
|
+
|
35
40
|
V8_EXPORT internal::Address* GlobalizeTracedReference(
|
36
|
-
internal::Isolate* isolate, internal::Address
|
37
|
-
internal::Address* slot,
|
41
|
+
internal::Isolate* isolate, internal::Address value,
|
42
|
+
internal::Address* slot, TracedReferenceStoreMode store_mode,
|
43
|
+
internal::TracedReferenceHandling reference_handling);
|
38
44
|
V8_EXPORT void MoveTracedReference(internal::Address** from,
|
39
45
|
internal::Address** to);
|
40
46
|
V8_EXPORT void CopyTracedReference(const internal::Address* const* from,
|
@@ -43,14 +49,12 @@ V8_EXPORT void DisposeTracedReference(internal::Address* global_handle);
|
|
43
49
|
|
44
50
|
} // namespace internal
|
45
51
|
|
46
|
-
|
52
|
+
/**
|
53
|
+
* An indirect handle, where the indirect pointer points to a GlobalHandles
|
54
|
+
* node.
|
55
|
+
*/
|
56
|
+
class TracedReferenceBase : public api_internal::IndirectHandleBase {
|
47
57
|
public:
|
48
|
-
/**
|
49
|
-
* Returns true if the reference is empty, i.e., has not been assigned
|
50
|
-
* object.
|
51
|
-
*/
|
52
|
-
bool IsEmpty() const { return val_ == nullptr; }
|
53
|
-
|
54
58
|
/**
|
55
59
|
* If non-empty, destroy the underlying storage cell. |IsEmpty| will return
|
56
60
|
* true after this call.
|
@@ -60,10 +64,9 @@ class TracedReferenceBase {
|
|
60
64
|
/**
|
61
65
|
* Construct a Local<Value> from this handle.
|
62
66
|
*/
|
63
|
-
V8_INLINE
|
67
|
+
V8_INLINE Local<Value> Get(Isolate* isolate) const {
|
64
68
|
if (IsEmpty()) return Local<Value>();
|
65
|
-
return Local<Value>::New(isolate,
|
66
|
-
internal::ValueHelper::SlotAsValue<Value>(val_));
|
69
|
+
return Local<Value>::New(isolate, this->value<Value>());
|
67
70
|
}
|
68
71
|
|
69
72
|
/**
|
@@ -74,23 +77,14 @@ class TracedReferenceBase {
|
|
74
77
|
return this->GetSlotThreadSafe() == nullptr;
|
75
78
|
}
|
76
79
|
|
77
|
-
/**
|
78
|
-
* Assigns a wrapper class ID to the handle.
|
79
|
-
*/
|
80
|
-
V8_INLINE void SetWrapperClassId(uint16_t class_id);
|
81
|
-
|
82
|
-
/**
|
83
|
-
* Returns the class ID previously assigned to this handle or 0 if no class ID
|
84
|
-
* was previously assigned.
|
85
|
-
*/
|
86
|
-
V8_INLINE uint16_t WrapperClassId() const;
|
87
|
-
|
88
80
|
protected:
|
81
|
+
V8_INLINE TracedReferenceBase() = default;
|
82
|
+
|
89
83
|
/**
|
90
84
|
* Update this reference in a thread-safe way.
|
91
85
|
*/
|
92
86
|
void SetSlotThreadSafe(void* new_val) {
|
93
|
-
reinterpret_cast<std::atomic<void*>*>(&
|
87
|
+
reinterpret_cast<std::atomic<void*>*>(&slot())->store(
|
94
88
|
new_val, std::memory_order_relaxed);
|
95
89
|
}
|
96
90
|
|
@@ -98,19 +92,13 @@ class TracedReferenceBase {
|
|
98
92
|
* Get this reference in a thread-safe way
|
99
93
|
*/
|
100
94
|
const void* GetSlotThreadSafe() const {
|
101
|
-
return reinterpret_cast<std::atomic<const void*> const*>(&
|
95
|
+
return reinterpret_cast<std::atomic<const void*> const*>(&slot())->load(
|
102
96
|
std::memory_order_relaxed);
|
103
97
|
}
|
104
98
|
|
105
99
|
V8_EXPORT void CheckValue() const;
|
106
100
|
|
107
|
-
V8_INLINE internal::Address address() const { return *val_; }
|
108
|
-
|
109
|
-
// val_ points to a GlobalHandles node.
|
110
|
-
internal::Address* val_ = nullptr;
|
111
|
-
|
112
101
|
friend class internal::BasicTracedReferenceExtractor;
|
113
|
-
friend class internal::HandleHelper;
|
114
102
|
template <typename F>
|
115
103
|
friend class Local;
|
116
104
|
template <typename U>
|
@@ -139,12 +127,7 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
139
127
|
/**
|
140
128
|
* Construct a Local<T> from this handle.
|
141
129
|
*/
|
142
|
-
Local<T> Get(Isolate* isolate) const {
|
143
|
-
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
|
144
|
-
if (val_ == nullptr) return Local<T>();
|
145
|
-
#endif
|
146
|
-
return Local<T>::New(isolate, *this);
|
147
|
-
}
|
130
|
+
Local<T> Get(Isolate* isolate) const { return Local<T>::New(isolate, *this); }
|
148
131
|
|
149
132
|
template <class S>
|
150
133
|
V8_INLINE BasicTracedReference<S>& As() const {
|
@@ -152,28 +135,27 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
152
135
|
const_cast<BasicTracedReference<T>&>(*this));
|
153
136
|
}
|
154
137
|
|
155
|
-
|
138
|
+
V8_DEPRECATE_SOON("Use Get to convert to Local instead")
|
139
|
+
V8_INLINE T* operator->() const {
|
156
140
|
#ifdef V8_ENABLE_CHECKS
|
157
141
|
CheckValue();
|
158
142
|
#endif // V8_ENABLE_CHECKS
|
159
|
-
return
|
160
|
-
}
|
161
|
-
T* operator*() const {
|
162
|
-
#ifdef V8_ENABLE_CHECKS
|
163
|
-
CheckValue();
|
164
|
-
#endif // V8_ENABLE_CHECKS
|
165
|
-
return reinterpret_cast<T*>(val_);
|
143
|
+
return this->template value<T>();
|
166
144
|
}
|
167
145
|
|
146
|
+
V8_DEPRECATE_SOON("Use Get to convert to Local instead")
|
147
|
+
V8_INLINE T* operator*() const { return this->operator->(); }
|
148
|
+
|
168
149
|
private:
|
169
150
|
/**
|
170
151
|
* An empty BasicTracedReference without storage cell.
|
171
152
|
*/
|
172
153
|
BasicTracedReference() = default;
|
173
154
|
|
174
|
-
V8_INLINE static internal::Address*
|
175
|
-
Isolate* isolate, T* that,
|
176
|
-
internal::
|
155
|
+
V8_INLINE static internal::Address* NewFromNonEmptyValue(
|
156
|
+
Isolate* isolate, T* that, internal::Address** slot,
|
157
|
+
internal::TracedReferenceStoreMode store_mode,
|
158
|
+
internal::TracedReferenceHandling reference_handling);
|
177
159
|
|
178
160
|
template <typename F>
|
179
161
|
friend class Local;
|
@@ -194,12 +176,14 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
194
176
|
template <typename T>
|
195
177
|
class TracedReference : public BasicTracedReference<T> {
|
196
178
|
public:
|
179
|
+
struct IsDroppable {};
|
180
|
+
|
197
181
|
using BasicTracedReference<T>::Reset;
|
198
182
|
|
199
183
|
/**
|
200
184
|
* An empty TracedReference without storage cell.
|
201
185
|
*/
|
202
|
-
TracedReference()
|
186
|
+
V8_INLINE TracedReference() = default;
|
203
187
|
|
204
188
|
/**
|
205
189
|
* Construct a TracedReference from a Local.
|
@@ -209,9 +193,35 @@ class TracedReference : public BasicTracedReference<T> {
|
|
209
193
|
*/
|
210
194
|
template <class S>
|
211
195
|
TracedReference(Isolate* isolate, Local<S> that) : BasicTracedReference<T>() {
|
212
|
-
this->val_ = this->New(isolate, *that, &this->val_,
|
213
|
-
internal::GlobalHandleStoreMode::kInitializingStore);
|
214
196
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
197
|
+
if (V8_UNLIKELY(that.IsEmpty())) {
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
this->slot() = this->NewFromNonEmptyValue(
|
201
|
+
isolate, *that, &this->slot(),
|
202
|
+
internal::TracedReferenceStoreMode::kInitializingStore,
|
203
|
+
internal::TracedReferenceHandling::kDefault);
|
204
|
+
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Construct a droppable TracedReference from a Local. Droppable means that V8
|
208
|
+
* is free to reclaim the pointee if it is unmodified and otherwise
|
209
|
+
* unreachable
|
210
|
+
*
|
211
|
+
* When the Local is non-empty, a new storage cell is created
|
212
|
+
* pointing to the same object.
|
213
|
+
*/
|
214
|
+
template <class S>
|
215
|
+
TracedReference(Isolate* isolate, Local<S> that, IsDroppable)
|
216
|
+
: BasicTracedReference<T>() {
|
217
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
218
|
+
if (V8_UNLIKELY(that.IsEmpty())) {
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
this->slot() = this->NewFromNonEmptyValue(
|
222
|
+
isolate, *that, &this->slot(),
|
223
|
+
internal::TracedReferenceStoreMode::kInitializingStore,
|
224
|
+
internal::TracedReferenceHandling::kDroppable);
|
215
225
|
}
|
216
226
|
|
217
227
|
/**
|
@@ -275,12 +285,19 @@ class TracedReference : public BasicTracedReference<T> {
|
|
275
285
|
V8_INLINE TracedReference& operator=(const TracedReference<S>& rhs);
|
276
286
|
|
277
287
|
/**
|
278
|
-
*
|
279
|
-
*
|
288
|
+
* Always resets the reference. Creates a new reference from `other` if it is
|
289
|
+
* non-empty.
|
280
290
|
*/
|
281
291
|
template <class S>
|
282
292
|
V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
|
283
293
|
|
294
|
+
/**
|
295
|
+
* Always resets the reference. Creates a new reference from `other` if it is
|
296
|
+
* non-empty. The new reference is droppable, see constructor.
|
297
|
+
*/
|
298
|
+
template <class S>
|
299
|
+
V8_INLINE void Reset(Isolate* isolate, const Local<S>& other, IsDroppable);
|
300
|
+
|
284
301
|
template <class S>
|
285
302
|
V8_INLINE TracedReference<S>& As() const {
|
286
303
|
return reinterpret_cast<TracedReference<S>&>(
|
@@ -290,19 +307,22 @@ class TracedReference : public BasicTracedReference<T> {
|
|
290
307
|
|
291
308
|
// --- Implementation ---
|
292
309
|
template <class T>
|
293
|
-
internal::Address* BasicTracedReference<T>::
|
294
|
-
Isolate* isolate, T* that,
|
295
|
-
internal::
|
296
|
-
|
297
|
-
internal::Address* p = reinterpret_cast<internal::Address*>(that);
|
310
|
+
internal::Address* BasicTracedReference<T>::NewFromNonEmptyValue(
|
311
|
+
Isolate* isolate, T* that, internal::Address** slot,
|
312
|
+
internal::TracedReferenceStoreMode store_mode,
|
313
|
+
internal::TracedReferenceHandling reference_handling) {
|
298
314
|
return internal::GlobalizeTracedReference(
|
299
|
-
reinterpret_cast<internal::Isolate*>(isolate),
|
300
|
-
|
315
|
+
reinterpret_cast<internal::Isolate*>(isolate),
|
316
|
+
internal::ValueHelper::ValueAsAddress(that),
|
317
|
+
reinterpret_cast<internal::Address*>(slot), store_mode,
|
318
|
+
reference_handling);
|
301
319
|
}
|
302
320
|
|
303
321
|
void TracedReferenceBase::Reset() {
|
304
|
-
if (IsEmpty())
|
305
|
-
|
322
|
+
if (V8_UNLIKELY(IsEmpty())) {
|
323
|
+
return;
|
324
|
+
}
|
325
|
+
internal::DisposeTracedReference(slot());
|
306
326
|
SetSlotThreadSafe(nullptr);
|
307
327
|
}
|
308
328
|
|
@@ -345,10 +365,28 @@ template <class S>
|
|
345
365
|
void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
346
366
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
347
367
|
this->Reset();
|
348
|
-
if (other.IsEmpty())
|
349
|
-
|
350
|
-
|
351
|
-
|
368
|
+
if (V8_UNLIKELY(other.IsEmpty())) {
|
369
|
+
return;
|
370
|
+
}
|
371
|
+
this->SetSlotThreadSafe(this->NewFromNonEmptyValue(
|
372
|
+
isolate, *other, &this->slot(),
|
373
|
+
internal::TracedReferenceStoreMode::kAssigningStore,
|
374
|
+
internal::TracedReferenceHandling::kDefault));
|
375
|
+
}
|
376
|
+
|
377
|
+
template <class T>
|
378
|
+
template <class S>
|
379
|
+
void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other,
|
380
|
+
IsDroppable) {
|
381
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
382
|
+
this->Reset();
|
383
|
+
if (V8_UNLIKELY(other.IsEmpty())) {
|
384
|
+
return;
|
385
|
+
}
|
386
|
+
this->SetSlotThreadSafe(this->NewFromNonEmptyValue(
|
387
|
+
isolate, *other, &this->slot(),
|
388
|
+
internal::TracedReferenceStoreMode::kAssigningStore,
|
389
|
+
internal::TracedReferenceHandling::kDroppable));
|
352
390
|
}
|
353
391
|
|
354
392
|
template <class T>
|
@@ -373,9 +411,7 @@ template <class T>
|
|
373
411
|
TracedReference<T>& TracedReference<T>::operator=(
|
374
412
|
TracedReference&& rhs) noexcept {
|
375
413
|
if (this != &rhs) {
|
376
|
-
internal::MoveTracedReference(
|
377
|
-
reinterpret_cast<internal::Address**>(&rhs.val_),
|
378
|
-
reinterpret_cast<internal::Address**>(&this->val_));
|
414
|
+
internal::MoveTracedReference(&rhs.slot(), &this->slot());
|
379
415
|
}
|
380
416
|
return *this;
|
381
417
|
}
|
@@ -384,31 +420,13 @@ template <class T>
|
|
384
420
|
TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) {
|
385
421
|
if (this != &rhs) {
|
386
422
|
this->Reset();
|
387
|
-
if (rhs.
|
388
|
-
internal::CopyTracedReference(
|
389
|
-
reinterpret_cast<const internal::Address* const*>(&rhs.val_),
|
390
|
-
reinterpret_cast<internal::Address**>(&this->val_));
|
423
|
+
if (!rhs.IsEmpty()) {
|
424
|
+
internal::CopyTracedReference(&rhs.slot(), &this->slot());
|
391
425
|
}
|
392
426
|
}
|
393
427
|
return *this;
|
394
428
|
}
|
395
429
|
|
396
|
-
void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) {
|
397
|
-
using I = internal::Internals;
|
398
|
-
if (IsEmpty()) return;
|
399
|
-
internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
|
400
|
-
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kTracedNodeClassIdOffset;
|
401
|
-
*reinterpret_cast<uint16_t*>(addr) = class_id;
|
402
|
-
}
|
403
|
-
|
404
|
-
uint16_t TracedReferenceBase::WrapperClassId() const {
|
405
|
-
using I = internal::Internals;
|
406
|
-
if (IsEmpty()) return 0;
|
407
|
-
internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
|
408
|
-
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kTracedNodeClassIdOffset;
|
409
|
-
return *reinterpret_cast<uint16_t*>(addr);
|
410
|
-
}
|
411
|
-
|
412
430
|
} // namespace v8
|
413
431
|
|
414
432
|
#endif // INCLUDE_V8_TRACED_HANDLE_H_
|
@@ -5,14 +5,14 @@
|
|
5
5
|
#ifndef INCLUDE_V8_TYPED_ARRAY_H_
|
6
6
|
#define INCLUDE_V8_TYPED_ARRAY_H_
|
7
7
|
|
8
|
+
#include <limits>
|
9
|
+
|
8
10
|
#include "v8-array-buffer.h" // NOLINT(build/include_directory)
|
9
11
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
10
12
|
#include "v8config.h" // NOLINT(build/include_directory)
|
11
13
|
|
12
14
|
namespace v8 {
|
13
15
|
|
14
|
-
class SharedArrayBuffer;
|
15
|
-
|
16
16
|
/**
|
17
17
|
* A base class for an instance of TypedArray series of constructors
|
18
18
|
* (ES6 draft 15.13.6).
|
@@ -20,12 +20,19 @@ class SharedArrayBuffer;
|
|
20
20
|
class V8_EXPORT TypedArray : public ArrayBufferView {
|
21
21
|
public:
|
22
22
|
/*
|
23
|
-
* The largest typed array size
|
23
|
+
* The largest supported typed array byte size. Each subclass defines a
|
24
|
+
* type-specific kMaxLength for the maximum length that can be passed to New.
|
24
25
|
*/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
#if V8_ENABLE_SANDBOX
|
27
|
+
static constexpr size_t kMaxByteLength =
|
28
|
+
internal::kMaxSafeBufferSizeForSandbox;
|
29
|
+
#elif V8_HOST_ARCH_32_BIT
|
30
|
+
static constexpr size_t kMaxByteLength = std::numeric_limits<int>::max();
|
31
|
+
#else
|
32
|
+
// The maximum safe integer (2^53 - 1).
|
33
|
+
static constexpr size_t kMaxByteLength =
|
34
|
+
static_cast<size_t>((uint64_t{1} << 53) - 1);
|
35
|
+
#endif
|
29
36
|
|
30
37
|
/**
|
31
38
|
* Number of elements in this typed array
|
@@ -50,6 +57,13 @@ class V8_EXPORT TypedArray : public ArrayBufferView {
|
|
50
57
|
*/
|
51
58
|
class V8_EXPORT Uint8Array : public TypedArray {
|
52
59
|
public:
|
60
|
+
/*
|
61
|
+
* The largest Uint8Array size that can be constructed using New.
|
62
|
+
*/
|
63
|
+
static constexpr size_t kMaxLength =
|
64
|
+
TypedArray::kMaxByteLength / sizeof(uint8_t);
|
65
|
+
static_assert(sizeof(uint8_t) == 1);
|
66
|
+
|
53
67
|
static Local<Uint8Array> New(Local<ArrayBuffer> array_buffer,
|
54
68
|
size_t byte_offset, size_t length);
|
55
69
|
static Local<Uint8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -71,6 +85,13 @@ class V8_EXPORT Uint8Array : public TypedArray {
|
|
71
85
|
*/
|
72
86
|
class V8_EXPORT Uint8ClampedArray : public TypedArray {
|
73
87
|
public:
|
88
|
+
/*
|
89
|
+
* The largest Uint8ClampedArray size that can be constructed using New.
|
90
|
+
*/
|
91
|
+
static constexpr size_t kMaxLength =
|
92
|
+
TypedArray::kMaxByteLength / sizeof(uint8_t);
|
93
|
+
static_assert(sizeof(uint8_t) == 1);
|
94
|
+
|
74
95
|
static Local<Uint8ClampedArray> New(Local<ArrayBuffer> array_buffer,
|
75
96
|
size_t byte_offset, size_t length);
|
76
97
|
static Local<Uint8ClampedArray> New(
|
@@ -93,6 +114,13 @@ class V8_EXPORT Uint8ClampedArray : public TypedArray {
|
|
93
114
|
*/
|
94
115
|
class V8_EXPORT Int8Array : public TypedArray {
|
95
116
|
public:
|
117
|
+
/*
|
118
|
+
* The largest Int8Array size that can be constructed using New.
|
119
|
+
*/
|
120
|
+
static constexpr size_t kMaxLength =
|
121
|
+
TypedArray::kMaxByteLength / sizeof(int8_t);
|
122
|
+
static_assert(sizeof(int8_t) == 1);
|
123
|
+
|
96
124
|
static Local<Int8Array> New(Local<ArrayBuffer> array_buffer,
|
97
125
|
size_t byte_offset, size_t length);
|
98
126
|
static Local<Int8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -114,6 +142,13 @@ class V8_EXPORT Int8Array : public TypedArray {
|
|
114
142
|
*/
|
115
143
|
class V8_EXPORT Uint16Array : public TypedArray {
|
116
144
|
public:
|
145
|
+
/*
|
146
|
+
* The largest Uint16Array size that can be constructed using New.
|
147
|
+
*/
|
148
|
+
static constexpr size_t kMaxLength =
|
149
|
+
TypedArray::kMaxByteLength / sizeof(uint16_t);
|
150
|
+
static_assert(sizeof(uint16_t) == 2);
|
151
|
+
|
117
152
|
static Local<Uint16Array> New(Local<ArrayBuffer> array_buffer,
|
118
153
|
size_t byte_offset, size_t length);
|
119
154
|
static Local<Uint16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -135,6 +170,13 @@ class V8_EXPORT Uint16Array : public TypedArray {
|
|
135
170
|
*/
|
136
171
|
class V8_EXPORT Int16Array : public TypedArray {
|
137
172
|
public:
|
173
|
+
/*
|
174
|
+
* The largest Int16Array size that can be constructed using New.
|
175
|
+
*/
|
176
|
+
static constexpr size_t kMaxLength =
|
177
|
+
TypedArray::kMaxByteLength / sizeof(int16_t);
|
178
|
+
static_assert(sizeof(int16_t) == 2);
|
179
|
+
|
138
180
|
static Local<Int16Array> New(Local<ArrayBuffer> array_buffer,
|
139
181
|
size_t byte_offset, size_t length);
|
140
182
|
static Local<Int16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -156,6 +198,13 @@ class V8_EXPORT Int16Array : public TypedArray {
|
|
156
198
|
*/
|
157
199
|
class V8_EXPORT Uint32Array : public TypedArray {
|
158
200
|
public:
|
201
|
+
/*
|
202
|
+
* The largest Uint32Array size that can be constructed using New.
|
203
|
+
*/
|
204
|
+
static constexpr size_t kMaxLength =
|
205
|
+
TypedArray::kMaxByteLength / sizeof(uint32_t);
|
206
|
+
static_assert(sizeof(uint32_t) == 4);
|
207
|
+
|
159
208
|
static Local<Uint32Array> New(Local<ArrayBuffer> array_buffer,
|
160
209
|
size_t byte_offset, size_t length);
|
161
210
|
static Local<Uint32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -177,6 +226,13 @@ class V8_EXPORT Uint32Array : public TypedArray {
|
|
177
226
|
*/
|
178
227
|
class V8_EXPORT Int32Array : public TypedArray {
|
179
228
|
public:
|
229
|
+
/*
|
230
|
+
* The largest Int32Array size that can be constructed using New.
|
231
|
+
*/
|
232
|
+
static constexpr size_t kMaxLength =
|
233
|
+
TypedArray::kMaxByteLength / sizeof(int32_t);
|
234
|
+
static_assert(sizeof(int32_t) == 4);
|
235
|
+
|
180
236
|
static Local<Int32Array> New(Local<ArrayBuffer> array_buffer,
|
181
237
|
size_t byte_offset, size_t length);
|
182
238
|
static Local<Int32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -193,11 +249,42 @@ class V8_EXPORT Int32Array : public TypedArray {
|
|
193
249
|
static void CheckCast(Value* obj);
|
194
250
|
};
|
195
251
|
|
252
|
+
/**
|
253
|
+
* An instance of Float16Array constructor.
|
254
|
+
*/
|
255
|
+
class V8_EXPORT Float16Array : public TypedArray {
|
256
|
+
static constexpr size_t kMaxLength =
|
257
|
+
TypedArray::kMaxByteLength / sizeof(uint16_t);
|
258
|
+
|
259
|
+
public:
|
260
|
+
static Local<Float16Array> New(Local<ArrayBuffer> array_buffer,
|
261
|
+
size_t byte_offset, size_t length);
|
262
|
+
static Local<Float16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
263
|
+
size_t byte_offset, size_t length);
|
264
|
+
V8_INLINE static Float16Array* Cast(Value* value) {
|
265
|
+
#ifdef V8_ENABLE_CHECKS
|
266
|
+
CheckCast(value);
|
267
|
+
#endif
|
268
|
+
return static_cast<Float16Array*>(value);
|
269
|
+
}
|
270
|
+
|
271
|
+
private:
|
272
|
+
Float16Array();
|
273
|
+
static void CheckCast(Value* obj);
|
274
|
+
};
|
275
|
+
|
196
276
|
/**
|
197
277
|
* An instance of Float32Array constructor (ES6 draft 15.13.6).
|
198
278
|
*/
|
199
279
|
class V8_EXPORT Float32Array : public TypedArray {
|
200
280
|
public:
|
281
|
+
/*
|
282
|
+
* The largest Float32Array size that can be constructed using New.
|
283
|
+
*/
|
284
|
+
static constexpr size_t kMaxLength =
|
285
|
+
TypedArray::kMaxByteLength / sizeof(float);
|
286
|
+
static_assert(sizeof(float) == 4);
|
287
|
+
|
201
288
|
static Local<Float32Array> New(Local<ArrayBuffer> array_buffer,
|
202
289
|
size_t byte_offset, size_t length);
|
203
290
|
static Local<Float32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -219,6 +306,13 @@ class V8_EXPORT Float32Array : public TypedArray {
|
|
219
306
|
*/
|
220
307
|
class V8_EXPORT Float64Array : public TypedArray {
|
221
308
|
public:
|
309
|
+
/*
|
310
|
+
* The largest Float64Array size that can be constructed using New.
|
311
|
+
*/
|
312
|
+
static constexpr size_t kMaxLength =
|
313
|
+
TypedArray::kMaxByteLength / sizeof(double);
|
314
|
+
static_assert(sizeof(double) == 8);
|
315
|
+
|
222
316
|
static Local<Float64Array> New(Local<ArrayBuffer> array_buffer,
|
223
317
|
size_t byte_offset, size_t length);
|
224
318
|
static Local<Float64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -240,6 +334,13 @@ class V8_EXPORT Float64Array : public TypedArray {
|
|
240
334
|
*/
|
241
335
|
class V8_EXPORT BigInt64Array : public TypedArray {
|
242
336
|
public:
|
337
|
+
/*
|
338
|
+
* The largest BigInt64Array size that can be constructed using New.
|
339
|
+
*/
|
340
|
+
static constexpr size_t kMaxLength =
|
341
|
+
TypedArray::kMaxByteLength / sizeof(int64_t);
|
342
|
+
static_assert(sizeof(int64_t) == 8);
|
343
|
+
|
243
344
|
static Local<BigInt64Array> New(Local<ArrayBuffer> array_buffer,
|
244
345
|
size_t byte_offset, size_t length);
|
245
346
|
static Local<BigInt64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
@@ -261,6 +362,13 @@ class V8_EXPORT BigInt64Array : public TypedArray {
|
|
261
362
|
*/
|
262
363
|
class V8_EXPORT BigUint64Array : public TypedArray {
|
263
364
|
public:
|
365
|
+
/*
|
366
|
+
* The largest BigUint64Array size that can be constructed using New.
|
367
|
+
*/
|
368
|
+
static constexpr size_t kMaxLength =
|
369
|
+
TypedArray::kMaxByteLength / sizeof(uint64_t);
|
370
|
+
static_assert(sizeof(uint64_t) == 8);
|
371
|
+
|
264
372
|
static Local<BigUint64Array> New(Local<ArrayBuffer> array_buffer,
|
265
373
|
size_t byte_offset, size_t length);
|
266
374
|
static Local<BigUint64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|