node-darwin-x64 25.9.0 → 26.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +200 -1436
  2. package/bin/node +0 -0
  3. package/include/node/common.gypi +13 -1
  4. package/include/node/config.gypi +5 -9
  5. package/include/node/cppgc/allocation.h +6 -7
  6. package/include/node/cppgc/heap-statistics.h +6 -2
  7. package/include/node/cppgc/internal/api-constants.h +1 -1
  8. package/include/node/cppgc/visitor.h +1 -0
  9. package/include/node/libplatform/v8-tracing.h +13 -2
  10. package/include/node/node.h +1 -1
  11. package/include/node/node_object_wrap.h +4 -2
  12. package/include/node/node_version.h +3 -3
  13. package/include/node/uv/unix.h +1 -4
  14. package/include/node/uv/version.h +2 -2
  15. package/include/node/uv/win.h +1 -1
  16. package/include/node/uv.h +7 -8
  17. package/include/node/v8-array-buffer.h +10 -0
  18. package/include/node/v8-callbacks.h +15 -6
  19. package/include/node/v8-context.h +79 -27
  20. package/include/node/v8-data.h +7 -1
  21. package/include/node/v8-debug.h +23 -3
  22. package/include/node/v8-exception.h +7 -4
  23. package/include/node/v8-extension.h +0 -2
  24. package/include/node/v8-external.h +40 -4
  25. package/include/node/v8-function-callback.h +172 -183
  26. package/include/node/v8-function.h +2 -2
  27. package/include/node/v8-initialization.h +29 -0
  28. package/include/node/v8-internal.h +149 -142
  29. package/include/node/v8-isolate.h +35 -22
  30. package/include/node/v8-local-handle.h +1 -1
  31. package/include/node/v8-memory-span.h +4 -59
  32. package/include/node/v8-message.h +0 -8
  33. package/include/node/v8-object.h +85 -92
  34. package/include/node/v8-persistent-handle.h +2 -9
  35. package/include/node/v8-platform.h +167 -58
  36. package/include/node/v8-primitive.h +5 -57
  37. package/include/node/v8-profiler.h +69 -3
  38. package/include/node/v8-promise.h +16 -5
  39. package/include/node/v8-sandbox.h +34 -53
  40. package/include/node/v8-script.h +27 -0
  41. package/include/node/v8-source-location.h +9 -8
  42. package/include/node/v8-statistics.h +8 -0
  43. package/include/node/v8-template.h +44 -122
  44. package/include/node/v8-version.h +3 -3
  45. package/include/node/v8-wasm.h +118 -21
  46. package/include/node/v8config.h +10 -8
  47. package/package.json +1 -1
  48. package/share/doc/node/gdbinit +79 -0
  49. package/share/doc/node/lldb_commands.py +6 -0
  50. package/share/man/man1/node.1 +0 -6
@@ -8,29 +8,14 @@
8
8
  #include <stddef.h>
9
9
 
10
10
  #include <array>
11
+ #include <compare>
11
12
  #include <cstddef>
12
13
  #include <iterator>
14
+ #include <ranges>
13
15
  #include <type_traits>
14
16
 
15
17
  #include "v8config.h" // NOLINT(build/include_directory)
16
18
 
