libv8-node 18.13.0.1-x86_64-linux → 20.2.0.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/common.h +0 -1
  4. data/vendor/v8/include/cppgc/cross-thread-persistent.h +11 -10
  5. data/vendor/v8/include/cppgc/heap-consistency.h +46 -3
  6. data/vendor/v8/include/cppgc/heap-handle.h +48 -0
  7. data/vendor/v8/include/cppgc/heap-statistics.h +2 -2
  8. data/vendor/v8/include/cppgc/heap.h +3 -7
  9. data/vendor/v8/include/cppgc/internal/api-constants.h +14 -1
  10. data/vendor/v8/include/cppgc/internal/base-page-handle.h +45 -0
  11. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +40 -8
  12. data/vendor/v8/include/cppgc/internal/caged-heap.h +61 -0
  13. data/vendor/v8/include/cppgc/internal/gc-info.h +35 -34
  14. data/vendor/v8/include/cppgc/internal/member-storage.h +248 -0
  15. data/vendor/v8/include/cppgc/internal/name-trait.h +21 -6
  16. data/vendor/v8/include/cppgc/internal/persistent-node.h +11 -13
  17. data/vendor/v8/include/cppgc/internal/pointer-policies.h +65 -8
  18. data/vendor/v8/include/cppgc/internal/write-barrier.h +153 -101
  19. data/vendor/v8/include/cppgc/liveness-broker.h +8 -7
  20. data/vendor/v8/include/cppgc/macros.h +10 -1
  21. data/vendor/v8/include/cppgc/member.h +424 -111
  22. data/vendor/v8/include/cppgc/name-provider.h +4 -4
  23. data/vendor/v8/include/cppgc/persistent.h +27 -24
  24. data/vendor/v8/include/cppgc/platform.h +7 -5
  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 +13 -3
  28. data/vendor/v8/include/cppgc/visitor.h +104 -57
  29. data/vendor/v8/include/libplatform/v8-tracing.h +2 -2
  30. data/vendor/v8/include/v8-array-buffer.h +59 -0
  31. data/vendor/v8/include/v8-callbacks.h +32 -5
  32. data/vendor/v8/include/v8-context.h +63 -11
  33. data/vendor/v8/include/v8-cppgc.h +22 -0
  34. data/vendor/v8/include/v8-data.h +1 -1
  35. data/vendor/v8/include/v8-date.h +5 -0
  36. data/vendor/v8/include/v8-embedder-heap.h +0 -164
  37. data/vendor/v8/include/v8-exception.h +1 -1
  38. data/vendor/v8/include/v8-fast-api-calls.h +49 -31
  39. data/vendor/v8/include/v8-function-callback.h +69 -42
  40. data/vendor/v8/include/v8-function.h +9 -0
  41. data/vendor/v8/include/v8-initialization.h +23 -49
  42. data/vendor/v8/include/v8-inspector.h +32 -11
  43. data/vendor/v8/include/v8-internal.h +480 -183
  44. data/vendor/v8/include/v8-isolate.h +52 -77
  45. data/vendor/v8/include/v8-local-handle.h +86 -53
  46. data/vendor/v8/include/v8-locker.h +0 -11
  47. data/vendor/v8/include/v8-maybe.h +24 -1
  48. data/vendor/v8/include/v8-message.h +2 -4
  49. data/vendor/v8/include/v8-metrics.h +48 -40
  50. data/vendor/v8/include/v8-microtask-queue.h +6 -1
  51. data/vendor/v8/include/v8-object.h +29 -18
  52. data/vendor/v8/include/v8-persistent-handle.h +25 -18
  53. data/vendor/v8/include/v8-platform.h +133 -35
  54. data/vendor/v8/include/v8-primitive.h +27 -20
  55. data/vendor/v8/include/v8-profiler.h +133 -53
  56. data/vendor/v8/include/v8-regexp.h +2 -1
  57. data/vendor/v8/include/v8-script.h +91 -7
  58. data/vendor/v8/include/v8-snapshot.h +4 -8
  59. data/vendor/v8/include/v8-template.h +16 -77
  60. data/vendor/v8/include/v8-traced-handle.h +22 -28
  61. data/vendor/v8/include/v8-unwinder-state.h +4 -4
  62. data/vendor/v8/include/v8-util.h +11 -7
  63. data/vendor/v8/include/v8-value-serializer.h +46 -23
  64. data/vendor/v8/include/v8-value.h +31 -4
  65. data/vendor/v8/include/v8-version.h +4 -4
  66. data/vendor/v8/include/v8-wasm.h +7 -63
  67. data/vendor/v8/include/v8-weak-callback-info.h +0 -7
  68. data/vendor/v8/include/v8config.h +353 -15
  69. data/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a +0 -0
  70. metadata +5 -1
