node-darwin-x64 25.8.2 → 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 -1293
  2. package/bin/node +0 -0
  3. package/include/node/common.gypi +13 -1
  4. package/include/node/config.gypi +20 -10
  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 +17 -1
  11. package/include/node/node_object_wrap.h +4 -2
  12. package/include/node/node_version.h +4 -4
  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 +6 -7
package/bin/node CHANGED
Binary file
@@ -38,7 +38,7 @@
38
38
 
39
39
  # Reset this number to 0 on major V8 upgrades.
40
40
  # Increment by one for each non-official patch applied to deps/v8.
41
- 'v8_embedder_string': '-node.24',
41
+ 'v8_embedder_string': '-node.19',
42
42
 
43
43
  ##### V8 defaults for Node.js #####
44
44
 
@@ -591,6 +591,18 @@
591
591
  '-maix64',
592
592
  ],
593
593
  'conditions': [
594
+ [ 'clang==1', {
595
+ 'cflags': [
596
+ '-fno-integrated-as',
597
+ '-fno-xl-pragma-pack',
598
+ '-mcpu=power9',
599
+ ],
600
+ 'cflags_cc': [
601
+ '-fno-integrated-as',
602
+ '-fno-xl-pragma-pack',
603
+ '-mcpu=power9',
604
+ ],
605
+ }],
594
606
  [ '"<(aix_variant_name)"=="OS400"', { # a.k.a. `IBM i`
595
607
  'ldflags': [
596
608
  '-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib',
@@ -19,6 +19,7 @@
19
19
  "host_arch": "x64",
20
20
  "target_arch": "x64",
21
21
  "node_byteorder": "little",
22
+ "cargo_rust_target": "x86_64-apple-darwin",
22
23
  "want_separate_host_toolset": 0,
23
24
  "node_use_node_snapshot": "true",
24
25
  "node_use_node_code_cache": "true",
@@ -37,8 +38,8 @@
37
38
  "node_no_browser_globals": "false",
38
39
  "node_shared": "false",
39
40
  "libdir": "lib",
40
- "node_module_version": 141,
41
- "shlib_suffix": "141.dylib",
41
+ "node_module_version": 147,
42
+ "shlib_suffix": "147.dylib",
42
43
  "asan": 0,
43
44
  "ubsan": 0,
44
45
  "coverage": "false",
@@ -50,12 +51,6 @@
50
51
  "lib/_http_incoming.js",
51
52
  "lib/_http_outgoing.js",
52
53
  "lib/_http_server.js",
53
- "lib/_stream_duplex.js",
54
- "lib/_stream_passthrough.js",
55
- "lib/_stream_readable.js",
56
- "lib/_stream_transform.js",
57
- "lib/_stream_wrap.js",
58
- "lib/_stream_writable.js",
59
54
  "lib/_tls_common.js",
60
55
  "lib/_tls_wrap.js",
61
56
  "lib/assert.js",
@@ -89,6 +84,7 @@
89
84
  "lib/internal/async_hooks.js",
90
85
  "lib/internal/async_local_storage/async_context_frame.js",
91
86
  "lib/internal/async_local_storage/async_hooks.js",
87
+ "lib/internal/async_local_storage/run_scope.js",
92
88
  "lib/internal/blob.js",
93
89
  "lib/internal/blocklist.js",
94
90
  "lib/internal/bootstrap/node.js",
@@ -137,6 +133,7 @@
137
133
  "lib/internal/crypto/sig.js",
138
134
  "lib/internal/crypto/util.js",
139
135
  "lib/internal/crypto/webcrypto.js",
136
+ "lib/internal/crypto/webcrypto_util.js",
140
137
  "lib/internal/crypto/webidl.js",
141
138
  "lib/internal/crypto/x509.js",
142
139
  "lib/internal/data_url.js",
@@ -282,6 +279,17 @@
282
279
  "lib/internal/streams/end-of-stream.js",
283
280
  "lib/internal/streams/fast-utf8-stream.js",
284
281
  "lib/internal/streams/from.js",
282
+ "lib/internal/streams/iter/broadcast.js",
283
+ "lib/internal/streams/iter/consumers.js",
284
+ "lib/internal/streams/iter/duplex.js",
285
+ "lib/internal/streams/iter/from.js",
286
+ "lib/internal/streams/iter/pull.js",
287
+ "lib/internal/streams/iter/push.js",
288
+ "lib/internal/streams/iter/ringbuffer.js",
289
+ "lib/internal/streams/iter/share.js",
290
+ "lib/internal/streams/iter/transform.js",
291
+ "lib/internal/streams/iter/types.js",
292
+ "lib/internal/streams/iter/utils.js",
285
293
  "lib/internal/streams/lazy_transform.js",
286
294
  "lib/internal/streams/legacy.js",
287
295
  "lib/internal/streams/operators.js",
@@ -373,6 +381,7 @@
373
381
  "lib/sqlite.js",
374
382
  "lib/stream.js",
375
383
  "lib/stream/consumers.js",
384
+ "lib/stream/iter.js",
376
385
  "lib/stream/promises.js",
377
386
  "lib/stream/web.js",
378
387
  "lib/string_decoder.js",
@@ -391,7 +400,8 @@
391
400
  "lib/vm.js",
392
401
  "lib/wasi.js",
393
402
  "lib/worker_threads.js",
394
- "lib/zlib.js"
403
+ "lib/zlib.js",
404
+ "lib/zlib/iter.js"
395
405
  ],
396
406
  "node_cctest_sources": [
397
407
  "src/node_snapshot_stub.cc",
@@ -469,7 +479,7 @@
469
479
  "v8_enable_external_code_space": 0,
470
480
  "v8_enable_31bit_smis_on_64bit_arch": 0,
471
481
  "v8_enable_extensible_ro_snapshot": 0,
472
- "v8_enable_temporal_support": 0,
482
+ "v8_enable_temporal_support": 1,
473
483
  "v8_trace_maps": 0,
474
484
  "node_use_v8_platform": "true",
475
485
  "node_use_bundled_v8": "true",
@@ -50,18 +50,17 @@ class MakeGarbageCollectedTraitInternal {
50
50
  protected:
51
51
  static inline void MarkObjectAsFullyConstructed(const void* payload) {
52
52
  // See api_constants for an explanation of the constants.
53
- std::atomic<uint16_t>* atomic_mutable_bitfield =
54
- reinterpret_cast<std::atomic<uint16_t>*>(
55
- const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
56
- reinterpret_cast<const uint8_t*>(payload) -
57
- api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
53
+ std::atomic_ref<uint16_t> atomic_mutable_bitfield(
54
+ *const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
55
+ reinterpret_cast<const uint8_t*>(payload) -
56
+ api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
58
57
  // It's safe to split use load+store here (instead of a read-modify-write
59
58
  // operation), since it's guaranteed that this 16-bit bitfield is only
60
59
  // modified by a single thread. This is cheaper in terms of code bloat (on
61
60
  // ARM) and performance.
62
- uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
61
+ uint16_t value = atomic_mutable_bitfield.load(std::memory_order_relaxed);
63
62
  value |= api_constants::kFullyConstructedBitMask;
64
- atomic_mutable_bitfield->store(value, std::memory_order_release);
63
+ atomic_mutable_bitfield.store(value, std::memory_order_release);
65
64
  }
66
65
 
67
66
  // Dispatch based on compile-time information.
@@ -55,8 +55,12 @@ struct HeapStatistics final {
55
55
  size_t resident_size_bytes = 0;
56
56
  /** Amount of memory actually used on the page. */
57
57
  size_t used_size_bytes = 0;
58
- /** Statistics for object allocated on the page. Filled only when
59
- * NameProvider::SupportsCppClassNamesAsObjectNames() is true. */
58
+ /**
59
+ * Statistics for object allocated on the page. If an object provides a
60
+ * name by inheriting from NameProvider, its name will be recorded in the
61
+ * statistics. Other objects, without an explicit name, are merged under a
62
+ * single type unless the CPPGC_SUPPORTS_OBJECT_NAME build flag is enabled.
63
+ */
60
64
  std::vector<ObjectStatsEntry> object_statistics;
61
65
  };
62
66
 
@@ -28,7 +28,7 @@ constexpr size_t kGB = kMB * 1024;
28
28
  static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload =
29
29
  2 * sizeof(uint16_t);
30
30
  // Mask for in-construction bit.
31
- static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};
31
+ static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1} << 15;
32
32
 
33
33
  static constexpr size_t kPageSizeBits = 17;
34
34
  static constexpr size_t kPageSize = size_t{1} << kPageSizeBits;
@@ -167,6 +167,7 @@ class V8_EXPORT Visitor {
167
167
  */
168
168
  template <typename T>
169
169
  void Trace(const T& object) {
170
+ static_assert(!IsGarbageCollectedOrMixinTypeV<T>);
170
171
  #if V8_ENABLE_CHECKS
171
172
  // This object is embedded in potentially multiple nested objects. The
172
173
  // outermost object must not be in construction as such objects are (a) not
@@ -14,9 +14,11 @@
14
14
  #include "v8-platform.h" // NOLINT(build/include_directory)
15
15
 
16
16
  namespace perfetto {
17
+ #if defined(V8_USE_PERFETTO_JSON_EXPORT)
17
18
  namespace trace_processor {
18
19
  class TraceProcessorStorage;
19
20
  }
21
+ #endif // defined(V8_USE_PERFETTO_JSON_EXPORT)
20
22
  class TracingSession;
21
23
  }
22
24
 
@@ -231,6 +233,12 @@ class V8_PLATFORM_EXPORT TraceConfig {
231
233
  #define V8_PLATFORM_NON_EXPORTED_BASE(code) code
232
234
  #endif // defined(_MSC_VER)
233
235
 
236
+ /**
237
+ * V8 Tracing controller default implementation.
238
+ *
239
+ * Will become obsolete in Perfetto build
240
+ * (v8_use_perfetto_json_export = true).
241
+ */
234
242
  class V8_PLATFORM_EXPORT TracingController
235
243
  : public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) {
236
244
  public:
@@ -307,10 +315,13 @@ class V8_PLATFORM_EXPORT TracingController
307
315
  std::unique_ptr<TraceConfig> trace_config_;
308
316
  std::atomic_bool recording_{false};
309
317
 
310
- #if defined(V8_USE_PERFETTO)
311
- std::ostream* output_stream_ = nullptr;
318
+ #if defined(V8_USE_PERFETTO_JSON_EXPORT)
312
319
  std::unique_ptr<perfetto::trace_processor::TraceProcessorStorage>
313
320
  trace_processor_;
321
+ #endif
322
+
323
+ #if defined(V8_USE_PERFETTO)
324
+ std::ostream* output_stream_ = nullptr;
314
325
  TraceEventListener* listener_for_testing_ = nullptr;
315
326
  std::unique_ptr<perfetto::TracingSession> tracing_session_;
316
327
  #else // !defined(V8_USE_PERFETTO)
@@ -76,7 +76,7 @@
76
76
  #include "v8-platform.h" // NOLINT(build/include_order)
77
77
  #include "node_version.h" // NODE_MODULE_VERSION
78
78
 
79
- #include "node_api.h"
79
+ #include "node_api_types.h" // napi_addon_register_func
80
80
 
81
81
  #include <functional>
82
82
  #include <memory>
@@ -124,6 +124,8 @@
124
124
 
125
125
  // Forward-declare libuv loop
126
126
  struct uv_loop_s;
127
+ struct napi_module;
128
+ struct ssl_ctx_st; // Forward declaration of SSL_CTX for OpenSSL.
127
129
 
128
130
  // Forward-declare these functions now to stop MSVS from becoming
129
131
  // terminally confused when it's done in node_internals.h
@@ -1656,6 +1658,20 @@ NODE_DEPRECATED(
1656
1658
  v8::Local<v8::Object> object,
1657
1659
  v8::Object::Wrappable* wrappable));
1658
1660
 
1661
+ namespace crypto {
1662
+
1663
+ // Returns the SSL_CTX* from a SecureContext JS object, as returned by
1664
+ // tls.createSecureContext().
1665
+ // Returns nullptr if the value is not a SecureContext instance,
1666
+ // or if Node.js was built without OpenSSL.
1667
+ //
1668
+ // The returned pointer is not owned by the caller and must not be freed.
1669
+ // It is valid only while the SecureContext JS object remains alive.
1670
+ NODE_EXTERN struct ssl_ctx_st* GetSSLCtx(v8::Local<v8::Context> context,
1671
+ v8::Local<v8::Value> secure_context);
1672
+
1673
+ } // namespace crypto
1674
+
1659
1675
  } // namespace node
1660
1676
 
1661
1677
  #endif // SRC_NODE_H_
@@ -49,7 +49,8 @@ class ObjectWrap {
49
49
  assert(handle->InternalFieldCount() > 0);
50
50
  // Cast to ObjectWrap before casting to T. A direct cast from void
51
51
  // to T won't work right when T has more than one base class.
52
- void* ptr = handle->GetAlignedPointerFromInternalField(0);
52
+ void* ptr = handle->GetAlignedPointerFromInternalField(
53
+ 0, v8::kEmbedderDataTypeTagDefault);
53
54
  ObjectWrap* wrap = static_cast<ObjectWrap*>(ptr);
54
55
  return static_cast<T*>(wrap);
55
56
  }
@@ -75,7 +76,8 @@ class ObjectWrap {
75
76
  inline void Wrap(v8::Local<v8::Object> handle) {
76
77
  assert(persistent().IsEmpty());
77
78
  assert(handle->InternalFieldCount() > 0);
78
- handle->SetAlignedPointerInInternalField(0, this);
79
+ handle->SetAlignedPointerInInternalField(
80
+ 0, this, v8::kEmbedderDataTypeTagDefault);
79
81
  persistent().Reset(v8::Isolate::GetCurrent(), handle);
80
82
  MakeWeak();
81
83
  }
@@ -22,9 +22,9 @@
22
22
  #ifndef SRC_NODE_VERSION_H_
23
23
  #define SRC_NODE_VERSION_H_
24
24
 
25
- #define NODE_MAJOR_VERSION 25
26
- #define NODE_MINOR_VERSION 8
27
- #define NODE_PATCH_VERSION 2
25
+ #define NODE_MAJOR_VERSION 26
26
+ #define NODE_MINOR_VERSION 0
27
+ #define NODE_PATCH_VERSION 0
28
28
 
29
29
  #define NODE_VERSION_IS_LTS 0
30
30
  #define NODE_VERSION_LTS_CODENAME ""
@@ -95,7 +95,7 @@
95
95
  #if defined(NODE_EMBEDDER_MODULE_VERSION)
96
96
  #define NODE_MODULE_VERSION NODE_EMBEDDER_MODULE_VERSION
97
97
  #else
98
- #define NODE_MODULE_VERSION 141
98
+ #define NODE_MODULE_VERSION 147
99
99
  #endif
100
100
 
101
101
  // The NAPI_VERSION supported by the runtime. This is the inclusive range of
@@ -85,13 +85,10 @@
85
85
  struct uv__io_s;
86
86
  struct uv_loop_s;
87
87
 
88
- typedef void (*uv__io_cb)(struct uv_loop_s* loop,
89
- struct uv__io_s* w,
90
- unsigned int events);
91
88
  typedef struct uv__io_s uv__io_t;
92
89
 
93
90
  struct uv__io_s {
94
- uv__io_cb cb;
91
+ uintptr_t bits;
95
92
  struct uv__queue pending_queue;
96
93
  struct uv__queue watcher_queue;
97
94
  unsigned int pevents; /* Pending event mask i.e. mask at next tick. */
@@ -31,8 +31,8 @@
31
31
  */
32
32
 
33
33
  #define UV_VERSION_MAJOR 1
34
- #define UV_VERSION_MINOR 51
35
- #define UV_VERSION_PATCH 0
34
+ #define UV_VERSION_MINOR 52
35
+ #define UV_VERSION_PATCH 1
36
36
  #define UV_VERSION_IS_RELEASE 1
37
37
  #define UV_VERSION_SUFFIX ""
38
38
 
@@ -279,7 +279,7 @@ typedef struct {
279
279
  DWORD tls_index;
280
280
  } uv_key_t;
281
281
 
282
- #define UV_ONCE_INIT { 0, NULL }
282
+ #define UV_ONCE_INIT { 0, { NULL } }
283
283
 
284
284
  typedef struct uv_once_s {
285
285
  unsigned char unused;
package/include/node/uv.h CHANGED
@@ -44,10 +44,8 @@ extern "C" {
44
44
  /* Building static library. */
45
45
  # define UV_EXTERN /* nothing */
46
46
  # endif
47
- #elif __GNUC__ >= 4
47
+ #elif defined(__GNUC__)
48
48
  # define UV_EXTERN __attribute__((visibility("default")))
49
- #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) /* Sun Studio >= 8 */
50
- # define UV_EXTERN __global
51
49
  #else
52
50
  # define UV_EXTERN /* nothing */
53
51
  #endif
@@ -741,6 +739,9 @@ struct uv_udp_send_s {
741
739
  UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
742
740
  UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags);
743
741
  UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
742
+ UV_EXTERN int uv_udp_open_ex(uv_udp_t* handle,
743
+ uv_os_sock_t sock,
744
+ unsigned int flags);
744
745
  UV_EXTERN int uv_udp_bind(uv_udp_t* handle,
745
746
  const struct sockaddr* addr,
746
747
  unsigned int flags);
@@ -1203,7 +1204,7 @@ struct uv_cpu_times_s {
1203
1204
  };
1204
1205
 
1205
1206
  struct uv_cpu_info_s {
1206
- char* model;
1207
+ const char* model;
1207
1208
  int speed;
1208
1209
  struct uv_cpu_times_s cpu_times;
1209
1210
  };
@@ -1254,7 +1255,8 @@ struct uv_statfs_s {
1254
1255
  uint64_t f_bavail;
1255
1256
  uint64_t f_files;
1256
1257
  uint64_t f_ffree;
1257
- uint64_t f_spare[4];
1258
+ uint64_t f_frsize;
1259
+ uint64_t f_spare[3];
1258
1260
  };
1259
1261
 
1260
1262
  typedef enum {
@@ -1964,7 +1966,6 @@ UV_EXTERN void uv_wtf8_to_utf16(const char* wtf8,
1964
1966
  size_t utf16_len);
1965
1967
 
1966
1968
  /* Don't export the private CPP symbols. */
1967
- #undef UV_HANDLE_TYPE_PRIVATE
1968
1969
  #undef UV_REQ_TYPE_PRIVATE
1969
1970
  #undef UV_REQ_PRIVATE_FIELDS
1970
1971
  #undef UV_STREAM_PRIVATE_FIELDS
@@ -1976,12 +1977,10 @@ UV_EXTERN void uv_wtf8_to_utf16(const char* wtf8,
1976
1977
  #undef UV_TIMER_PRIVATE_FIELDS
1977
1978
  #undef UV_GETADDRINFO_PRIVATE_FIELDS
1978
1979
  #undef UV_GETNAMEINFO_PRIVATE_FIELDS
1979
- #undef UV_FS_REQ_PRIVATE_FIELDS
1980
1980
  #undef UV_WORK_PRIVATE_FIELDS
1981
1981
  #undef UV_FS_EVENT_PRIVATE_FIELDS
1982
1982
  #undef UV_SIGNAL_PRIVATE_FIELDS
1983
1983
  #undef UV_LOOP_PRIVATE_FIELDS
1984
- #undef UV_LOOP_PRIVATE_PLATFORM_FIELDS
1985
1984
  #undef UV__ERR
1986
1985
 
1987
1986
  #ifdef __cplusplus
@@ -77,6 +77,11 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase {
77
77
  */
78
78
  bool IsShared() const;
79
79
 
80
+ /**
81
+ * Indicates whether the backing store is immutable.
82
+ */
83
+ bool IsImmutable() const;
84
+
80
85
  /**
81
86
  * Indicates whether the backing store was created for a resizable ArrayBuffer
82
87
  * or a growable SharedArrayBuffer, and thus may be resized by user JavaScript
@@ -328,6 +333,11 @@ class V8_EXPORT ArrayBuffer : public Object {
328
333
  */
329
334
  bool WasDetached() const;
330
335
 
336
+ /**
337
+ * Returns true if this ArrayBuffer is immutable.
338
+ */
339
+ bool IsImmutable() const;
340
+
331
341
  /**
332
342
  * Detaches this ArrayBuffer and all its views (typed arrays).
333
343
  * Detaching sets the byte length of the buffer and all typed arrays to zero,
@@ -184,6 +184,7 @@ enum GCCallbackFlags {
184
184
  kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4,
185
185
  kGCCallbackFlagCollectAllExternalMemory = 1 << 5,
186
186
  kGCCallbackScheduleIdleGarbageCollection = 1 << 6,
187
+ kGCCallbackFlagLastResort = 1 << 7,
187
188
  };
188
189
 
189
190
  using GCCallback = void (*)(GCType type, GCCallbackFlags flags);
@@ -232,6 +233,10 @@ struct OOMDetails {
232
233
  using OOMErrorCallback = void (*)(const char* location,
233
234
  const OOMDetails& details);
234
235
 
236
+ using OOMErrorCallbackWithData = void (*)(const char* location,
237
+ const OOMDetails& details,
238
+ void* data);
239
+
235
240
  using MessageCallback = void (*)(Local<Message> message, Local<Value> data);
236
241
 
237
242
  // --- Tracing ---
@@ -255,6 +260,15 @@ enum class CrashKeyId {
255
260
 
256
261
  using AddCrashKeyCallback = void (*)(CrashKeyId id, const std::string& value);
257
262
 
263
+ // --- CrashKeyString Callbacks ---
264
+ using CrashKey = void*;
265
+ enum class CrashKeySize { Size32, Size64, Size256, Size1024 };
266
+
267
+ using AllocateCrashKeyStringCallback =
268
+ std::function<CrashKey(const char key[], CrashKeySize size)>;
269
+ using SetCrashKeyStringCallback =
270
+ std::function<void(CrashKey key, const std::string_view value)>;
271
+
258
272
  // --- Enter/Leave Script Callback ---
259
273
  using BeforeCallEnteredCallback = void (*)(Isolate*);
260
274
  using CallCompletedCallback = void (*)(Isolate*);
@@ -321,9 +335,6 @@ using WasmAsyncResolvePromiseCallback = void (*)(
321
335
  using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
322
336
  const char* name);
323
337
 
324
- // --- Callback for checking if WebAssembly imported strings are enabled ---
325
- using WasmImportedStringsEnabledCallback = bool (*)(Local<Context> context);
326
-
327
338
  // --- Callback for checking if WebAssembly Custom Descriptors are enabled ---
328
339
  using WasmCustomDescriptorsEnabledCallback = bool (*)(Local<Context> context);
329
340
 
@@ -331,14 +342,12 @@ using WasmCustomDescriptorsEnabledCallback = bool (*)(Local<Context> context);
331
342
  using SharedArrayBufferConstructorEnabledCallback =
332
343
  bool (*)(Local<Context> context);
333
344
 
334
- // --- Callback for checking if WebAssembly JSPI is enabled ---
335
- using WasmJSPIEnabledCallback = bool (*)(Local<Context> context);
336
-
337
345
  /**
338
346
  * Import phases in import requests.
339
347
  */
340
348
  enum class ModuleImportPhase {
341
349
  kSource,
350
+ kDefer,
342
351
  kEvaluation,
343
352
  };
344
353
 
@@ -255,12 +255,6 @@ class V8_EXPORT Context : public Data {
255
255
  */
256
256
  Maybe<void> DeepFreeze(DeepFreezeDelegate* delegate = nullptr);
257
257
 
258
- /** Returns the isolate associated with a current context. */
259
- V8_DEPRECATED(
260
- "Use Isolate::GetCurrent() instead, which is guaranteed to return the "
261
- "same isolate since https://crrev.com/c/6458560.")
262
- Isolate* GetIsolate();
263
-
264
258
  /** Returns the microtask queue associated with a current context. */
265
259
  MicrotaskQueue* GetMicrotaskQueue();
266
260
 
@@ -282,6 +276,20 @@ class V8_EXPORT Context : public Data {
282
276
  * Gets the embedder data with the given index, which must have been set by a
283
277
  * previous call to SetEmbedderData with the same index.
284
278
  */
279
+ V8_INLINE Local<Data> GetEmbedderDataV2(int index);
280
+
281
+ /**
282
+ * Sets the embedder data with the given index, growing the data as
283
+ * needed. Note that index 0 currently has a special meaning for Chrome's
284
+ * debugger.
285
+ */
286
+ void SetEmbedderDataV2(int index, Local<Data> value);
287
+
288
+ /**
289
+ * Gets the embedder data with the given index, which must have been set by a
290
+ * previous call to SetEmbedderData with the same index.
291
+ */
292
+ V8_DEPRECATE_SOON("Use GetEmbedderDataV2 instead")
285
293
  V8_INLINE Local<Value> GetEmbedderData(int index);
286
294
 
287
295
  /**
@@ -297,6 +305,7 @@ class V8_EXPORT Context : public Data {
297
305
  * needed. Note that index 0 currently has a special meaning for Chrome's
298
306
  * debugger.
299
307
  */
308
+ V8_DEPRECATE_SOON("Use SetEmbedderDataV2 instead")
300
309
  void SetEmbedderData(int index, Local<Value> value);
301
310
 
302
311
  /**
@@ -305,22 +314,42 @@ class V8_EXPORT Context : public Data {
305
314
  * SetAlignedPointerInEmbedderData with the same index. Note that index 0
306
315
  * currently has a special meaning for Chrome's debugger.
307
316
  */
317
+ V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate, int index,
318
+ EmbedderDataTypeTag tag);
319
+ V8_INLINE void* GetAlignedPointerFromEmbedderData(int index,
320
+ EmbedderDataTypeTag tag);
321
+
322
+ V8_DEPRECATED(
323
+ "Use GetAlignedPointerFromEmbedderData with EmbedderDataTypeTag "
324
+ "parameter instead.")
308
325
  V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate,
309
- int index);
310
- V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
326
+ int index) {
327
+ return GetAlignedPointerFromEmbedderData(isolate, index,
328
+ kEmbedderDataTypeTagDefault);
329
+ }
330
+
331
+ V8_DEPRECATED(
332
+ "Use GetAlignedPointerFromEmbedderData with EmbedderDataTypeTag "
333
+ "parameter instead.")
334
+ V8_INLINE void* GetAlignedPointerFromEmbedderData(int index) {
335
+ return GetAlignedPointerFromEmbedderData(index,
336
+ kEmbedderDataTypeTagDefault);
337
+ }
338
+
339
+ void SetAlignedPointerInEmbedderData(int index, void* value,
340
+ EmbedderDataTypeTag tag);
311
341
 
312
342
  /**
313
343
  * Sets a 2-byte-aligned native pointer in the embedder data with the given
314
344
  * index, growing the data as needed. Note that index 0 currently has a
315
345
  * special meaning for Chrome's debugger.
316
346
  */
317
- V8_DEPRECATE_SOON(
347
+ V8_DEPRECATED(
318
348
  "Use SetAlignedPointerInEmbedderData with EmbedderDataTypeTag parameter "
319
349
  "instead.")
320
- void SetAlignedPointerInEmbedderData(int index, void* value);
321
-
322
- void SetAlignedPointerInEmbedderData(int index, void* value,
323
- EmbedderDataTypeTag slot);
350
+ void SetAlignedPointerInEmbedderData(int index, void* value) {
351
+ SetAlignedPointerInEmbedderData(index, value, kEmbedderDataTypeTagDefault);
352
+ }
324
353
 
325
354
  /**
326
355
  * Control whether code generation from strings is allowed. Calling
@@ -439,7 +468,9 @@ class V8_EXPORT Context : public Data {
439
468
  internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce(
440
469
  size_t index);
441
470
  Local<Value> SlowGetEmbedderData(int index);
442
- void* SlowGetAlignedPointerFromEmbedderData(int index);
471
+ Local<Data> SlowGetEmbedderDataV2(int index);
472
+ void* SlowGetAlignedPointerFromEmbedderData(int index,
473
+ EmbedderDataTypeTag tag);
443
474
  };
444
475
 
445
476
  // --- Implementation ---
@@ -456,7 +487,7 @@ Local<Value> Context::GetEmbedderData(int index) {
456
487
  A value = I::ReadRawField<A>(embedder_data, value_offset);
457
488
  #ifdef V8_COMPRESS_POINTERS
458
489
  // We read the full pointer value and then decompress it in order to avoid
459
- // dealing with potential endiannes issues.
490
+ // dealing with potential endianness issues.
460
491
  value = I::DecompressTaggedField(embedder_data, static_cast<uint32_t>(value));
461
492
  #endif
462
493
 
@@ -467,7 +498,31 @@ Local<Value> Context::GetEmbedderData(int index) {
467
498
  #endif
468
499
  }
469
500
 
470
- void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index) {
501
+ V8_INLINE Local<Data> Context::GetEmbedderDataV2(int index) {
502
+ #ifndef V8_ENABLE_CHECKS
503
+ using A = internal::Address;
504
+ using I = internal::Internals;
505
+ A ctx = internal::ValueHelper::ValueAsAddress(this);
506
+ A embedder_data =
507
+ I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
508
+ int value_offset =
509
+ I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
510
+ A value = I::ReadRawField<A>(embedder_data, value_offset);
511
+ #ifdef V8_COMPRESS_POINTERS
512
+ // We read the full pointer value and then decompress it in order to avoid
513
+ // dealing with potential endianness issues.
514
+ value = I::DecompressTaggedField(embedder_data, static_cast<uint32_t>(value));
515
+ #endif
516
+
517
+ auto* isolate = I::GetCurrentIsolate();
518
+ return Local<Data>::New(isolate, value);
519
+ #else
520
+ return SlowGetEmbedderDataV2(index);
521
+ #endif
522
+ }
523
+
524
+ void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index,
525
+ EmbedderDataTypeTag tag) {
471
526
  #if !defined(V8_ENABLE_CHECKS)
472
527
  using A = internal::Address;
473
528
  using I = internal::Internals;
@@ -477,16 +532,15 @@ void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index) {
477
532
  int value_offset = I::kEmbedderDataArrayHeaderSize +
478
533
  (I::kEmbedderDataSlotSize * index) +
479
534
  I::kEmbedderDataSlotExternalPointerOffset;
480
- return reinterpret_cast<void*>(
481
- I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
482
- internal::kLastEmbedderDataTag}>(
483
- isolate, embedder_data, value_offset));
535
+ return reinterpret_cast<void*>(I::ReadExternalPointerField(
536
+ isolate, embedder_data, value_offset, ToExternalPointerTag(tag)));
484
537
  #else
485
- return SlowGetAlignedPointerFromEmbedderData(index);
538
+ return SlowGetAlignedPointerFromEmbedderData(index, tag);
486
539
  #endif
487
540
  }
488
541
 
489
- void* Context::GetAlignedPointerFromEmbedderData(int index) {
542
+ void* Context::GetAlignedPointerFromEmbedderData(int index,
543
+ EmbedderDataTypeTag tag) {
490
544
  #if !defined(V8_ENABLE_CHECKS)
491
545
  using A = internal::Address;
492
546
  using I = internal::Internals;
@@ -497,12 +551,10 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
497
551
  (I::kEmbedderDataSlotSize * index) +
498
552
  I::kEmbedderDataSlotExternalPointerOffset;
499
553
  Isolate* isolate = I::GetCurrentIsolateForSandbox();
500
- return reinterpret_cast<void*>(
501
- I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
502
- internal::kLastEmbedderDataTag}>(
503
- isolate, embedder_data, value_offset));
554
+ return reinterpret_cast<void*>(I::ReadExternalPointerField(
555
+ isolate, embedder_data, value_offset, ToExternalPointerTag(tag)));
504
556
  #else
505
- return SlowGetAlignedPointerFromEmbedderData(index);
557
+ return SlowGetAlignedPointerFromEmbedderData(index, tag);
506
558
  #endif
507
559
  }
508
560