libv8-node 21.7.2.0-aarch64-linux-musl → 24.12.0.0-aarch64-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +3 -5
  3. data/ext/libv8-node/paths.rb +2 -0
  4. data/lib/libv8/node/version.rb +7 -4
  5. data/lib/libv8/node.rb +2 -0
  6. data/lib/libv8-node.rb +2 -0
  7. data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  8. data/vendor/v8/include/cppgc/allocation.h +11 -13
  9. data/vendor/v8/include/cppgc/default-platform.h +3 -2
  10. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  11. data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
  12. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  13. data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
  14. data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
  15. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
  16. data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
  17. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  18. data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
  19. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  20. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  21. data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
  22. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  23. data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
  24. data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
  25. data/vendor/v8/include/cppgc/macros.h +21 -0
  26. data/vendor/v8/include/cppgc/member.h +70 -36
  27. data/vendor/v8/include/cppgc/name-provider.h +10 -0
  28. data/vendor/v8/include/cppgc/platform.h +11 -0
  29. data/vendor/v8/include/cppgc/type-traits.h +26 -4
  30. data/vendor/v8/include/cppgc/visitor.h +25 -1
  31. data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
  32. data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
  33. data/vendor/v8/include/v8-array-buffer.h +149 -46
  34. data/vendor/v8/include/v8-callbacks.h +100 -43
  35. data/vendor/v8/include/v8-container.h +54 -0
  36. data/vendor/v8/include/v8-context.h +92 -30
  37. data/vendor/v8/include/v8-cppgc.h +5 -56
  38. data/vendor/v8/include/v8-data.h +5 -0
  39. data/vendor/v8/include/v8-date.h +9 -0
  40. data/vendor/v8/include/v8-debug.h +11 -0
  41. data/vendor/v8/include/v8-embedder-heap.h +8 -20
  42. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  43. data/vendor/v8/include/v8-exception.h +87 -9
  44. data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
  45. data/vendor/v8/include/v8-fast-api-calls.h +67 -223
  46. data/vendor/v8/include/v8-forward.h +1 -0
  47. data/vendor/v8/include/v8-function-callback.h +296 -75
  48. data/vendor/v8/include/v8-function.h +11 -3
  49. data/vendor/v8/include/v8-handle-base.h +52 -82
  50. data/vendor/v8/include/v8-initialization.h +26 -1
  51. data/vendor/v8/include/v8-inspector.h +26 -27
  52. data/vendor/v8/include/v8-internal.h +960 -230
  53. data/vendor/v8/include/v8-isolate.h +347 -226
  54. data/vendor/v8/include/v8-local-handle.h +307 -55
  55. data/vendor/v8/include/v8-maybe.h +2 -1
  56. data/vendor/v8/include/v8-memory-span.h +284 -4
  57. data/vendor/v8/include/v8-message.h +11 -5
  58. data/vendor/v8/include/v8-metrics.h +15 -0
  59. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  60. data/vendor/v8/include/v8-object.h +314 -41
  61. data/vendor/v8/include/v8-persistent-handle.h +29 -39
  62. data/vendor/v8/include/v8-platform.h +135 -77
  63. data/vendor/v8/include/v8-primitive.h +223 -5
  64. data/vendor/v8/include/v8-profiler.h +51 -2
  65. data/vendor/v8/include/v8-promise.h +2 -2
  66. data/vendor/v8/include/v8-proxy.h +0 -1
  67. data/vendor/v8/include/v8-regexp.h +0 -1
  68. data/vendor/v8/include/v8-sandbox.h +173 -0
  69. data/vendor/v8/include/v8-script.h +125 -27
  70. data/vendor/v8/include/v8-snapshot.h +130 -23
  71. data/vendor/v8/include/v8-source-location.h +6 -1
  72. data/vendor/v8/include/v8-statistics.h +10 -24
  73. data/vendor/v8/include/v8-template.h +320 -193
  74. data/vendor/v8/include/v8-trace-categories.h +23 -0
  75. data/vendor/v8/include/v8-traced-handle.h +99 -76
  76. data/vendor/v8/include/v8-typed-array.h +111 -7
  77. data/vendor/v8/include/v8-unwinder-state.h +2 -3
  78. data/vendor/v8/include/v8-unwinder.h +2 -1
  79. data/vendor/v8/include/v8-util.h +10 -125
  80. data/vendor/v8/include/v8-value-serializer-version.h +3 -3
  81. data/vendor/v8/include/v8-value.h +113 -6
  82. data/vendor/v8/include/v8-version.h +3 -3
  83. data/vendor/v8/include/v8-wasm.h +27 -0
  84. data/vendor/v8/include/v8-weak-callback-info.h +20 -12
  85. data/vendor/v8/include/v8.h +3 -3
  86. data/vendor/v8/include/v8config.h +116 -53
  87. metadata +55 -12
  88. data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
