libv8-node 18.19.1.0-aarch64-linux-musl → 19.9.0.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  4. data/vendor/v8/include/cppgc/common.h +0 -1
  5. data/vendor/v8/include/cppgc/cross-thread-persistent.h +7 -8
  6. data/vendor/v8/include/cppgc/heap-consistency.h +46 -3
  7. data/vendor/v8/include/cppgc/heap-handle.h +43 -0
  8. data/vendor/v8/include/cppgc/heap-statistics.h +2 -2
  9. data/vendor/v8/include/cppgc/heap.h +3 -7
  10. data/vendor/v8/include/cppgc/internal/api-constants.h +11 -1
  11. data/vendor/v8/include/cppgc/internal/base-page-handle.h +45 -0
  12. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +40 -8
  13. data/vendor/v8/include/cppgc/internal/caged-heap.h +61 -0
  14. data/vendor/v8/include/cppgc/internal/gc-info.h +0 -1
  15. data/vendor/v8/include/cppgc/internal/member-storage.h +236 -0
  16. data/vendor/v8/include/cppgc/internal/name-trait.h +21 -6
  17. data/vendor/v8/include/cppgc/internal/persistent-node.h +11 -13
  18. data/vendor/v8/include/cppgc/internal/pointer-policies.h +28 -7
  19. data/vendor/v8/include/cppgc/internal/write-barrier.h +143 -101
  20. data/vendor/v8/include/cppgc/liveness-broker.h +8 -7
  21. data/vendor/v8/include/cppgc/member.h +364 -89
  22. data/vendor/v8/include/cppgc/name-provider.h +4 -4
  23. data/vendor/v8/include/cppgc/persistent.h +5 -9
  24. data/vendor/v8/include/cppgc/platform.h +2 -2
  25. data/vendor/v8/include/cppgc/sentinel-pointer.h +1 -1
  26. data/vendor/v8/include/cppgc/trace-trait.h +4 -0
  27. data/vendor/v8/include/cppgc/type-traits.h +9 -0
  28. data/vendor/v8/include/cppgc/visitor.h +89 -57
  29. data/vendor/v8/include/v8-callbacks.h +19 -5
  30. data/vendor/v8/include/v8-context.h +13 -8
  31. data/vendor/v8/include/v8-cppgc.h +12 -0
  32. data/vendor/v8/include/v8-date.h +5 -0
  33. data/vendor/v8/include/v8-embedder-heap.h +8 -3
  34. data/vendor/v8/include/v8-exception.h +1 -1
  35. data/vendor/v8/include/v8-fast-api-calls.h +46 -32
  36. data/vendor/v8/include/v8-function.h +8 -0
  37. data/vendor/v8/include/v8-initialization.h +23 -49
  38. data/vendor/v8/include/v8-inspector.h +13 -7
  39. data/vendor/v8/include/v8-internal.h +328 -123
  40. data/vendor/v8/include/v8-isolate.h +27 -42
  41. data/vendor/v8/include/v8-local-handle.h +5 -5
  42. data/vendor/v8/include/v8-locker.h +0 -11
  43. data/vendor/v8/include/v8-maybe.h +24 -1
  44. data/vendor/v8/include/v8-message.h +2 -4
  45. data/vendor/v8/include/v8-metrics.h +20 -38
  46. data/vendor/v8/include/v8-microtask-queue.h +1 -1
  47. data/vendor/v8/include/v8-object.h +8 -15
  48. data/vendor/v8/include/v8-persistent-handle.h +0 -2
  49. data/vendor/v8/include/v8-platform.h +54 -25
  50. data/vendor/v8/include/v8-primitive.h +8 -8
  51. data/vendor/v8/include/v8-profiler.h +84 -22
  52. data/vendor/v8/include/v8-regexp.h +2 -1
  53. data/vendor/v8/include/v8-script.h +62 -6
  54. data/vendor/v8/include/v8-template.h +13 -76
  55. data/vendor/v8/include/v8-unwinder-state.h +4 -4
  56. data/vendor/v8/include/v8-util.h +2 -4
  57. data/vendor/v8/include/v8-value-serializer.h +46 -23
  58. data/vendor/v8/include/v8-version.h +3 -3
  59. data/vendor/v8/include/v8-wasm.h +5 -62
  60. data/vendor/v8/include/v8-weak-callback-info.h +0 -7
  61. data/vendor/v8/include/v8config.h +280 -13
  62. metadata +6 -2
