libv8-node 21.7.2.0-arm64-darwin → 22.5.1.0-arm64-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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
  4. data/vendor/v8/include/cppgc/internal/api-constants.h +1 -1
  5. data/vendor/v8/include/cppgc/type-traits.h +25 -4
  6. data/vendor/v8/include/v8-array-buffer.h +6 -0
  7. data/vendor/v8/include/v8-callbacks.h +6 -12
  8. data/vendor/v8/include/v8-container.h +54 -0
  9. data/vendor/v8/include/v8-context.h +51 -22
  10. data/vendor/v8/include/v8-embedder-heap.h +19 -3
  11. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  12. data/vendor/v8/include/v8-exception.h +15 -9
  13. data/vendor/v8/include/v8-fast-api-calls.h +35 -26
  14. data/vendor/v8/include/v8-forward.h +1 -0
  15. data/vendor/v8/include/v8-function-callback.h +129 -20
  16. data/vendor/v8/include/v8-handle-base.h +32 -80
  17. data/vendor/v8/include/v8-inspector.h +16 -24
  18. data/vendor/v8/include/v8-internal.h +472 -65
  19. data/vendor/v8/include/v8-isolate.h +86 -51
  20. data/vendor/v8/include/v8-local-handle.h +257 -31
  21. data/vendor/v8/include/v8-memory-span.h +157 -2
  22. data/vendor/v8/include/v8-message.h +22 -3
  23. data/vendor/v8/include/v8-metrics.h +1 -0
  24. data/vendor/v8/include/v8-object.h +29 -10
  25. data/vendor/v8/include/v8-persistent-handle.h +5 -3
  26. data/vendor/v8/include/v8-platform.h +81 -44
  27. data/vendor/v8/include/v8-script.h +61 -11
  28. data/vendor/v8/include/v8-snapshot.h +94 -23
  29. data/vendor/v8/include/v8-statistics.h +10 -24
  30. data/vendor/v8/include/v8-template.h +410 -131
  31. data/vendor/v8/include/v8-traced-handle.h +81 -46
  32. data/vendor/v8/include/v8-typed-array.h +115 -7
  33. data/vendor/v8/include/v8-util.h +13 -12
  34. data/vendor/v8/include/v8-value.h +92 -4
  35. data/vendor/v8/include/v8-version.h +4 -4
  36. data/vendor/v8/include/v8config.h +35 -10
  37. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa63687255404f025cf453ac2987406f98ec6cdc3218bde612e0659382d7290f
4
- data.tar.gz: 848f8250e6d0e889426722e5c535806070240b3de1f0d30a99f514f828f80a8a
3
+ metadata.gz: 71bea17fb073f8320887a24da57474ce36427d02e74f445b15caea968c66b619
4
+ data.tar.gz: 1a84a1a964681aa25a2a6a66dd71c5c19d27e6c22aa2810cc107fea88f620ddb
5
5
  SHA512:
6
- metadata.gz: cbd77e21fcc48789ff9392ec223d2236eed9824e8beb02dcc79cc7e89b54ea3fc76076aef3c4a6c45607239b918e807a99db8bc8e256c97ec3df69fbe48dd161
7
- data.tar.gz: fa5bb07d040c1b8ea6ef81395d51a417180f3cf688c54c3f01c7c8e8599bae3cfbfbd117433235e0d4e8c98bef14ea69f791d566f6e0c7d2ef5a8e72ff143c10
6
+ metadata.gz: d646c7d61be64fffa6782b1faa9478f0d7d052c56913ee7544f357c11c573d90356f948d53203404d18731eb963ba509539cab02723747f18c05503e1621ac70
7
+ data.tar.gz: 84194316c6050baa4ca2dd0fcd337764e449c3009de7704f0ceeea8c2e5ba0a6dcdd71e8f44701464d1200d0ede8d2baf3e2673c8056bed7920f29d39134da34
@@ -1,7 +1,7 @@
1
1
  module Libv8; end
2
2
 
3
3
  module Libv8::Node