@@ -8,6 +8,7 @@
8
8
  #include <stddef.h>
9
9
  #include <stdint.h>
10
10
 
11
+ #include <memory>
11
12
  #include <utility>
12
13
 
13
14
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
@@ -26,8 +27,37 @@ class Value;
26
27
 
27
28
  namespace internal {
28
29
  struct ScriptStreamingData;
30
+ class SharedObjectConveyorHandles;
31
+ class ValueDeserializer;
32
+ class ValueSerializer;
29
33
  } // namespace internal
30
34
 
35
+ /**
36
+ * A move-only class for managing the lifetime of shared value conveyors used
37
+ * by V8 to keep JS shared values alive in transit when serialized.
38
+ *
39
+ * This class is not directly constructible and is always passed to a
40
+ * ValueSerializer::Delegate via ValueSerializer::SetSharedValueConveyor.
41
+ *
42
+ * The embedder must not destruct the SharedValueConveyor until the associated
43
+ * serialized data will no longer be deserialized.
44
+ */
45
+ class V8_EXPORT SharedValueConveyor final {
46
+ public:
47
+ SharedValueConveyor(SharedValueConveyor&&) noexcept;
48
+ ~SharedValueConveyor();
49
+
50
+ SharedValueConveyor& operator=(SharedValueConveyor&&) noexcept;
51
+
52
+ private:
53
+ friend class internal::ValueSerializer;
54
+ friend class internal::ValueDeserializer;
55
+
56
+ explicit SharedValueConveyor(Isolate* isolate);
57
+
58
+ std::unique_ptr<internal::SharedObjectConveyorHandles> private_;
59
+ };
60
+
31
61
  /**
32
62
  * Value serialization compatible with the HTML structured clone algorithm.
33
63
  * The format is backward-compatible (i.e. safe to store to disk).
@@ -69,20 +99,20 @@ class V8_EXPORT ValueSerializer {
69
99
  Isolate* isolate, Local<WasmModuleObject> module);
70
100
 
71
101
  /**
72
- * Returns whether shared values are supported. GetSharedValueId is only
73
- * called if SupportsSharedValues() returns true.
74
- */
75
- virtual bool SupportsSharedValues() const;
76
-
77
- /**
78
- * Called when the ValueSerializer serializes a value that is shared across
79
- * Isolates. The embedder must return an ID for the object. This function
80
- * must be idempotent for the same object. When deserializing, the ID will
81
- * be passed to ValueDeserializer::Delegate::GetSharedValueFromId as
82
- * |shared_value_id|.
102
+ * Called when the first shared value is serialized. All subsequent shared
103
+ * values will use the same conveyor.
104
+ *
105
+ * The embedder must ensure the lifetime of the conveyor matches the
106
+ * lifetime of the serialized data.
107
+ *
108
+ * If the embedder supports serializing shared values, this method should
109
+ * return true. Otherwise the embedder should throw an exception and return
110
+ * false.
111
+ *
112
+ * This method is called at most once per serializer.
83
113
  */
84
- virtual Maybe<uint32_t> GetSharedValueId(Isolate* isolate,
85
- Local<Value> shared_value);
114
+ virtual bool AdoptSharedValueConveyor(Isolate* isolate,
115
+ SharedValueConveyor&& conveyor);
86
116
 