@@ -132,8 +132,8 @@ class V8_EXPORT Platform {
132
132
  *
133
133
  * Can be called multiple times when paired with `ShutdownProcess()`.
134
134
  *
135
- * \param page_allocator The allocator used for maintaining meta data. Must not
136
- * change between multiple calls to InitializeProcess.
135
+ * \param page_allocator The allocator used for maintaining meta data. Must stay
136
+ * always alive and not change between multiple calls to InitializeProcess.
137
137
  */
138
138
  V8_EXPORT void InitializeProcess(PageAllocator* page_allocator);
139
139
 
@@ -13,9 +13,9 @@ namespace internal {
13
13
  // Special tag type used to denote some sentinel member. The semantics of the
14
14
  // sentinel is defined by the embedder.
15
15
  struct SentinelPointer {
16
+ static constexpr intptr_t kSentinelValue = 0b10;
16
17
  template <typename T>
17
18
  operator T*() const {
18
- static constexpr intptr_t kSentinelValue = 1;
19
19
  return reinterpret_cast<T*>(kSentinelValue);
20
20
  }
21
21
  // Hidden friends.
@@ -16,6 +16,10 @@ class Visitor;
16
16
 
17
17
  namespace internal {
18
18
 
19
+ class RootVisitor;
20
+
21
+ using TraceRootCallback = void (*)(RootVisitor&, const void* object);
22
+
19
23
  // Implementation of the default TraceTrait handling GarbageCollected and
20
24
  // GarbageCollectedMixin.
21
25
  template <typename T,
@@ -170,6 +170,15 @@ struct IsComplete {
170
170
  decltype(IsSizeOfKnown(std::declval<T*>()))::value;
171
171
  };
172
172
 
173
+ template <typename T, typename U>
174
+ constexpr bool IsDecayedSameV =
175
+ std::is_same_v<std::decay_t<T>, std::decay_t<U>>;
176
+
177
+ template <typename B, typename D>
178
+ constexpr bool IsStrictlyBaseOfV =
179
+ std::is_base_of_v<std::decay_t<B>, std::decay_t<D>> &&
180
+ !IsDecayedSameV<B, D>;
181
+
173
182
  } // namespace internal
174
183
 
175
184
  /**
@@ -62,22 +62,6 @@ class V8_EXPORT Visitor {
62
62
 
63
63
  virtual ~Visitor() = default;
64
64
 
65
- /**
66
- * Trace method for raw pointers. Prefer the versions for managed pointers.
67
- *
68
- * \param member Reference retaining an object.
69
- */
70
- template <typename T>
71
- void Trace(const T* t) {
72
- static_assert(sizeof(T), "Pointee type must be fully defined.");
73
- static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
74
- "T must be GarbageCollected or GarbageCollectedMixin type");
75
- if (!t) {
76
- return;
77
- }
78
- Visit(t, TraceTrait<T>::GetTraceDescriptor(t));
79
- }
80
-
81
65
  /**
82
66
  * Trace method for Member.
83
67
  *
@@ -87,7 +71,7 @@ class V8_EXPORT Visitor {
87
71
  void Trace(const Member<T>& member) {
88
72
  const T* value = member.GetRawAtomic();
89
73
  CPPGC_DCHECK(value != kSentinelPointer);
90
- Trace(value);
74
+ TraceImpl(value);
91
75
  }
92
76
 
93
77
  /**
@@ -231,23 +215,33 @@ class V8_EXPORT Visitor {
231
215
  void TraceStrongly(const WeakMember<T>& weak_member) {
232
216
  const T* value = weak_member.GetRawAtomic();
233
217
  CPPGC_DCHECK(value != kSentinelPointer);
234
- Trace(value);
218
+ TraceImpl(value);
219
+ }
220
+
221
+ /**
222
+ * Trace method for retaining containers strongly.
223
+ *
224
+ * \param object reference to the container.
225
+ */
226
+ template <typename T>
227
+ void TraceStrongContainer(const T* object) {
228
+ TraceImpl(object);
235
229
  }
236
230
 
237
231
  /**
238
- * Trace method for weak containers.
232
+ * Trace method for retaining containers weakly.
239
233
  *
240
- * \param object reference of the weak container.
234
+ * \param object reference to the container.
241
235
  * \param callback to be invoked.
242
- * \param data custom data that is passed to the callback.
236
+ * \param callback_data custom data that is passed to the callback.
243
237
  */
244
238
  template <typename T>
245
239
  void TraceWeakContainer(const T* object, WeakCallback callback,
246
- const void* data) {
240
+ const void* callback_data) {
247
241
  if (!object) return;
248
242
  VisitWeakContainer(object, TraceTrait<T>::GetTraceDescriptor(object),
249
243
  TraceTrait<T>::GetWeakTraceDescriptor(object), callback,
250
- data);
244
+ callback_data);
251
245
  }
252
246
 
253
247
  /**
@@ -255,6 +249,7 @@ class V8_EXPORT Visitor {
255
249
  * compactable space. Such references maybe be arbitrarily moved by the GC.
256
250
  *
257
251
  * \param slot location of reference to object that might be moved by the GC.
252
+ * The slot must contain an uncompressed pointer.
258
253
  */
259
254
  template <typename T>
260
255
  void RegisterMovableReference(const T** slot) {
@@ -297,9 +292,6 @@ class V8_EXPORT Visitor {
297
292
  virtual void Visit(const void* self, TraceDescriptor) {}
298
293
  virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback,
299
294
  const void* weak_member) {}
300
- virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {}
301
- virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback,
302
- const void* weak_root, const SourceLocation&) {}
303
295
  virtual void VisitEphemeron(const void* key, const void* value,
304
296
  TraceDescriptor value_desc) {}
305
297
  virtual void VisitWeakContainer(const void* self, TraceDescriptor strong_desc,
@@ -320,44 +312,20 @@ class V8_EXPORT Visitor {
320
312
  static void HandleWeak(const LivenessBroker& info, const void* object) {
321
313
  const PointerType* weak = static_cast<const PointerType*>(object);
322
314
  auto* raw_ptr = weak->GetFromGC();
323
- // Sentinel values are preserved for weak pointers.
324
- if (raw_ptr == kSentinelPointer) return;
325
315
  if (!info.IsHeapObjectAlive(raw_ptr)) {
326
316
  weak->ClearFromGC();
327
317
  }
328
318
  }
329
319
 
330
- template <typename Persistent,
331
- std::enable_if_t<Persistent::IsStrongPersistent::value>* = nullptr>
332
- void TraceRoot(const Persistent& p, const SourceLocation& loc) {
333
- using PointeeType = typename Persistent::PointeeType;
334
- static_assert(sizeof(PointeeType),
335
- "Persistent's pointee type must be fully defined");
336
- static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
337
- "Persistent's pointee type must be GarbageCollected or "
338
- "GarbageCollectedMixin");
339
- auto* ptr = p.GetFromGC();
340
- if (!ptr) {
320
+ template <typename T>
321
+ void TraceImpl(const T* t) {
322
+ static_assert(sizeof(T), "Pointee type must be fully defined.");
323
+ static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
324
+ "T must be GarbageCollected or GarbageCollectedMixin type");
325
+ if (!t) {
341
326
  return;
342
327
  }
343
- VisitRoot(ptr, TraceTrait<PointeeType>::GetTraceDescriptor(ptr), loc);
344
- }
345
-
346
- template <
347
- typename WeakPersistent,
348
- std::enable_if_t<!WeakPersistent::IsStrongPersistent::value>* = nullptr>
349
- void TraceRoot(const WeakPersistent& p, const SourceLocation& loc) {
350
- using PointeeType = typename WeakPersistent::PointeeType;
351
- static_assert(sizeof(PointeeType),
352
- "Persistent's pointee type must be fully defined");
353
- static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
354
- "Persistent's pointee type must be GarbageCollected or "
355
- "GarbageCollectedMixin");
356
- static_assert(!internal::IsAllocatedOnCompactableSpace<PointeeType>::value,
357
- "Weak references to compactable objects are not allowed");
358
- auto* ptr = p.GetFromGC();
359
- VisitWeakRoot(ptr, TraceTrait<PointeeType>::GetTraceDescriptor(ptr),
360
- &HandleWeak<WeakPersistent>, &p, loc);
328
+ Visit(t, TraceTrait<T>::GetTraceDescriptor(t));
361
329
  }
362
330
 
363
331
  #if V8_ENABLE_CHECKS
@@ -374,6 +342,70 @@ class V8_EXPORT Visitor {
374
342
  friend class internal::VisitorBase;
375
343
  };
376
344
 
345
+ namespace internal {
346
+
347
+ class V8_EXPORT RootVisitor {
348
+ public:
349
+ explicit RootVisitor(Visitor::Key) {}
350
+
351
+ virtual ~RootVisitor() = default;
352
+
353
+ template <typename AnyStrongPersistentType,
354
+ std::enable_if_t<
355
+ AnyStrongPersistentType::IsStrongPersistent::value>* = nullptr>
356
+ void Trace(const AnyStrongPersistentType& p) {
357
+ using PointeeType = typename AnyStrongPersistentType::PointeeType;
358
+ const void* object = Extract(p);
359
+ if (!object) {
360
+ return;
361
+ }
362
+ VisitRoot(object, TraceTrait<PointeeType>::GetTraceDescriptor(object),
363
+ p.Location());
364
+ }
365
+
366
+ template <typename AnyWeakPersistentType,
367
+ std::enable_if_t<
368
+ !AnyWeakPersistentType::IsStrongPersistent::value>* = nullptr>
369
+ void Trace(const AnyWeakPersistentType& p) {
370
+ using PointeeType = typename AnyWeakPersistentType::PointeeType;
371
+ static_assert(!internal::IsAllocatedOnCompactableSpace<PointeeType>::value,
372
+ "Weak references to compactable objects are not allowed");
373
+ const void* object = Extract(p);
374
+ if (!object) {
375
+ return;
376
+ }
377
+ VisitWeakRoot(object, TraceTrait<PointeeType>::GetTraceDescriptor(object),
378
+ &HandleWeak<AnyWeakPersistentType>, &p, p.Location());
379
+ }
380
+
381
+ protected:
382
+ virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {}
383
+ virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback,
384
+ const void* weak_root, const SourceLocation&) {}
385
+
386
+ private:
387
+ template <typename AnyPersistentType>
388
+ static const void* Extract(AnyPersistentType& p) {
389
+ using PointeeType = typename AnyPersistentType::PointeeType;
390
+ static_assert(sizeof(PointeeType),
391
+ "Persistent's pointee type must be fully defined");
392
+ static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
393
+ "Persistent's pointee type must be GarbageCollected or "
394
+ "GarbageCollectedMixin");
395
+ return p.GetFromGC();
396
+ }
397
+
398
+ template <typename PointerType>
399
+ static void HandleWeak(const LivenessBroker& info, const void* object) {
400
+ const PointerType* weak = static_cast<const PointerType*>(object);
401
+ auto* raw_ptr = weak->GetFromGC();
402
+ if (!info.IsHeapObjectAlive(raw_ptr)) {
403
+ weak->ClearFromGC();
404
+ }
405
+ }
406
+ };
407
+
408
+ } // namespace internal
377
409
  } // namespace cppgc
