libv8-node 22.7.0.4-x86_64-darwin → 23.6.1.0-x86_64-darwin

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/allocation.h +10 -11
  4. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  5. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  6. data/vendor/v8/include/cppgc/internal/api-constants.h +6 -1
  7. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  8. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  9. data/vendor/v8/include/cppgc/internal/member-storage.h +6 -0
  10. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  11. data/vendor/v8/include/cppgc/name-provider.h +7 -0
  12. data/vendor/v8/include/v8-array-buffer.h +44 -24
  13. data/vendor/v8/include/v8-callbacks.h +10 -5
  14. data/vendor/v8/include/v8-context.h +41 -9
  15. data/vendor/v8/include/v8-cppgc.h +3 -55
  16. data/vendor/v8/include/v8-date.h +9 -0
  17. data/vendor/v8/include/v8-embedder-heap.h +4 -1
  18. data/vendor/v8/include/v8-exception.h +70 -0
  19. data/vendor/v8/include/v8-fast-api-calls.h +31 -38
  20. data/vendor/v8/include/v8-function-callback.h +203 -62
  21. data/vendor/v8/include/v8-function.h +4 -3
  22. data/vendor/v8/include/v8-handle-base.h +2 -2
  23. data/vendor/v8/include/v8-initialization.h +18 -1
  24. data/vendor/v8/include/v8-inspector.h +6 -3
  25. data/vendor/v8/include/v8-internal.h +303 -58
  26. data/vendor/v8/include/v8-isolate.h +58 -39
  27. data/vendor/v8/include/v8-local-handle.h +18 -19
  28. data/vendor/v8/include/v8-message.h +0 -21
  29. data/vendor/v8/include/v8-metrics.h +4 -0
  30. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  31. data/vendor/v8/include/v8-object.h +284 -35
  32. data/vendor/v8/include/v8-persistent-handle.h +0 -19
  33. data/vendor/v8/include/v8-platform.h +21 -35
  34. data/vendor/v8/include/v8-primitive.h +92 -1
  35. data/vendor/v8/include/v8-profiler.h +38 -1
  36. data/vendor/v8/include/v8-promise.h +2 -2
  37. data/vendor/v8/include/v8-sandbox.h +173 -0
  38. data/vendor/v8/include/v8-script.h +44 -14
  39. data/vendor/v8/include/v8-snapshot.h +38 -2
  40. data/vendor/v8/include/v8-template.h +105 -263
  41. data/vendor/v8/include/v8-traced-handle.h +4 -15
  42. data/vendor/v8/include/v8-unwinder.h +2 -1
  43. data/vendor/v8/include/v8-util.h +1 -117
  44. data/vendor/v8/include/v8-value.h +3 -2
  45. data/vendor/v8/include/v8-version.h +3 -3
  46. data/vendor/v8/include/v8-wasm.h +3 -0
  47. data/vendor/v8/include/v8config.h +51 -7
  48. data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
  49. metadata +4 -3
@@ -8,6 +8,7 @@
8
8
  #include <stddef.h>
9
9
 
10
10
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
11
+ #include "v8-object.h" // NOLINT(build/include_directory)
11
12
  #include "v8config.h" // NOLINT(build/include_directory)
12
13
 