4
- VERSION = '21.7.2.0'.freeze
5
- NODE_VERSION = '21.7.2'.freeze
6
- LIBV8_VERSION = '11.8.172.17'.freeze # from v8/include/v8-version.h
4
+ VERSION = '22.5.1.0'.freeze
5
+ NODE_VERSION = '22.5.1'.freeze
6
+ LIBV8_VERSION = '21.4.254.21'.freeze # from v8/include/v8-version.h
7
7
  end
@@ -32,7 +32,7 @@ static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};
32
32
 
33
33
  static constexpr size_t kPageSize = size_t{1} << 17;
34
34
 
35
- #if defined(V8_TARGET_ARCH_ARM64) && defined(V8_OS_DARWIN)
35
+ #if defined(V8_HOST_ARCH_ARM64) && defined(V8_OS_DARWIN)
36
36
  constexpr size_t kGuardPageSize = 0;
37
37
  #else
38
38
  constexpr size_t kGuardPageSize = 4096;
@@ -128,13 +128,13 @@ struct IsSubclassOfBasicMemberTemplate {
128
128
  private:
129
129
  template <typename T, typename CheckingPolicy, typename StorageType>
130
130
  static std::true_type SubclassCheck(
131
- BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
132
- StorageType>*);
131
+ const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
132
+ StorageType>*);
133
133
  static std::false_type SubclassCheck(...);
134
134
 
135
135
  public:
136
- static constexpr bool value =
137
- decltype(SubclassCheck(std::declval<BasicMemberCandidate*>()))::value;
136
+ static constexpr bool value = decltype(SubclassCheck(
137
+ std::declval<std::decay_t<BasicMemberCandidate>*>()))::value;
138
138
  };
139
139
 
140
140
  template <typename T,
@@ -180,6 +180,14 @@ constexpr bool IsStrictlyBaseOfV =
180
180
  std::is_base_of_v<std::decay_t<B>, std::decay_t<D>> &&
181
181
  !IsDecayedSameV<B, D>;
182
182
 
183
+ template <typename T>
184
+ constexpr bool IsAnyMemberTypeV = false;
185
+
186
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
187
+ typename CheckingPolicy, typename StorageType>
188
+ constexpr bool IsAnyMemberTypeV<internal::BasicMember<
189
+ T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy, StorageType>> = true;
190
+
183
191
  } // namespace internal
184
192
 
185
193
  /**
@@ -245,6 +253,19 @@ constexpr bool IsWeakV = internal::IsWeak<T>::value;
245
253
  template <typename T>
246
254
  constexpr bool IsCompleteV = internal::IsComplete<T>::value;
247
255
 
256
+ /**
257
+ * Value is true for member types `Member<T>` and `WeakMember<T>`.
258
+ */
259
+ template <typename T>
260
+ constexpr bool IsMemberOrWeakMemberTypeV =
261
+ IsMemberTypeV<T> || IsWeakMemberTypeV<T>;
262
+
263
+ /**
264
+ * Value is true for any member type.
265
+ */
266
+ template <typename T>
267
+ constexpr bool IsAnyMemberTypeV = internal::IsAnyMemberTypeV<std::decay_t<T>>;
268
+
248
269
  } // namespace cppgc
249
270
 
250
271
  #endif // INCLUDE_CPPGC_TYPE_TRAITS_H_
