libv8-node 20.12.1.0-x86_64-linux-musl → 22.5.1.0-x86_64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/internal/api-constants.h +24 -5
  4. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +16 -6
  5. data/vendor/v8/include/cppgc/internal/caged-heap.h +12 -5
  6. data/vendor/v8/include/cppgc/internal/gc-info.h +82 -91
  7. data/vendor/v8/include/cppgc/internal/member-storage.h +16 -8
  8. data/vendor/v8/include/cppgc/member.h +25 -0
  9. data/vendor/v8/include/cppgc/persistent.h +4 -0
  10. data/vendor/v8/include/cppgc/platform.h +6 -1
  11. data/vendor/v8/include/cppgc/sentinel-pointer.h +7 -0
  12. data/vendor/v8/include/cppgc/source-location.h +2 -78
  13. data/vendor/v8/include/cppgc/trace-trait.h +8 -0
  14. data/vendor/v8/include/cppgc/type-traits.h +25 -4
  15. data/vendor/v8/include/cppgc/visitor.h +82 -4
  16. data/vendor/v8/include/libplatform/libplatform.h +7 -1
  17. data/vendor/v8/include/v8-array-buffer.h +6 -0
  18. data/vendor/v8/include/v8-callbacks.h +57 -19
  19. data/vendor/v8/include/v8-container.h +54 -0
  20. data/vendor/v8/include/v8-context.h +58 -32
  21. data/vendor/v8/include/v8-embedder-heap.h +31 -3
  22. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  23. data/vendor/v8/include/v8-exception.h +15 -9
  24. data/vendor/v8/include/v8-fast-api-calls.h +58 -31
  25. data/vendor/v8/include/v8-forward.h +1 -0
  26. data/vendor/v8/include/v8-function-callback.h +135 -30
  27. data/vendor/v8/include/v8-function.h +6 -0
  28. data/vendor/v8/include/v8-handle-base.h +137 -0
  29. data/vendor/v8/include/v8-inspector.h +35 -13
  30. data/vendor/v8/include/v8-internal.h +510 -71
  31. data/vendor/v8/include/v8-isolate.h +176 -100
  32. data/vendor/v8/include/v8-local-handle.h +383 -112
  33. data/vendor/v8/include/v8-memory-span.h +157 -2
  34. data/vendor/v8/include/v8-message.h +22 -3
  35. data/vendor/v8/include/v8-metrics.h +1 -0
  36. data/vendor/v8/include/v8-object.h +98 -77
  37. data/vendor/v8/include/v8-persistent-handle.h +68 -90
  38. data/vendor/v8/include/v8-platform.h +191 -23
  39. data/vendor/v8/include/v8-primitive.h +12 -8
  40. data/vendor/v8/include/v8-profiler.h +16 -2
  41. data/vendor/v8/include/v8-script.h +88 -14
  42. data/vendor/v8/include/v8-snapshot.h +96 -22
  43. data/vendor/v8/include/v8-source-location.h +92 -0
  44. data/vendor/v8/include/v8-statistics.h +31 -10
  45. data/vendor/v8/include/v8-template.h +410 -131
  46. data/vendor/v8/include/v8-traced-handle.h +108 -90
  47. data/vendor/v8/include/v8-typed-array.h +115 -7
  48. data/vendor/v8/include/v8-unwinder.h +1 -1
  49. data/vendor/v8/include/v8-util.h +23 -20
  50. data/vendor/v8/include/v8-value-serializer.h +14 -0
  51. data/vendor/v8/include/v8-value.h +105 -3
  52. data/vendor/v8/include/v8-version.h +4 -4
  53. data/vendor/v8/include/v8config.h +54 -20
  54. data/vendor/v8/x86_64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  55. metadata +4 -2
@@ -7,12 +7,16 @@
7
7
 
8
8
  #include <stddef.h>
9
9
 
10
+ #include <array>
11
+ #include <iterator>
12
+ #include <type_traits>
13
+
10
14
  #include "v8config.h" // NOLINT(build/include_directory)
11
15
 