13
14
  namespace v8 {
@@ -58,8 +59,77 @@ class V8_EXPORT Exception {
58
59
  * of a given exception, or an empty handle if not available.
59
60
  */
60
61
  static Local<StackTrace> GetStackTrace(Local<Value> exception);
62
+
63
+ /**
64
+ * Captures the current stack trace and attaches it to the given object in the
65
+ * form of `stack` property.
66
+ */
67
+ static Maybe<bool> CaptureStackTrace(Local<Context> context,
68
+ Local<Object> object);
61
69
  };
62
70
 
71
+ /**
72
+ * This is a part of experimental Api and might be changed without further
73
+ * notice.
74
+ * Do not use it.
75
+ */
76
+ enum class ExceptionContext : uint32_t {
77
+ kUnknown,
78
+ kConstructor,
79
+ kOperation,
80
+ kAttributeGet,
81
+ kAttributeSet,
82
+ kIndexedQuery,
83
+ kIndexedGetter,
84
+ kIndexedDescriptor,
85
+ kIndexedSetter,
86
+ kIndexedDefiner,
87
+ kIndexedDeleter,
88
+ kNamedQuery,
89
+ kNamedGetter,
90
+ kNamedDescriptor,
91
+ kNamedSetter,
92
+ kNamedDefiner,
93
+ kNamedDeleter,
94
+ kNamedEnumerator
95
+ };
96
+
97
+ /**
98
+ * This is a part of experimental Api and might be changed without further
99
+ * notice.
100
+ * Do not use it.
101
+ */
102
+ class ExceptionPropagationMessage {
103
+ public:
104
+ ExceptionPropagationMessage(v8::Isolate* isolate, Local<Object> exception,
105
+ Local<String> interface_name,
106
+ Local<String> property_name,
107
+ ExceptionContext exception_context)
108
+ : isolate_(isolate),
109
+ exception_(exception),
110
+ interface_name_(interface_name),
111
+ property_name_(property_name),
112
+ exception_context_(exception_context) {}
113
+
114
+ V8_INLINE Isolate* GetIsolate() const { return isolate_; }
115
+ V8_INLINE Local<Object> GetException() const { return exception_; }
116
+ V8_INLINE Local<String> GetInterfaceName() const { return interface_name_; }
117
+ V8_INLINE Local<String> GetPropertyName() const { return property_name_; }
118
+ V8_INLINE ExceptionContext GetExceptionContext() const {
119
+ return exception_context_;
120
+ }
121
+
122
+ private:
123
+ Isolate* isolate_;
124
+ Local<Object> exception_;
125
+ Local<String> interface_name_;
126
+ Local<String> property_name_;
127
+ ExceptionContext exception_context_;
128
+ };
129
+
130
+ using ExceptionPropagationCallback =
131
+ void (*)(ExceptionPropagationMessage message);
132
+
63
133
  /**
64
134
  * An external exception handler.
65
135
  */
@@ -337,7 +337,13 @@ struct FastApiTypedArrayBase {
337
337
  };
338
338
 
339
339
  template <typename T>
340
- struct FastApiTypedArray : public FastApiTypedArrayBase {
340
+ struct V8_DEPRECATE_SOON(
341
+ "When an API function expects a TypedArray as a parameter, the type in the "
342
+ "signature should be `v8::Local<v8::Value>` instead of "
343
+ "FastApiTypedArray<>. The API function then has to type-check the "
344
+ "parameter and convert it to a `v8::Local<v8::TypedArray` to access the "
345
+ "data. In essence, the parameter should be handled the same as for a "
346
+ "regular API call.") FastApiTypedArray : public FastApiTypedArrayBase {
341
347
  public:
342
348
  V8_INLINE T get(size_t index) const {
343
349
  #ifdef DEBUG
@@ -458,13 +464,6 @@ union V8_TRIVIAL_ABI AnyCType {
458
464
  void* pointer_value;
459
465
  Local<Object> object_value;
460
466
  Local<Array> sequence_value;
461
- const FastApiTypedArray<uint8_t>* uint8_ta_value;
462
- const FastApiTypedArray<int32_t>* int32_ta_value;
463
- const FastApiTypedArray<uint32_t>* uint32_ta_value;
464
- const FastApiTypedArray<int64_t>* int64_ta_value;
465
- const FastApiTypedArray<uint64_t>* uint64_ta_value;
466
- const FastApiTypedArray<float>* float_ta_value;
467
- const FastApiTypedArray<double>* double_ta_value;
468
467
  const FastOneByteString* string_value;
469
468
  FastApiCallbackOptions* options_value;
470
469
  };
@@ -529,16 +528,22 @@ class V8_EXPORT CFunction {
529
528
  }
530
529
 
531
530
  template <typename F>
532
- static CFunction Make(F* func) {
533
- return ArgUnwrap<F*>::Make(func);
531
+ static CFunction Make(F* func,
532
+ CFunctionInfo::Int64Representation int64_rep =
533
+ CFunctionInfo::Int64Representation::kNumber) {
534
+ CFunction result = ArgUnwrap<F*>::Make(func, int64_rep);
535
+ result.GetInt64Representation();
536
+ return result;
534
537
  }
535
538
 
536
539
  // Provided for testing purposes.
537
540
  template <typename R, typename... Args, typename R_Patch,
538
541
  typename... Args_Patch>
539
542
  static CFunction Make(R (*func)(Args...),
540
- R_Patch (*patching_func)(Args_Patch...)) {
541
- CFunction c_func = ArgUnwrap<R (*)(Args...)>::Make(func);
543
+ R_Patch (*patching_func)(Args_Patch...),
544
+ CFunctionInfo::Int64Representation int64_rep =
545
+ CFunctionInfo::Int64Representation::kNumber) {
546
+ CFunction c_func = ArgUnwrap<R (*)(Args...)>::Make(func, int64_rep);
542
547
  static_assert(
543
548
  sizeof...(Args_Patch) == sizeof...(Args),
544
549
  "The patching function must have the same number of arguments.");
@@ -561,7 +566,9 @@ class V8_EXPORT CFunction {
561
566
  template <typename R, typename... Args>
562
567
  class ArgUnwrap<R (*)(Args...)> {
563
568
  public:
564
- static CFunction Make(R (*func)(Args...));
569
+ static CFunction Make(R (*func)(Args...),
570
+ CFunctionInfo::Int64Representation int64_rep =
571
+ CFunctionInfo::Int64Representation::kNumber);
565
572
  };
566
573
  };
567
574
 
@@ -577,35 +584,15 @@ struct FastApiCallbackOptions {
577
584
  * returned instance may be filled with mock data.
578
585
  */
579
586
  static FastApiCallbackOptions CreateForTesting(Isolate* isolate) {
580
- return {false, {0}, nullptr};
587
+ return {};
581
588
  }
582
589
 
583
- /**
584
- * If the callback wants to signal an error condition or to perform an
585
- * allocation, it must set options.fallback to true and do an early return
586
- * from the fast method. Then V8 checks the value of options.fallback and if
587
- * it's true, falls back to executing the SlowCallback, which is capable of
588
- * reporting the error (either by throwing a JS exception or logging to the
589
- * console) or doing the allocation. It's the embedder's responsibility to
590
- * ensure that the fast callback is idempotent up to the point where error and
591
- * fallback conditions are checked, because otherwise executing the slow
592
- * callback might produce visible side-effects twice.
593
- */
594
- bool fallback;
590
+ v8::Isolate* isolate = nullptr;
595
591
 
596
592
  /**
597
593
  * The `data` passed to the FunctionTemplate constructor, or `undefined`.
598
- * `data_ptr` allows for default constructing FastApiCallbackOptions.
599
594
  */
600
- union {
601
- uintptr_t data_ptr;
602
- v8::Local<v8::Value> data;
603
- };
604
-
605
- /**
606
- * When called from WebAssembly, a view of the calling module's memory.
607
- */
608
- FastApiTypedArray<uint8_t>* const wasm_memory;
595
+ v8::Local<v8::Value> data;
609
596
  };
610
597
 
611
598
  namespace internal {
@@ -929,8 +916,14 @@ class CFunctionBuilder {
929
916
 
930
917
  // static
931
918
  template <typename R, typename... Args>
932
- CFunction CFunction::ArgUnwrap<R (*)(Args...)>::Make(R (*func)(Args...)) {
933
- return internal::CFunctionBuilder().Fn(func).Build();
919
+ CFunction CFunction::ArgUnwrap<R (*)(Args...)>::Make(
920
+ R (*func)(Args...), CFunctionInfo::Int64Representation int64_rep) {
921
+ if (int64_rep == CFunctionInfo::Int64Representation::kNumber) {
922
+ return internal::CFunctionBuilder().Fn(func).Build();
923
+ }
924
+ return internal::CFunctionBuilder()
925
+ .Fn(func)
926
+ .template Build<CFunctionInfo::Int64Representation::kBigInt>();
934
927
  }
935
928
 
936
929
  using CFunctionBuilder = internal::CFunctionBuilder;