libv8-node 18.13.0.0-x86_64-darwin → 19.9.0.0-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +1 -1
  3. data/lib/libv8/node/version.rb +3 -3
  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. data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
  63. metadata +8 -4
@@ -20,6 +20,7 @@ class String;
20
20
  namespace internal {
21
21
  class ExternalString;
22
22
  class ScopedExternalStringLock;
23
+ class StringForwardingTable;
23
24
  } // namespace internal
24
25
 
25
26
  /**
@@ -269,6 +270,7 @@ class V8_EXPORT String : public Name {
269
270
  private:
270
271
  friend class internal::ExternalString;
271
272
  friend class v8::String;
273
+ friend class internal::StringForwardingTable;
272
274
  friend class internal::ScopedExternalStringLock;
273
275
  };
274
276
 
@@ -785,10 +787,9 @@ String::ExternalStringResource* String::GetExternalStringResource() const {
785
787
 
786
788
  ExternalStringResource* result;
787
789
  if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
788
- internal::Isolate* isolate = I::GetIsolateForSandbox(obj);
789
- A value =
790
- I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset,
791
- internal::kExternalStringResourceTag);
790
+ Isolate* isolate = I::GetIsolateForSandbox(obj);
791
+ A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
792
+ isolate, obj, I::kStringResourceOffset);
792
793
  result = reinterpret_cast<String::ExternalStringResource*>(value);
793
794
  } else {
794
795
  result = GetExternalStringResourceSlow();
@@ -809,10 +810,9 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
809
810
  ExternalStringResourceBase* resource;
810
811
  if (type == I::kExternalOneByteRepresentationTag ||
811
812
  type == I::kExternalTwoByteRepresentationTag) {
812
- internal::Isolate* isolate = I::GetIsolateForSandbox(obj);
813
- A value =
814
- I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset,
815
- internal::kExternalStringResourceTag);
813
+ Isolate* isolate = I::GetIsolateForSandbox(obj);
814
+ A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
815
+ isolate, obj, I::kStringResourceOffset);
816
816
  resource = reinterpret_cast<ExternalStringResourceBase*>(value);
817
817
  } else {
818
818
  resource = GetExternalStringResourceBaseSlow(encoding_out);
@@ -331,6 +331,9 @@ class V8_EXPORT CpuProfilingOptions {
331
331
  unsigned max_samples = kNoSampleLimit, int sampling_interval_us = 0,
332
332
  MaybeLocal<Context> filter_context = MaybeLocal<Context>());
333
333
 
334
+ CpuProfilingOptions(CpuProfilingOptions&&) = default;
335
+ CpuProfilingOptions& operator=(CpuProfilingOptions&&) = default;
336
+
334
337
  CpuProfilingMode mode() const { return mode_; }
335
338
  unsigned max_samples() const { return max_samples_; }
336
339
  int sampling_interval_us() const { return sampling_interval_us_; }
@@ -344,7 +347,7 @@ class V8_EXPORT CpuProfilingOptions {
344
347
  CpuProfilingMode mode_;
345
348
  unsigned max_samples_;
346
349
  int sampling_interval_us_;
347
- CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
350
+ Global<Context> filter_context_;
348
351
  };
349
352
 
350
353
  /**
@@ -542,7 +545,9 @@ class V8_EXPORT HeapGraphNode {
542
545
  kConsString = 10, // Concatenated string. A pair of pointers to strings.
543
546
  kSlicedString = 11, // Sliced string. A fragment of another string.
544
547
  kSymbol = 12, // A Symbol (ES6).
545
- kBigInt = 13 // BigInt.
548
+ kBigInt = 13, // BigInt.
549
+ kObjectShape = 14, // Internal data used for tracking the shapes (or
550
+ // "hidden classes") of JS objects.
546
551
  };
547
552
 
548
553
  /** Returns node type (see HeapGraphNode::Type). */