12
16
  namespace v8 {
13
17
 
14
18
  /**
15
- * Points to an unowned continous buffer holding a known number of elements.
19
+ * Points to an unowned contiguous buffer holding a known number of elements.
16
20
  *
17
21
  * This is similar to std::span (under consideration for C++20), but does not
18
22
  * require advanced C++ support. In the (far) future, this may be replaced with
@@ -23,21 +27,172 @@ namespace v8 {
23
27
  */
24
28
  template <typename T>
25
29
  class V8_EXPORT MemorySpan {
30
+ private:
31
+ /** Some C++ machinery, brought from the future. */
32
+ template <typename From, typename To>
33
+ using is_array_convertible = std::is_convertible<From (*)[], To (*)[]>;
34
+ template <typename From, typename To>
35
+ static constexpr bool is_array_convertible_v =
36
+ is_array_convertible<From, To>::value;
37
+
38
+ template <typename It>
39
+ using iter_reference_t = decltype(*std::declval<It&>());
40
+
41
+ template <typename It, typename = void>
42
+ struct is_compatible_iterator : std::false_type {};
43
+ template <typename It>
44
+ struct is_compatible_iterator<
45
+ It,
46
+ std::void_t<
47
+ std::is_base_of<std::random_access_iterator_tag,
48
+ typename std::iterator_traits<It>::iterator_category>,
49
+ is_array_convertible<std::remove_reference_t<iter_reference_t<It>>,
50
+ T>>> : std::true_type {};
51
+ template <typename It>
52
+ static constexpr bool is_compatible_iterator_v =
53
+ is_compatible_iterator<It>::value;
54
+
55
+ template <typename U>
56
+ static constexpr U* to_address(U* p) noexcept {
57
+ return p;
58
+ }
59
+
60
+ template <typename It,
61
+ typename = std::void_t<decltype(std::declval<It&>().operator->())>>
62
+ static constexpr auto to_address(It it) noexcept {
63
+ return it.operator->();
64
+ }
65
+
26
66
  public:
27
67
  /** The default constructor creates an empty span. */
28
68
  constexpr MemorySpan() = default;
29
69
 
30
- constexpr MemorySpan(T* data, size_t size) : data_(data), size_(size) {}
70
+ /** Constructor from nullptr and count, for backwards compatibility.
71
+ * This is not compatible with C++20 std::span.
72
+ */
73
+ constexpr MemorySpan(std::nullptr_t, size_t) {}
74
+
75
+ /** Constructor from "iterator" and count. */
76
+ template <typename Iterator,
77
+ std::enable_if_t<is_compatible_iterator_v<Iterator>, bool> = true>
78
+ constexpr MemorySpan(Iterator first,
79
+ size_t count) // NOLINT(runtime/explicit)
80
+ : data_(to_address(first)), size_(count) {}
81
+
82
+ /** Constructor from two "iterators". */
83
+ template <typename Iterator,
84
+ std::enable_if_t<is_compatible_iterator_v<Iterator> &&
85
+ !std::is_convertible_v<Iterator, size_t>,
86
+ bool> = true>
87
+ constexpr MemorySpan(Iterator first,
88
+ Iterator last) // NOLINT(runtime/explicit)
89
+ : data_(to_address(first)), size_(last - first) {}
90
+
91
+ /** Implicit conversion from C-style array. */
92
+ template <size_t N>
93
+ constexpr MemorySpan(T (&a)[N]) noexcept // NOLINT(runtime/explicit)
94
+ : data_(a), size_(N) {}
95
+
96
+ /** Implicit conversion from std::array. */
97
+ template <typename U, size_t N,
98
+ std::enable_if_t<is_array_convertible_v<U, T>, bool> = true>
99
+ constexpr MemorySpan(
100
+ std::array<U, N>& a) noexcept // NOLINT(runtime/explicit)
101
+ : data_(a.data()), size_{N} {}
102
+
103
+ /** Implicit conversion from const std::array. */
104
+ template <typename U, size_t N,
105
+ std::enable_if_t<is_array_convertible_v<const U, T>, bool> = true>
106
+ constexpr MemorySpan(
107
+ const std::array<U, N>& a) noexcept // NOLINT(runtime/explicit)
108
+ : data_(a.data()), size_{N} {}
31
109
 
32
110
  /** Returns a pointer to the beginning of the buffer. */
33
111
  constexpr T* data() const { return data_; }
34
112
  /** Returns the number of elements that the buffer holds. */
35
113
  constexpr size_t size() const { return size_; }
36
114
 
115
+ constexpr T& operator[](size_t i) const { return data_[i]; }
116
+
117
+ /** Returns true if the buffer is empty. */
118
+ constexpr bool empty() const { return size() == 0; }
119
+
120
+ class Iterator {
121
+ public:
122
+ using iterator_category = std::forward_iterator_tag;
123
+ using value_type = T;
124
+ using difference_type = std::ptrdiff_t;
125
+ using pointer = value_type*;
126
+ using reference = value_type&;
127
+
128
+ T& operator*() const { return *ptr_; }
129
+ T* operator->() const { return ptr_; }
130
+
131
+ bool operator==(Iterator other) const { return ptr_ == other.ptr_; }
132
+ bool operator!=(Iterator other) const { return !(*this == other); }
133
+
134
+ Iterator& operator++() {
135
+ ++ptr_;
136
+ return *this;
137
+ }
138
+
139
+ Iterator operator++(int) {
140
+ Iterator temp(*this);
141
+ ++(*this);
142
+ return temp;
143
+ }
144
+
145
+ private:
146
+ friend class MemorySpan<T>;
147
+
148
+ explicit Iterator(T* ptr) : ptr_(ptr) {}
149
+
150
+ T* ptr_ = nullptr;
151
+ };
152
+
153
+ Iterator begin() const { return Iterator(data_); }
154
+ Iterator end() const { return Iterator(data_ + size_); }
155
+
37
156
  private:
38
157
  T* data_ = nullptr;
39
158
  size_t size_ = 0;
40
159
  };
41
160
 
161
+ /**
162
+ * Helper function template to create an array of fixed length, initialized by
163
+ * the provided initializer list, without explicitly specifying the array size,
164
+ * e.g.
165
+ *
166
+ * auto arr = v8::to_array<Local<String>>({v8_str("one"), v8_str("two")});
167
+ *
168
+ * In the future, this may be replaced with or aliased to std::to_array (under
169
+ * consideration for C++20).
170
+ */
171
+
172
+ namespace detail {
173
+ template <class T, std::size_t N, std::size_t... I>
174
+ constexpr std::array<std::remove_cv_t<T>, N> to_array_lvalue_impl(
175
+ T (&a)[N], std::index_sequence<I...>) {
176
+ return {{a[I]...}};
177
+ }
178
+
179
+ template <class T, std::size_t N, std::size_t... I>
180
+ constexpr std::array<std::remove_cv_t<T>, N> to_array_rvalue_impl(
181
+ T (&&a)[N], std::index_sequence<I...>) {
182
+ return {{std::move(a[I])...}};
183
+ }
184
+ } // namespace detail
185
+
186
+ template <class T, std::size_t N>
187
+ constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&a)[N]) {
188
+ return detail::to_array_lvalue_impl(a, std::make_index_sequence<N>{});
189
+ }
190
+
191
+ template <class T, std::size_t N>
192
+ constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&&a)[N]) {
193
+ return detail::to_array_rvalue_impl(std::move(a),
194
+ std::make_index_sequence<N>{});
195
+ }
196
+
42
197
  } // namespace v8