@@ -318,6 +318,12 @@ class V8_EXPORT ArrayBuffer : public Object {
318
318
  */
319
319
  std::shared_ptr<BackingStore> GetBackingStore();
320
320
 
321
+ /**
322
+ * More efficient shortcut for
323
+ * GetBackingStore()->IsResizableByUserJavaScript().
324
+ */
325
+ bool IsResizableByUserJavaScript() const;
326
+
321
327
  /**
322
328
  * More efficient shortcut for GetBackingStore()->Data(). The returned pointer
323
329
  * is valid as long as the ArrayBuffer is alive.
@@ -327,10 +327,6 @@ using WasmAsyncResolvePromiseCallback = void (*)(
327
327
  using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
328
328
  const char* name);
329
329
 
330
- // --- Callback for checking if WebAssembly GC is enabled ---
331
- // If the callback returns true, it will also enable Wasm stringrefs.
332
- using WasmGCEnabledCallback = bool (*)(Local<Context> context);
333
-
334
330
  // --- Callback for checking if WebAssembly imported strings are enabled ---
335
331
  using WasmImportedStringsEnabledCallback = bool (*)(Local<Context> context);
336
332
 
@@ -342,6 +338,9 @@ using SharedArrayBufferConstructorEnabledCallback =
342
338
  using JavaScriptCompileHintsMagicEnabledCallback =
343
339
  bool (*)(Local<Context> context);
344
340
 
341
+ // --- Callback for checking if WebAssembly JSPI is enabled ---
342
+ using WasmJSPIEnabledCallback = bool (*)(Local<Context> context);
343
+
345
344
  /**
346
345
  * HostImportModuleDynamicallyCallback is called when we
347
346
  * require the embedder to load a module. This is used as part of the dynamic
@@ -352,11 +351,11 @@ using JavaScriptCompileHintsMagicEnabledCallback =
352
351
  *
353
352
  * The specifier is the name of the module that should be imported.
354
353
  *
355
- * The import_assertions are import assertions for this request in the form:
354
+ * The import_attributes are import attributes for this request in the form:
356
355
  * [key1, value1, key2, value2, ...] where the keys and values are of type
357
356
  * v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and
358
357
  * returned from ModuleRequest::GetImportAssertions(), this array does not
359
- * contain the source Locations of the assertions.
358
+ * contain the source Locations of the attributes.
360
359
  *
361
360
  * The embedder must compile, instantiate, evaluate the Module, and
362
361
  * obtain its namespace object.
@@ -368,15 +367,10 @@ using JavaScriptCompileHintsMagicEnabledCallback =
368
367
  * fails (e.g. due to stack overflow), the embedder must propagate
369
368
  * that exception by returning an empty MaybeLocal.
370
369
  */
371
- using HostImportModuleDynamicallyWithImportAssertionsCallback =
372
- MaybeLocal<Promise> (*)(Local<Context> context,
373
- Local<ScriptOrModule> referrer,
374
- Local<String> specifier,
375
- Local<FixedArray> import_assertions);
376
370
  using HostImportModuleDynamicallyCallback = MaybeLocal<Promise> (*)(
377
371
  Local<Context> context, Local<Data> host_defined_options,
378
372
  Local<Value> resource_name, Local<String> specifier,
379
- Local<FixedArray> import_assertions);
373
+ Local<FixedArray> import_attributes);
380
374
 