@@ -898,6 +903,8 @@ class V8_EXPORT HeapProfiler {
898
903
  enum SamplingFlags {
899
904
  kSamplingNoFlags = 0,
900
905
  kSamplingForceGC = 1 << 0,
906
+ kSamplingIncludeObjectsCollectedByMajorGC = 1 << 1,
907
+ kSamplingIncludeObjectsCollectedByMinorGC = 1 << 2,
901
908
  };
902
909
 
903
910
  /**
@@ -975,14 +982,71 @@ class V8_EXPORT HeapProfiler {
975
982
  virtual ~ObjectNameResolver() = default;
976
983
  };
977
984
 
985
+ enum class HeapSnapshotMode {
986
+ /**
987
+ * Heap snapshot for regular developers.
988
+ */
989
+ kRegular,
990
+ /**
991
+ * Heap snapshot is exposing internals that may be useful for experts.
992
+ */
993
+ kExposeInternals,
994
+ };
995
+
996
+ enum class NumericsMode {
997
+ /**
998
+ * Numeric values are hidden as they are values of the corresponding
999
+ * objects.
1000
+ */
1001
+ kHideNumericValues,
1002
+ /**
1003
+ * Numeric values are exposed in artificial fields.
1004
+ */
1005
+ kExposeNumericValues
1006
+ };
1007
+
1008
+ struct HeapSnapshotOptions final {
1009
+ // Manually define default constructor here to be able to use it in
1010
+ // `TakeSnapshot()` below.
1011
+ // NOLINTNEXTLINE
1012
+ HeapSnapshotOptions() {}
1013
+
1014
+ /**
1015
+ * The control used to report intermediate progress to.
1016
+ */
1017
+ ActivityControl* control = nullptr;
1018
+ /**
1019
+ * The resolver used by the snapshot generator to get names for V8 objects.
1020
+ */
1021
+ ObjectNameResolver* global_object_name_resolver = nullptr;
1022
+ /**
1023
+ * Mode for taking the snapshot, see `HeapSnapshotMode`.
1024
+ */
1025
+ HeapSnapshotMode snapshot_mode = HeapSnapshotMode::kRegular;
1026
+ /**
1027
+ * Mode for dealing with numeric values, see `NumericsMode`.
1028
+ */
1029
+ NumericsMode numerics_mode = NumericsMode::kHideNumericValues;
1030
+ };
1031
+
978
1032
  /**
979
- * Takes a heap snapshot and returns it.
1033
+ * Takes a heap snapshot.
1034
+ *
1035
+ * \returns the snapshot.
1036
+ */
1037
+ const HeapSnapshot* TakeHeapSnapshot(
1038
+ const HeapSnapshotOptions& options = HeapSnapshotOptions());
1039
+
1040
+ /**
1041
+ * Takes a heap snapshot. See `HeapSnapshotOptions` for details on the
1042
+ * parameters.
1043
+ *
1044
+ * \returns the snapshot.
980
1045
  */
981
1046
  const HeapSnapshot* TakeHeapSnapshot(
982
- ActivityControl* control = nullptr,
1047
+ ActivityControl* control,
983
1048
  ObjectNameResolver* global_object_name_resolver = nullptr,
984
- bool treat_global_objects_as_roots = true,
985
- bool capture_numeric_value = false);
1049
+ bool hide_internals = true, bool capture_numeric_value = false);
986
1050
 
987
1051
  /**
988
1052
  * Starts tracking of heap objects population statistics. After calling
@@ -1035,10 +1099,8 @@ class V8_EXPORT HeapProfiler {
1035
1099
  * |stack_depth| parameter controls the maximum number of stack frames to be
1036
1100
  * captured on each allocation.
1037
1101
  *
1038
- * NOTE: This is a proof-of-concept at this point. Right now we only sample
1039
- * newspace allocations. Support for paged space allocation (e.g. pre-tenured
1040
- * objects, large objects, code objects, etc.) and native allocations
1041
- * doesn't exist yet, but is anticipated in the future.
1102
+ * NOTE: Support for native allocations doesn't exist yet, but is anticipated
1103
+ * in the future.
1042
1104
  *
1043
1105
  * Objects allocated before the sampling is started will not be included in
1044
1106
  * the profile.
@@ -1101,18 +1163,18 @@ struct HeapStatsUpdate {
1101
1163
  uint32_t size; // New value of size field for the interval with this index.
1102
1164
  };
1103
1165
 
1104
- #define CODE_EVENTS_LIST(V) \
1105
- V(Builtin) \
1106
- V(Callback) \
1107
- V(Eval) \
1108
- V(Function) \
1109
- V(InterpretedFunction) \
1110
- V(Handler) \
1111
- V(BytecodeHandler) \
1112
- V(LazyCompile) \
1113
- V(RegExp) \
1114
- V(Script) \
1115
- V(Stub) \
1166
+ #define CODE_EVENTS_LIST(V) \
1167
+ V(Builtin) \
1168
+ V(Callback) \
1169
+ V(Eval) \
1170
+ V(Function) \
1171
+ V(InterpretedFunction) \
1172
+ V(Handler) \
1173
+ V(BytecodeHandler) \
1174
+ V(LazyCompile) /* Unused, use kFunction instead */ \
1175
+ V(RegExp) \
1176
+ V(Script) \
1177
+ V(Stub) \
1116
1178
  V(Relocation)