43
198
  #endif // INCLUDE_V8_MEMORY_SPAN_H_
@@ -61,6 +61,7 @@ class ScriptOriginOptions {
61
61
  */
62
62
  class V8_EXPORT ScriptOrigin {
63
63
  public:
64
+ V8_DEPRECATE_SOON("Use constructor without the isolate.")
64
65
  V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name,
65
66
  int resource_line_offset = 0,
66
67
  int resource_column_offset = 0,
@@ -70,8 +71,27 @@ class V8_EXPORT ScriptOrigin {
70
71
  bool resource_is_opaque = false, bool is_wasm = false,
71
72
  bool is_module = false,
72
73
  Local<Data> host_defined_options = Local<Data>())
73
- : v8_isolate_(isolate),
74
- resource_name_(resource_name),
74
+ : resource_name_(resource_name),
75
+ resource_line_offset_(resource_line_offset),
76
+ resource_column_offset_(resource_column_offset),
77
+ options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm,
78
+ is_module),
79
+ script_id_(script_id),
80
+ source_map_url_(source_map_url),
81
+ host_defined_options_(host_defined_options) {
82
+ VerifyHostDefinedOptions();
83
+ }
84
+
85
+ V8_INLINE ScriptOrigin(Local<Value> resource_name,
86
+ int resource_line_offset = 0,
87
+ int resource_column_offset = 0,
88
+ bool resource_is_shared_cross_origin = false,
89
+ int script_id = -1,
90
+ Local<Value> source_map_url = Local<Value>(),
91
+ bool resource_is_opaque = false, bool is_wasm = false,
92
+ bool is_module = false,
93
+ Local<Data> host_defined_options = Local<Data>())
94
+ : resource_name_(resource_name),
75
95
  resource_line_offset_(resource_line_offset),
76
96
  resource_column_offset_(resource_column_offset),
77
97
  options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm,
@@ -92,7 +112,6 @@ class V8_EXPORT ScriptOrigin {
92
112
 
93
113
  private:
94
114
  void VerifyHostDefinedOptions() const;
95
- Isolate* v8_isolate_;
96
115
  Local<Value> resource_name_;
97
116
  int resource_line_offset_;
98
117
  int resource_column_offset_;
@@ -55,6 +55,7 @@ struct GarbageCollectionFullCycle {
55
55
  double efficiency_cpp_in_bytes_per_us = -1.0;
56
56
  double main_thread_efficiency_in_bytes_per_us = -1.0;
57
57
  double main_thread_efficiency_cpp_in_bytes_per_us = -1.0;
58
+ int64_t incremental_marking_start_stop_wall_clock_duration_in_us = -1;
58
59
  };
59
60
 
60
61
  struct GarbageCollectionFullMainThreadIncrementalMark {
@@ -20,8 +20,6 @@ class Function;
20
20
  class FunctionTemplate;
21
21
  template <typename T>
22
22
  class PropertyCallbackInfo;
23
- class Module;
24
- class UnboundScript;
25
23
 
26
24
  /**
27
25
  * A private symbol
@@ -167,17 +165,13 @@ using AccessorNameSetterCallback =
167
165
  /**
168
166
  * Access control specifications.
169
167
  *
170
- * Some accessors should be accessible across contexts. These
168
+ * Some accessors should be accessible across contexts. These
171
169
  * accessors have an explicit access control parameter which specifies
172
170
  * the kind of cross-context access that should be allowed.
173
171
  *
174
- * TODO(dcarney): Remove PROHIBITS_OVERWRITING as it is now unused.
175
172
  */
176
173
  enum AccessControl {
177
174
  DEFAULT = 0,
178
- ALL_CAN_READ = 1,
179
- ALL_CAN_WRITE = 1 << 1,
180
- PROHIBITS_OVERWRITING = 1 << 2
181
175
  };
182
176
 
183
177
  /**
@@ -249,13 +243,16 @@ class V8_EXPORT Object : public Value {
249
243
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
250
244
  Local<Value> value);
251
245
 
252
- // Implements CreateDataProperty (ECMA-262, 7.3.4).
253
- //
254
- // Defines a configurable, writable, enumerable property with the given value
255
- // on the object unless the property already exists and is not configurable
256
- // or the object is not extensible.
257
- //
258
- // Returns true on success.
246
+ /**
247
+ * Implements CreateDataProperty(O, P, V), see
248
+ * https://tc39.es/ecma262/#sec-createdataproperty.
249
+ *
250
+ * Defines a configurable, writable, enumerable property with the given value
251
+ * on the object unless the property already exists and is not configurable
252
+ * or the object is not extensible.
253
+ *
254
+ * Returns true on success.
255
+ */
259
256
  V8_WARN_UNUSED_RESULT Maybe<bool> CreateDataProperty(Local<Context> context,
260
257
  Local<Name> key,
261
258
  Local<Value> value);
@@ -263,29 +260,35 @@ class V8_EXPORT Object : public Value {
263
260
  uint32_t index,
264
261
  Local<Value> value);
265
262
 
266
- // Implements DefineOwnProperty.
267
- //
268
- // In general, CreateDataProperty will be faster, however, does not allow
269
- // for specifying attributes.
270
- //
271
- // Returns true on success.
263
+ /**
264
+ * Implements [[DefineOwnProperty]] for data property case, see
265
+ * https://tc39.es/ecma262/#table-essential-internal-methods.
266
+ *
267
+ * In general, CreateDataProperty will be faster, however, does not allow
268
+ * for specifying attributes.
269
+ *
270
+ * Returns true on success.
271
+ */
272
272
  V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
273
273
  Local<Context> context, Local<Name> key, Local<Value> value,
274
274
  PropertyAttribute attributes = None);
275
275
 
276
- // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4.
277
- //
278
- // The defineProperty function is used to add an own property or
279
- // update the attributes of an existing own property of an object.
280
- //
281
- // Both data and accessor descriptors can be used.
282
- //
283
- // In general, CreateDataProperty is faster, however, does not allow
284
- // for specifying attributes or an accessor descriptor.
285
- //
286
- // The PropertyDescriptor can change when redefining a property.
287
- //
288
- // Returns true on success.
276
+ /**
277
+ * Implements Object.defineProperty(O, P, Attributes), see
278
+ * https://tc39.es/ecma262/#sec-object.defineproperty.
279
+ *
280
+ * The defineProperty function is used to add an own property or
281
+ * update the attributes of an existing own property of an object.
282
+ *
283
+ * Both data and accessor descriptors can be used.
284
+ *
285
+ * In general, CreateDataProperty is faster, however, does not allow
286
+ * for specifying attributes or an accessor descriptor.
287
+ *
288
+ * The PropertyDescriptor can change when redefining a property.
289
+ *
290
+ * Returns true on success.
291
+ */
289
292
  V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
290
293
  Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
291
294
 
@@ -304,14 +307,15 @@ class V8_EXPORT Object : public Value {
304
307
  Local<Context> context, Local<Value> key);
305
308
 
306
309
  /**
307
- * Returns Object.getOwnPropertyDescriptor as per ES2016 section 19.1.2.6.
310
+ * Implements Object.getOwnPropertyDescriptor(O, P), see
311
+ * https://tc39.es/ecma262/#sec-object.getownpropertydescriptor.
308
312
  */
309
313
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor(
310
314
  Local<Context> context, Local<Name> key);
311
315
 
312
316
  /**
313
- * Object::Has() calls the abstract operation HasProperty(O, P) described
314
- * in ECMA-262, 7.3.10. Has() returns
317
+ * Object::Has() calls the abstract operation HasProperty(O, P), see
318
+ * https://tc39.es/ecma262/#sec-hasproperty. Has() returns
315
319
  * true, if the object has the property, either own or on the prototype chain.
316
320
  * Interceptors, i.e., PropertyQueryCallbacks, are called if present.
317
321
  *
@@ -335,22 +339,20 @@ class V8_EXPORT Object : public Value {
335
339
  V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
336
340
  uint32_t index);
337
341
 
338
- /**
339
- * Note: SideEffectType affects the getter only, not the setter.
340
- */
342
+ V8_DEPRECATE_SOON("Use SetNativeDataProperty instead")
341
343
  V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
342
344
  Local<Context> context, Local<Name> name,
343
345
  AccessorNameGetterCallback getter,
344
346
  AccessorNameSetterCallback setter = nullptr,
345
347
  MaybeLocal<Value> data = MaybeLocal<Value>(),
346
- AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
348
+ AccessControl deprecated_settings = DEFAULT,
349
+ PropertyAttribute attribute = None,
347
350
  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
348
351
  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
349
352
 
350
353
  void SetAccessorProperty(Local<Name> name, Local<Function> getter,
351
354
  Local<Function> setter = Local<Function>(),
352
- PropertyAttribute attribute = None,
353
- AccessControl settings = DEFAULT);
355
+ PropertyAttribute attributes = None);
354
356
 
355
357
  /**
356
358
  * Sets a native data property like Template::SetNativeDataProperty, but
@@ -467,35 +469,29 @@ class V8_EXPORT Object : public Value {
467
469
  /** Same as above, but works for PersistentBase. */
468
470
  V8_INLINE static int InternalFieldCount(
469
471
  const PersistentBase<Object>& object) {
470
- return object.val_->InternalFieldCount();
472
+ return object.template value<Object>()->InternalFieldCount();
471
473
  }
472
474
 
473
475
  /** Same as above, but works for BasicTracedReference. */
474
476
  V8_INLINE static int InternalFieldCount(
475
477
  const BasicTracedReference<Object>& object) {
476
- return object->InternalFieldCount();
478
+ return object.template value<Object>()->InternalFieldCount();
477
479
  }
478
480
 
479
- /** Gets the value from an internal field. */
480
- V8_INLINE Local<Value> GetInternalField(int index);
481
-
482
- /** Sets the value in an internal field. */
483
- void SetInternalField(int index, Local<Value> value);
484
-
485
481
  /**
486
- * Warning: These are Node.js-specific extentions used to avoid breaking
487
- * changes in Node.js v20.x. They do not exist in V8 upstream and will
488
- * not exist in Node.js v21.x. Node.js embedders and addon authors should
489
- * not use them from v20.x.
490
- */
491
- #ifndef NODE_WANT_INTERNALS
492
- V8_DEPRECATED("This extention should only be used by Node.js core")
493
- #endif
494
- void SetInternalFieldForNodeCore(int index, Local<Module> value);
495
- #ifndef NODE_WANT_INTERNALS
496
- V8_DEPRECATED("This extention should only be used by Node.js core")
497
- #endif
498
- void SetInternalFieldForNodeCore(int index, Local<UnboundScript> value);
482
+ * Gets the data from an internal field.
483
+ * To cast the return value into v8::Value subtypes, it needs to be
484
+ * casted to a v8::Value first. For example, to cast it into v8::External:
485
+ *
486
+ * object->GetInternalField(index).As<v8::Value>().As<v8::External>();
487
+ *
488
+ * The embedder should make sure that the internal field being retrieved
489
+ * using this method has already been set with SetInternalField() before.
490
+ **/
491
+ V8_INLINE Local<Data> GetInternalField(int index);
492
+
493
+ /** Sets the data in an internal field. */
494
+ void SetInternalField(int index, Local<Data> data);
499
495
 
500
496
  /**
501
497
  * Gets a 2-byte-aligned native pointer from an internal field. This field
@@ -503,17 +499,21 @@ class V8_EXPORT Object : public Value {
503
499
  * leads to undefined behavior.
504
500
  */
505
501
  V8_INLINE void* GetAlignedPointerFromInternalField(int index);
502
+ V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
503
+ int index);
506
504
 