378
410
 
379
411
  #endif // INCLUDE_CPPGC_VISITOR_H_
@@ -12,6 +12,7 @@
12
12
  #include "cppgc/common.h"
13
13
  #include "v8-data.h" // NOLINT(build/include_directory)
14
14
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
15
+ #include "v8-promise.h" // NOLINT(build/include_directory)
15
16
  #include "v8config.h" // NOLINT(build/include_directory)
16
17
 
17
18
  #if defined(V8_OS_WIN)
@@ -105,7 +106,7 @@ struct JitCodeEvent {
105
106
  size_t line_number_table_size;
106
107
  };
107
108
 
108
- wasm_source_info_t* wasm_source_info;
109
+ wasm_source_info_t* wasm_source_info = nullptr;
109
110
 
110
111
  union {
111
112
  // Only valid for CODE_ADDED.
@@ -216,7 +217,13 @@ using AddHistogramSampleCallback = void (*)(void* histogram, int sample);
216
217
 
217
218
  using FatalErrorCallback = void (*)(const char* location, const char* message);
218
219
 
219
- using OOMErrorCallback = void (*)(const char* location, bool is_heap_oom);
220
+ struct OOMDetails {
221
+ bool is_heap_oom = false;
222
+ const char* detail = nullptr;
223
+ };
224
+
225
+ using OOMErrorCallback = void (*)(const char* location,
226
+ const OOMDetails& details);
220
227
 
221
228
  using MessageCallback = void (*)(Local<Message> message, Local<Value> data);
222
229
 
@@ -231,8 +238,11 @@ enum class CrashKeyId {
231
238
  kIsolateAddress,
232
239
  kReadonlySpaceFirstPageAddress,
233
240
  kMapSpaceFirstPageAddress,
241
+ kCodeRangeBaseAddress,
234
242
  kCodeSpaceFirstPageAddress,
235
243
  kDumpType,
244
+ kSnapshotChecksumCalculated,
245
+ kSnapshotChecksumExpected,
236
246
  };
237
247
 
238
248
  using AddCrashKeyCallback = void (*)(CrashKeyId id, const std::string& value);
@@ -300,6 +310,13 @@ using ApiImplementationCallback = void (*)(const FunctionCallbackInfo<Value>&);
300
310
  // --- Callback for WebAssembly.compileStreaming ---
301
311
  using WasmStreamingCallback = void (*)(const FunctionCallbackInfo<Value>&);
302
312
 
313
+ enum class WasmAsyncSuccess { kSuccess, kFail };
314
+
315
+ // --- Callback called when async WebAssembly operations finish ---
316
+ using WasmAsyncResolvePromiseCallback = void (*)(
317
+ Isolate* isolate, Local<Context> context, Local<Promise::Resolver> resolver,
318
+ Local<Value> result, WasmAsyncSuccess success);
319
+
303
320
  // --- Callback for loading source map file for Wasm profiling support
304
321
  using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
305
322
  const char* name);