1117
1179
 
1118
1180
  /**
@@ -37,9 +37,10 @@ class V8_EXPORT RegExp : public Object {
37
37
  kDotAll = 1 << 5,
38
38
  kLinear = 1 << 6,
39
39
  kHasIndices = 1 << 7,
40
+ kUnicodeSets = 1 << 8,
40
41
  };
41
42
 
42
- static constexpr int kFlagCount = 8;
43
+ static constexpr int kFlagCount = 9;
43
44
 
44
45
  /**
45
46
  * Creates a regular expression from the given pattern string and
@@ -20,6 +20,7 @@
20
20
  namespace v8 {
21
21
 
22
22
  class Function;
23
+ class Message;
23
24
  class Object;
24
25
  class PrimitiveArray;
25
26
  class Script;
@@ -47,8 +48,6 @@ class V8_EXPORT ScriptOrModule {
47
48
  * The options that were passed by the embedder as HostDefinedOptions to
48
49
  * the ScriptOrigin.
49
50
  */
50
- V8_DEPRECATED("Use HostDefinedOptions")
51
- Local<PrimitiveArray> GetHostDefinedOptions();
52
51
  Local<Data> HostDefinedOptions();
53
52
  };
54
53
 
@@ -78,7 +77,13 @@ class V8_EXPORT UnboundScript {
78
77
  * Returns zero based line number of the code_pos location in the script.
79
78
  * -1 will be returned if no information available.
80
79
  */
81
- int GetLineNumber(int code_pos);
80
+ int GetLineNumber(int code_pos = 0);
81
+
82
+ /**
83
+ * Returns zero based column number of the code_pos location in the script.
84
+ * -1 will be returned if no information available.
85
+ */
86
+ int GetColumnNumber(int code_pos = 0);
82
87
 
83
88
  static const int kNoScriptId = 0;
84
89
  };