507
505
  /** Same as above, but works for PersistentBase. */
508
506
  V8_INLINE static void* GetAlignedPointerFromInternalField(
509
507
  const PersistentBase<Object>& object, int index) {
510
- return object.val_->GetAlignedPointerFromInternalField(index);
508
+ return object.template value<Object>()->GetAlignedPointerFromInternalField(
509
+ index);
511
510
  }
512
511
 
513
512
  /** Same as above, but works for TracedReference. */
514
513
  V8_INLINE static void* GetAlignedPointerFromInternalField(
515
514
  const BasicTracedReference<Object>& object, int index) {
516
- return object->GetAlignedPointerFromInternalField(index);
515
+ return object.template value<Object>()->GetAlignedPointerFromInternalField(
516
+ index);
517
517
  }
518
518
 
519
519
  /**
@@ -621,7 +621,7 @@ class V8_EXPORT Object : public Value {
621
621
  /** Same as above, but works for Persistents */
622
622
  V8_INLINE static MaybeLocal<Context> GetCreationContext(
623
623
  const PersistentBase<Object>& object) {
624
- return object.val_->GetCreationContext();
624
+ return object.template value<Object>()->GetCreationContext();
625
625
  }
626
626
 
627
627
  /**
@@ -687,6 +687,10 @@ class V8_EXPORT Object : public Value {
687
687
  */