381
375
  /**
382
376
  * Callback for requesting a compile hint for a function from the embedder. The
@@ -8,6 +8,8 @@
8
8
  #include <stddef.h>
9
9
  #include <stdint.h>
10
10
 
11
+ #include <functional>
12
+
11
13
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
12
14
  #include "v8-object.h" // NOLINT(build/include_directory)
13
15
  #include "v8config.h" // NOLINT(build/include_directory)
@@ -43,6 +45,58 @@ class V8_EXPORT Array : public Object {
43
45
  return static_cast<Array*>(value);
44
46
  }
45
47
 
48
+ /**
49
+ * Creates a JavaScript array from a provided callback.
50
+ *
51
+ * \param context The v8::Context to create the array in.
52
+ * \param length The length of the array to be created.
53
+ * \param next_value_callback The callback that is invoked to retrieve
54
+ * elements for the array. The embedder can signal that the array
55
+ * initialization should be aborted by throwing an exception and returning
56
+ * an empty MaybeLocal.
57
+ * \returns The v8::Array if all elements were constructed successfully and an
58
+ * empty MaybeLocal otherwise.
59
+ */
60
+ static MaybeLocal<Array> New(
61
+ Local<Context> context, size_t length,
62
+ std::function<MaybeLocal<v8::Value>()> next_value_callback);
63
+
64
+ enum class CallbackResult {
65
+ kException,
66
+ kBreak,
67
+ kContinue,
68
+ };
69
+ using IterationCallback = CallbackResult (*)(uint32_t index,
70
+ Local<Value> element,
71
+ void* data);
72
+
73
+ /**
74
+ * Calls {callback} for every element of this array, passing {callback_data}
75
+ * as its {data} parameter.
76
+ * This function will typically be faster than calling {Get()} repeatedly.
77
+ * As a consequence of being optimized for low overhead, the provided
78
+ * callback must adhere to the following restrictions:
79
+ * - It must not allocate any V8 objects and continue iterating; it may
80
+ * allocate (e.g. an error message/object) and then immediately terminate
81
+ * the iteration.
82
+ * - It must not modify the array being iterated.
83
+ * - It must not call back into V8 (unless it can guarantee that such a
84
+ * call does not violate the above restrictions, which is difficult).
85
+ * - The {Local<Value> element} must not "escape", i.e. must not be assigned
86
+ * to any other {Local}. Creating a {Global} from it, or updating a
87
+ * v8::TypecheckWitness with it, is safe.
88
+ * These restrictions may be lifted in the future if use cases arise that
89
+ * justify a slower but more robust implementation.
90
+ *
91
+ * Returns {Nothing} on exception; use a {TryCatch} to catch and handle this
92
+ * exception.
93
+ * When the {callback} returns {kException}, iteration is terminated
94
+ * immediately, returning {Nothing}. By returning {kBreak}, the callback
95
+ * can request non-exceptional early termination of the iteration.
96
+ */
97
+ Maybe<void> Iterate(Local<Context> context, IterationCallback callback,
98
+ void* callback_data);
99
+
46
100
  private:
47
101
  Array();
48
102
  static void CheckCast(Value* obj);
@@ -84,6 +84,29 @@ class V8_EXPORT Context : public Data {
84
84
  * created by a previous call to Context::New with the same global
85
85
  * template. The state of the global object will be completely reset
86
86
  * and only object identify will remain.
87
+ *
88
+ * \param internal_fields_deserializer An optional callback used
89
+ * to deserialize fields set by
90
+ * v8::Object::SetAlignedPointerInInternalField() in wrapper objects
91
+ * from the default context snapshot. It should match the
92
+ * SerializeInternalFieldsCallback() used by
93
+ * v8::SnapshotCreator::SetDefaultContext() when the default context
94
+ * snapshot is created. It does not need to be configured if the default
95
+ * context snapshot contains no wrapper objects with pointer internal
96
+ * fields, or if no custom startup snapshot is configured
97
+ * in the v8::CreateParams used to create the isolate.
98
+ *
99
+ * \param microtask_queue An optional microtask queue used to manage
100
+ * the microtasks created in this context. If not set the per-isolate
101
+ * default microtask queue would be used.
102
+ *
103
+ * \param context_data_deserializer An optional callback used
104
+ * to deserialize embedder data set by
105
+ * v8::Context::SetAlignedPointerInEmbedderData() in the default
106
+ * context from the default context snapshot. It does not need to be
107
+ * configured if the default context snapshot contains no pointer embedder
108
+ * data, or if no custom startup snapshot is configured in the
109
+ * v8::CreateParams used to create the isolate.
87
110
  */
88
111
  static Local<Context> New(
89
112
  Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
@@ -91,7 +114,9 @@ class V8_EXPORT Context : public Data {
91
114
  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
92
115
  DeserializeInternalFieldsCallback internal_fields_deserializer =
93
116
  DeserializeInternalFieldsCallback(),
94
- MicrotaskQueue* microtask_queue = nullptr);
117
+ MicrotaskQueue* microtask_queue = nullptr,
118
+ DeserializeContextDataCallback context_data_deserializer =
119
+ DeserializeContextDataCallback());
95
120
 
96
121
  /**
97
122
  * Create a new context from a (non-default) context snapshot. There
@@ -103,21 +128,37 @@ class V8_EXPORT Context : public Data {
103
128
  * \param context_snapshot_index The index of the context snapshot to
104
129
  * deserialize from. Use v8::Context::New for the default snapshot.
105
130
  *
106
- * \param embedder_fields_deserializer Optional callback to deserialize
107
- * internal fields. It should match the SerializeInternalFieldCallback used
108
- * to serialize.
131
+ * \param internal_fields_deserializer An optional callback used
132
+ * to deserialize fields set by
133
+ * v8::Object::SetAlignedPointerInInternalField() in wrapper objects
134
+ * from the default context snapshot. It does not need to be
135
+ * configured if there are no wrapper objects with no internal
136
+ * pointer fields in the default context snapshot or if no startup
137
+ * snapshot is configured when the isolate is created.
109
138
  *
110
139
  * \param extensions See v8::Context::New.
111
140
  *
112
141
  * \param global_object See v8::Context::New.
142
+ *
143
+ * \param internal_fields_deserializer Similar to
144
+ * internal_fields_deserializer in v8::Context::New but applies to
145
+ * the context specified by the context_snapshot_index.
146
+ *
147
+ * \param microtask_queue See v8::Context::New.
148
+ *
149
+ * \param context_data_deserializer Similar to
150
+ * context_data_deserializer in v8::Context::New but applies to
151
+ * the context specified by the context_snapshot_index.
113
152
  */
114
153
  static MaybeLocal<Context> FromSnapshot(
115
154
  Isolate* isolate, size_t context_snapshot_index,
116
- DeserializeInternalFieldsCallback embedder_fields_deserializer =
155
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
117
156
  DeserializeInternalFieldsCallback(),
118
157
  ExtensionConfiguration* extensions = nullptr,
119
158
  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
120
- MicrotaskQueue* microtask_queue = nullptr);
159
+ MicrotaskQueue* microtask_queue = nullptr,
160
+ DeserializeContextDataCallback context_data_deserializer =
161
+ DeserializeContextDataCallback());
121
162
 