@@ -87,7 +92,15 @@ class V8_EXPORT UnboundScript {
87
92
  * A compiled JavaScript module, not yet tied to a Context.
88
93
  */
89
94
  class V8_EXPORT UnboundModuleScript : public Data {
90
- // Only used as a container for code caching.
95
+ public:
96
+ /**
97
+ * Data read from magic sourceURL comments.
98
+ */
99
+ Local<Value> GetSourceURL();
100
+ /**
101
+ * Data read from magic sourceMappingURL comments.
102
+ */
103
+ Local<Value> GetSourceMappingURL();
91
104
  };
92
105
 
93
106
  /**
@@ -286,6 +299,16 @@ class V8_EXPORT Module : public Data {
286
299
  V8_WARN_UNUSED_RESULT Maybe<bool> SetSyntheticModuleExport(
287
300
  Isolate* isolate, Local<String> export_name, Local<Value> export_value);
288
301
 
302
+ /**
303
+ * Search the modules requested directly or indirectly by the module for
304
+ * any top-level await that has not yet resolved. If there is any, the
305
+ * returned vector contains a tuple of the unresolved module and a message
306
+ * with the pending top-level await.
307
+ * An embedder may call this before exiting to improve error messages.
308
+ */
309
+ std::vector<std::tuple<Local<Module>, Local<Message>>>
310
+ GetStalledTopLevelAwaitMessage(Isolate* isolate);
311
+
289
312
  V8_INLINE static Module* Cast(Data* data);
290
313
 
291
314
  private:
@@ -489,7 +512,7 @@ class V8_EXPORT ScriptCompiler {
489
512
  /**
490
513
  * A task which the embedder must run on a background thread to
491
514
  * consume a V8 code cache. Returned by
492
- * ScriptCompiler::StarConsumingCodeCache.
515
+ * ScriptCompiler::StartConsumingCodeCache.
493
516
  */
494
517
  class V8_EXPORT ConsumeCodeCacheTask final {
495
518
  public:
@@ -497,6 +520,36 @@ class V8_EXPORT ScriptCompiler {
497
520
 
498
521
  void Run();
499
522
 
523
+ /**
524
+ * Provides the source text string and origin information to the consumption
525
+ * task. May be called before, during, or after Run(). This step checks
526
+ * whether the script matches an existing script in the Isolate's
527
+ * compilation cache. To check whether such a script was found, call
528
+ * ShouldMergeWithExistingScript.
529
+ *
530
+ * The Isolate provided must be the same one used during
531
+ * StartConsumingCodeCache and must be currently entered on the thread that
532
+ * calls this function. The source text and origin provided in this step
533
+ * must precisely match those used later in the ScriptCompiler::Source that
534
+ * will contain this ConsumeCodeCacheTask.
535
+ */
536
+ void SourceTextAvailable(Isolate* isolate, Local<String> source_text,
537
+ const ScriptOrigin& origin);
538
+
539
+ /**
540
+ * Returns whether the embedder should call MergeWithExistingScript. This
541
+ * function may be called from any thread, any number of times, but its
542
+ * return value is only meaningful after SourceTextAvailable has completed.
543
+ */
544
+ bool ShouldMergeWithExistingScript() const;
545
+
546
+ /**
547
+ * Merges newly deserialized data into an existing script which was found
548
+ * during SourceTextAvailable. May be called only after Run() has completed.
549
+ * Can execute on any thread, like Run().
550
+ */
551
+ void MergeWithExistingScript();
552
+
500
553
  private:
501
554
  friend class ScriptCompiler;
502
555
 
@@ -581,7 +634,8 @@ class V8_EXPORT ScriptCompiler {
581
634
  */
582
635
  static ScriptStreamingTask* StartStreaming(
583
636
  Isolate* isolate, StreamedSource* source,
584
- ScriptType type = ScriptType::kClassic);
637
+ ScriptType type = ScriptType::kClassic,
638
+ CompileOptions options = kNoCompileOptions);
585
639
 
586
640
  static ConsumeCodeCacheTask* StartConsumingCodeCache(
587
641
  Isolate* isolate, std::unique_ptr<CachedData> source);
@@ -650,6 +704,7 @@ class V8_EXPORT ScriptCompiler {
650
704
  * It is possible to specify multiple context extensions (obj in the above
651
705
  * example).
652
706
  */
707
+ V8_DEPRECATED("Use CompileFunction")
653
708
  static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext(
654
709
  Local<Context> context, Source* source, size_t arguments_count,
655
710
  Local<String> arguments[], size_t context_extension_count,
@@ -657,6 +712,7 @@ class V8_EXPORT ScriptCompiler {
657
712
  CompileOptions options = kNoCompileOptions,
658
713
  NoCacheReason no_cache_reason = kNoCacheNoReason,
659
714
  Local<ScriptOrModule>* script_or_module_out = nullptr);
715
+
660
716
  static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunction(
661
717
  Local<Context> context, Source* source, size_t arguments_count = 0,
662
718
  Local<String> arguments[] = nullptr, size_t context_extension_count = 0,
@@ -14,7 +14,6 @@
14
14
 
15
15
  namespace v8 {
16
16
 
17
- class AccessorSignature;
18
17
  class CFunction;
19
18
  class FunctionTemplate;
20
19
  class ObjectTemplate;
@@ -83,28 +82,7 @@ class V8_EXPORT Template : public Data {
83
82
  * cross-context access.
84
83
  * \param attribute The attributes of the property for which an accessor
85
84
  * is added.
86
- * \param signature The signature describes valid receivers for the accessor
87
- * and is used to perform implicit instance checks against them. If the
88
- * receiver is incompatible (i.e. is not an instance of the constructor as
89
- * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
90
- * thrown and no callback is invoked.
91
85
  */
92
- V8_DEPRECATED("Do signature check in accessor")
93
- void SetNativeDataProperty(
94
- Local<String> name, AccessorGetterCallback getter,
95
- AccessorSetterCallback setter, Local<Value> data,
96
- PropertyAttribute attribute, Local<AccessorSignature> signature,
97
- AccessControl settings = DEFAULT,
98
- SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
99
- SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
100
- V8_DEPRECATED("Do signature check in accessor")
101
- void SetNativeDataProperty(
102
- Local<Name> name, AccessorNameGetterCallback getter,
103
- AccessorNameSetterCallback setter, Local<Value> data,
104
- PropertyAttribute attribute, Local<AccessorSignature> signature,
105
- AccessControl settings = DEFAULT,
106
- SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
107
- SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
108
86
  void SetNativeDataProperty(
109
87
  Local<String> name, AccessorGetterCallback getter,
110
88
  AccessorSetterCallback setter = nullptr,
@@ -151,7 +129,8 @@ class V8_EXPORT Template : public Data {
151
129
  * Interceptor for get requests on an object.
152
130
  *
153
131
  * Use `info.GetReturnValue().Set()` to set the return value of the
154
- * intercepted get request.
132
+ * intercepted get request. If the property does not exist the callback should
133
+ * not set the result and must not produce side effects.
155
134
  *
156
135
  * \param property The name of the property for which the request was
157
136
  * intercepted.
@@ -192,9 +171,9 @@ using GenericNamedPropertyGetterCallback =
192
171
  * Use `info.GetReturnValue()` to indicate whether the request was intercepted
193
172
  * or not. If the setter successfully intercepts the request, i.e., if the
194
173
  * request should not be further executed, call
195
- * `info.GetReturnValue().Set(value)`. If the setter
196
- * did not intercept the request, i.e., if the request should be handled as
197
- * if no interceptor is present, do not not call `Set()`.
174
+ * `info.GetReturnValue().Set(value)`. If the setter did not intercept the
175
+ * request, i.e., if the request should be handled as if no interceptor is
176
+ * present, do not not call `Set()` and do not produce side effects.
198
177
  *
199
178
  * \param property The name of the property for which the request was
200
179
  * intercepted.
@@ -217,7 +196,9 @@ using GenericNamedPropertySetterCallback =
217
196
  * defineProperty().
218
197
  *
219
198
  * Use `info.GetReturnValue().Set(value)` to set the property attributes. The
220
- * value is an integer encoding a `v8::PropertyAttribute`.
199
+ * value is an integer encoding a `v8::PropertyAttribute`. If the property does
200
+ * not exist the callback should not set the result and must not produce side
201
+ * effects.
221
202
  *
222
203
  * \param property The name of the property for which the request was
223
204
  * intercepted.
@@ -242,7 +223,8 @@ using GenericNamedPropertyQueryCallback =
242
223
  * or not. If the deleter successfully intercepts the request, i.e., if the
243
224
  * request should not be further executed, call
244
225
  * `info.GetReturnValue().Set(value)` with a boolean `value`. The `value` is
245
- * used as the return value of `delete`.
226
+ * used as the return value of `delete`. If the deleter does not intercept the
227
+ * request then it should not set the result and must not produce side effects.
246
228
  *
247
229
  * \param property The name of the property for which the request was
248
230
  * intercepted.
@@ -274,9 +256,9 @@ using GenericNamedPropertyEnumeratorCallback =
274
256
  * Use `info.GetReturnValue()` to indicate whether the request was intercepted
275
257
  * or not. If the definer successfully intercepts the request, i.e., if the
276
258
  * request should not be further executed, call
277
- * `info.GetReturnValue().Set(value)`. If the definer
278
- * did not intercept the request, i.e., if the request should be handled as
279
- * if no interceptor is present, do not not call `Set()`.
259
+ * `info.GetReturnValue().Set(value)`. If the definer did not intercept the
260
+ * request, i.e., if the request should be handled as if no interceptor is
261
+ * present, do not not call `Set()` and do not produce side effects.
280
262
  *
281
263
  * \param property The name of the property for which the request was
282
264
  * intercepted.
@@ -821,27 +803,7 @@ class V8_EXPORT ObjectTemplate : public Template {
821
803
  * cross-context access.
822
804
  * \param attribute The attributes of the property for which an accessor
823
805
  * is added.
824
- * \param signature The signature describes valid receivers for the accessor
825
- * and is used to perform implicit instance checks against them. If the
826
- * receiver is incompatible (i.e. is not an instance of the constructor as
827
- * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
828
- * thrown and no callback is invoked.
829
806
  */
830
- V8_DEPRECATED("Do signature check in accessor")
831
- void SetAccessor(
832
- Local<String> name, AccessorGetterCallback getter,
833
- AccessorSetterCallback setter, Local<Value> data, AccessControl settings,
834
- PropertyAttribute attribute, Local<AccessorSignature> signature,
835
- SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
836
- SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
837
- V8_DEPRECATED("Do signature check in accessor")
838
- void SetAccessor(
839
- Local<Name> name, AccessorNameGetterCallback getter,
840
- AccessorNameSetterCallback setter, Local<Value> data,
841
- AccessControl settings, PropertyAttribute attribute,
842
- Local<AccessorSignature> signature,
843
- SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
844
- SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
845
807
  void SetAccessor(
846
808
  Local<String> name, AccessorGetterCallback getter,
847
809
  AccessorSetterCallback setter = nullptr,
@@ -1019,24 +981,6 @@ class V8_EXPORT Signature : public Data {
1019
981
  static void CheckCast(Data* that);
1020
982
  };
1021
983
 
1022
- /**
1023
- * An AccessorSignature specifies which receivers are valid parameters
1024
- * to an accessor callback.
1025
- */
1026
- class V8_EXPORT AccessorSignature : public Data {
1027
- public:
1028
- static Local<AccessorSignature> New(
1029
- Isolate* isolate,
1030
- Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
1031
-
1032
- V8_INLINE static AccessorSignature* Cast(Data* data);
1033
-
1034
- private:
1035
- AccessorSignature();
1036
-
1037
- static void CheckCast(Data* that);
1038
- };
1039
-
1040
984
  // --- Implementation ---
1041
985
 
1042
986
  void Template::Set(Isolate* isolate, const char* name, Local<Data> value,
@@ -1067,13 +1011,6 @@ Signature* Signature::Cast(Data* data) {
1067
1011
  return reinterpret_cast<Signature*>(data);
1068
1012
  }
1069
1013
 
1070
- AccessorSignature* AccessorSignature::Cast(Data* data) {
1071
- #ifdef V8_ENABLE_CHECKS
1072
- CheckCast(data);
1073
- #endif
1074
- return reinterpret_cast<AccessorSignature*>(data);
1075
- }
1076
-
1077
1014
  } // namespace v8
1078
1015
 
1079
1016
  #endif // INCLUDE_V8_TEMPLATE_H_
@@ -17,10 +17,10 @@ struct CalleeSavedRegisters {
17
17
  void* arm_r9;
18
18
  void* arm_r10;
19
19
  };
20
- #elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \
21
- V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || \
22
- V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 || \
23
- V8_TARGET_ARCH_LOONG64
20
+ #elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \
21
+ V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 || \
22
+ V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 || V8_TARGET_ARCH_LOONG64 || \
23
+ V8_TARGET_ARCH_RISCV32
24
24
  struct CalleeSavedRegisters {};
25
25
  #else
26
26
  #error Target architecture was not detected as supported by v8
@@ -537,7 +537,6 @@ class StdGlobalValueMap : public GlobalValueMap<K, V, Traits> {
537
537
  : GlobalValueMap<K, V, Traits>(isolate) {}
538
538
  };
539
539
 
540
-
541
540
  class DefaultPersistentValueVectorTraits {
542
541
  public:
543
542
  typedef std::vector<PersistentContainerValue> Impl;
@@ -562,7 +561,6 @@ class DefaultPersistentValueVectorTraits {
562
561
  }
563
562
  };
564
563
 
565
-
566
564
  /**
567
565
  * A vector wrapper that safely stores Global values.
568
566
  * C++11 embedders don't need this class, as they can use Global
@@ -573,8 +571,8 @@ class DefaultPersistentValueVectorTraits {
573
571
  * PersistentContainerValue, with all conversion into and out of V8
574
572
  * handles being transparently handled by this class.
575
573
  */
576
- template<typename V, typename Traits = DefaultPersistentValueVectorTraits>
577
- class PersistentValueVector {
574
+ template <typename V, typename Traits = DefaultPersistentValueVectorTraits>
575
+ class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
578
576
  public:
579
577
  explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { }
580
578
 
@@ -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);
@@ -9,9 +9,9 @@
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
11
  #define V8_MAJOR_VERSION 10
12
- #define V8_MINOR_VERSION 2
13
- #define V8_BUILD_NUMBER 154
14
- #define V8_PATCH_LEVEL 23
12
+ #define V8_MINOR_VERSION 8
13
+ #define V8_BUILD_NUMBER 168
14
+ #define V8_PATCH_LEVEL 25
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
17
17
  // (Boolean macro values are not supported by all preprocessors.)