@@ -310,9 +327,6 @@ using WasmSimdEnabledCallback = bool (*)(Local<Context> context);
310
327
  // --- Callback for checking if WebAssembly exceptions are enabled ---
311
328
  using WasmExceptionsEnabledCallback = bool (*)(Local<Context> context);
312
329
 
313
- // --- Callback for checking if WebAssembly dynamic tiering is enabled ---
314
- using WasmDynamicTieringEnabledCallback = bool (*)(Local<Context> context);
315
-
316
330
  // --- Callback for checking if the SharedArrayBuffer constructor is enabled ---
317
331
  using SharedArrayBufferConstructorEnabledCallback =
318
332
  bool (*)(Local<Context> context);
@@ -244,6 +244,12 @@ class V8_EXPORT Context : public Data {
244
244
  */
245
245
  void SetErrorMessageForCodeGenerationFromStrings(Local<String> message);
246
246
 
247
+ /**
248
+ * Sets the error description for the exception that is thrown when
249
+ * wasm code generation is not allowed.
250
+ */
251
+ void SetErrorMessageForWasmCodeGeneration(Local<String> message);
252
+
247
253
  /**
248
254
  * Return data that was previously attached to the context snapshot via
249
255
  * SnapshotCreator, and removes the reference to it.
@@ -284,6 +290,7 @@ class V8_EXPORT Context : public Data {
284
290
  Local<Function> after_hook,
285
291
  Local<Function> resolve_hook);
286
292
 
293
+ bool HasTemplateLiteralObject(Local<Value> object);
287
294
  /**
288
295
  * Stack-allocated class which sets the execution context for all
289
296
  * operations executed within a local scope.
@@ -374,15 +381,13 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
374
381
  A ctx = *reinterpret_cast<const A*>(this);
375
382
  A embedder_data =
376
383
  I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
377
- int value_offset =
378
- I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
379
- #ifdef V8_SANDBOXED_EXTERNAL_POINTERS
380
- value_offset += I::kEmbedderDataSlotRawPayloadOffset;
381
- #endif
382
- internal::Isolate* isolate = I::GetIsolateForSandbox(ctx);
384
+ int value_offset = I::kEmbedderDataArrayHeaderSize +
385
+ (I::kEmbedderDataSlotSize * index) +
386
+ I::kEmbedderDataSlotExternalPointerOffset;
387
+ Isolate* isolate = I::GetIsolateForSandbox(ctx);
383
388
  return reinterpret_cast<void*>(
384
- I::ReadExternalPointerField(isolate, embedder_data, value_offset,
385
- internal::kEmbedderDataSlotPayloadTag));
389
+ I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
390
+ isolate, embedder_data, value_offset));
386
391
  #else
387
392
  return SlowGetAlignedPointerFromEmbedderData(index);
388
393
  #endif
@@ -82,6 +82,18 @@ struct V8_EXPORT CppHeapCreateParams {
82
82
 
83
83
  std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces;
84
84
  WrapperDescriptor wrapper_descriptor;
85
+ /**
86
+ * Specifies which kind of marking are supported by the heap. The type may be
87
+ * further reduced via runtime flags when attaching the heap to an Isolate.
88
+ */
89
+ cppgc::Heap::MarkingType marking_support =
90
+ cppgc::Heap::MarkingType::kIncrementalAndConcurrent;
91
+ /**
92
+ * Specifies which kind of sweeping is supported by the heap. The type may be
93
+ * further reduced via runtime flags when attaching the heap to an Isolate.
94
+ */
95
+ cppgc::Heap::SweepingType sweeping_support =
96
+ cppgc::Heap::SweepingType::kIncrementalAndConcurrent;
85
97
  };