122
163
  /**
123
164
  * Returns an global object that isn't backed by an actual context.
@@ -182,7 +223,7 @@ class V8_EXPORT Context : public Data {
182
223
  * parameter. Returns true if the operation completed successfully.
183
224
  */
184
225
  virtual bool FreezeEmbedderObjectAndGetChildren(
185
- Local<Object> obj, std::vector<Local<Object>>& children_out) = 0;
226
+ Local<Object> obj, LocalVector<Object>& children_out) = 0;
186
227
  };
187
228
 
188
229
  /**
@@ -309,18 +350,6 @@ class V8_EXPORT Context : public Data {
309
350
  Local<Context> context);
310
351
  void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
311
352
 
312
- /**
313
- * Returns the value that was set or restored by
314
- * SetContinuationPreservedEmbedderData(), if any.
315
- */
316
- Local<Value> GetContinuationPreservedEmbedderData() const;
317
-
318
- /**
319
- * Sets a value that will be stored on continuations and reset while the
320
- * continuation runs.
321
- */
322
- void SetContinuationPreservedEmbedderData(Local<Value> context);
323
-
324
353
  /**
325
354
  * Set or clear hooks to be invoked for promise lifecycle operations.
326
355
  * To clear a hook, set it to an empty v8::Function. Each function will
@@ -436,12 +465,12 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
436
465
 
437
466
  template <class T>
438
467
  MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
439
- auto slot = GetDataFromSnapshotOnce(index);
440
- if (slot) {
468
+ if (auto slot = GetDataFromSnapshotOnce(index); slot) {
441
469
  internal::PerformCastCheck(
442
470
  internal::ValueHelper::SlotAsValue<T, false>(slot));
471
+ return Local<T>::FromSlot(slot);
443
472
  }
444
- return Local<T>::FromSlot(slot);
473
+ return {};
445
474
  }
446
475
 
447
476
  Context* Context::Cast(v8::Data* data) {
@@ -9,6 +9,9 @@
9
9
  #include "v8config.h" // NOLINT(build/include_directory)
10
10
 
11
11
  namespace v8 {
12
+ namespace internal {
13
+ class TracedHandles;
14
+ } // namespace internal
12
15
 
13
16
  class Isolate;
14
17
  class Value;
@@ -18,8 +21,17 @@ class Value;
18
21
  */
