libv8-node 22.7.0.3-arm64-darwin → 23.6.1.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) 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/allocation.h +10 -11
  5. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  6. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  7. data/vendor/v8/include/cppgc/internal/api-constants.h +6 -1
  8. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  9. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  10. data/vendor/v8/include/cppgc/internal/member-storage.h +6 -0
  11. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  12. data/vendor/v8/include/cppgc/name-provider.h +7 -0
  13. data/vendor/v8/include/v8-array-buffer.h +44 -24
  14. data/vendor/v8/include/v8-callbacks.h +10 -5
  15. data/vendor/v8/include/v8-context.h +41 -9
  16. data/vendor/v8/include/v8-cppgc.h +3 -55
  17. data/vendor/v8/include/v8-date.h +9 -0
  18. data/vendor/v8/include/v8-embedder-heap.h +4 -1
  19. data/vendor/v8/include/v8-exception.h +70 -0
  20. data/vendor/v8/include/v8-fast-api-calls.h +31 -38
  21. data/vendor/v8/include/v8-function-callback.h +203 -62
  22. data/vendor/v8/include/v8-function.h +4 -3
  23. data/vendor/v8/include/v8-handle-base.h +2 -2
  24. data/vendor/v8/include/v8-initialization.h +18 -1
  25. data/vendor/v8/include/v8-inspector.h +6 -3
  26. data/vendor/v8/include/v8-internal.h +303 -58
  27. data/vendor/v8/include/v8-isolate.h +58 -39
  28. data/vendor/v8/include/v8-local-handle.h +18 -19
  29. data/vendor/v8/include/v8-message.h +0 -21
  30. data/vendor/v8/include/v8-metrics.h +4 -0
  31. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  32. data/vendor/v8/include/v8-object.h +284 -35
  33. data/vendor/v8/include/v8-persistent-handle.h +0 -19
  34. data/vendor/v8/include/v8-platform.h +21 -35
  35. data/vendor/v8/include/v8-primitive.h +92 -1
  36. data/vendor/v8/include/v8-profiler.h +38 -1
  37. data/vendor/v8/include/v8-promise.h +2 -2
  38. data/vendor/v8/include/v8-sandbox.h +173 -0
  39. data/vendor/v8/include/v8-script.h +44 -14
  40. data/vendor/v8/include/v8-snapshot.h +38 -2
  41. data/vendor/v8/include/v8-template.h +105 -263
  42. data/vendor/v8/include/v8-traced-handle.h +4 -15
  43. data/vendor/v8/include/v8-unwinder.h +2 -1
  44. data/vendor/v8/include/v8-util.h +1 -117
  45. data/vendor/v8/include/v8-value.h +3 -2
  46. data/vendor/v8/include/v8-version.h +3 -3
  47. data/vendor/v8/include/v8-wasm.h +3 -0
  48. data/vendor/v8/include/v8config.h +51 -7
  49. metadata +4 -3
@@ -5,10 +5,12 @@
5
5
  #ifndef INCLUDE_V8_OBJECT_H_
6
6
  #define INCLUDE_V8_OBJECT_H_
7
7
 
8
+ #include "v8-internal.h" // NOLINT(build/include_directory)
8
9
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
9
10
  #include "v8-maybe.h" // NOLINT(build/include_directory)
10
11
  #include "v8-persistent-handle.h" // NOLINT(build/include_directory)
11
12
  #include "v8-primitive.h" // NOLINT(build/include_directory)
13
+ #include "v8-sandbox.h" // NOLINT(build/include_directory)
12
14
  #include "v8-traced-handle.h" // NOLINT(build/include_directory)
13
15
  #include "v8-value.h" // NOLINT(build/include_directory)
14
16
  #include "v8config.h" // NOLINT(build/include_directory)
@@ -146,18 +148,13 @@ enum PropertyAttribute {
146
148
  };
147
149
 
148
150
  /**
149
- * Accessor[Getter|Setter] are used as callback functions when
150
- * setting|getting a particular property. See Object and ObjectTemplate's
151
- * method SetAccessor.
151
+ * Accessor[Getter|Setter] are used as callback functions when setting|getting
152
+ * a particular data property. See Object::SetNativeDataProperty and
153
+ * ObjectTemplate::SetNativeDataProperty methods.
152
154
  */