17
- // TODO(pkasting): Use <compare>/spaceship unconditionally after dropping
18
- // support for old libstdc++ versions.
19
- #if __has_include(<version>)
20
- #include <version>
21
- #endif
22
- #if defined(__cpp_lib_three_way_comparison) && \
23
- __cpp_lib_three_way_comparison >= 201711L
24
- #define V8_HAVE_SPACESHIP_OPERATOR 1
25
- #else
26
- #define V8_HAVE_SPACESHIP_OPERATOR 0
27
- #endif
28
-
29
- // TODO(pkasting): Make this block unconditional after dropping support for old
30
- // libstdc++ versions.
31
- #if __has_include(<ranges>)
32
- #include <ranges>
33
-
34
19
  namespace v8 {
35
20
 
36
21
  template <typename T>
@@ -46,7 +31,6 @@ inline constexpr bool std::ranges::enable_view<v8::MemorySpan<T>> = true;
46
31
  template <typename T>
47
32
  inline constexpr bool std::ranges::enable_borrowed_range<v8::MemorySpan<T>> =
48
33
  true;
49
- #endif
50
34
 
51
35
  namespace v8 {
52
36
 
@@ -164,52 +148,13 @@ class V8_EXPORT MemorySpan {
164
148
  using pointer = value_type*;
165
149
  using reference = value_type&;
166
150
  using iterator_category = std::random_access_iterator_tag;
167
- // There seems to be no feature-test macro covering this, so use the
168
- // presence of `<ranges>` as a crude proxy, since it was added to the
169
- // standard as part of the Ranges papers.
170
- // TODO(pkasting): Add this unconditionally after dropping support for old
171
- // libstdc++ versions.
172
- #if __has_include(<ranges>)
173
151
  using iterator_concept = std::contiguous_iterator_tag;
174
- #endif
175
152
 
176
153
  // Required to satisfy `std::semiregular<>`.
177
154
  constexpr Iterator() = default;
178
155
 
179
- [[nodiscard]] friend constexpr bool operator==(const Iterator& a,
180
- const Iterator& b) {
181
- // TODO(pkasting): Replace this body with `= default` after dropping
182
- // support for old gcc versions.
183
- return a.ptr_ == b.ptr_;
184
- }
185
- #if V8_HAVE_SPACESHIP_OPERATOR
186
- [[nodiscard]] friend constexpr auto operator<=>(const Iterator&,
187
- const Iterator&) = default;
188
- #else
189
- // Assume that if spaceship isn't present, operator rewriting might not be
190
- // either.
191
- [[nodiscard]] friend constexpr bool operator!=(const Iterator& a,
192
- const Iterator& b) {
193
- return a.ptr_ != b.ptr_;
194
- }
195
-
196
- [[nodiscard]] friend constexpr bool operator<(const Iterator& a,
197
- const Iterator& b) {
198
- return a.ptr_ < b.ptr_;
199
- }
200
- [[nodiscard]] friend constexpr bool operator<=(const Iterator& a,
201
- const Iterator& b) {
202
- return a.ptr_ <= b.ptr_;
203
- }
204
- [[nodiscard]] friend constexpr bool operator>(const Iterator& a,
205
- const Iterator& b) {
206
- return a.ptr_ > b.ptr_;
207
- }
208
- [[nodiscard]] friend constexpr bool operator>=(const Iterator& a,
209
- const Iterator& b) {
210
- return a.ptr_ >= b.ptr_;
211
- }
212
- #endif
156
+ [[nodiscard]] constexpr bool operator==(const Iterator&) const = default;
157
+ [[nodiscard]] constexpr auto operator<=>(const Iterator&) const = default;
213
158
 
214
159
  constexpr Iterator& operator++() {
215
160
  ++ptr_;
@@ -108,14 +108,6 @@ class V8_EXPORT Message {
108
108
  public:
109
109
  Local<String> Get() const;
110
110
 
111
- /**
112
- * Return the isolate to which the Message belongs.
113
- */
114
- V8_DEPRECATED(
115
- "Use Isolate::GetCurrent() instead, which is guaranteed to return the "
116
- "same isolate since https://crrev.com/c/6458560.")
117
- Isolate* GetIsolate() const;
118
-
119
111
  V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSource(
120
112
  Local<Context> context) const;
121
113
  V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(
@@ -33,6 +33,11 @@ class PropertyCallbackInfo;
33
33
  */
34
34
  using EmbedderDataTypeTag = uint16_t;
35
35
 
36
+ constexpr EmbedderDataTypeTag kEmbedderDataTypeTagDefault = 0;
37
+
38
+ V8_EXPORT internal::ExternalPointerTag ToExternalPointerTag(
39
+ v8::EmbedderDataTypeTag api_tag);
40
+
36
41
  /**
37
42
  * A private symbol
38
43
  *
@@ -158,30 +163,44 @@ enum PropertyAttribute {
158
163
  };
159
164
 
160
165
  /**
161
- * Accessor[Getter|Setter] are used as callback functions when setting|getting
162
- * a particular data property. See Object::SetNativeDataProperty and
166
+ * This callback function is called when getting a particular data property
167
+ * (i.e. when performing [[Get]] operation).
168
+ *
169
+ * The callback returns the result by calling `info.GetReturnValue().Set(..)`.
170
+ *
171
+ * \param property The name of the property being requested.
172
+ * \param info Information about the intercepted request, such as
173
+ * isolate, object holding the property, return value. See
174
+ * `PropertyCallbackInfo`.
175
+ *
176
+ * See Object::SetNativeDataProperty and
163
177
  * ObjectTemplate::SetNativeDataProperty methods.
164
178
  */
165
179
  using AccessorNameGetterCallback =
166
180
  void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
167
181
 
168
- using AccessorNameSetterCallback =
169
- void (*)(Local<Name> property, Local<Value> value,
170
- const PropertyCallbackInfo<void>& info);
171
-
172
182
  /**
173
- * Access control specifications.
183
+ * This callback function is called when setting a particular data property
184
+ * (i.e. when performing [[Set]] operation).
185
+ *
186
+ * In case of operation failure the callback should
187
+ * - call `info.GetReturnValue().Set(false)`,
188
+ * - (optionally) upon operation failure and info.ShouldThrowOnError()
189
+ * is true (indicating execution in `'use strict'` mode) the callback can
190
+ * throw TypeError if the error message needs to include more details than
191
+ * a TypeError thrown by V8 in this case.
174
192
  *
175
- * Some accessors should be accessible across contexts. These
176
- * accessors have an explicit access control parameter which specifies
177
- * the kind of cross-context access that should be allowed.
193
+ * \param property The name of the property being requested.
194
+ * \param info Information about the intercepted request, such as
195
+ * isolate, object holding the property, return value, or whether running in
196
+ * `'use strict'` mode. See `PropertyCallbackInfo`.
178
197
  *
198
+ * See Object::SetNativeDataProperty and
199
+ * ObjectTemplate::SetNativeDataProperty methods.
179
200
  */
180
- enum V8_DEPRECATE_SOON(
181
- "This enum is no longer used and will be removed in V8 12.9.")
182
- AccessControl {
183
- DEFAULT V8_ENUM_DEPRECATE_SOON("not used") = 0,
184
- };
201
+ using AccessorNameSetterCallback =
202
+ void (*)(Local<Name> property, Local<Value> value,
203
+ const PropertyCallbackInfo<void>& info);
185
204
 
186
205
  /**
187
206
  * Property filter bits. They can be or'ed to build a composite filter.
@@ -317,9 +336,24 @@ class V8_EXPORT Object : public Value {
317
336
  * Gets the property attributes of a property which can be None or
318
337
  * any combination of ReadOnly, DontEnum and DontDelete. Returns
319
338
  * None when the property doesn't exist.
339
+ *
340
+ * This method will be deprecated soon, since it doesn't provide a way
341
+ * to return "property does not exist" result. Use GetPropertyAttributes with
342
+ * PropertyAttribute* instead.
320
343
  */
321
344
  V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetPropertyAttributes(
322
345
  Local<Context> context, Local<Value> key);
346
+ /**
347
+ * Gets the property attributes of a property which can be None or
348
+ * any combination of ReadOnly, DontEnum and DontDelete.
349
+ *
350
+ * Returns true and sets *out_attributes if the property exists, false if
351
+ * not or empty Maybe if an exception is thrown. In the latter two cases,
352
+ * the value of *out_attributes is not modified.
353
+ */
354
+ V8_WARN_UNUSED_RESULT Maybe<bool> GetPropertyAttributes(
355
+ Local<Context> context, Local<Value> key,
356
+ PropertyAttribute* out_attributes);
323
357
 
324
358
  /**
325
359
  * Implements Object.getOwnPropertyDescriptor(O, P), see
@@ -432,42 +466,17 @@ class V8_EXPORT Object : public Value {
432
466
  Local<Context> context, PropertyFilter filter,
433
467
  KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
434
468
 
435
- /**
436
- * Get the prototype object. This does not skip objects marked to
437
- * be skipped by __proto__ and it does not consult the security
438
- * handler.
439
- */
440
- V8_DEPRECATED(
441
- "V8 will stop providing access to hidden prototype (i.e. "
442
- "JSGlobalObject). Use GetPrototypeV2() instead. "
443
- "See http://crbug.com/333672197.")
444
- Local<Value> GetPrototype();
445
-
446
469
  /**
447
470
  * Get the prototype object (same as calling Object.getPrototypeOf(..)).
448
471
  * This does not consult the security handler.
449
- * TODO(333672197): rename back to GetPrototype() once the old version goes
450
- * through the deprecation process and is removed.
472
+ * TODO(http://crbug.com/333672197): rename back to GetPrototype().
451
473
  */
452
474
  Local<Value> GetPrototypeV2();
453
475
 
454
- /**
455
- * Set the prototype object. This does not skip objects marked to
456
- * be skipped by __proto__ and it does not consult the security
457
- * handler.
458
- */
459
- V8_DEPRECATED(
460
- "V8 will stop providing access to hidden prototype (i.e. "
461
- "JSGlobalObject). Use SetPrototypeV2() instead. "
462
- "See http://crbug.com/333672197.")
463
- V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
464
- Local<Value> prototype);
465
-
466
476
  /**
467
477
  * Set the prototype object (same as calling Object.setPrototypeOf(..)).
468
478
  * This does not consult the security handler.
469
- * TODO(333672197): rename back to SetPrototype() once the old version goes
470
- * through the deprecation process and is removed.
479
+ * TODO(http://crbug.com/333672197): rename back to SetPrototype().
471
480
  */
472
481
  V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
473
482
  Local<Value> prototype);
@@ -531,22 +540,26 @@ class V8_EXPORT Object : public Value {
531
540
  * must have been set by SetAlignedPointerInInternalField, everything else
532
541
  * leads to undefined behavior.
533
542
  */
534
- V8_INLINE void* GetAlignedPointerFromInternalField(int index);
543
+ V8_INLINE void* GetAlignedPointerFromInternalField(int index,
544
+ EmbedderDataTypeTag tag);
535
545
  V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
536
- int index);
546
+ int index,
547
+ EmbedderDataTypeTag tag);
537
548
 
538
549
  /** Same as above, but works for PersistentBase. */
539
550
  V8_INLINE static void* GetAlignedPointerFromInternalField(
540
- const PersistentBase<Object>& object, int index) {
551
+ const PersistentBase<Object>& object, int index,
552
+ EmbedderDataTypeTag tag) {
541
553
  return object.template value<Object>()->GetAlignedPointerFromInternalField(
542
- index);
554
+ index, tag);
543
555
  }
544
556
 
545
557
  /** Same as above, but works for TracedReference. */
546
558
  V8_INLINE static void* GetAlignedPointerFromInternalField(
547
- const BasicTracedReference<Object>& object, int index) {
559
+ const BasicTracedReference<Object>& object, int index,
560
+ EmbedderDataTypeTag tag) {
548
561
  return object.template value<Object>()->GetAlignedPointerFromInternalField(
549
- index);
562
+ index, tag);
550
563
  }
551
564
 
552
565
  /**
@@ -554,20 +567,9 @@ class V8_EXPORT Object : public Value {
554
567
  * a field, GetAlignedPointerFromInternalField must be used, everything else
555
568
  * leads to undefined behavior.
556
569
  */
557
- V8_DEPRECATE_SOON(
558
- "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag parameter "
559
- "instead.")
560
- void SetAlignedPointerInInternalField(int index, void* value);
561
-
562
570
  void SetAlignedPointerInInternalField(int index, void* value,
563
571
  EmbedderDataTypeTag tag);
564
572
 
565
- V8_DEPRECATE_SOON(
566
- "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag "
567
- "parameter instead.")
568
- void SetAlignedPointerInInternalFields(int argc, int indices[],
569
- void* values[]);
570
-
571
573
  // Type information for a Wrappable object that got wrapped with
572
574
  // `v8::Object::Wrap()`.
573
575
  struct WrapperTypeInfo {
@@ -794,10 +796,16 @@ class V8_EXPORT Object : public Value {
794
796
  *
795
797
  * Prefer using version with Isolate parameter if you have an Isolate,
796
798
  * otherwise use the other one.
799
+ *
800
+ * The type tag has to match the type tag used for storing the value in the
801
+ * embedder field.
802
+ * If type tags are not used in the embedder, the default value
803
+ * `kEmbedderDataTypeTagDefault` can be used.
797
804
  */
798
- void* GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate* isolate,
799
- int index);
800
- void* GetAlignedPointerFromEmbedderDataInCreationContext(int index);
805
+ void* GetAlignedPointerFromEmbedderDataInCreationContext(
806
+ v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
807
+ void* GetAlignedPointerFromEmbedderDataInCreationContext(
808
+ int index, EmbedderDataTypeTag tag);
801
809
 
802
810
  /**
803
811
  * Checks whether a callback is set by the
@@ -848,21 +856,6 @@ class V8_EXPORT Object : public Value {
848
856
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor(
849
857
  Local<Context> context, int argc, Local<Value> argv[]);
850
858
 
851
- /**
852
- * Return the isolate to which the Object belongs to.
853
- */
854
- V8_DEPRECATED(
855
- "Use Isolate::GetCurrent() instead, which is guaranteed to return the "
856
- "same isolate since https://crrev.com/c/6458560.")
857
- Isolate* GetIsolate();
858
-
859
- V8_DEPRECATED(
860
- "Use Isolate::GetCurrent() instead, which is guaranteed to return the "
861
- "same isolate since https://crrev.com/c/6458560.")
862
- V8_INLINE static Isolate* GetIsolate(const TracedReference<Object>& handle) {
863
- return handle.template value<Object>()->GetIsolate();
864
- }
865
-
866
859
  /**
867
860
  * If this object is a Set, Map, WeakSet or WeakMap, this returns a
868
861
  * representation of the elements of this object as an array.
@@ -909,8 +902,10 @@ class V8_EXPORT Object : public Value {
909
902
  Object();
910
903
  static void CheckCast(Value* obj);
911
904
  Local<Data> SlowGetInternalField(int index);
912
- void* SlowGetAlignedPointerFromInternalField(int index);
913
- void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index);
905
+ void* SlowGetAlignedPointerFromInternalField(int index,
906
+ EmbedderDataTypeTag tag);
907
+ void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
908
+ EmbedderDataTypeTag tag);
914
909
  };
915
910
 
916
911
  // --- Implementation ---
@@ -929,7 +924,7 @@ Local<Data> Object::GetInternalField(int index) {
929
924
  A value = I::ReadRawField<A>(obj, offset);
930
925
  #ifdef V8_COMPRESS_POINTERS
931
926
  // We read the full pointer value and then decompress it in order to avoid
932
- // dealing with potential endiannes issues.
927
+ // dealing with potential endianness issues.
933
928
  value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
934
929
  #endif
935
930
 
@@ -941,7 +936,8 @@ Local<Data> Object::GetInternalField(int index) {
941
936
  }
942
937
 
943
938
  void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
944
- int index) {
939
+ int index,
940
+ EmbedderDataTypeTag tag) {
945
941
  #if !defined(V8_ENABLE_CHECKS)
946
942
  using A = internal::Address;
947
943
  using I = internal::Internals;
@@ -953,17 +949,16 @@ void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
953
949
  int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
954
950
  (I::kEmbedderDataSlotSize * index) +
955
951
  I::kEmbedderDataSlotExternalPointerOffset;
956
- A value =
957
- I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
958
- internal::kLastEmbedderDataTag}>(
959
- isolate, obj, offset);
952
+ A value = I::ReadExternalPointerField(isolate, obj, offset,
953
+ ToExternalPointerTag(tag));
960
954
  return reinterpret_cast<void*>(value);
961
955
  }
962
956
  #endif
963
- return SlowGetAlignedPointerFromInternalField(isolate, index);
957
+ return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
964
958
  }
965
959
 
966
- void* Object::GetAlignedPointerFromInternalField(int index) {
960
+ void* Object::GetAlignedPointerFromInternalField(int index,
961
+ EmbedderDataTypeTag tag) {
967
962
  #if !defined(V8_ENABLE_CHECKS)
968
963
  using A = internal::Address;
969
964
  using I = internal::Internals;
@@ -976,14 +971,12 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
976
971
  (I::kEmbedderDataSlotSize * index) +
977
972
  I::kEmbedderDataSlotExternalPointerOffset;
978
973
  Isolate* isolate = I::GetCurrentIsolateForSandbox();
979
- A value =
980
- I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
981
- internal::kLastEmbedderDataTag}>(
982
- isolate, obj, offset);
974
+ A value = I::ReadExternalPointerField(isolate, obj, offset,
975
+ ToExternalPointerTag(tag));
983
976
  return reinterpret_cast<void*>(value);
984
977
  }
985
978
  #endif
986
- return SlowGetAlignedPointerFromInternalField(index);
979
+ return SlowGetAlignedPointerFromInternalField(index, tag);
987
980
  }
988
981
 
989
982
  // static
@@ -485,20 +485,13 @@ V8_INLINE void PersistentBase<T>::SetWeak(
485
485
  P* parameter, typename WeakCallbackInfo<P>::Callback callback,
486
486
  WeakCallbackType type) {
487
487
  using Callback = WeakCallbackInfo<void>::Callback;
488
- #if (__GNUC__ >= 8) && !defined(__clang__)
488
+ #if (__GNUC__ >= 8) || defined(__clang__)
489
489
  #pragma GCC diagnostic push
490
490
  #pragma GCC diagnostic ignored "-Wcast-function-type"
491
- #endif
492
- #if __clang__
493
- #pragma clang diagnostic push
494
- #pragma clang diagnostic ignored "-Wcast-function-type"
495
491
  #endif
496
492
  api_internal::MakeWeak(this->slot(), parameter,
497
493
  reinterpret_cast<Callback>(callback), type);
498
- #if __clang__
499
- #pragma clang diagnostic pop
500
- #endif
501
- #if (__GNUC__ >= 8) && !defined(__clang__)
494
+ #if (__GNUC__ >= 8) || defined(__clang__)
502
495
  #pragma GCC diagnostic pop
503
496
  #endif
504
497
  }