libv8-node 22.7.0.4-x86_64-linux-musl → 24.1.0.0-x86_64-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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/allocation.h +11 -13
  4. data/vendor/v8/include/cppgc/default-platform.h +3 -2
  5. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  6. data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
  7. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  8. data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
  9. data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
  10. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
  11. data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
  12. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  13. data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
  14. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  15. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  16. data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
  17. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  18. data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
  19. data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
  20. data/vendor/v8/include/cppgc/macros.h +21 -0
  21. data/vendor/v8/include/cppgc/member.h +70 -36
  22. data/vendor/v8/include/cppgc/name-provider.h +10 -0
  23. data/vendor/v8/include/cppgc/platform.h +11 -0
  24. data/vendor/v8/include/cppgc/type-traits.h +1 -0
  25. data/vendor/v8/include/cppgc/visitor.h +25 -1
  26. data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
  27. data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
  28. data/vendor/v8/include/v8-array-buffer.h +143 -46
  29. data/vendor/v8/include/v8-callbacks.h +94 -31
  30. data/vendor/v8/include/v8-context.h +48 -15
  31. data/vendor/v8/include/v8-cppgc.h +5 -56
  32. data/vendor/v8/include/v8-data.h +5 -0
  33. data/vendor/v8/include/v8-date.h +9 -0
  34. data/vendor/v8/include/v8-debug.h +11 -0
  35. data/vendor/v8/include/v8-embedder-heap.h +1 -29
  36. data/vendor/v8/include/v8-exception.h +72 -0
  37. data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
  38. data/vendor/v8/include/v8-fast-api-calls.h +41 -206
  39. data/vendor/v8/include/v8-function-callback.h +190 -78
  40. data/vendor/v8/include/v8-function.h +11 -3
  41. data/vendor/v8/include/v8-handle-base.h +20 -2
  42. data/vendor/v8/include/v8-initialization.h +26 -1
  43. data/vendor/v8/include/v8-inspector.h +10 -3
  44. data/vendor/v8/include/v8-internal.h +638 -315
  45. data/vendor/v8/include/v8-isolate.h +275 -189
  46. data/vendor/v8/include/v8-local-handle.h +69 -42
  47. data/vendor/v8/include/v8-maybe.h +2 -1
  48. data/vendor/v8/include/v8-memory-span.h +149 -24
  49. data/vendor/v8/include/v8-message.h +9 -22
  50. data/vendor/v8/include/v8-metrics.h +14 -0
  51. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  52. data/vendor/v8/include/v8-object.h +291 -37
  53. data/vendor/v8/include/v8-persistent-handle.h +17 -36
  54. data/vendor/v8/include/v8-platform.h +66 -45
  55. data/vendor/v8/include/v8-primitive.h +221 -5
  56. data/vendor/v8/include/v8-profiler.h +51 -2
  57. data/vendor/v8/include/v8-promise.h +2 -2
  58. data/vendor/v8/include/v8-proxy.h +0 -1
  59. data/vendor/v8/include/v8-regexp.h +0 -1
  60. data/vendor/v8/include/v8-sandbox.h +173 -0
  61. data/vendor/v8/include/v8-script.h +65 -17
  62. data/vendor/v8/include/v8-snapshot.h +38 -2
  63. data/vendor/v8/include/v8-source-location.h +6 -1
  64. data/vendor/v8/include/v8-template.h +111 -263
  65. data/vendor/v8/include/v8-trace-categories.h +23 -0
  66. data/vendor/v8/include/v8-traced-handle.h +20 -32
  67. data/vendor/v8/include/v8-typed-array.h +6 -10
  68. data/vendor/v8/include/v8-unwinder-state.h +2 -3
  69. data/vendor/v8/include/v8-unwinder.h +2 -1
  70. data/vendor/v8/include/v8-util.h +1 -117
  71. data/vendor/v8/include/v8-value-serializer-version.h +3 -3
  72. data/vendor/v8/include/v8-value.h +21 -2
  73. data/vendor/v8/include/v8-version.h +4 -4
  74. data/vendor/v8/include/v8-wasm.h +27 -0
  75. data/vendor/v8/include/v8-weak-callback-info.h +20 -12
  76. data/vendor/v8/include/v8.h +3 -3
  77. data/vendor/v8/include/v8config.h +83 -45
  78. data/vendor/v8/x86_64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  79. metadata +6 -3
  80. data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