153
- using AccessorGetterCallback =
154
- void (*)(Local<String> property, const PropertyCallbackInfo<Value>& info);
155
155
  using AccessorNameGetterCallback =
156
156
  void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
157
157
 
158
- using AccessorSetterCallback = void (*)(Local<String> property,
159
- Local<Value> value,
160
- const PropertyCallbackInfo<void>& info);
161
158
  using AccessorNameSetterCallback =
162
159
  void (*)(Local<Name> property, Local<Value> value,
163
160
  const PropertyCallbackInfo<void>& info);
@@ -170,9 +167,11 @@ using AccessorNameSetterCallback =
170
167
  * the kind of cross-context access that should be allowed.
171
168
  *
172
169
  */
173
- enum AccessControl {
174
- DEFAULT = 0,
175
- };
170
+ enum V8_DEPRECATE_SOON(
171
+ "This enum is no longer used and will be removed in V8 12.9.")
172
+ AccessControl {
173
+ DEFAULT V8_ENUM_DEPRECATE_SOON("not used") = 0,
174
+ };
176
175
 
177
176
  /**
178
177
  * Property filter bits. They can be or'ed to build a composite filter.
@@ -239,6 +238,9 @@ class V8_EXPORT Object : public Value {
239
238
  */
240
239
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
241
240
  Local<Value> key, Local<Value> value);
241
+ V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
242
+ Local<Value> key, Local<Value> value,
243
+ MaybeLocal<Object> receiver);
242
244
 
243
245
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
244
246
  Local<Value> value);
@@ -294,6 +296,9 @@ class V8_EXPORT Object : public Value {
294
296
 
295
297
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
296
298
  Local<Value> key);
299
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
300
+ Local<Value> key,
301
+ MaybeLocal<Object> receiver);
297
302
 
298
303
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
299
304
  uint32_t index);
@@ -339,17 +344,10 @@ class V8_EXPORT Object : public Value {
339
344
  V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
340
345
  uint32_t index);
341
346
 
342
- V8_DEPRECATE_SOON("Use SetNativeDataProperty instead")
343
- V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
344
- Local<Context> context, Local<Name> name,
345
- AccessorNameGetterCallback getter,
346
- AccessorNameSetterCallback setter = nullptr,
347
- MaybeLocal<Value> data = MaybeLocal<Value>(),
348
- AccessControl deprecated_settings = DEFAULT,
349
- PropertyAttribute attribute = None,
350
- SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
351
- SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
352
-
347
+ /**
348
+ * Sets an accessor property like Template::SetAccessorProperty, but
349
+ * this method sets on this object directly.
350
+ */
353
351
  void SetAccessorProperty(Local<Name> name, Local<Function> getter,
354
352
  Local<Function> setter = Local<Function>(),
355
353
  PropertyAttribute attributes = None);
@@ -429,16 +427,41 @@ class V8_EXPORT Object : public Value {
429
427
  * be skipped by __proto__ and it does not consult the security
430
428
  * handler.
431
429
  */
430
+ V8_DEPRECATE_SOON(
431
+ "V8 will stop providing access to hidden prototype (i.e. "
432
+ "JSGlobalObject). Use GetPrototypeV2() instead. "
433
+ "See http://crbug.com/333672197.")
432
434
  Local<Value> GetPrototype();
433
435
 
436
+ /**
437
+ * Get the prototype object (same as getting __proto__ property). This does
438
+ * not consult the security handler.
439
+ * TODO(333672197): rename back to GetPrototype() once the old version goes
440
+ * through the deprecation process and is removed.
441
+ */
442
+ Local<Value> GetPrototypeV2();
443
+
434
444
  /**
435
445
  * Set the prototype object. This does not skip objects marked to
436
446
  * be skipped by __proto__ and it does not consult the security
437
447
  * handler.
438
448
  */
449
+ V8_DEPRECATE_SOON(
450
+ "V8 will stop providing access to hidden prototype (i.e. "
451
+ "JSGlobalObject). Use SetPrototypeV2() instead. "
452
+ "See http://crbug.com/333672197.")
439
453
  V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
440
454
  Local<Value> prototype);
441
455
 