86
98
 
87
99
  /**
@@ -27,6 +27,11 @@ class V8_EXPORT Date : public Object {
27
27
  */
28
28
  double ValueOf() const;
29
29
 
30
+ /**
31
+ * Generates ISO string representation.
32
+ */
33
+ v8::Local<v8::String> ToISOString() const;
34
+
30
35
  V8_INLINE static Date* Cast(Value* value) {
31
36
  #ifdef V8_ENABLE_CHECKS
32
37
  CheckCast(value);
@@ -69,7 +69,12 @@ class V8_EXPORT EmbedderRootsHandler {
69
69
  * trace through its heap and use reporter to report each JavaScript object
70
70
  * reachable from any of the given wrappers.
71
71
  */
72
- class V8_EXPORT EmbedderHeapTracer {
72
+ class V8_EXPORT
73
+ // GCC doesn't like combining __attribute__(()) with [[deprecated]].
74
+ #ifdef __clang__
75
+ V8_DEPRECATE_SOON("Use CppHeap when working with v8::TracedReference.")
76
+ #endif // __clang__
77
+ EmbedderHeapTracer {
73
78
  public:
74
79
  using EmbedderStackState = cppgc::EmbedderStackState;
75
80
 
@@ -205,10 +210,10 @@ class V8_EXPORT EmbedderHeapTracer {
205
210
  * Returns the v8::Isolate this tracer is attached too and |nullptr| if it
206
211
  * is not attached to any v8::Isolate.
207
212
  */
208
- v8::Isolate* isolate() const { return isolate_; }
213
+ v8::Isolate* isolate() const { return v8_isolate_; }
209
214
 
210
215
  protected:
211
- v8::Isolate* isolate_ = nullptr;
216
+ v8::Isolate* v8_isolate_ = nullptr;
212
217
 
213
218
  friend class internal::LocalEmbedderHeapTracer;
214
219
  };
@@ -197,7 +197,7 @@ class V8_EXPORT TryCatch {
197
197
 
198
198
  void ResetInternal();
199
199
 
200
- internal::Isolate* isolate_;
200
+ internal::Isolate* i_isolate_;
201
201
  TryCatch* next_;
202
202
  void* exception_;
203
203
  void* message_obj_;
@@ -240,6 +240,7 @@ class CTypeInfo {
240
240
  enum class Type : uint8_t {
241
241
  kVoid,
242
242
  kBool,
243
+ kUint8,
243
244
  kInt32,
244
245
  kUint32,
245
246
  kInt64,
@@ -247,6 +248,7 @@ class CTypeInfo {
247
248
  kFloat32,
248
249
  kFloat64,
249
250
  kV8Value,
251
+ kSeqOneByteString,
250
252
  kApiObject, // This will be deprecated once all users have
251
253
  // migrated from v8::ApiObject to v8::Local<v8::Value>.
252
254
  kAny, // This is added to enable untyped representation of fast
@@ -302,8 +304,9 @@ class CTypeInfo {
302
304
  constexpr Flags GetFlags() const { return flags_; }
303
305
 
304
306
  static constexpr bool IsIntegralType(Type type) {
305
- return type == Type::kInt32 || type == Type::kUint32 ||
306
- type == Type::kInt64 || type == Type::kUint64;
307
+ return type == Type::kUint8 || type == Type::kInt32 ||
308
+ type == Type::kUint32 || type == Type::kInt64 ||
309
+ type == Type::kUint64;
307
310
  }
308
311
 
309
312
  static constexpr bool IsFloatingPointType(Type type) {
@@ -377,6 +380,11 @@ struct FastApiArrayBuffer {
377
380
  size_t byte_length;
378
381
  };
379
382
 
383
+ struct FastOneByteString {
384
+ const char* data;
385
+ uint32_t length;
386
+ };
387
+
380
388
  class V8_EXPORT CFunctionInfo {
381
389
  public:
382
390
  // Construct a struct to hold a CFunction's type information.
@@ -429,12 +437,14 @@ struct AnyCType {
429
437
  double double_value;
430
438
  Local<Object> object_value;
431
439
  Local<Array> sequence_value;
440
+ const FastApiTypedArray<uint8_t>* uint8_ta_value;
432
441
  const FastApiTypedArray<int32_t>* int32_ta_value;
433
442
  const FastApiTypedArray<uint32_t>* uint32_ta_value;
434
443
  const FastApiTypedArray<int64_t>* int64_ta_value;
435
444
  const FastApiTypedArray<uint64_t>* uint64_ta_value;
436
445
  const FastApiTypedArray<float>* float_ta_value;
437
446
  const FastApiTypedArray<double>* double_ta_value;
447
+ const FastOneByteString* string_value;
438
448
  FastApiCallbackOptions* options_value;
439
449
  };
440
450
  };
@@ -544,7 +554,7 @@ struct FastApiCallbackOptions {
544
554
  * returned instance may be filled with mock data.
545
555
  */
546
556
  static FastApiCallbackOptions CreateForTesting(Isolate* isolate) {
547
- return {false, {0}};
557
+ return {false, {0}, nullptr};
548
558
  }
549
559
 
550
560
  /**
@@ -566,8 +576,13 @@ struct FastApiCallbackOptions {
566
576
  */
567
577
  union {
568
578
  uintptr_t data_ptr;
569
- v8::Value data;
579
+ v8::Local<v8::Value> data;
570
580
  };
581
+
582
+ /**
583
+ * When called from WebAssembly, a view of the calling module's memory.
584
+ */
585
+ FastApiTypedArray<uint8_t>* const wasm_memory;
571
586
  };
572
587
 
573
588
  namespace internal {
@@ -606,7 +621,7 @@ class CFunctionInfoImpl : public CFunctionInfo {
606
621
  kReturnType == CTypeInfo::Type::kFloat32 ||
607
622
  kReturnType == CTypeInfo::Type::kFloat64 ||
608
623
  kReturnType == CTypeInfo::Type::kAny,
609
- "64-bit int and api object values are not currently "
624
+ "64-bit int, string and api object values are not currently "
610
625
  "supported return types.");
611
626
  }
612
627
 
@@ -648,7 +663,8 @@ struct CTypeInfoTraits {};
648
663
  V(int64_t, kInt64) \
649
664
  V(uint64_t, kUint64) \
650
665
  V(float, kFloat32) \
651
- V(double, kFloat64)
666
+ V(double, kFloat64) \
667
+ V(uint8_t, kUint8)
652
668
 
653
669
  // Same as above, but includes deprecated types for compatibility.
654
670
  #define ALL_C_TYPES(V) \
@@ -687,7 +703,8 @@ PRIMITIVE_C_TYPES(DEFINE_TYPE_INFO_TRAITS)
687
703
  V(int64_t, kInt64) \
688
704
  V(uint64_t, kUint64) \
689
705
  V(float, kFloat32) \
690
- V(double, kFloat64)
706
+ V(double, kFloat64) \
707
+ V(uint8_t, kUint8)
691
708
 
692
709
  TYPED_ARRAY_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA)
693
710
 
@@ -725,6 +742,18 @@ struct TypeInfoHelper<FastApiCallbackOptions&> {
725
742
  }
726
743
  };
727
744
 
745
+ template <>
746
+ struct TypeInfoHelper<const FastOneByteString&> {
747
+ static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
748
+
749
+ static constexpr CTypeInfo::Type Type() {
750
+ return CTypeInfo::Type::kSeqOneByteString;
751
+ }
752
+ static constexpr CTypeInfo::SequenceType SequenceType() {
753
+ return CTypeInfo::SequenceType::kScalar;
754
+ }
755
+ };
756
+
728
757
  #define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \
729
758
  static_assert(((COND) == 0) || (ASSERTION), MSG)
730
759
 
@@ -802,6 +831,16 @@ class CFunctionBuilderWithFunction {
802
831
  std::make_index_sequence<sizeof...(ArgBuilders)>());
803
832
  }
804
833
 
834
+ // Provided for testing purposes.
835
+ template <typename Ret, typename... Args>
836
+ auto Patch(Ret (*patching_func)(Args...)) {
837
+ static_assert(
838
+ sizeof...(Args) == sizeof...(ArgBuilders),
839
+ "The patching function must have the same number of arguments.");
840
+ fn_ = reinterpret_cast<void*>(patching_func);
841
+ return *this;
842
+ }
843
+
805
844
  auto Build() {
806
845
  static CFunctionInfoImpl<RetBuilder, ArgBuilders...> instance;
807
846
  return CFunction(fn_, &instance);
@@ -881,31 +920,6 @@ static constexpr CTypeInfo kTypeInfoFloat64 =
881
920
  * to the requested destination type, is considered unsupported. The operation
882
921
  * returns true on success. `type_info` will be used for conversions.
883
922
  */
884
- template <const CTypeInfo* type_info, typename T>
885
- V8_DEPRECATED(
886
- "Use TryToCopyAndConvertArrayToCppBuffer<CTypeInfo::Identifier, T>()")
887
- bool V8_EXPORT V8_WARN_UNUSED_RESULT
888
- TryCopyAndConvertArrayToCppBuffer(Local<Array> src, T* dst,
889
- uint32_t max_length);
890
-
891
- template <>
892
- V8_DEPRECATED(
893
- "Use TryToCopyAndConvertArrayToCppBuffer<CTypeInfo::Identifier, T>()")
894
- inline bool V8_WARN_UNUSED_RESULT
895
- TryCopyAndConvertArrayToCppBuffer<&kTypeInfoInt32, int32_t>(
896
- Local<Array> src, int32_t* dst, uint32_t max_length) {
897
- return false;
898
- }
899
-
900
- template <>
901
- V8_DEPRECATED(
902
- "Use TryToCopyAndConvertArrayToCppBuffer<CTypeInfo::Identifier, T>()")
903
- inline bool V8_WARN_UNUSED_RESULT
904
- TryCopyAndConvertArrayToCppBuffer<&kTypeInfoFloat64, double>(
905
- Local<Array> src, double* dst, uint32_t max_length) {
906
- return false;
907
- }
908
-
909
923
  template <CTypeInfo::Identifier type_info_id, typename T>
910
924
  bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer(
911
925
  Local<Array> src, T* dst, uint32_t max_length);
@@ -106,6 +106,14 @@ class V8_EXPORT Function : public Object {
106
106
  V8_WARN_UNUSED_RESULT MaybeLocal<String> FunctionProtoToString(
107
107
  Local<Context> context);
108
108
 
109
+ /**
110
+ * Returns true if the function does nothing.
111
+ * The function returns false on error.
112
+ * Note that this function is experimental. Embedders should not rely on
113
+ * this existing. We may remove this function in the future.
114
+ */
115
+ V8_WARN_UNUSED_RESULT bool Experimental_IsNopFunction() const;
116
+
109
117
  ScriptOrigin GetScriptOrigin() const;
110
118
  V8_INLINE static Function* Cast(Value* value) {
111
119
  #ifdef V8_ENABLE_CHECKS