87
117
  /**
88
118
  * Allocates memory for the buffer of at least the size provided. The actual
@@ -196,17 +226,10 @@ class V8_EXPORT ValueDeserializer {
196
226
  Isolate* isolate, uint32_t clone_id);
197
227
 
198
228
  /**
199
- * Returns whether shared values are supported. GetSharedValueFromId is only
200
- * called if SupportsSharedValues() returns true.
201
- */
202
- virtual bool SupportsSharedValues() const;
203
-
204
- /**
205
- * Get a value shared across Isolates given a shared_value_id provided by
206
- * ValueSerializer::Delegate::GetSharedValueId.
229
+ * Get the SharedValueConveyor previously provided by
230
+ * ValueSerializer::Delegate::AdoptSharedValueConveyor.
207
231
  */
208
- virtual MaybeLocal<Value> GetSharedValueFromId(Isolate* isolate,
209
- uint32_t shared_value_id);
232
+ virtual const SharedValueConveyor* GetSharedValueConveyor(Isolate* isolate);
210
233
  };
211
234
 
212
235
  ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);
@@ -244,6 +244,11 @@ class V8_EXPORT Value : public Data {
244
244
  */
245
245
  bool IsWeakSet() const;
246
246
 
247
+ /**
248
+ * Returns true if this value is a WeakRef.
249
+ */
250
+ bool IsWeakRef() const;
251
+
247
252
  /**
248
253
  * Returns true if this value is an ArrayBuffer.
249
254
  */
@@ -339,6 +344,11 @@ class V8_EXPORT Value : public Data {
339
344
  */
340
345
  bool IsWasmModuleObject() const;
341
346
 
347
+ /**
348
+ * Returns true if this value is the WasmNull object.
349
+ */
350
+ bool IsWasmNull() const;
351
+
342
352
  /**
343
353
  * Returns true if the value is a Module Namespace Object.
344
354
  */
@@ -464,10 +474,14 @@ bool Value::IsUndefined() const {
464
474
  bool Value::QuickIsUndefined() const {
465
475
  using A = internal::Address;
466
476
  using I = internal::Internals;
467
- A obj = *reinterpret_cast<const A*>(this);
477
+ A obj = internal::ValueHelper::ValueAsAddress(this);
478
+ #if V8_STATIC_ROOTS_BOOL
479
+ return I::is_identical(obj, I::StaticReadOnlyRoot::kUndefinedValue);
480
+ #else
468
481
  if (!I::HasHeapObjectTag(obj)) return false;
469
482
  if (I::GetInstanceType(obj) != I::kOddballType) return false;
470
483
  return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
484
+ #endif // V8_STATIC_ROOTS_BOOL
471
485
  }
472
486
 
473
487
  bool Value::IsNull() const {
@@ -481,10 +495,14 @@ bool Value::IsNull() const {
481
495
  bool Value::QuickIsNull() const {
482
496
  using A = internal::Address;
483
497
  using I = internal::Internals;
484
- A obj = *reinterpret_cast<const A*>(this);
498
+ A obj = internal::ValueHelper::ValueAsAddress(this);
499
+ #if V8_STATIC_ROOTS_BOOL
500
+ return I::is_identical(obj, I::StaticReadOnlyRoot::kNullValue);
501
+ #else
485
502
  if (!I::HasHeapObjectTag(obj)) return false;
486
503
  if (I::GetInstanceType(obj) != I::kOddballType) return false;
487
504
  return (I::GetOddballKind(obj) == I::kNullOddballKind);
505
+ #endif // V8_STATIC_ROOTS_BOOL
488
506
  }
489
507
 
490
508
  bool Value::IsNullOrUndefined() const {
@@ -496,13 +514,17 @@ bool Value::IsNullOrUndefined() const {
496
514
  }
497
515
 
498
516
  bool Value::QuickIsNullOrUndefined() const {
517
+ #if V8_STATIC_ROOTS_BOOL
518
+ return QuickIsNull() || QuickIsUndefined();
519
+ #else
499
520
  using A = internal::Address;
500
521
  using I = internal::Internals;
501
- A obj = *reinterpret_cast<const A*>(this);
522
+ A obj = internal::ValueHelper::ValueAsAddress(this);
502
523
  if (!I::HasHeapObjectTag(obj)) return false;
503
524
  if (I::GetInstanceType(obj) != I::kOddballType) return false;
504
525
  int kind = I::GetOddballKind(obj);
505
526
  return kind == I::kNullOddballKind || kind == I::kUndefinedOddballKind;
527
+ #endif // V8_STATIC_ROOTS_BOOL
506
528
  }
507
529
 
508
530
  bool Value::IsString() const {
@@ -516,9 +538,14 @@ bool Value::IsString() const {
516
538
  bool Value::QuickIsString() const {
517
539
  using A = internal::Address;
518
540
  using I = internal::Internals;
519
- A obj = *reinterpret_cast<const A*>(this);
541
+ A obj = internal::ValueHelper::ValueAsAddress(this);
520
542
  if (!I::HasHeapObjectTag(obj)) return false;
543
+ #if V8_STATIC_ROOTS_BOOL && !V8_MAP_PACKING
544
+ return I::CheckInstanceMapRange(obj, I::StaticReadOnlyRoot::kFirstStringMap,
545
+ I::StaticReadOnlyRoot::kLastStringMap);
546
+ #else
521
547
  return (I::GetInstanceType(obj) < I::kFirstNonstringType);
548
+ #endif // V8_STATIC_ROOTS_BOOL
522
549
  }
523
550
 
524
551
  } // namespace v8
@@ -8,10 +8,10 @@
8
8
  // These macros define the version number for the current version.
9
9
  // NOTE these macros are used by some of the tool scripts and the build
10
10
  // system so their names cannot be changed without changing the scripts.
11
- #define V8_MAJOR_VERSION 10
12
- #define V8_MINOR_VERSION 2
13
- #define V8_BUILD_NUMBER 154
14
- #define V8_PATCH_LEVEL 23
11
+ #define V8_MAJOR_VERSION 11
12
+ #define V8_MINOR_VERSION 3
13
+ #define V8_BUILD_NUMBER 244
14
+ #define V8_PATCH_LEVEL 8
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
17
17
  // (Boolean macro values are not supported by all preprocessors.)
@@ -5,6 +5,7 @@
5
5
  #ifndef INCLUDE_V8_WASM_H_
6
6
  #define INCLUDE_V8_WASM_H_
7
7
 
8
+ #include <functional>
8
9
  #include <memory>
9
10
  #include <string>
10
11
 
@@ -130,19 +131,6 @@ class V8_EXPORT WasmStreaming final {
130
131
  public:
131
132
  class WasmStreamingImpl;
132
133
 
133
- /**
134
- * Client to receive streaming event notifications.
135
- */
136
- class Client {
137
- public:
138
- virtual ~Client() = default;
139
- /**
140
- * Passes the fully compiled module to the client. This can be used to
141
- * implement code caching.
142
- */
143
- virtual void OnModuleCompiled(CompiledWasmModule compiled_module) = 0;
144
- };
145
-
146
134
  explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
147
135
 
148
136
  ~WasmStreaming();
@@ -156,7 +144,7 @@ class V8_EXPORT WasmStreaming final {
156
144
  /**
157
145
  * {Finish} should be called after all received bytes where passed to
158
146
  * {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish}
159
- * does not have to be called after {Abort} has been called already.
147
+ * must not be called after {Abort} has been called already.
160
148
  * If {can_use_compiled_module} is true and {SetCompiledModuleBytes} was
161
149
  * previously called, the compiled module bytes can be used.
162
150
  * If {can_use_compiled_module} is false, the compiled module bytes previously
@@ -168,6 +156,7 @@ class V8_EXPORT WasmStreaming final {
168
156
  * Abort streaming compilation. If {exception} has a value, then the promise
169
157
  * associated with streaming compilation is rejected with that value. If
170
158
  * {exception} does not have value, the promise does not get rejected.
159
+ * {Abort} must not be called repeatedly, or after {Finish}.
171
160
  */
172
161
  void Abort(MaybeLocal<Value> exception);
173
162
 
@@ -183,10 +172,11 @@ class V8_EXPORT WasmStreaming final {
183
172
  bool SetCompiledModuleBytes(const uint8_t* bytes, size_t size);
184
173
 
185
174
  /**
186
- * Sets the client object that will receive streaming event notifications.
187
- * This must be called before {OnBytesReceived}, {Finish}, or {Abort}.
175
+ * Sets a callback which is called whenever a significant number of new
176
+ * functions are ready for serialization.
188
177
  */
189
- void SetClient(std::shared_ptr<Client> client);
178
+ void SetMoreFunctionsCanBeSerializedCallback(
179
+ std::function<void(CompiledWasmModule)>);
190
180
 
191
181
  /*
192
182
  * Sets the UTF-8 encoded source URL for the {Script} object. This must be
@@ -206,52 +196,6 @@ class V8_EXPORT WasmStreaming final {
206
196
  std::unique_ptr<WasmStreamingImpl> impl_;
207
197
  };
208
198
 
209
- // TODO(mtrofin): when streaming compilation is done, we can rename this
210
- // to simply WasmModuleObjectBuilder
211
- class V8_EXPORT WasmModuleObjectBuilderStreaming final {
212
- public:
213
- explicit WasmModuleObjectBuilderStreaming(Isolate* isolate);
214
- /**
215
- * The buffer passed into OnBytesReceived is owned by the caller.
216
- */
217
- void OnBytesReceived(const uint8_t*, size_t size);
218
- void Finish();
219
- /**
220
- * Abort streaming compilation. If {exception} has a value, then the promise
221
- * associated with streaming compilation is rejected with that value. If
222
- * {exception} does not have value, the promise does not get rejected.
223
- */
224
- void Abort(MaybeLocal<Value> exception);
225
- Local<Promise> GetPromise();
226
-
227
- ~WasmModuleObjectBuilderStreaming() = default;
228
-
229
- private:
230
- WasmModuleObjectBuilderStreaming(const WasmModuleObjectBuilderStreaming&) =
231
- delete;
232
- WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
233
- default;
234
- WasmModuleObjectBuilderStreaming& operator=(
235
- const WasmModuleObjectBuilderStreaming&) = delete;
236
- WasmModuleObjectBuilderStreaming& operator=(
237
- WasmModuleObjectBuilderStreaming&&) = default;
238
- Isolate* isolate_ = nullptr;
239
-
240
- #if V8_CC_MSVC
241
- /**
242
- * We don't need the static Copy API, so the default
243
- * NonCopyablePersistentTraits would be sufficient, however,
244
- * MSVC eagerly instantiates the Copy.
245
- * We ensure we don't use Copy, however, by compiling with the
246
- * defaults everywhere else.
247
- */
248
- Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
249
- #else
250
- Persistent<Promise> promise_;
251
- #endif
252
- std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
253
- };
254
-
255
199
  } // namespace v8
256
200
 
257
201
  #endif // INCLUDE_V8_WASM_H_
@@ -63,13 +63,6 @@ enum class WeakCallbackType {
63
63
  * Passes the first two internal fields of the object back to the callback.
64
64
  */
65
65
  kInternalFields,
66
- /**
67
- * Passes a user-defined void* parameter back to the callback. Will do so
68
- * before the object is actually reclaimed, allowing it to be resurrected. In
69
- * this case it is not possible to set a second-pass callback.
70
- */
71
- kFinalizer V8_ENUM_DEPRECATED("Resurrecting finalizers are deprecated "
72
- "and will not be supported going forward.")
73
66
  };
74
67
 
75
68
  template <class T>