456
+ /**
457
+ * Set the prototype object (same as setting __proto__ property). This does
458
+ * does not consult the security handler.
459
+ * TODO(333672197): rename back to SetPrototype() once the old version goes
460
+ * through the deprecation process and is removed.
461
+ */
462
+ V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
463
+ Local<Value> prototype);
464
+
442
465
  /**
443
466
  * Finds an instance of the given function template in the prototype
444
467
  * chain.
@@ -526,7 +549,72 @@ class V8_EXPORT Object : public Value {
526
549
  void* values[]);
527
550
 
528
551
  /**
529
- * HasOwnProperty() is like JavaScript's Object.prototype.hasOwnProperty().
552
+ * Unwraps a JS wrapper object.
553
+ *
554
+ * \param tag The tag for retrieving the wrappable instance. Must match the
555
+ * tag that has been used for a previous `Wrap()` operation.
556
+ * \param isolate The Isolate for the `wrapper` object.
557
+ * \param wrapper The JS wrapper object that should be unwrapped.
558
+ * \returns the C++ wrappable instance, or nullptr if the JS object has never
559
+ * been wrapped.
560
+ */
561
+ template <CppHeapPointerTag tag, typename T = void>
562
+ static V8_INLINE T* Unwrap(v8::Isolate* isolate,
563
+ const v8::Local<v8::Object>& wrapper);
564
+ template <CppHeapPointerTag tag, typename T = void>
565
+ static V8_INLINE T* Unwrap(v8::Isolate* isolate,
566
+ const PersistentBase<Object>& wrapper);
567
+ template <CppHeapPointerTag tag, typename T = void>
568
+ static V8_INLINE T* Unwrap(v8::Isolate* isolate,
569
+ const BasicTracedReference<Object>& wrapper);
570
+
571
+ template <typename T = void>
572
+ static V8_INLINE T* Unwrap(v8::Isolate* isolate,
573
+ const v8::Local<v8::Object>& wrapper,
574
+ CppHeapPointerTagRange tag_range);
575
+ template <typename T = void>
576
+ static V8_INLINE T* Unwrap(v8::Isolate* isolate,
577
+ const PersistentBase<Object>& wrapper,
578
+ CppHeapPointerTagRange tag_range);
579
+ template <typename T = void>
580
+ static V8_INLINE T* Unwrap(v8::Isolate* isolate,
581
+ const BasicTracedReference<Object>& wrapper,
582
+ CppHeapPointerTagRange tag_range);
583
+
584
+ /**
585
+ * Wraps a JS wrapper with a C++ instance.
586
+ *
587
+ * \param tag The pointer tag that should be used for storing this object.
588
+ * Future `Unwrap()` operations must provide a matching tag.
589
+ * \param isolate The Isolate for the `wrapper` object.
590
+ * \param wrapper The JS wrapper object.
591
+ * \param wrappable The C++ object instance that is wrapped by the JS object.
592
+ */
593
+ template <CppHeapPointerTag tag>
594
+ static V8_INLINE void Wrap(v8::Isolate* isolate,
595
+ const v8::Local<v8::Object>& wrapper,
596
+ void* wrappable);
597
+ template <CppHeapPointerTag tag>
598
+ static V8_INLINE void Wrap(v8::Isolate* isolate,
599
+ const PersistentBase<Object>& wrapper,
600
+ void* wrappable);
601
+ template <CppHeapPointerTag tag>
602
+ static V8_INLINE void Wrap(v8::Isolate* isolate,
603
+ const BasicTracedReference<Object>& wrapper,
604
+ void* wrappable);
605
+ static V8_INLINE void Wrap(v8::Isolate* isolate,
606
+ const v8::Local<v8::Object>& wrapper,
607
+ void* wrappable, CppHeapPointerTag tag);
608
+ static V8_INLINE void Wrap(v8::Isolate* isolate,
609
+ const PersistentBase<Object>& wrapper,
610
+ void* wrappable, CppHeapPointerTag tag);
611
+ static V8_INLINE void Wrap(v8::Isolate* isolate,
612
+ const BasicTracedReference<Object>& wrapper,
613
+ void* wrappable, CppHeapPointerTag tag);
614
+
615
+ /**
616
+ * HasOwnProperty() is like JavaScript's
617
+ * Object.prototype.hasOwnProperty().
530
618
  *
531
619
  * See also v8::Object::Has() and v8::Object::HasRealNamedProperty().
532
620
  */