@@ -0,0 +1,23 @@
1
+ // Copyright 2025 the V8 project authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #ifndef INCLUDE_V8_TRACE_CATEGORIES_H_
6
+ #define INCLUDE_V8_TRACE_CATEGORIES_H_
7
+
8
+ #if defined(V8_USE_PERFETTO)
9
+
10
+ #include "perfetto/tracing/track_event.h"
11
+ #include "v8config.h"
12
+
13
+ namespace v8 {
14
+
15
+ // Returns the perfeto TrackEventCategoryRegistry for v8 tracing categories.
16
+ V8_EXPORT const perfetto::internal::TrackEventCategoryRegistry&
17
+ GetTrackEventCategoryRegistry();
18
+
19
+ } // namespace v8
20
+
21
+ #endif // defined(V8_USE_PERFETTO)
22
+
23
+ #endif // INCLUDE_V8_TRACE_CATEGORIES_H_
@@ -27,19 +27,23 @@ namespace internal {
27
27
 
28
28
  class BasicTracedReferenceExtractor;
29
29
 
30
- enum class GlobalHandleStoreMode {
30
+ enum class TracedReferenceStoreMode {
31
31
  kInitializingStore,
32
32
  kAssigningStore,
33
33
  };
34
34
 
35
- V8_EXPORT internal::Address* GlobalizeTracedReference(
36
- internal::Isolate* isolate, internal::Address value,
37
- internal::Address* slot, GlobalHandleStoreMode store_mode);
38
- V8_EXPORT void MoveTracedReference(internal::Address** from,
39
- internal::Address** to);
40
- V8_EXPORT void CopyTracedReference(const internal::Address* const* from,
41
- internal::Address** to);
42
- V8_EXPORT void DisposeTracedReference(internal::Address* global_handle);
35
+ enum class TracedReferenceHandling {
36
+ kDefault, // See EmbedderRootsHandler::IsRoot().
37
+ kDroppable
38
+ };
39
+
40
+ V8_EXPORT Address* GlobalizeTracedReference(
41
+ Isolate* isolate, Address value, Address* slot,
42
+ TracedReferenceStoreMode store_mode,
43
+ TracedReferenceHandling reference_handling);
44
+ V8_EXPORT void MoveTracedReference(Address** from, Address** to);
45
+ V8_EXPORT void CopyTracedReference(const Address* const* from, Address** to);
46
+ V8_EXPORT void DisposeTracedReference(Address* global_handle);
43
47
 
44
48
  } // namespace internal
45
49
 
@@ -47,8 +51,11 @@ V8_EXPORT void DisposeTracedReference(internal::Address* global_handle);
47
51
  * An indirect handle, where the indirect pointer points to a GlobalHandles
48
52
  * node.
49
53
  */
50
- class TracedReferenceBase : public IndirectHandleBase {
54
+ class TracedReferenceBase : public api_internal::IndirectHandleBase {
51
55
  public:
56
+ static_assert(sizeof(std::atomic<internal::Address*>) ==
57
+ sizeof(internal::Address*));
58
+
52
59
  /**
53
60
  * If non-empty, destroy the underlying storage cell. |IsEmpty| will return
54
61
  * true after this call.
@@ -56,31 +63,18 @@ class TracedReferenceBase : public IndirectHandleBase {
56
63
  V8_INLINE void Reset();
57
64
 
58
65
  /**
59
- * Construct a Local<Value> from this handle.
66
+ * Construct a Local<Data> from this handle.
60
67
  */
61
- V8_INLINE Local<Value> Get(Isolate* isolate) const {
62
- if (IsEmpty()) return Local<Value>();
63
- return Local<Value>::New(isolate, this->value<Value>());
68
+ V8_INLINE Local<Data> Get(Isolate* isolate) const {
69
+ if (IsEmpty()) return Local<Data>();
70
+ return Local<Data>::New(isolate, this->value<Data>());
64
71
  }
65
72
 
66
73
  /**
67
74
  * Returns true if this TracedReference is empty, i.e., has not been
68
75
  * assigned an object. This version of IsEmpty is thread-safe.
69
76
  */
70
- bool IsEmptyThreadSafe() const {
71
- return this->GetSlotThreadSafe() == nullptr;
72
- }
73
-
74
- /**
75
- * Assigns a wrapper class ID to the handle.
76
- */
77
- V8_INLINE void SetWrapperClassId(uint16_t class_id);
78
-
79
- /**
80
- * Returns the class ID previously assigned to this handle or 0 if no class ID
81
- * was previously assigned.
82
- */
83
- V8_INLINE uint16_t WrapperClassId() const;
77
+ bool IsEmptyThreadSafe() const { return GetSlotThreadSafe() == nullptr; }
84
78
 
85
79
  protected:
86
80
  V8_INLINE TracedReferenceBase() = default;
@@ -88,17 +82,17 @@ class TracedReferenceBase : public IndirectHandleBase {
88
82
  /**
89
83
  * Update this reference in a thread-safe way.
90
84
  */
91
- void SetSlotThreadSafe(void* new_val) {
92
- reinterpret_cast<std::atomic<void*>*>(&slot())->store(
85
+ void SetSlotThreadSafe(internal::Address* new_val) {
86
+ reinterpret_cast<std::atomic<internal::Address*>*>(&slot())->store(
93
87
  new_val, std::memory_order_relaxed);
94
88
  }
95
89
 
96
90
  /**
97
91
  * Get this reference in a thread-safe way
98
92
  */
99
- const void* GetSlotThreadSafe() const {
100
- return reinterpret_cast<std::atomic<const void*> const*>(&slot())->load(
101
- std::memory_order_relaxed);
93
+ const internal::Address* GetSlotThreadSafe() const {
94
+ return reinterpret_cast<const std::atomic<internal::Address*>*>(&slot())
95
+ ->load(std::memory_order_relaxed);
102
96
  }
103
97
 
104
98
  V8_EXPORT void CheckValue() const;
@@ -140,26 +134,16 @@ class BasicTracedReference : public TracedReferenceBase {
140
134
  const_cast<BasicTracedReference<T>&>(*this));
141
135
  }
142
136
 
143
- V8_DEPRECATE_SOON("Use Get to convert to Local instead")
144
- V8_INLINE T* operator->() const {
145
- #ifdef V8_ENABLE_CHECKS
146
- CheckValue();
147
- #endif // V8_ENABLE_CHECKS
148
- return this->template value<T>();
149
- }
150
-
151
- V8_DEPRECATE_SOON("Use Get to convert to Local instead")
152
- V8_INLINE T* operator*() const { return this->operator->(); }
153
-
154
137
  private:
155
138
  /**
156
139
  * An empty BasicTracedReference without storage cell.
157
140
  */
158
141
  BasicTracedReference() = default;
159
142
 
160
- V8_INLINE static internal::Address* New(
143
+ V8_INLINE static internal::Address* NewFromNonEmptyValue(
161
144
  Isolate* isolate, T* that, internal::Address** slot,
162
- internal::GlobalHandleStoreMode store_mode);
145
+ internal::TracedReferenceStoreMode store_mode,
146
+ internal::TracedReferenceHandling reference_handling);
163
147
 
164
148
  template <typename F>
165
149
  friend class Local;
@@ -180,6 +164,8 @@ class BasicTracedReference : public TracedReferenceBase {
180
164
  template <typename T>
181
165
  class TracedReference : public BasicTracedReference<T> {
182
166
  public:
167
+ struct IsDroppable {};
168
+
183
169
  using BasicTracedReference<T>::Reset;
184
170
 
185
171
  /**
@@ -195,10 +181,35 @@ class TracedReference : public BasicTracedReference<T> {
195
181
  */
196
182
  template <class S>
197
183
  TracedReference(Isolate* isolate, Local<S> that) : BasicTracedReference<T>() {
198
- this->slot() =
199
- this->New(isolate, *that, &this->slot(),
200
- internal::GlobalHandleStoreMode::kInitializingStore);
201
184
  static_assert(std::is_base_of<T, S>::value, "type check");
185
+ if (V8_UNLIKELY(that.IsEmpty())) {
186
+ return;
187
+ }
188
+ this->slot() = this->NewFromNonEmptyValue(
189
+ isolate, *that, &this->slot(),
190
+ internal::TracedReferenceStoreMode::kInitializingStore,
191
+ internal::TracedReferenceHandling::kDefault);
192
+ }
193
+
194
+ /**
195
+ * Construct a droppable TracedReference from a Local. Droppable means that V8
196
+ * is free to reclaim the pointee if it is unmodified and otherwise
197
+ * unreachable
198
+ *
199
+ * When the Local is non-empty, a new storage cell is created
200
+ * pointing to the same object.
201
+ */
202
+ template <class S>
203
+ TracedReference(Isolate* isolate, Local<S> that, IsDroppable)
204
+ : BasicTracedReference<T>() {
205
+ static_assert(std::is_base_of<T, S>::value, "type check");
206
+ if (V8_UNLIKELY(that.IsEmpty())) {
207
+ return;
208
+ }
209
+ this->slot() = this->NewFromNonEmptyValue(
210
+ isolate, *that, &this->slot(),
211
+ internal::TracedReferenceStoreMode::kInitializingStore,
212
+ internal::TracedReferenceHandling::kDroppable);
202
213
  }
203
214
 
204
215
  /**
@@ -262,12 +273,19 @@ class TracedReference : public BasicTracedReference<T> {
262
273
  V8_INLINE TracedReference& operator=(const TracedReference<S>& rhs);
263
274
 
264
275
  /**
265
- * If non-empty, destroy the underlying storage cell and create a new one with
266
- * the contents of other if other is non empty
276
+ * Always resets the reference. Creates a new reference from `other` if it is
277
+ * non-empty.
267
278
  */
268
279
  template <class S>
269
280
  V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
270
281
 
282
+ /**
283
+ * Always resets the reference. Creates a new reference from `other` if it is
284
+ * non-empty. The new reference is droppable, see constructor.
285
+ */
286
+ template <class S>
287
+ V8_INLINE void Reset(Isolate* isolate, const Local<S>& other, IsDroppable);
288
+
271
289
  template <class S>
272
290
  V8_INLINE TracedReference<S>& As() const {
273
291
  return reinterpret_cast<TracedReference<S>&>(
@@ -277,18 +295,21 @@ class TracedReference : public BasicTracedReference<T> {
277
295
 
278
296
  // --- Implementation ---
279
297
  template <class T>
280
- internal::Address* BasicTracedReference<T>::New(
298
+ internal::Address* BasicTracedReference<T>::NewFromNonEmptyValue(
281
299
  Isolate* isolate, T* that, internal::Address** slot,
282
- internal::GlobalHandleStoreMode store_mode) {
283
- if (internal::ValueHelper::IsEmpty(that)) return nullptr;
300
+ internal::TracedReferenceStoreMode store_mode,
301
+ internal::TracedReferenceHandling reference_handling) {
284
302
  return internal::GlobalizeTracedReference(
285
303
  reinterpret_cast<internal::Isolate*>(isolate),
286
304
  internal::ValueHelper::ValueAsAddress(that),
287
- reinterpret_cast<internal::Address*>(slot), store_mode);
305
+ reinterpret_cast<internal::Address*>(slot), store_mode,
306
+ reference_handling);
288
307
  }
289
308
 
290
309
  void TracedReferenceBase::Reset() {
291
- if (IsEmpty()) return;
310
+ if (V8_UNLIKELY(IsEmpty())) {
311
+ return;
312
+ }
292
313
  internal::DisposeTracedReference(slot());
293
314
  SetSlotThreadSafe(nullptr);
294
315
  }
@@ -332,10 +353,28 @@ template <class S>
332
353
  void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
333
354
  static_assert(std::is_base_of<T, S>::value, "type check");
334
355
  this->Reset();
335
- if (other.IsEmpty()) return;
336
- this->SetSlotThreadSafe(
337
- this->New(isolate, *other, &this->slot(),
338
- internal::GlobalHandleStoreMode::kAssigningStore));
356
+ if (V8_UNLIKELY(other.IsEmpty())) {
357
+ return;
358
+ }
359
+ this->SetSlotThreadSafe(this->NewFromNonEmptyValue(
360
+ isolate, *other, &this->slot(),
361
+ internal::TracedReferenceStoreMode::kAssigningStore,
362
+ internal::TracedReferenceHandling::kDefault));
363
+ }
364
+
365
+ template <class T>
366
+ template <class S>
367
+ void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other,
368
+ IsDroppable) {
369
+ static_assert(std::is_base_of<T, S>::value, "type check");
370
+ this->Reset();
371
+ if (V8_UNLIKELY(other.IsEmpty())) {
372
+ return;
373
+ }
374
+ this->SetSlotThreadSafe(this->NewFromNonEmptyValue(
375
+ isolate, *other, &this->slot(),
376
+ internal::TracedReferenceStoreMode::kAssigningStore,
377
+ internal::TracedReferenceHandling::kDroppable));
339
378
  }
340
379
 
341
380
  template <class T>
@@ -376,22 +415,6 @@ TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) {
376
415
  return *this;
377
416
  }
378
417
 
379
- void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) {
380
- using I = internal::Internals;
381
- if (IsEmpty()) return;
382
- uint8_t* addr =
383
- reinterpret_cast<uint8_t*>(slot()) + I::kTracedNodeClassIdOffset;
384
- *reinterpret_cast<uint16_t*>(addr) = class_id;
385
- }
386
-
387
- uint16_t TracedReferenceBase::WrapperClassId() const {
388
- using I = internal::Internals;
389
- if (IsEmpty()) return 0;
390
- uint8_t* addr =
391
- reinterpret_cast<uint8_t*>(slot()) + I::kTracedNodeClassIdOffset;
392
- return *reinterpret_cast<uint16_t*>(addr);
393
- }
394
-
395
418
  } // namespace v8
396
419
 
397
420
  #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,15 @@ class SharedArrayBuffer;
20
20
  class V8_EXPORT TypedArray : public ArrayBufferView {
21
21
  public:
22
22
  /*
23
- * The largest typed array size that can be constructed using New.
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
- static constexpr size_t kMaxLength =
26
- internal::kApiSystemPointerSize == 4
27
- ? internal::kSmiMaxValue
28
- : static_cast<size_t>(uint64_t{1} << 32);
26
+ static constexpr size_t kMaxByteLength = ArrayBuffer::kMaxByteLength;
27
+
28
+ #ifdef V8_ENABLE_SANDBOX
29
+ static_assert(v8::TypedArray::kMaxByteLength <=
30
+ v8::internal::kMaxSafeBufferSizeForSandbox);
31
+ #endif
29
32
 
30
33
  /**
31
34
  * Number of elements in this typed array
@@ -50,6 +53,13 @@ class V8_EXPORT TypedArray : public ArrayBufferView {
50
53
  */
51
54
  class V8_EXPORT Uint8Array : public TypedArray {
52
55
  public:
56
+ /*
57
+ * The largest Uint8Array size that can be constructed using New.
58
+ */
59
+ static constexpr size_t kMaxLength =
60
+ TypedArray::kMaxByteLength / sizeof(uint8_t);
61
+ static_assert(sizeof(uint8_t) == 1);
62
+
53
63
  static Local<Uint8Array> New(Local<ArrayBuffer> array_buffer,
54
64
  size_t byte_offset, size_t length);
55
65
  static Local<Uint8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -71,6 +81,13 @@ class V8_EXPORT Uint8Array : public TypedArray {
71
81
  */
72
82
  class V8_EXPORT Uint8ClampedArray : public TypedArray {
73
83
  public:
84
+ /*
85
+ * The largest Uint8ClampedArray size that can be constructed using New.
86
+ */
87
+ static constexpr size_t kMaxLength =
88
+ TypedArray::kMaxByteLength / sizeof(uint8_t);
89
+ static_assert(sizeof(uint8_t) == 1);
90
+
74
91
  static Local<Uint8ClampedArray> New(Local<ArrayBuffer> array_buffer,
75
92
  size_t byte_offset, size_t length);
76
93
  static Local<Uint8ClampedArray> New(
@@ -93,6 +110,13 @@ class V8_EXPORT Uint8ClampedArray : public TypedArray {
93
110
  */
94
111
  class V8_EXPORT Int8Array : public TypedArray {
95
112
  public:
113
+ /*
114
+ * The largest Int8Array size that can be constructed using New.
115
+ */
116
+ static constexpr size_t kMaxLength =
117
+ TypedArray::kMaxByteLength / sizeof(int8_t);
118
+ static_assert(sizeof(int8_t) == 1);
119
+
96
120
  static Local<Int8Array> New(Local<ArrayBuffer> array_buffer,
97
121
  size_t byte_offset, size_t length);
98
122
  static Local<Int8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -114,6 +138,13 @@ class V8_EXPORT Int8Array : public TypedArray {
114
138
  */
115
139
  class V8_EXPORT Uint16Array : public TypedArray {
116
140
  public:
141
+ /*
142
+ * The largest Uint16Array size that can be constructed using New.
143
+ */
144
+ static constexpr size_t kMaxLength =
145
+ TypedArray::kMaxByteLength / sizeof(uint16_t);
146
+ static_assert(sizeof(uint16_t) == 2);
147
+
117
148
  static Local<Uint16Array> New(Local<ArrayBuffer> array_buffer,
118
149
  size_t byte_offset, size_t length);
119
150
  static Local<Uint16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -135,6 +166,13 @@ class V8_EXPORT Uint16Array : public TypedArray {
135
166
  */
136
167
  class V8_EXPORT Int16Array : public TypedArray {
137
168
  public:
169
+ /*
170
+ * The largest Int16Array size that can be constructed using New.
171
+ */
172
+ static constexpr size_t kMaxLength =
173
+ TypedArray::kMaxByteLength / sizeof(int16_t);
174
+ static_assert(sizeof(int16_t) == 2);
175
+
138
176
  static Local<Int16Array> New(Local<ArrayBuffer> array_buffer,
139
177
  size_t byte_offset, size_t length);
140
178
  static Local<Int16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -156,6 +194,13 @@ class V8_EXPORT Int16Array : public TypedArray {
156
194
  */
157
195
  class V8_EXPORT Uint32Array : public TypedArray {
158
196
  public:
197
+ /*
198
+ * The largest Uint32Array size that can be constructed using New.
199
+ */
200
+ static constexpr size_t kMaxLength =
201
+ TypedArray::kMaxByteLength / sizeof(uint32_t);
202
+ static_assert(sizeof(uint32_t) == 4);
203
+
159
204
  static Local<Uint32Array> New(Local<ArrayBuffer> array_buffer,
160
205
  size_t byte_offset, size_t length);
161
206
  static Local<Uint32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -177,6 +222,13 @@ class V8_EXPORT Uint32Array : public TypedArray {
177
222
  */
178
223
  class V8_EXPORT Int32Array : public TypedArray {
179
224
  public:
225
+ /*
226
+ * The largest Int32Array size that can be constructed using New.
227
+ */
228
+ static constexpr size_t kMaxLength =
229
+ TypedArray::kMaxByteLength / sizeof(int32_t);
230
+ static_assert(sizeof(int32_t) == 4);
231
+
180
232
  static Local<Int32Array> New(Local<ArrayBuffer> array_buffer,
181
233
  size_t byte_offset, size_t length);
182
234
  static Local<Int32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -193,11 +245,42 @@ class V8_EXPORT Int32Array : public TypedArray {
193
245
  static void CheckCast(Value* obj);
194
246
  };
195
247
 
248
+ /**
249
+ * An instance of Float16Array constructor.
250
+ */
251
+ class V8_EXPORT Float16Array : public TypedArray {
252
+ public:
253
+ static constexpr size_t kMaxLength =
254
+ TypedArray::kMaxByteLength / sizeof(uint16_t);
255
+
256
+ static Local<Float16Array> New(Local<ArrayBuffer> array_buffer,
257
+ size_t byte_offset, size_t length);
258
+ static Local<Float16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
259
+ size_t byte_offset, size_t length);
260
+ V8_INLINE static Float16Array* Cast(Value* value) {
261
+ #ifdef V8_ENABLE_CHECKS
262
+ CheckCast(value);
263
+ #endif
264
+ return static_cast<Float16Array*>(value);
265
+ }
266
+
267
+ private:
268
+ Float16Array();
269
+ static void CheckCast(Value* obj);
270
+ };
271
+
196
272
  /**
197
273
  * An instance of Float32Array constructor (ES6 draft 15.13.6).
198
274
  */
199
275
  class V8_EXPORT Float32Array : public TypedArray {
200
276
  public:
277
+ /*
278
+ * The largest Float32Array size that can be constructed using New.
279
+ */
280
+ static constexpr size_t kMaxLength =
281
+ TypedArray::kMaxByteLength / sizeof(float);
282
+ static_assert(sizeof(float) == 4);
283
+
201
284
  static Local<Float32Array> New(Local<ArrayBuffer> array_buffer,
202
285
  size_t byte_offset, size_t length);
203
286
  static Local<Float32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -219,6 +302,13 @@ class V8_EXPORT Float32Array : public TypedArray {
219
302
  */
220
303
  class V8_EXPORT Float64Array : public TypedArray {
221
304
  public:
305
+ /*
306
+ * The largest Float64Array size that can be constructed using New.
307
+ */
308
+ static constexpr size_t kMaxLength =
309
+ TypedArray::kMaxByteLength / sizeof(double);
310
+ static_assert(sizeof(double) == 8);
311
+
222
312
  static Local<Float64Array> New(Local<ArrayBuffer> array_buffer,
223
313
  size_t byte_offset, size_t length);
224
314
  static Local<Float64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -240,6 +330,13 @@ class V8_EXPORT Float64Array : public TypedArray {
240
330
  */
241
331
  class V8_EXPORT BigInt64Array : public TypedArray {
242
332
  public:
333
+ /*
334
+ * The largest BigInt64Array size that can be constructed using New.
335
+ */
336
+ static constexpr size_t kMaxLength =
337
+ TypedArray::kMaxByteLength / sizeof(int64_t);
338
+ static_assert(sizeof(int64_t) == 8);
339
+
243
340
  static Local<BigInt64Array> New(Local<ArrayBuffer> array_buffer,
244
341
  size_t byte_offset, size_t length);
245
342
  static Local<BigInt64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -261,6 +358,13 @@ class V8_EXPORT BigInt64Array : public TypedArray {
261
358
  */
262
359
  class V8_EXPORT BigUint64Array : public TypedArray {
263
360
  public:
361
+ /*
362
+ * The largest BigUint64Array size that can be constructed using New.
363
+ */
364
+ static constexpr size_t kMaxLength =
365
+ TypedArray::kMaxByteLength / sizeof(uint64_t);
366
+ static_assert(sizeof(uint64_t) == 8);
367
+
264
368
  static Local<BigUint64Array> New(Local<ArrayBuffer> array_buffer,
265
369
  size_t byte_offset, size_t length);
266
370
  static Local<BigUint64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
@@ -18,9 +18,8 @@ struct CalleeSavedRegisters {
18
18
  void* arm_r10;
19
19
  };
20
20
  #elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \
21
- V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 || \
22
- V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 || V8_TARGET_ARCH_LOONG64 || \
23
- V8_TARGET_ARCH_RISCV32
21
+ V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_RISCV64 || \
22
+ V8_TARGET_ARCH_S390X || V8_TARGET_ARCH_LOONG64 || V8_TARGET_ARCH_RISCV32
24
23
  struct CalleeSavedRegisters {};
25
24
  #else
26
25
  #error Target architecture was not detected as supported by v8
@@ -42,7 +42,8 @@ enum StateTag : uint16_t {
42
42
  OTHER,
43
43
  EXTERNAL,
44
44
  ATOMICS_WAIT,
45
- IDLE
45
+ IDLE,
46
+ LOGGING,
46
47
  };
47
48
 
48
49
  // The output structure filled up by GetStackSample API function.