libv8-node 22.7.0.4-aarch64-linux → 23.6.1.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/aarch64-linux/libv8/obj/libv8_monolith.a +0 -0
  4. data/vendor/v8/include/cppgc/allocation.h +10 -11
  5. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  6. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  7. data/vendor/v8/include/cppgc/internal/api-constants.h +6 -1
  8. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  9. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  10. data/vendor/v8/include/cppgc/internal/member-storage.h +6 -0
  11. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  12. data/vendor/v8/include/cppgc/name-provider.h +7 -0
  13. data/vendor/v8/include/v8-array-buffer.h +44 -24
  14. data/vendor/v8/include/v8-callbacks.h +10 -5
  15. data/vendor/v8/include/v8-context.h +41 -9
  16. data/vendor/v8/include/v8-cppgc.h +3 -55
  17. data/vendor/v8/include/v8-date.h +9 -0
  18. data/vendor/v8/include/v8-embedder-heap.h +4 -1
  19. data/vendor/v8/include/v8-exception.h +70 -0
  20. data/vendor/v8/include/v8-fast-api-calls.h +31 -38
  21. data/vendor/v8/include/v8-function-callback.h +203 -62
  22. data/vendor/v8/include/v8-function.h +4 -3
  23. data/vendor/v8/include/v8-handle-base.h +2 -2
  24. data/vendor/v8/include/v8-initialization.h +18 -1
  25. data/vendor/v8/include/v8-inspector.h +6 -3
  26. data/vendor/v8/include/v8-internal.h +303 -58
  27. data/vendor/v8/include/v8-isolate.h +58 -39
  28. data/vendor/v8/include/v8-local-handle.h +18 -19
  29. data/vendor/v8/include/v8-message.h +0 -21
  30. data/vendor/v8/include/v8-metrics.h +4 -0
  31. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  32. data/vendor/v8/include/v8-object.h +284 -35
  33. data/vendor/v8/include/v8-persistent-handle.h +0 -19
  34. data/vendor/v8/include/v8-platform.h +21 -35
  35. data/vendor/v8/include/v8-primitive.h +92 -1
  36. data/vendor/v8/include/v8-profiler.h +38 -1
  37. data/vendor/v8/include/v8-promise.h +2 -2
  38. data/vendor/v8/include/v8-sandbox.h +173 -0
  39. data/vendor/v8/include/v8-script.h +44 -14
  40. data/vendor/v8/include/v8-snapshot.h +38 -2
  41. data/vendor/v8/include/v8-template.h +105 -263
  42. data/vendor/v8/include/v8-traced-handle.h +4 -15
  43. data/vendor/v8/include/v8-unwinder.h +2 -1
  44. data/vendor/v8/include/v8-util.h +1 -117
  45. data/vendor/v8/include/v8-value.h +3 -2
  46. data/vendor/v8/include/v8-version.h +3 -3
  47. data/vendor/v8/include/v8-wasm.h +3 -0
  48. data/vendor/v8/include/v8config.h +51 -7
  49. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4d8c256f80d8af53f0a641df7fc8f9d1e1a2d91eff38e74cdeb1716bc16eeaf
4
- data.tar.gz: '0220823faa484a59ab32936d1a592528e5f01d15652955e3095e0b68efcfd559'
3
+ metadata.gz: 7da90a2d4704581bce0d6e040b05791801cf4d346f221c5dc434e5c99f1dc11b
4
+ data.tar.gz: 6da6cb71c1210ca76ec89a477bfad5dfaf8c6ce720e7df819158439a4462dedd
5
5
  SHA512:
6
- metadata.gz: 3efb9ca9752012fb93e211b0f4572a945001b48efe646f481d6dfb975865689238a33226edd98ecf1357d59cb8b3ed9611f7b283909fb3c8e63573e75a440dd6
7
- data.tar.gz: b1d22ccc36662281f8d852d5e09f9468de2fed4af872bc2d4a10041610d58496ab3ab41d5fd37d4d1ab9a73845463b2fbe4cfdacca1bce463ac33887954d1438
6
+ metadata.gz: 3f714017a1e549ee27a3d6db6644656714e822e1f9a933ab649100a33b404dc1cadc1ac2ccfd2bedcb859981d3ca0066e13bbc337bc5710f5de1990734807dab
7
+ data.tar.gz: ecf7958600fed12a249a7dd4d9140b66f931ec54007745fa93ef7f827c6205416b820b078e5bb0ecd0103321c3a3288ff2345b4fbe8d29cde9be1039f323f329
@@ -4,7 +4,7 @@ module Libv8
4
4
  end