19
22
  class V8_EXPORT EmbedderRootsHandler {
20
23
  public:
24
+ enum class RootHandling {
25
+ kQueryEmbedderForNonDroppableReferences,
26
+ kDontQueryEmbedderForAnyReference,
27
+ };
28
+
21
29
  virtual ~EmbedderRootsHandler() = default;
22
30
 
31
+ EmbedderRootsHandler() = default;
32
+ explicit EmbedderRootsHandler(RootHandling default_traced_reference_handling)
33
+ : default_traced_reference_handling_(default_traced_reference_handling) {}
34
+
23
35
  /**
24
36
  * Returns true if the |TracedReference| handle should be considered as root
25
37
  * for the currently running non-tracing garbage collection and false
@@ -31,9 +43,7 @@ class V8_EXPORT EmbedderRootsHandler {
31
43
  * |TracedReference|.
32
44
  *
33
45
  * Note that the `handle` is different from the handle that the embedder holds
34
- * for retaining the object. The embedder may use |WrapperClassId()| to
35
- * distinguish cases where it wants handles to be treated as roots from not
36
- * being treated as roots.
46
+ * for retaining the object.
37
47
  *
38
48
  * The concrete implementations must be thread-safe.
39
49
  */
@@ -59,6 +69,12 @@ class V8_EXPORT EmbedderRootsHandler {
59
69
  ResetRoot(handle);
60
70
  return true;
61
71
  }
72
+
73
+ private:
74
+ const RootHandling default_traced_reference_handling_ =
75
+ RootHandling::kQueryEmbedderForNonDroppableReferences;
76
+
77
+ friend class internal::TracedHandles;
62
78
  };
63
79
 
64
80
  } // namespace v8
@@ -7,12 +7,13 @@
7
7
 
8
8
  #include <memory>
9
9
 
10
- #include "v8-context.h" // NOLINT(build/include_directory)
11
10
  #include "v8-internal.h" // NOLINT(build/include_directory)
12
11
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
13
12
 