688
688
  Isolate* GetIsolate();
689
689
 
690
+ V8_INLINE static Isolate* GetIsolate(const TracedReference<Object>& handle) {
691
+ return handle.template value<Object>()->GetIsolate();
692
+ }
693
+
690
694
  /**
691
695
  * If this object is a Set, Map, WeakSet or WeakMap, this returns a
692
696
  * representation of the elements of this object as an array.
@@ -727,13 +731,14 @@ class V8_EXPORT Object : public Value {
727
731
  private:
728
732
  Object();
729
733
  static void CheckCast(Value* obj);
730
- Local<Value> SlowGetInternalField(int index);
734
+ Local<Data> SlowGetInternalField(int index);
731
735
  void* SlowGetAlignedPointerFromInternalField(int index);
736
+ void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index);
732
737
  };
733
738
 
734
739
  // --- Implementation ---
735
740
 
736
- Local<Value> Object::GetInternalField(int index) {
741
+ Local<Data> Object::GetInternalField(int index) {
737
742
  #ifndef V8_ENABLE_CHECKS
738
743
  using A = internal::Address;
739
744
  using I = internal::Internals;
@@ -750,19 +755,35 @@ Local<Value> Object::GetInternalField(int index) {
750
755
  value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
751
756
  #endif
752
757
 
753
- #ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
754
- return Local<Value>(reinterpret_cast<Value*>(value));
755
- #else
756
- internal::Isolate* isolate =
757
- internal::IsolateFromNeverReadOnlySpaceObject(obj);
758
- A* result = HandleScope::CreateHandle(isolate, value);
759
- return Local<Value>(reinterpret_cast<Value*>(result));
760
- #endif
758
+ auto isolate = reinterpret_cast<v8::Isolate*>(
759
+ internal::IsolateFromNeverReadOnlySpaceObject(obj));
760
+ return Local<Data>::New(isolate, value);
761
761
  }
762
762
  #endif
763
763
  return SlowGetInternalField(index);
764
764
  }
765
765
 
766
+ void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
767
+ int index) {
768
+ #if !defined(V8_ENABLE_CHECKS)
769
+ using A = internal::Address;
770
+ using I = internal::Internals;
771
+ A obj = internal::ValueHelper::ValueAsAddress(this);
772
+ // Fast path: If the object is a plain JSObject, which is the common case, we
773
+ // know where to find the internal fields and can return the value directly.
774
+ auto instance_type = I::GetInstanceType(obj);
775
+ if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
776
+ int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index) +
777
+ I::kEmbedderDataSlotExternalPointerOffset;
778
+ A value =
779
+ I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
780
+ isolate, obj, offset);
781
+ return reinterpret_cast<void*>(value);
782
+ }
783
+ #endif
784
+ return SlowGetAlignedPointerFromInternalField(isolate, index);
785
+ }
786
+
766
787
  void* Object::GetAlignedPointerFromInternalField(int index) {
767
788
  #if !defined(V8_ENABLE_CHECKS)
768
789
  using A = internal::Address;
@@ -771,7 +792,7 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
771
792
  // Fast path: If the object is a plain JSObject, which is the common case, we
772
793
  // know where to find the internal fields and can return the value directly.
773
794
  auto instance_type = I::GetInstanceType(obj);
774
- if (I::CanHaveInternalField(instance_type)) {
795
+ if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
775
796
  int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index) +
776
797
  I::kEmbedderDataSlotExternalPointerOffset;
777
798
  Isolate* isolate = I::GetIsolateForSandbox(obj);