5
5
 
6
6
  module Libv8::Node
7
- VERSION = '22.7.0.4'
8
- NODE_VERSION = '22.7.0'
9
- LIBV8_VERSION = '12.4.254.21' # from src/node-.../deps/v8/include/v8-version.h
7
+ VERSION = '23.6.1.0'
8
+ NODE_VERSION = '23.6.1'
9
+ LIBV8_VERSION = '12.9.202.28' # from src/node-.../deps/v8/include/v8-version.h
10
10
  end
@@ -47,7 +47,7 @@ namespace internal {
47
47
  // Similar to C++17 std::align_val_t;
48
48
  enum class AlignVal : size_t {};
49
49
 
50
- class V8_EXPORT MakeGarbageCollectedTraitInternal {
50
+ class MakeGarbageCollectedTraitInternal {
51
51
  protected:
52
52
  static inline void MarkObjectAsFullyConstructed(const void* payload) {
53
53
  // See api_constants for an explanation of the constants.
@@ -121,16 +121,15 @@ class V8_EXPORT MakeGarbageCollectedTraitInternal {
121
121
  };
122
122
 
123
123
  private:
124
- static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t,
125
- GCInfoIndex);
126
- static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&,
127
- size_t, AlignVal,
128
- GCInfoIndex);
129
- static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t,
130
- GCInfoIndex, CustomSpaceIndex);
131
- static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&,
132
- size_t, AlignVal, GCInfoIndex,
133
- CustomSpaceIndex);
124
+ V8_EXPORT static void* CPPGC_DEFAULT_ALIGNED
125
+ Allocate(cppgc::AllocationHandle&, size_t, GCInfoIndex);
126
+ V8_EXPORT static void* CPPGC_DOUBLE_WORD_ALIGNED
127
+ Allocate(cppgc::AllocationHandle&, size_t, AlignVal, GCInfoIndex);
128
+ V8_EXPORT static void* CPPGC_DEFAULT_ALIGNED
129
+ Allocate(cppgc::AllocationHandle&, size_t, GCInfoIndex, CustomSpaceIndex);
130
+ V8_EXPORT static void* CPPGC_DOUBLE_WORD_ALIGNED
131
+ Allocate(cppgc::AllocationHandle&, size_t, AlignVal, GCInfoIndex,
132
+ CustomSpaceIndex);
134
133
 
135
134
  friend class HeapObjectHeader;
136
135
  };
@@ -94,6 +94,14 @@ class GarbageCollectedMixin {
94
94
  public:
95
95
  using IsGarbageCollectedMixinTypeMarker = void;
96
96
 
97
+ // Must use MakeGarbageCollected.
98
+ void* operator new(size_t) = delete;
99
+ void* operator new[](size_t) = delete;
100
+ // The garbage collector is taking care of reclaiming the object.
101
+ // Not override the non-array varaint of `delete` to not conflict with the
102
+ // operator in GarbageCollected above.
103
+ void operator delete[](void*) = delete;
104
+
97
105
  /**
98
106
  * This Trace method must be overriden by objects inheriting from
99
107
  * GarbageCollectedMixin.
@@ -102,6 +102,8 @@ struct HeapStatistics final {
102
102
  size_t resident_size_bytes = 0;
103
103
  /** Amount of memory actually used on the heap. */
104
104
  size_t used_size_bytes = 0;
105
+ /** Memory retained in the page pool, not used directly by the heap. */
106
+ size_t pooled_memory_size_bytes = 0;
105
107
  /** Detail level of this HeapStatistics. */
106
108
  DetailLevel detail_level;
107
109
 
@@ -30,10 +30,15 @@ static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload =
30
30
  // Mask for in-construction bit.
31
31
  static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};
32
32
 
33
- static constexpr size_t kPageSize = size_t{1} << 17;
33
+ static constexpr size_t kPageSizeBits = 17;
34
+ static constexpr size_t kPageSize = size_t{1} << kPageSizeBits;
34
35
 
35
36
  #if defined(V8_HOST_ARCH_ARM64) && defined(V8_OS_DARWIN)
36
37
  constexpr size_t kGuardPageSize = 0;
38
+ #elif defined(V8_HOST_ARCH_PPC64)
39
+ constexpr size_t kGuardPageSize = 0;
40
+ #elif defined(V8_HOST_ARCH_LOONG64) || defined(V8_HOST_ARCH_MIPS64)
41
+ constexpr size_t kGuardPageSize = 0;
37
42
  #else
38
43
  constexpr size_t kGuardPageSize = 4096;