@@ -602,20 +690,28 @@ class V8_EXPORT Object : public Value {
602
690
  int GetIdentityHash();
603
691
 
604
692
  /**
605
- * Clone this object with a fast but shallow copy. Values will point
606
- * to the same values as the original object.
693
+ * Clone this object with a fast but shallow copy. Values will point to the
694
+ * same values as the original object.
695
+ *
696
+ * Prefer using version with Isolate parameter.
607
697
  */
608
- // TODO(dcarney): take an isolate and optionally bail out?
698
+ Local<Object> Clone(v8::Isolate* isolate);
609
699
  Local<Object> Clone();
610
700
 
611
701
  /**
612
702
  * Returns the context in which the object was created.
703
+ *
704
+ * Prefer using version with Isolate parameter.
613
705
  */
706
+ MaybeLocal<Context> GetCreationContext(v8::Isolate* isolate);
614
707
  MaybeLocal<Context> GetCreationContext();
615
708
 
616
709
  /**
617
- * Shortcut for GetCreationContext().ToLocalChecked().
710
+ * Shortcut for GetCreationContext(...).ToLocalChecked().
711
+ *
712
+ * Prefer using version with Isolate parameter.
618
713
  **/
714
+ Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
619
715
  Local<Context> GetCreationContextChecked();
620
716
 
621
717
  /** Same as above, but works for Persistents */
@@ -634,7 +730,12 @@ class V8_EXPORT Object : public Value {
634
730
  * try to expand the embedder data attached to the context.
635
731
  * In case the Local<Context> is already available because of other reasons,
636
732
  * it's fine to keep using Context::GetAlignedPointerFromEmbedderData().
733
+ *
734
+ * Prefer using version with Isolate parameter if you have an Isolate,
735
+ * otherwise use the other one.
637
736
  */
737
+ void* GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate* isolate,
738
+ int index);
638
739
  void* GetAlignedPointerFromEmbedderDataInCreationContext(int index);
639
740
 
640
741
  /**
@@ -650,11 +751,15 @@ class V8_EXPORT Object : public Value {
650
751
  bool IsConstructor() const;
651
752
 
652
753
  /**
653
- * True if this object can carry information relevant to the embedder in its
654
- * embedder fields, false otherwise. This is generally true for objects
655
- * constructed through function templates but also holds for other types where
656
- * V8 automatically adds internal fields at compile time, such as e.g.
657
- * v8::ArrayBuffer.
754
+ * Returns true if this object can be generally used to wrap object objects.
755
+ * This means that the object either follows the convention of using embedder
756
+ * fields to denote type/instance pointers or is using the Wrap()/Unwrap()
757
+ * APIs for the same purpose. Returns false otherwise.
758
+ *
759
+ * Note that there may be other objects that use embedder fields but are not
760
+ * used as API wrapper objects. E.g., v8::Promise may in certain configuration
761
+ * use embedder fields but promises are not generally supported as API
762
+ * wrappers. The method will return false in those cases.
658
763
  */
659
764
  bool IsApiWrapper() const;
660
765
 
@@ -729,6 +834,11 @@ class V8_EXPORT Object : public Value {
729
834
  bool IsCodeLike(Isolate* isolate) const;
730
835
 
731
836
  private:
837
+ static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
838
+ CppHeapPointerTagRange tag_range);
839
+ static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
840
+ CppHeapPointerTag tag, void* wrappable);
841
+
732
842
  Object();
733
843
  static void CheckCast(Value* obj);
734
844
  Local<Data> SlowGetInternalField(int index);
@@ -747,7 +857,8 @@ Local<Data> Object::GetInternalField(int index) {
747
857
  // know where to find the internal fields and can return the value directly.
748
858
  int instance_type = I::GetInstanceType(obj);
749
859
  if (I::CanHaveInternalField(instance_type)) {
750
- int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
860
+ int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
861
+ (I::kEmbedderDataSlotSize * index);
751
862
  A value = I::ReadRawField<A>(obj, offset);
752
863
  #ifdef V8_COMPRESS_POINTERS
753
864
  // We read the full pointer value and then decompress it in order to avoid
@@ -773,7 +884,8 @@ void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
773
884
  // know where to find the internal fields and can return the value directly.
774
885
  auto instance_type = I::GetInstanceType(obj);
775
886
  if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
776
- int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index) +
887
+ int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
888
+ (I::kEmbedderDataSlotSize * index) +
777
889
  I::kEmbedderDataSlotExternalPointerOffset;
778
890
  A value =
779
891
  I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
@@ -793,7 +905,8 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
793
905
  // know where to find the internal fields and can return the value directly.
794
906
  auto instance_type = I::GetInstanceType(obj);
795
907
  if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
796
- int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index) +
908
+ int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
909
+ (I::kEmbedderDataSlotSize * index) +
797
910
  I::kEmbedderDataSlotExternalPointerOffset;