14
13
  namespace v8 {
15
14
 
15
+ class Context;
16
+
16
17
  namespace internal {
17
18
  class EmbedderState;
18
19
  } // namespace internal
@@ -30,14 +30,21 @@ class ThreadLocalTop;
30
30
  */
31
31
  class V8_EXPORT Exception {
32
32
  public:
33
- static Local<Value> RangeError(Local<String> message);
34
- static Local<Value> ReferenceError(Local<String> message);
35
- static Local<Value> SyntaxError(Local<String> message);
36
- static Local<Value> TypeError(Local<String> message);
37
- static Local<Value> WasmCompileError(Local<String> message);
38
- static Local<Value> WasmLinkError(Local<String> message);
39
- static Local<Value> WasmRuntimeError(Local<String> message);
40
- static Local<Value> Error(Local<String> message);
33
+ static Local<Value> RangeError(Local<String> message,
34
+ Local<Value> options = {});
35
+ static Local<Value> ReferenceError(Local<String> message,
36
+ Local<Value> options = {});
37
+ static Local<Value> SyntaxError(Local<String> message,
38
+ Local<Value> options = {});
39
+ static Local<Value> TypeError(Local<String> message,
40
+ Local<Value> options = {});
41
+ static Local<Value> WasmCompileError(Local<String> message,
42
+ Local<Value> options = {});
43
+ static Local<Value> WasmLinkError(Local<String> message,
44
+ Local<Value> options = {});
45
+ static Local<Value> WasmRuntimeError(Local<String> message,
46
+ Local<Value> options = {});
47
+ static Local<Value> Error(Local<String> message, Local<Value> options = {});
41
48
 
42
49
  /**
43
50
  * Creates an error message for the given exception.
@@ -206,7 +213,6 @@ class V8_EXPORT TryCatch {
206
213
  bool can_continue_ : 1;
207
214
  bool capture_message_ : 1;
208
215
  bool rethrow_ : 1;
209
- bool has_terminated_ : 1;
210
216
 
211
217
  friend class internal::Isolate;
212
218
  friend class internal::ThreadLocalTop;
@@ -254,8 +254,8 @@ class CTypeInfo {
254
254
  // migrated from v8::ApiObject to v8::Local<v8::Value>.
255
255
  kAny, // This is added to enable untyped representation of fast
256
256
  // call arguments for test purposes. It can represent any of
257
- // the other types stored in the same memory as a union (see
258
- // the AnyCType struct declared below). This allows for
257
+ // the other types stored in the same memory as a union
258
+ // (see AnyCType declared below). This allows for
259
259
  // uniform passing of arguments w.r.t. their location
260
260
  // (in a register or on the stack), independent of their
261
261
  // actual type. It's currently used by the arm64 simulator
@@ -344,7 +344,8 @@ struct FastApiTypedArray : public FastApiTypedArrayBase {
344
344
  ValidateIndex(index);
345
345
  #endif // DEBUG
346
346
  T tmp;
347
- memcpy(&tmp, reinterpret_cast<T*>(data_) + index, sizeof(T));
347
+ memcpy(&tmp, static_cast<void*>(reinterpret_cast<T*>(data_) + index),
348
+ sizeof(T));
348
349
  return tmp;
349
350
  }
350
351
 
@@ -434,35 +435,43 @@ class V8_EXPORT CFunctionInfo {
434
435
  struct FastApiCallbackOptions;
435
436
 
436
437
  // Provided for testing.
437
- struct AnyCType {
438
+ union V8_TRIVIAL_ABI AnyCType {
438
439
  AnyCType() : int64_value(0) {}
439
440
 
440
- union {
441
- bool bool_value;
442
- int32_t int32_value;
443
- uint32_t uint32_value;
444
- int64_t int64_value;
445
- uint64_t uint64_value;
446
- float float_value;
447
- double double_value;
448
- void* pointer_value;
449
- Local<Object> object_value;
450
- Local<Array> sequence_value;
451
- const FastApiTypedArray<uint8_t>* uint8_ta_value;
452
- const FastApiTypedArray<int32_t>* int32_ta_value;
453
- const FastApiTypedArray<uint32_t>* uint32_ta_value;
454
- const FastApiTypedArray<int64_t>* int64_ta_value;
455
- const FastApiTypedArray<uint64_t>* uint64_ta_value;
456
- const FastApiTypedArray<float>* float_ta_value;
457
- const FastApiTypedArray<double>* double_ta_value;
458
- const FastOneByteString* string_value;
459
- FastApiCallbackOptions* options_value;
460
- };
441
+ #if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
442
+ // In this case, Local<T> is not trivially copyable and the implicit
443
+ // copy constructor and copy assignment for the union are deleted.
444
+ AnyCType(const AnyCType& other) : int64_value(other.int64_value) {}
445
+ AnyCType& operator=(const AnyCType& other) {
446
+ int64_value = other.int64_value;
447
+ return *this;
448
+ }
449
+ #endif
450
+
451
+ bool bool_value;
452
+ int32_t int32_value;
453
+ uint32_t uint32_value;
454
+ int64_t int64_value;
455
+ uint64_t uint64_value;
456
+ float float_value;
457
+ double double_value;
458
+ void* pointer_value;
459
+ Local<Object> object_value;
460
+ 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
+ const FastOneByteString* string_value;
469
+ FastApiCallbackOptions* options_value;
461
470
  };
462
471
 
463
472
  static_assert(
464
473
  sizeof(AnyCType) == 8,
465
- "The AnyCType struct should have size == 64 bits, as this is assumed "
474
+ "The union AnyCType should have size == 64 bits, as this is assumed "
466
475
  "by EffectControlLinearizer.");
467
476
 
468
477
  class V8_EXPORT CFunction {
@@ -27,6 +27,7 @@ class Context;
27
27
  class DataView;
28
28
  class Data;
29
29
  class Date;
30
+ class DictionaryTemplate;
30
31
  class Extension;
31
32
  class External;
32
33
  class FixedArray;