39
44
  #endif
@@ -5,6 +5,8 @@
5
5
  #ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
6
6
  #define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
7
7
 
8
+ #include "v8config.h" // NOLINT(build/include_directory)
9
+
8
10
  namespace cppgc {
9
11
 
10
12
  #if defined(__has_attribute)
@@ -21,7 +23,13 @@ namespace cppgc {
21
23
 
22
24
  // [[no_unique_address]] comes in C++20 but supported in clang with -std >=
23
25
  // c++11.
24
- #if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
26
+ #if defined(V8_CC_MSVC) && CPPGC_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
27
+ // Unfortunately MSVC ignores [[no_unique_address]] (see
28
+ // https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi),
29
+ // and clang-cl matches it for ABI compatibility reasons. We need to prefer
30
+ // [[msvc::no_unique_address]] when available if we actually want any effect.
31
+ #define CPPGC_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
32
+ #elif CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
25
33
  #define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
26
34
  #else
27
35
  #define CPPGC_NO_UNIQUE_ADDRESS
@@ -94,12 +94,11 @@ struct GCInfoTrait final {
94
94
  return index;
95
95
  }
96
96
 
97
- static constexpr bool CheckCallbacksAreDefined() {
97
+ static constexpr void CheckCallbacksAreDefined() {
98
98
  // No USE() macro available.
99
99
  (void)static_cast<TraceCallback>(TraceTrait<T>::Trace);
100
100
  (void)static_cast<FinalizationCallback>(FinalizerTrait<T>::kCallback);
101
101
  (void)static_cast<NameCallback>(NameTrait<T>::GetName);
102
- return true;
103
102
  }
104
103
  };
105
104
 
@@ -127,19 +126,22 @@ struct GCInfoFolding final {
127
126
  // configuration. Only a single GCInfo (for `ResultType` below) will actually
128
127
  // be instantiated but existence (and well-formedness) of all callbacks is
129
128
  // checked.
130
- static constexpr bool kCheckTypeGuardAlwaysTrue =
131
- GCInfoTrait<T>::CheckCallbacksAreDefined() &&
129
+ static constexpr bool WantToFold() {
130
+ if constexpr ((kHasVirtualDestructorAtBase ||
131
+ kBothTypesAreTriviallyDestructible ||
132
+ kHasCustomFinalizerDispatchAtBase) &&
133
+ !kWantsDetailedObjectNames) {
134
+ GCInfoTrait<T>::CheckCallbacksAreDefined();
132
135
  GCInfoTrait<ParentMostGarbageCollectedType>::CheckCallbacksAreDefined();
136
+ return true;
137
+ }
138
+ return false;
139
+ }
133
140
 
134
141
  // Folding would regress name resolution when deriving names from C++
135
142
  // class names as it would just folds a name to the base class name.
136
143
  using ResultType =
137
- std::conditional_t<kCheckTypeGuardAlwaysTrue &&
138
- (kHasVirtualDestructorAtBase ||
139
- kBothTypesAreTriviallyDestructible ||
140
- kHasCustomFinalizerDispatchAtBase) &&
141
- !kWantsDetailedObjectNames,
142
- ParentMostGarbageCollectedType, T>;
144
+ std::conditional_t<WantToFold(), ParentMostGarbageCollectedType, T>;
143
145
  };
144
146
 
145
147
  } // namespace internal
@@ -158,6 +158,12 @@ class V8_TRIVIAL_ABI CompressedPointer final {
158
158
  static V8_INLINE void* Decompress(IntegralType ptr) {
159
159
  CPPGC_DCHECK(CageBaseGlobal::IsSet());
160
160
  const uintptr_t base = CageBaseGlobal::Get();
161
+ return Decompress(ptr, base);
162
+ }
163
+
164
+ static V8_INLINE void* Decompress(IntegralType ptr, uintptr_t base) {
165
+ CPPGC_DCHECK(CageBaseGlobal::IsSet());
166
+ CPPGC_DCHECK(base == CageBaseGlobal::Get());
161
167
  // Treat compressed pointer as signed and cast it to uint64_t, which will
162
168
  // sign-extend it.
163
169
  #if defined(CPPGC_2GB_CAGE)
@@ -121,7 +121,11 @@ class NameTrait final : public NameTraitBase {
121
121
  #undef PRETTY_FUNCTION_VALUE
122
122
 
123
123
  #else // !CPPGC_SUPPORTS_OBJECT_NAMES
124
- return {NameProvider::kHiddenName, true};
124
+ // We wanted to use a class name but were unable to provide one due to
125
+ // compiler limitations or build configuration. As such, return the hidden
126
+ // name with name_was_hidden=false, which will cause this object to be
127
+ // visible in the snapshot.
128
+ return {NameProvider::kHiddenName, false};
125
129
  #endif // !CPPGC_SUPPORTS_OBJECT_NAMES
126
130
  }
127
131
  };
@@ -55,6 +55,13 @@ class V8_EXPORT NameProvider {
55
55
  * Specifies a name for the garbage-collected object. Such names will never
56
56
  * be hidden, as they are explicitly specified by the user of this API.
57
57
  *
58
+ * V8 may call this function while generating a heap snapshot or at other
59
+ * times. If V8 is currently generating a heap snapshot (according to
60
+ * HeapProfiler::IsTakingSnapshot), then the returned string must stay alive
61
+ * until the snapshot generation has completed. Otherwise, the returned string
62
+ * must stay alive forever. If you need a place to store a temporary string
63
+ * during snapshot generation, use HeapProfiler::CopyNameForHeapSnapshot.
64
+ *
58
65
  * @returns a human readable name for the object.
59
66
  */
60
67
  virtual const char* GetHumanReadableName() const = 0;
@@ -18,11 +18,12 @@ namespace v8 {
18
18
  class SharedArrayBuffer;
19
19
 
20
20
  #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
21
- // The number of required internal fields can be defined by embedder.
21
+ // Defined using gn arg `v8_array_buffer_internal_field_count`.
22
22
  #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
23
23
  #endif
24
24
 
25
25
  enum class ArrayBufferCreationMode { kInternalized, kExternalized };
26
+ enum class BackingStoreInitializationMode { kZeroInitialized, kUninitialized };
26
27
 
27
28
  /**
28
29
  * A wrapper around the backing store (i.e. the raw memory) of an array buffer.
@@ -87,6 +88,9 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase {
87
88
  * Assumes that the backing_store was allocated by the ArrayBuffer allocator
88
89
  * of the given isolate.
89
90
  */
91
+ V8_DEPRECATED(
92
+ "Reallocate is unsafe, please do not use. Please allocate a new "
93
+ "BackingStore and copy instead.")
90
94
  static std::unique_ptr<BackingStore> Reallocate(
91
95
  v8::Isolate* isolate, std::unique_ptr<BackingStore> backing_store,
92
96
  size_t byte_length);
@@ -179,6 +183,9 @@ class V8_EXPORT ArrayBuffer : public Object {
179
183
  *
180
184
  * The default implementation allocates a new block and copies data.
181
185
  */
186
+ V8_DEPRECATED(
187
+ "Reallocate is unsafe, please do not use. Please allocate new memory "
188
+ "and copy instead.")
182
189
  virtual void* Reallocate(void* data, size_t old_length, size_t new_length);
183
190
 
184
191
  /**
@@ -211,12 +218,15 @@ class V8_EXPORT ArrayBuffer : public Object {
211
218
  size_t MaxByteLength() const;
212
219
 
213
220
  /**
214
- * Create a new ArrayBuffer. Allocate |byte_length| bytes.
215
- * Allocated memory will be owned by a created ArrayBuffer and
216
- * will be deallocated when it is garbage-collected,
221
+ * Create a new ArrayBuffer. Allocate |byte_length| bytes, which are either
222
+ * zero-initialized or uninitialized. Allocated memory will be owned by a
223
+ * created ArrayBuffer and will be deallocated when it is garbage-collected,
217
224
  * unless the object is externalized.
218
225
  */
219
- static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length);
226
+ static Local<ArrayBuffer> New(
227
+ Isolate* isolate, size_t byte_length,
228
+ BackingStoreInitializationMode initialization_mode =
229
+ BackingStoreInitializationMode::kZeroInitialized);
220
230
 
221
231
  /**
222
232
  * Create a new ArrayBuffer with an existing backing store.
@@ -235,15 +245,18 @@ class V8_EXPORT ArrayBuffer : public Object {
235
245
 
236
246
  /**
237
247
  * Returns a new standalone BackingStore that is allocated using the array
238
- * buffer allocator of the isolate. The result can be later passed to
248
+ * buffer allocator of the isolate. The allocation can either be zero
249
+ * intialized, or uninitialized. The result can be later passed to
239
250
  * ArrayBuffer::New.
240
251
  *
241
252
  * If the allocator returns nullptr, then the function may cause GCs in the
242
253
  * given isolate and re-try the allocation. If GCs do not help, then the
243
254
  * function will crash with an out-of-memory error.
244
255
  */
245
- static std::unique_ptr<BackingStore> NewBackingStore(Isolate* isolate,
246
- size_t byte_length);
256
+ static std::unique_ptr<BackingStore> NewBackingStore(
257
+ Isolate* isolate, size_t byte_length,
258
+ BackingStoreInitializationMode initialization_mode =
259
+ BackingStoreInitializationMode::kZeroInitialized);
247
260
  /**
248
261
  * Returns a new standalone BackingStore that takes over the ownership of
249
262
  * the given buffer. The destructor of the BackingStore invokes the given
@@ -287,7 +300,7 @@ class V8_EXPORT ArrayBuffer : public Object {
287
300
  * preventing JavaScript from ever accessing underlying backing store.
288
301
  * ArrayBuffer should have been externalized and must be detachable.
289
302
  */
290
- V8_DEPRECATE_SOON(
303
+ V8_DEPRECATED(
291
304
  "Use the version which takes a key parameter (passing a null handle is "
292
305
  "ok).")
293
306
  void Detach();
@@ -337,8 +350,9 @@ class V8_EXPORT ArrayBuffer : public Object {
337
350
  return static_cast<ArrayBuffer*>(value);
338
351
  }
339
352
 
340
- static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
341
- static const int kEmbedderFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
353
+ static constexpr int kInternalFieldCount =
354
+ V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
355
+ static constexpr int kEmbedderFieldCount = kInternalFieldCount;
342
356
 
343
357
  private:
344
358
  ArrayBuffer();
@@ -346,7 +360,7 @@ class V8_EXPORT ArrayBuffer : public Object {
346
360
  };
347
361
 
348
362
  #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
349
- // The number of required internal fields can be defined by embedder.
363
+ // Defined using gn arg `v8_array_buffer_view_internal_field_count`.
350
364
  #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
351
365
  #endif
352
366
 
@@ -393,10 +407,9 @@ class V8_EXPORT ArrayBufferView : public Object {
393
407
  return static_cast<ArrayBufferView*>(value);
394
408
  }
395
409
 
396
- static const int kInternalFieldCount =
397
- V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
398
- static const int kEmbedderFieldCount =
410
+ static constexpr int kInternalFieldCount =
399
411
  V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
412
+ static const int kEmbedderFieldCount = kInternalFieldCount;
400
413
 
401
414
  private:
402
415
  ArrayBufferView();
@@ -440,12 +453,15 @@ class V8_EXPORT SharedArrayBuffer : public Object {
440
453
  size_t MaxByteLength() const;
441
454
 
442
455
  /**
443
- * Create a new SharedArrayBuffer. Allocate |byte_length| bytes.
444
- * Allocated memory will be owned by a created SharedArrayBuffer and
445
- * will be deallocated when it is garbage-collected,
446
- * unless the object is externalized.
456
+ * Create a new SharedArrayBuffer. Allocate |byte_length| bytes, which are
457
+ * either zero-initialized or uninitialized. Allocated memory will be owned by
458
+ * a created SharedArrayBuffer and will be deallocated when it is
459
+ * garbage-collected, unless the object is externalized.
447
460
  */
448
- static Local<SharedArrayBuffer> New(Isolate* isolate, size_t byte_length);
461
+ static Local<SharedArrayBuffer> New(
462
+ Isolate* isolate, size_t byte_length,
463
+ BackingStoreInitializationMode initialization_mode =
464
+ BackingStoreInitializationMode::kZeroInitialized);
449
465
 
450
466
  /**
451
467
  * Create a new SharedArrayBuffer with an existing backing store.
@@ -464,15 +480,18 @@ class V8_EXPORT SharedArrayBuffer : public Object {
464
480
 
465
481
  /**
466
482
  * Returns a new standalone BackingStore that is allocated using the array
467
- * buffer allocator of the isolate. The result can be later passed to
483
+ * buffer allocator of the isolate. The allocation can either be zero
484
+ * intialized, or uninitialized. The result can be later passed to
468
485
  * SharedArrayBuffer::New.
469
486
  *
470
487
  * If the allocator returns nullptr, then the function may cause GCs in the
471
488
  * given isolate and re-try the allocation. If GCs do not help, then the
472
489
  * function will crash with an out-of-memory error.
473
490
  */
474
- static std::unique_ptr<BackingStore> NewBackingStore(Isolate* isolate,
475
- size_t byte_length);
491
+ static std::unique_ptr<BackingStore> NewBackingStore(
492
+ Isolate* isolate, size_t byte_length,
493
+ BackingStoreInitializationMode initialization_mode =
494
+ BackingStoreInitializationMode::kZeroInitialized);
476
495
  /**
477
496
  * Returns a new standalone BackingStore that takes over the ownership of
478
497
  * the given buffer. The destructor of the BackingStore invokes the given
@@ -506,7 +525,8 @@ class V8_EXPORT SharedArrayBuffer : public Object {
506
525
  return static_cast<SharedArrayBuffer*>(value);
507
526
  }
508
527
 
509
- static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
528
+ static constexpr int kInternalFieldCount =
529
+ V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
510
530
 
511
531
  private:
512
532
  SharedArrayBuffer();
@@ -152,9 +152,6 @@ using JitCodeEventHandler = void (*)(const JitCodeEvent* event);
152
152
  enum GCType {
153
153
  kGCTypeScavenge = 1 << 0,
154
154
  kGCTypeMinorMarkSweep = 1 << 1,
155
- kGCTypeMinorMarkCompact V8_DEPRECATE_SOON(
156
- "Use kGCTypeMinorMarkSweep instead of kGCTypeMinorMarkCompact.") =
157
- kGCTypeMinorMarkSweep,
158
155
  kGCTypeMarkSweepCompact = 1 << 2,
159
156
  kGCTypeIncrementalMarking = 1 << 3,
160
157
  kGCTypeProcessWeakCallbacks = 1 << 4,
@@ -234,7 +231,7 @@ using MessageCallback = void (*)(Local<Message> message, Local<Value> data);
234
231
 
235
232
  // --- Tracing ---
236
233
 
237
- enum LogEventStatus : int { kStart = 0, kEnd = 1, kStamp = 2 };
234
+ enum LogEventStatus : int { kStart = 0, kEnd = 1, kLog = 2 };
238
235
  using LogEventCallback = void (*)(const char* name,
239
236
  int /* LogEventStatus */ status);
240
237
 
@@ -341,6 +338,14 @@ using JavaScriptCompileHintsMagicEnabledCallback =
341
338
  // --- Callback for checking if WebAssembly JSPI is enabled ---
342
339
  using WasmJSPIEnabledCallback = bool (*)(Local<Context> context);
343
340
 
341
+ /**
342
+ * Import phases in import requests.
343
+ */
344
+ enum class ModuleImportPhase {
345
+ kSource,
346
+ kEvaluation,
347
+ };
348
+
344
349
  /**
345
350
  * HostImportModuleDynamicallyCallback is called when we
346
351
  * require the embedder to load a module. This is used as part of the dynamic
@@ -354,7 +359,7 @@ using WasmJSPIEnabledCallback = bool (*)(Local<Context> context);
354
359
  * The import_attributes are import attributes for this request in the form:
355
360
  * [key1, value1, key2, value2, ...] where the keys and values are of type
356
361
  * v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and
357
- * returned from ModuleRequest::GetImportAssertions(), this array does not
362
+ * returned from ModuleRequest::GetImportAttributes(), this array does not
358
363
  * contain the source Locations of the attributes.
359
364
  *
360
365
  * The embedder must compile, instantiate, evaluate the Module, and
@@ -107,6 +107,10 @@ class V8_EXPORT Context : public Data {
107
107
  * configured if the default context snapshot contains no pointer embedder
108
108
  * data, or if no custom startup snapshot is configured in the
109
109
  * v8::CreateParams used to create the isolate.
110
+ *
111
+ * \param api_wrapper_deserializer An optional callback used to deserialize
112
+ * API wrapper objects that was initially set with v8::Object::Wrap() and then
113
+ * serialized using SerializeAPIWrapperCallback.
110
114
  */
111
115
  static Local<Context> New(
112
116
  Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
@@ -116,17 +120,19 @@ class V8_EXPORT Context : public Data {
116
120
  DeserializeInternalFieldsCallback(),
117
121
  MicrotaskQueue* microtask_queue = nullptr,
118
122
  DeserializeContextDataCallback context_data_deserializer =
119
- DeserializeContextDataCallback());
123
+ DeserializeContextDataCallback(),
124
+ DeserializeAPIWrapperCallback api_wrapper_deserializer =
125
+ DeserializeAPIWrapperCallback());
120
126
 
121
127
  /**
122
128
  * Create a new context from a (non-default) context snapshot. There
123
129
  * is no way to provide a global object template since we do not create
124
130
  * a new global object from template, but we can reuse a global object.
125
131
  *
126
- * \param isolate See v8::Context::New.
132
+ * \param isolate See v8::Context::New().
127
133
  *
128
134
  * \param context_snapshot_index The index of the context snapshot to
129
- * deserialize from. Use v8::Context::New for the default snapshot.
135
+ * deserialize from. Use v8::Context::New() for the default snapshot.
130
136
  *
131
137
  * \param internal_fields_deserializer An optional callback used
132
138
  * to deserialize fields set by
@@ -136,19 +142,23 @@ class V8_EXPORT Context : public Data {
136
142
  * pointer fields in the default context snapshot or if no startup
137
143
  * snapshot is configured when the isolate is created.
138
144
  *
139
- * \param extensions See v8::Context::New.
145
+ * \param extensions See v8::Context::New().
140
146
  *
141
- * \param global_object See v8::Context::New.
147
+ * \param global_object See v8::Context::New().
142
148
  *
143
149
  * \param internal_fields_deserializer Similar to
144
- * internal_fields_deserializer in v8::Context::New but applies to
150
+ * internal_fields_deserializer in v8::Context::New() but applies to
145
151
  * the context specified by the context_snapshot_index.
146
152
  *
147
- * \param microtask_queue See v8::Context::New.
153
+ * \param microtask_queue See v8::Context::New().
148
154
  *
149
155
  * \param context_data_deserializer Similar to
150
- * context_data_deserializer in v8::Context::New but applies to
156
+ * context_data_deserializer in v8::Context::New() but applies to
151
157
  * the context specified by the context_snapshot_index.
158
+ *
159
+ *\param api_wrapper_deserializer Similar to api_wrapper_deserializer in
160
+ * v8::Context::New() but applies to the context specified by the
161
+ * context_snapshot_index.
152
162
  */
153
163
  static MaybeLocal<Context> FromSnapshot(
154
164
  Isolate* isolate, size_t context_snapshot_index,
@@ -158,7 +168,9 @@ class V8_EXPORT Context : public Data {
158
168
  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
159
169
  MicrotaskQueue* microtask_queue = nullptr,
160
170
  DeserializeContextDataCallback context_data_deserializer =
161
- DeserializeContextDataCallback());
171
+ DeserializeContextDataCallback(),
172
+ DeserializeAPIWrapperCallback api_wrapper_deserializer =
173
+ DeserializeAPIWrapperCallback());
162
174
 
163
175
  /**
164
176
  * Returns an global object that isn't backed by an actual context.
@@ -290,6 +302,8 @@ class V8_EXPORT Context : public Data {
290
302
  * SetAlignedPointerInEmbedderData with the same index. Note that index 0
291
303
  * currently has a special meaning for Chrome's debugger.
292
304
  */
305
+ V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate,
306
+ int index);
293
307
  V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
294
308
 
295
309
  /**
@@ -444,6 +458,24 @@ Local<Value> Context::GetEmbedderData(int index) {
444
458
  #endif
445
459
  }
446
460
 
461
+ void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index) {
462
+ #if !defined(V8_ENABLE_CHECKS)
463
+ using A = internal::Address;
464
+ using I = internal::Internals;
465
+ A ctx = internal::ValueHelper::ValueAsAddress(this);
466
+ A embedder_data =
467
+ I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
468
+ int value_offset = I::kEmbedderDataArrayHeaderSize +
469
+ (I::kEmbedderDataSlotSize * index) +
470
+ I::kEmbedderDataSlotExternalPointerOffset;
471
+ return reinterpret_cast<void*>(
472
+ I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
473
+ isolate, embedder_data, value_offset));
474
+ #else
475
+ return SlowGetAlignedPointerFromEmbedderData(index);
476
+ #endif
477
+ }
478
+
447
479
  void* Context::GetAlignedPointerFromEmbedderData(int index) {
448
480
  #if !defined(V8_ENABLE_CHECKS)
449
481
  using A = internal::Address;
@@ -32,62 +32,15 @@ class CppHeap;
32
32
 
33
33
  class CustomSpaceStatisticsReceiver;
34
34
 
35
- /**
36
- * Describes how V8 wrapper objects maintain references to garbage-collected C++
37
- * objects.
38
- */
39
- struct WrapperDescriptor final {
40
- /**
41
- * The index used on `v8::Ojbect::SetAlignedPointerFromInternalField()` and
42
- * related APIs to add additional data to an object which is used to identify
43
- * JS->C++ references.
44
- */
45
- using InternalFieldIndex = int;
46
-
47
- /**
48
- * Unknown embedder id. The value is reserved for internal usages and must not
49
- * be used with `CppHeap`.
50
- */
51
- static constexpr uint16_t kUnknownEmbedderId = UINT16_MAX;
52
-
53
- constexpr WrapperDescriptor(InternalFieldIndex wrappable_type_index,
54
- InternalFieldIndex wrappable_instance_index,
55
- uint16_t embedder_id_for_garbage_collected)
56
- : wrappable_type_index(wrappable_type_index),
57
- wrappable_instance_index(wrappable_instance_index),
58
- embedder_id_for_garbage_collected(embedder_id_for_garbage_collected) {}
59
-
60
- /**
61
- * Index of the wrappable type.
62
- */
63
- InternalFieldIndex wrappable_type_index;
64
-
65
- /**
66
- * Index of the wrappable instance.
67
- */
68
- InternalFieldIndex wrappable_instance_index;
69
-
70
- /**
71
- * Embedder id identifying instances of garbage-collected objects. It is
72
- * expected that the first field of the wrappable type is a uint16_t holding
73
- * the id. Only references to instances of wrappables types with an id of
74
- * `embedder_id_for_garbage_collected` will be considered by CppHeap.
75
- */
76
- uint16_t embedder_id_for_garbage_collected;
77
- };
78
-
79
35
  struct V8_EXPORT CppHeapCreateParams {
80
- CppHeapCreateParams(
81
- std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces,
82
- WrapperDescriptor wrapper_descriptor)
83
- : custom_spaces(std::move(custom_spaces)),
84
- wrapper_descriptor(wrapper_descriptor) {}
36
+ explicit CppHeapCreateParams(
37
+ std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces)
38
+ : custom_spaces(std::move(custom_spaces)) {}
85
39
 
86
40
  CppHeapCreateParams(const CppHeapCreateParams&) = delete;
87
41
  CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete;
88
42
 
89
43
  std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces;
90
- WrapperDescriptor wrapper_descriptor;
91
44
  /**
92
45
  * Specifies which kind of marking are supported by the heap. The type may be
93
46
  * further reduced via runtime flags when attaching the heap to an Isolate.
@@ -177,11 +130,6 @@ class V8_EXPORT CppHeap {
177
130
  void CollectGarbageInYoungGenerationForTesting(
178
131
  cppgc::EmbedderStackState stack_state);
179
132
 
180
- /**
181
- * \returns the wrapper descriptor of this CppHeap.
182
- */
183
- v8::WrapperDescriptor wrapper_descriptor() const;
184
-
185
133
  private:
186
134
  CppHeap() = default;
187
135
 
@@ -21,6 +21,10 @@ class V8_EXPORT Date : public Object {
21
21
  static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
22
22
  double time);
23
23
 
24
+ static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse(
25
+ Local<Context> context,
26
+ Local<String> date_string);
27
+
24
28
  /**
25
29
  * A specialization of Value::NumberValue that is more efficient
26
30
  * because we know the structure of this object.
@@ -32,6 +36,11 @@ class V8_EXPORT Date : public Object {
32
36
  */
33
37
  v8::Local<v8::String> ToISOString() const;
34
38
 
39
+ /**
40
+ * Generates UTC string representation.
41
+ */
42
+ v8::Local<v8::String> ToUTCString() const;
43
+
35
44
  V8_INLINE static Date* Cast(Value* value) {
36
45
  #ifdef V8_ENABLE_CHECKS
37
46
  CheckCast(value);
@@ -29,6 +29,8 @@ class V8_EXPORT EmbedderRootsHandler {
29
29
  virtual ~EmbedderRootsHandler() = default;
30
30
 
31
31
  EmbedderRootsHandler() = default;
32
+
33
+ V8_DEPRECATED("Use the default constructor instead.")
32
34
  explicit EmbedderRootsHandler(RootHandling default_traced_reference_handling)
33
35
  : default_traced_reference_handling_(default_traced_reference_handling) {}
34
36
 
@@ -47,6 +49,7 @@ class V8_EXPORT EmbedderRootsHandler {
47
49
  *
48
50
  * The concrete implementations must be thread-safe.
49
51
  */
52
+ V8_DEPRECATED("Use TracedReferenceHandling::kDroppable instead.")
50
53
  virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
51
54
 
52
55
  /**
@@ -72,7 +75,7 @@ class V8_EXPORT EmbedderRootsHandler {
72
75
 
73
76
  private:
74
77
  const RootHandling default_traced_reference_handling_ =
75
- RootHandling::kQueryEmbedderForNonDroppableReferences;
78
+ RootHandling::kDontQueryEmbedderForAnyReference;
76
79
 
77
80
  friend class internal::TracedHandles;
78
81
  };