798
911
  Isolate* isolate = I::GetIsolateForSandbox(obj);
799
912
  A value =
@@ -805,6 +918,142 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
805
918
  return SlowGetAlignedPointerFromInternalField(index);
806
919
  }
807
920
 
921
+ // static
922
+ template <CppHeapPointerTag tag, typename T>
923
+ T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
924
+ CppHeapPointerTagRange tag_range(tag, tag);
925
+ auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
926
+ #if !defined(V8_ENABLE_CHECKS)
927
+ return internal::ReadCppHeapPointerField<T>(
928
+ isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
929
+ #else // defined(V8_ENABLE_CHECKS)
930
+ return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
931
+ #endif // defined(V8_ENABLE_CHECKS)
932
+ }
933
+
934
+ // static
935
+ template <CppHeapPointerTag tag, typename T>
936
+ T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper) {
937
+ CppHeapPointerTagRange tag_range(tag, tag);
938
+ auto obj =
939
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
940
+ #if !defined(V8_ENABLE_CHECKS)
941
+ return internal::ReadCppHeapPointerField<T>(
942
+ isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
943
+ #else // defined(V8_ENABLE_CHECKS)
944
+ return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
945
+ #endif // defined(V8_ENABLE_CHECKS)
946
+ }
947
+
948
+ // static
949
+ template <CppHeapPointerTag tag, typename T>
950
+ T* Object::Unwrap(v8::Isolate* isolate,
951
+ const BasicTracedReference<Object>& wrapper) {
952
+ CppHeapPointerTagRange tag_range(tag, tag);
953
+ auto obj =
954
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
955
+ #if !defined(V8_ENABLE_CHECKS)
956
+ return internal::ReadCppHeapPointerField<T>(
957
+ isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
958
+ #else // defined(V8_ENABLE_CHECKS)
959
+ return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
960
+ #endif // defined(V8_ENABLE_CHECKS)
961
+ }
962
+
963
+ // static
964
+ template <typename T>
965
+ T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
966
+ CppHeapPointerTagRange tag_range) {
967
+ auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
968
+ #if !defined(V8_ENABLE_CHECKS)
969
+ return internal::ReadCppHeapPointerField<T>(
970
+ isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
971
+ #else // defined(V8_ENABLE_CHECKS)
972
+ return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
973
+ #endif // defined(V8_ENABLE_CHECKS)
974
+ }
975
+
976
+ // static
977
+ template <typename T>
978
+ T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
979
+ CppHeapPointerTagRange tag_range) {
980
+ auto obj =
981
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
982
+ #if !defined(V8_ENABLE_CHECKS)
983
+ return internal::ReadCppHeapPointerField<T>(
984
+ isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
985
+ #else // defined(V8_ENABLE_CHECKS)
986
+
987
+ return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
988
+ #endif // defined(V8_ENABLE_CHECKS)
989
+ }
990
+
991
+ // static
992
+ template <typename T>
993
+ T* Object::Unwrap(v8::Isolate* isolate,
994
+ const BasicTracedReference<Object>& wrapper,
995
+ CppHeapPointerTagRange tag_range) {
996
+ auto obj =
997
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
998
+ #if !defined(V8_ENABLE_CHECKS)
999
+ return internal::ReadCppHeapPointerField<T>(
1000
+ isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1001
+ #else // defined(V8_ENABLE_CHECKS)
1002
+ return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1003
+ #endif // defined(V8_ENABLE_CHECKS)
1004
+ }
1005
+
1006
+ // static
1007
+ template <CppHeapPointerTag tag>
1008
+ void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1009
+ void* wrappable) {
1010
+ auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1011
+ Wrap(isolate, obj, tag, wrappable);
1012
+ }
1013
+
1014
+ // static
1015
+ template <CppHeapPointerTag tag>
1016
+ void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1017
+ void* wrappable) {
1018
+ auto obj =
1019
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1020
+ Wrap(isolate, obj, tag, wrappable);
1021
+ }
1022
+
1023
+ // static
1024
+ template <CppHeapPointerTag tag>
1025
+ void Object::Wrap(v8::Isolate* isolate,
1026
+ const BasicTracedReference<Object>& wrapper,
1027
+ void* wrappable) {
1028
+ auto obj =
1029
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1030
+ Wrap(isolate, obj, tag, wrappable);
1031
+ }
1032
+
1033
+ // static
1034
+ void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1035
+ void* wrappable, CppHeapPointerTag tag) {
1036
+ auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1037
+ Wrap(isolate, obj, tag, wrappable);
1038
+ }
1039
+
1040
+ // static
1041
+ void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1042
+ void* wrappable, CppHeapPointerTag tag) {
1043
+ auto obj =
1044
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1045
+ Wrap(isolate, obj, tag, wrappable);
1046
+ }
1047
+
1048
+ // static
1049
+ void Object::Wrap(v8::Isolate* isolate,
1050
+ const BasicTracedReference<Object>& wrapper, void* wrappable,
1051
+ CppHeapPointerTag tag) {
1052
+ auto obj =
1053
+ internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1054
+ Wrap(isolate, obj, tag, wrappable);
1055
+ }
1056
+
808
1057
  Private* Private::Cast(Data* data) {
809
1058
  #ifdef V8_ENABLE_CHECKS
810
1059
  CheckCast(data);
@@ -15,8 +15,6 @@ namespace v8 {
15
15
  class Isolate;
16
16
  template <class K, class V, class T>
17
17
  class PersistentValueMapBase;
18
- template <class V, class T>
19
- class PersistentValueVector;
20
18
  template <class T>
21
19
  class Global;
22
20
  template <class T>
@@ -204,8 +202,6 @@ class PersistentBase : public api_internal::IndirectHandleBase {
204
202
  friend class ReturnValue;
205
203
  template <class F1, class F2, class F3>
206
204
  friend class PersistentValueMapBase;
207
- template <class F1, class F2>
208
- friend class PersistentValueVector;
209
205
  friend class Object;
210
206
  friend class internal::ValueHelper;
211
207
 
@@ -236,21 +232,6 @@ class NonCopyablePersistentTraits {
236
232
  }
237
233
  };
238
234
 
239
- /**
240
- * Helper class traits to allow copying and assignment of Persistent.
241
- * This will clone the contents of storage cell, but not any of the flags, etc.
242
- */
243
- template <class T>
244
- struct CopyablePersistentTraits {
245
- using CopyablePersistent = Persistent<T, CopyablePersistentTraits<T>>;
246
- static const bool kResetInDestructor = true;
247
- template <class S, class M>
248
- static V8_INLINE void Copy(const Persistent<S, M>& source,
249
- CopyablePersistent* dest) {
250
- // do nothing, just allow copy
251
- }
252
- };
253
-
254
235
  /**
255
236
  * A PersistentBase which allows copy and assignment.
256
237
  *
@@ -79,8 +79,10 @@ class TaskRunner {
79
79
  *
80
80
  * Embedders should override PostTaskImpl instead of this.
81
81
  */
82
- virtual void PostTask(std::unique_ptr<Task> task) {
83
- PostTaskImpl(std::move(task), SourceLocation::Current());
82
+ void PostTask(
83
+ std::unique_ptr<Task> task,
84
+ const SourceLocation& location = SourceLocation::Current()) {
85
+ PostTaskImpl(std::move(task), location);
84
86
  }
85
87
 
86
88
  /**
@@ -100,8 +102,10 @@ class TaskRunner {
100
102
  *
101
103
  * Embedders should override PostNonNestableTaskImpl instead of this.
102
104
  */
103
- virtual void PostNonNestableTask(std::unique_ptr<Task> task) {
104
- PostNonNestableTaskImpl(std::move(task), SourceLocation::Current());
105
+ void PostNonNestableTask(
106
+ std::unique_ptr<Task> task,
107
+ const SourceLocation& location = SourceLocation::Current()) {
108
+ PostNonNestableTaskImpl(std::move(task), location);
105
109
  }
106
110
 
107
111
  /**
@@ -111,10 +115,10 @@ class TaskRunner {
111
115
  *
112
116
  * Embedders should override PostDelayedTaskImpl instead of this.
113
117
  */
114
- virtual void PostDelayedTask(std::unique_ptr<Task> task,
115
- double delay_in_seconds) {
116
- PostDelayedTaskImpl(std::move(task), delay_in_seconds,
117
- SourceLocation::Current());
118
+ void PostDelayedTask(
119
+ std::unique_ptr<Task> task, double delay_in_seconds,
120
+ const SourceLocation& location = SourceLocation::Current()) {
121
+ PostDelayedTaskImpl(std::move(task), delay_in_seconds, location);
118
122
  }
119
123
 
120
124
  /**
@@ -135,10 +139,10 @@ class TaskRunner {
135
139
  *
136
140
  * Embedders should override PostNonNestableDelayedTaskImpl instead of this.
137
141
  */
138
- virtual void PostNonNestableDelayedTask(std::unique_ptr<Task> task,
139
- double delay_in_seconds) {
140
- PostNonNestableDelayedTaskImpl(std::move(task), delay_in_seconds,
141
- SourceLocation::Current());
142
+ void PostNonNestableDelayedTask(
143
+ std::unique_ptr<Task> task, double delay_in_seconds,
144
+ const SourceLocation& location = SourceLocation::Current()) {
145
+ PostNonNestableDelayedTaskImpl(std::move(task), delay_in_seconds, location);
142
146
  }
143
147
 
144
148
  /**
@@ -151,8 +155,10 @@ class TaskRunner {
151
155
  *
152
156
  * Embedders should override PostIdleTaskImpl instead of this.
153
157
  */
154
- virtual void PostIdleTask(std::unique_ptr<IdleTask> task) {
155
- PostIdleTaskImpl(std::move(task), SourceLocation::Current());
158
+ void PostIdleTask(
159
+ std::unique_ptr<IdleTask> task,
160
+ const SourceLocation& location = SourceLocation::Current()) {
161
+ PostIdleTaskImpl(std::move(task), location);
156
162
  }
157
163
 
158
164
  /**
@@ -389,7 +395,7 @@ class TracingController {
389
395
 
390
396
  /**
391
397
  * Adds a trace event to the platform tracing system. These function calls are
392
- * usually the result of a TRACE_* macro from trace_event_common.h when
398
+ * usually the result of a TRACE_* macro from trace-event-no-perfetto.h when
393
399
  * tracing and the category of the particular trace are enabled. It is not
394
400
  * advisable to call these functions on their own; they are really only meant
395
401
  * to be used by the trace macros. The returned handle can be used by
@@ -1021,18 +1027,6 @@ class VirtualAddressSpace {
1021
1027
  const PagePermissions max_page_permissions_;
1022
1028
  };
1023
1029
 
1024
- /**
1025
- * V8 Allocator used for allocating zone backings.
1026
- */
1027
- class ZoneBackingAllocator {
1028
- public:
1029
- using MallocFn = void* (*)(size_t);
1030
- using FreeFn = void (*)(void*);
1031
-
1032
- virtual MallocFn GetMallocFn() const { return ::malloc; }
1033
- virtual FreeFn GetFreeFn() const { return ::free; }
1034
- };
1035
-
1036
1030
  /**
1037
1031
  * Observer used by V8 to notify the embedder about entering/leaving sections
1038
1032
  * with high throughput of malloc/free operations.
@@ -1069,14 +1063,6 @@ class Platform {
1069
1063
  return nullptr;
1070
1064
  }
1071
1065
 
1072
- /**
1073
- * Allows the embedder to specify a custom allocator used for zones.
1074
- */
1075
- virtual ZoneBackingAllocator* GetZoneBackingAllocator() {
1076
- static ZoneBackingAllocator default_allocator;
1077
- return &default_allocator;
1078
- }
1079
-
1080
1066
  /**
1081
1067
  * Enables the embedder to respond in cases where V8 can't allocate large
1082
1068
  * blocks of memory. V8 retries the failed allocation once after calling this