@@ -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.
@@ -134,6 +87,7 @@ class V8_EXPORT CppHeap {
134
87
  *
135
88
  * After this call, object allocation is prohibited.
136
89
  */
90
+ V8_DEPRECATED("Terminate gets automatically called in the CppHeap destructor")
137
91
  void Terminate();
138
92
 
139
93
  /**
@@ -148,7 +102,7 @@ class V8_EXPORT CppHeap {
148
102
  /**
149
103
  * Collects statistics for the given spaces and reports them to the receiver.
150
104
  *
151
- * \param custom_spaces a collection of custom space indicies.
105
+ * \param custom_spaces a collection of custom space indices.
152
106
  * \param receiver an object that gets the results.
153
107
  */
154
108
  void CollectCustomSpaceStatisticsAtLastGC(
@@ -177,11 +131,6 @@ class V8_EXPORT CppHeap {
177
131
  void CollectGarbageInYoungGenerationForTesting(
178
132
  cppgc::EmbedderStackState stack_state);
179
133
 
180
- /**
181
- * \returns the wrapper descriptor of this CppHeap.
182
- */
183
- v8::WrapperDescriptor wrapper_descriptor() const;
184
-
185
134
  private:
186
135
  CppHeap() = default;
187
136
 
@@ -27,6 +27,11 @@ class V8_EXPORT Data {
27
27
  */
28
28
  bool IsModule() const;
29
29
 
30
+ /**
31
+ * Returns true if this data is a |v8::ModuleRequest|.
32
+ */
33
+ bool IsModuleRequest() const;
34
+
30
35
  /**
31
36
  * Returns tru if this data is a |v8::FixedArray|
32
37
  */
@@ -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);
@@ -42,6 +42,12 @@ class V8_EXPORT StackFrame {
42
42
  */
43
43
  int GetColumn() const { return GetLocation().GetColumnNumber() + 1; }
44
44
 
45
+ /**
46
+ * Returns zero based source position (character offset) for the associated
47
+ * function.
48
+ */
49
+ int GetSourcePosition() const;
50
+
45
51
  /**
46
52
  * Returns the id of the script for the function for this StackFrame.
47
53
  * This method will return Message::kNoScriptIdInfo if it is unable to
@@ -130,6 +136,11 @@ class V8_EXPORT StackTrace {
130
136
  kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
131
137
  };
132
138
 
139
+ /**
140
+ * Returns the (unique) ID of this stack trace.
141
+ */
142
+ int GetID() const;
143
+
133
144
  /**
134
145
  * Returns a StackFrame at a particular index.
135
146
  */
@@ -21,33 +21,9 @@ class Value;
21
21
  */
22
22
  class V8_EXPORT EmbedderRootsHandler {
23
23
  public:
24
- enum class RootHandling {
25
- kQueryEmbedderForNonDroppableReferences,
26
- kDontQueryEmbedderForAnyReference,
27
- };
28
-
29
24
  virtual ~EmbedderRootsHandler() = default;
30
25
 
31
26
  EmbedderRootsHandler() = default;
32
- explicit EmbedderRootsHandler(RootHandling default_traced_reference_handling)
33
- : default_traced_reference_handling_(default_traced_reference_handling) {}
34
-
35
- /**
36
- * Returns true if the |TracedReference| handle should be considered as root
37
- * for the currently running non-tracing garbage collection and false
38
- * otherwise. The default implementation will keep all |TracedReference|
39
- * references as roots.
40
- *
41
- * If this returns false, then V8 may decide that the object referred to by
42
- * such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the
43
- * |TracedReference|.
44
- *
45
- * Note that the `handle` is different from the handle that the embedder holds
46
- * for retaining the object.
47
- *
48
- * The concrete implementations must be thread-safe.
49
- */
50
- virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
51
27
 
52
28
  /**
53
29
  * Used in combination with |IsRoot|. Called by V8 when an
@@ -66,14 +42,10 @@ class V8_EXPORT EmbedderRootsHandler {
66
42
  * |false| is returned, |ResetRoot()| will be recalled for the same handle.
67
43
  */
68
44
  virtual bool TryResetRoot(const v8::TracedReference<v8::Value>& handle) {
69
- ResetRoot(handle);
70
- return true;
45
+ return false;
71
46
  }
72
47
 
73
48
  private:
74
- const RootHandling default_traced_reference_handling_ =
75
- RootHandling::kQueryEmbedderForNonDroppableReferences;
76
-
77
49
  friend class internal::TracedHandles;
78
50
  };
79
51
 
@@ -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 {
@@ -44,6 +45,8 @@ class V8_EXPORT Exception {
44
45
  Local<Value> options = {});
45
46
  static Local<Value> WasmRuntimeError(Local<String> message,
46
47
  Local<Value> options = {});
48
+ static Local<Value> WasmSuspendError(Local<String> message,
49
+ Local<Value> options = {});
47
50
  static Local<Value> Error(Local<String> message, Local<Value> options = {});
48
51
 
49
52
  /**
@@ -58,8 +61,77 @@ class V8_EXPORT Exception {
58
61
  * of a given exception, or an empty handle if not available.
59
62
  */
60
63
  static Local<StackTrace> GetStackTrace(Local<Value> exception);
64
+
65
+ /**
66
+ * Captures the current stack trace and attaches it to the given object in the
67
+ * form of `stack` property.
68
+ */
69
+ static Maybe<bool> CaptureStackTrace(Local<Context> context,
70
+ Local<Object> object);
71
+ };
72
+
73
+ /**
74
+ * This is a part of experimental Api and might be changed without further
75
+ * notice.
76
+ * Do not use it.
77
+ */
78
+ enum class ExceptionContext : uint32_t {
79
+ kUnknown,
80
+ kConstructor,
81
+ kOperation,
82
+ kAttributeGet,
83
+ kAttributeSet,
84
+ kIndexedQuery,
85
+ kIndexedGetter,
86
+ kIndexedDescriptor,
87
+ kIndexedSetter,
88
+ kIndexedDefiner,
89
+ kIndexedDeleter,
90
+ kNamedQuery,
91
+ kNamedGetter,
92
+ kNamedDescriptor,
93
+ kNamedSetter,
94
+ kNamedDefiner,
95
+ kNamedDeleter,
96
+ kNamedEnumerator
97
+ };
98
+
99
+ /**
100
+ * This is a part of experimental Api and might be changed without further
101
+ * notice.
102
+ * Do not use it.
103
+ */
104
+ class ExceptionPropagationMessage {
105
+ public:
106
+ ExceptionPropagationMessage(v8::Isolate* isolate, Local<Object> exception,
107
+ Local<String> interface_name,
108
+ Local<String> property_name,
109
+ ExceptionContext exception_context)
110
+ : isolate_(isolate),
111
+ exception_(exception),
112
+ interface_name_(interface_name),
113
+ property_name_(property_name),
114
+ exception_context_(exception_context) {}
115
+
116
+ V8_INLINE Isolate* GetIsolate() const { return isolate_; }
117
+ V8_INLINE Local<Object> GetException() const { return exception_; }
118
+ V8_INLINE Local<String> GetInterfaceName() const { return interface_name_; }
119
+ V8_INLINE Local<String> GetPropertyName() const { return property_name_; }
120
+ V8_INLINE ExceptionContext GetExceptionContext() const {
121
+ return exception_context_;
122
+ }
123
+
124
+ private:
125
+ Isolate* isolate_;
126
+ Local<Object> exception_;
127
+ Local<String> interface_name_;
128
+ Local<String> property_name_;
129
+ ExceptionContext exception_context_;
61
130
  };
62
131
 
132
+ using ExceptionPropagationCallback =
133
+ void (*)(ExceptionPropagationMessage message);
134
+
63
135
  /**
64
136
  * An external exception handler.
65
137
  */
@@ -0,0 +1,60 @@
1
+ // Copyright 2024 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_EXTERNAL_MEMORY_ACCOUNTER_H_
6
+ #define INCLUDE_EXTERNAL_MEMORY_ACCOUNTER_H_
7
+
8
+ #include <stdint.h>
9
+
10
+ #include "v8-isolate.h"
11
+
12
+ namespace v8 {
13
+
14
+ /**
15
+ * This class is used to give V8 an indication of the amount of externally
16
+ * allocated memory that is kept alive by JavaScript objects. V8 uses this to
17
+ * decide when to perform garbage collections. Registering externally allocated
18
+ * memory will trigger garbage collections more often than it would otherwise in
19
+ * an attempt to garbage collect the JavaScript objects that keep the externally
20
+ * allocated memory alive. Instances of ExternalMemoryAccounter check that the
21
+ * reported external memory is back to 0 on destruction.
22
+ */
23
+ class V8_EXPORT ExternalMemoryAccounter {
24
+ public:
25
+ /**
26
+ * Returns the amount of external memory registered for `isolate`.
27
+ */
28
+ static int64_t GetTotalAmountOfExternalAllocatedMemoryForTesting(
29
+ const Isolate* isolate);
30
+
31
+ ExternalMemoryAccounter() = default;
32
+ ~ExternalMemoryAccounter();
33
+ ExternalMemoryAccounter(ExternalMemoryAccounter&&);
34
+ ExternalMemoryAccounter& operator=(ExternalMemoryAccounter&&);
35
+ ExternalMemoryAccounter(const ExternalMemoryAccounter&) = delete;
36
+ ExternalMemoryAccounter& operator=(const ExternalMemoryAccounter&) = delete;
37
+
38
+ /**
39
+ * Reports an increase of `size` bytes of external memory.
40
+ */
41
+ void Increase(Isolate* isolate, size_t size);
42
+ /**
43
+ * Reports an update of `delta` bytes of external memory.
44
+ */
45
+ void Update(Isolate* isolate, int64_t delta);
46
+ /**
47
+ * Reports an decrease of `size` bytes of external memory.
48
+ */
49
+ void Decrease(Isolate* isolate, size_t size);
50
+
51
+ private:
52
+ #ifdef V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
53
+ size_t amount_of_external_memory_ = 0;
54
+ v8::Isolate* isolate_ = nullptr;
55
+ #endif
56
+ };
57
+
58
+ } // namespace v8
59
+
60
+ #endif // INCLUDE_EXTERNAL_MEMORY_ACCOUNTER_H_