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,6 +8,7 @@
8
8
  #include <functional>
9
9
  #include <memory>
10
10
  #include <string>
11
+ #include <variant>
11
12
 
12
13
  #include "v8-internal.h" // NOLINT(build/include_directory)
13
14
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
@@ -20,12 +21,9 @@ namespace v8 {
20
21
  class ArrayBuffer;
21
22
  class Promise;
22
23
 
23
- namespace internal {
24
- namespace wasm {
24
+ namespace internal::wasm {
25
25
  class NativeModule;
26
- class StreamingDecoder;
27
- } // namespace wasm
28
- } // namespace internal
26
+ } // namespace internal::wasm
29
27
 
30
28
  /**
31
29
  * An owned byte buffer with associated size.
@@ -38,8 +36,10 @@ struct OwnedBuffer {
38
36
  OwnedBuffer() = default;
39
37
  };
40
38
 
41
- // Wrapper around a compiled WebAssembly module, which is potentially shared by
42
- // different WasmModuleObjects.
39
+ /**
40
+ * Wrapper around a compiled WebAssembly module, which is potentially shared by
41
+ * different WasmModuleObjects.
42
+ */
43
43
  class V8_EXPORT CompiledWasmModule {
44
44
  public:
45
45
  /**
@@ -56,11 +56,12 @@ class V8_EXPORT CompiledWasmModule {
56
56
  const std::string& source_url() const { return source_url_; }
57
57
 
58
58
  private:
59
+ friend class WasmModuleCompilation;
59
60
  friend class WasmModuleObject;
60
61
  friend class WasmStreaming;
61
62
 
62
63
  explicit CompiledWasmModule(std::shared_ptr<internal::wasm::NativeModule>,
63
- const char* source_url, size_t url_length);
64
+ std::string source_url);
64
65
 
65
66
  const std::shared_ptr<internal::wasm::NativeModule> native_module_;
66
67
  const std::string source_url_;
@@ -134,6 +135,22 @@ class V8_EXPORT WasmStreaming final {
134
135
  internal::kWasmWasmStreamingTag;
135
136
  class WasmStreamingImpl;
136
137
 
138
+ class ModuleCachingInterface {
139
+ public:
140
+ // Get the full wire bytes, to check against the cached version.
141
+ virtual MemorySpan<const uint8_t> GetWireBytes() const = 0;
142
+ // Pass serialized (cached) compiled module bytes, to be deserialized and
143
+ // used as the result of this streaming compilation.
144
+ // The passed bytes will only be accessed inside this callback, i.e.
145
+ // lifetime can end after the call.
146
+ // The return value indicates whether V8 could use the passed bytes; {false}
147
+ // would be returned on e.g. version mismatch.
148
+ // This method can only be called once.
149
+ virtual bool SetCachedCompiledModuleBytes(MemorySpan<const uint8_t>) = 0;
150
+ };
151
+
152
+ using ModuleCachingCallback = std::function<void(ModuleCachingInterface&)>;
153
+
137
154
  explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
138
155
 
139
156
  ~WasmStreaming();
@@ -148,12 +165,12 @@ class V8_EXPORT WasmStreaming final {
148
165
  * {Finish} should be called after all received bytes where passed to
149
166
  * {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish}
150
167
  * must not be called after {Abort} has been called already.
151
- * If {can_use_compiled_module} is true and {SetCompiledModuleBytes} was
152
- * previously called, the compiled module bytes can be used.
153
- * If {can_use_compiled_module} is false, the compiled module bytes previously
154
- * set by {SetCompiledModuleBytes} should not be used.
168
+ * If {SetHasCompiledModuleBytes()} was called before, a {caching_callback}
169
+ * can be passed which can inspect the full received wire bytes and set cached
170
+ * module bytes which will be deserialized then. This callback will happen
171
+ * synchronously within this call; the callback is not stored.
155
172
  */
156
- void Finish(bool can_use_compiled_module = true);
173
+ void Finish(const ModuleCachingCallback& caching_callback);
157
174
 
158
175
  /**
159
176
  * Abort streaming compilation. If {exception} has a value, then the promise
@@ -164,15 +181,14 @@ class V8_EXPORT WasmStreaming final {
164
181
  void Abort(MaybeLocal<Value> exception);
165
182
 
166
183
  /**
167
- * Passes previously compiled module bytes. This must be called before
168
- * {OnBytesReceived}, {Finish}, or {Abort}. Returns true if the module bytes
169
- * can be used, false otherwise. The buffer passed via {bytes} and {size}
170
- * is owned by the caller. If {SetCompiledModuleBytes} returns true, the
171
- * buffer must remain valid until either {Finish} or {Abort} completes.
172
- * The compiled module bytes should not be used until {Finish(true)} is
173
- * called, because they can be invalidated later by {Finish(false)}.
184
+ * Mark that the embedder has (potentially) cached compiled module bytes (i.e.
185
+ * a serialized {CompiledWasmModule}) that could match this streaming request.
186
+ * This will cause V8 to skip streaming compilation.
187
+ * The embedder should then pass a callback to the {Finish} method to pass the
188
+ * serialized bytes, after potentially checking their validity against the
189
+ * full received wire bytes.
174
190
  */
175
- bool SetCompiledModuleBytes(const uint8_t* bytes, size_t size);
191
+ void SetHasCompiledModuleBytes();
176
192
 
177
193
  /**
178
194
  * Sets a callback which is called whenever a significant number of new
@@ -199,6 +215,87 @@ class V8_EXPORT WasmStreaming final {
199
215
  std::unique_ptr<WasmStreamingImpl> impl_;
200
216
  };
201
217
 
218
+ /**
219
+ * An interface for asynchronous WebAssembly module compilation, to be used e.g.
220
+ * for implementing source phase imports.
221
+ * Note: This interface is experimental and can change or be removed without
222
+ * notice.
223
+ */
224
+ class V8_EXPORT WasmModuleCompilation final {
225
+ public:
226
+ using ModuleCachingCallback = WasmStreaming::ModuleCachingCallback;
227
+
228
+ /**
229
+ * Start an asynchronous module compilation. This can be called on any thread.
230
+ * TODO(clemensb): Add some way to pass enabled features.
231
+ * TODO(clemensb): Add some way to pass compile time imports.
232
+ */
233
+ WasmModuleCompilation();
234
+
235
+ ~WasmModuleCompilation();
236
+
237
+ WasmModuleCompilation(const WasmModuleCompilation&) = delete;
238
+ WasmModuleCompilation& operator=(const WasmModuleCompilation&) = delete;
239
+
240
+ /**
241
+ * Pass a new chunk of bytes to WebAssembly compilation.
242
+ * The buffer passed into {OnBytesReceived} is owned by the caller and will
243
+ * not be accessed any more after this call returns.
244
+ */
245
+ void OnBytesReceived(const uint8_t* bytes, size_t size);
246
+
247
+ /**
248
+ * {Finish} must be called on the main thread after all bytes were passed to
249
+ * {OnBytesReceived}.
250
+ * It eventually calls the provided callback to deliver the compiled module or
251
+ * an error. This callback will also be called in foreground, but not
252
+ * necessarily within this call.
253
+ * {Finish} must not be called after {Abort} has been called already.
254
+ * If {SetHasCompiledModuleBytes()} was called before, a {caching_callback}
255
+ * can be passed which can inspect the full received wire bytes and set cached
256
+ * module bytes which will be deserialized then. This callback will happen
257
+ * synchronously within this call; the callback is not stored.
258
+ */
259
+ void Finish(
260
+ Isolate*, const ModuleCachingCallback& caching_callback,
261
+ const std::function<void(
262
+ std::variant<Local<WasmModuleObject>, Local<Value>> module_or_error)>&
263
+ resolution_callback);
264
+
265
+ /**
266
+ * Abort compilation. This can be called from any thread.
267
+ * {Abort} must not be called repeatedly, or after {Finish}.
268
+ */
269
+ void Abort();
270
+
271
+ /**
272
+ * Mark that the embedder has (potentially) cached compiled module bytes (i.e.
273
+ * a serialized {CompiledWasmModule}) that could match this streaming request.
274
+ * This will cause V8 to skip streaming compilation.
275
+ * The embedder should then pass a callback to the {Finish} method to pass the
276
+ * serialized bytes, after potentially checking their validity against the
277
+ * full received wire bytes.
278
+ */
279
+ void SetHasCompiledModuleBytes();
280
+
281
+ /**
282
+ * Sets a callback which is called whenever a significant number of new
283
+ * functions are ready for serialization.
284
+ */
285
+ void SetMoreFunctionsCanBeSerializedCallback(
286
+ std::function<void(CompiledWasmModule)>);
287
+
288
+ /*
289
+ * Sets the UTF-8 encoded source URL for the {Script} object. This must be
290
+ * called before {Finish}.
291
+ */
292
+ void SetUrl(const char* url, size_t length);
293
+
294
+ private:
295
+ class Impl;
296
+ const std::unique_ptr<Impl> impl_;
297
+ };
298
+
202
299
  /**
203
300
  * The V8 interface for a WebAssembly memory map descriptor. This is an
204
301
  * experimental feature that may change and be removed without further
@@ -335,7 +335,6 @@ path. Add it with -I<path> to the command line
335
335
  // - [[no_unique_address]] supported
336
336
  // V8_HAS_CPP_ATTRIBUTE_LIFETIME_BOUND - [[clang::lifetimebound]] supported
337
337
  // V8_HAS_BUILTIN_ADD_OVERFLOW - __builtin_add_overflow() supported
338
- // V8_HAS_BUILTIN_BIT_CAST - __builtin_bit_cast() supported
339
338
  // V8_HAS_BUILTIN_BSWAP16 - __builtin_bswap16() supported
340
339
  // V8_HAS_BUILTIN_BSWAP32 - __builtin_bswap32() supported
341
340
  // V8_HAS_BUILTIN_BSWAP64 - __builtin_bswap64() supported
@@ -418,7 +417,6 @@ path. Add it with -I<path> to the command line
418
417
  # define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow))
419
418
  # define V8_HAS_BUILTIN_ASSUME (__has_builtin(__builtin_assume))
420
419
  # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
421
- # define V8_HAS_BUILTIN_BIT_CAST (__has_builtin(__builtin_bit_cast))
422
420
  # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
423
421
  # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
424
422
  # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
@@ -473,9 +471,6 @@ path. Add it with -I<path> to the command line
473
471
  // for V8_HAS_CPP_ATTRIBUTE_NODISCARD. See https://crbug.com/v8/11707.
474
472
 
475
473
  # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
476
- # if __GNUC__ >= 11
477
- # define V8_HAS_BUILTIN_BIT_CAST 1
478
- # endif
479
474
  # define V8_HAS_BUILTIN_CLZ 1
480
475
  # define V8_HAS_BUILTIN_CTZ 1
481
476
  # define V8_HAS_BUILTIN_EXPECT 1
@@ -546,9 +541,8 @@ path. Add it with -I<path> to the command line
546
541
  # define V8_ASSUME USE
547
542
  #endif
548
543
 
549
- // Prefer c++20 std::assume_aligned. Don't use it on MSVC though, because it's
550
- // not happy with our large 4GB alignment values.
551
- #if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned) && !V8_CC_MSVC
544
+ // Prefer c++20 std::assume_aligned.
545
+ #if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned)
552
546
  # define V8_ASSUME_ALIGNED(ptr, alignment) \
553
547
  std::assume_aligned<(alignment)>(ptr)
554
548
  #elif V8_HAS_BUILTIN_ASSUME_ALIGNED
@@ -1072,4 +1066,12 @@ arm64 host
1072
1066
  #define V8_TARGET_BIG_ENDIAN_BOOL false
1073
1067
  #endif
1074
1068
 
1069
+ // V8_USE_PERFETTO_SDK and V8_USE_PERFETTO_JSON_EXPORT must imply
1070
+ // V8_USE_PERFETTO.
1071
+ #if (defined(V8_USE_PERFETTO_SDK) || defined(V8_USE_PERFETTO_JSON_EXPORT)) && \
1072
+ !defined(V8_USE_PERFETTO)
1073
+ #error Inconsistent build configuration: To build the V8 with Perfetto \
1074
+ features, set V8_USE_PERFETTO as well.
1075
+ #endif
1076
+
1075
1077
  #endif // V8CONFIG_H_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-darwin-x64",
3
- "version": "25.9.0",
3
+ "version": "26.0.0",
4
4
  "description": "node",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/aredridel/node-bin-gen.git"
@@ -182,6 +182,15 @@ Print the current JavaScript stack trace
182
182
  Usage: jst
183
183
  end
184
184
 
185
+ # Print JavaScript stack trace in concise format
186
+ define jstc
187
+ call (void) _v8_internal_Print_StackTraceConcise()
188
+ end
189
+ document jstc
190
+ Print the current JavaScript stack trace in concise format
191
+ Usage: jstc
192
+ end
193
+
185
194
  # Print TurboFan graph node.
186
195
  define pn
187
196
  call _v8_internal_Node_Print((void*)($arg0))
@@ -733,3 +742,73 @@ def direct_handle_pretty_printers(val):
733
742
  gdb.pretty_printers.append(direct_handle_pretty_printers)
734
743
 
735
744
  end
745
+
746
+ python
747
+
748
+ # V8 JIT-compiled frame unwinder for x86-64.
749
+ # See https://sourceware.org/gdb/current/onlinedocs/gdb.html/Unwinding-Frames-in-Python.html
750
+
751
+ from gdb.unwinder import Unwinder, FrameId
752
+
753
+ class V8Unwinder(Unwinder):
754
+ """Unwinder for V8 JIT-compiled frames by following the RBP chain on x86-64."""
755
+
756
+ PTR_SIZE = 8 # x86-64
757
+
758
+ @staticmethod
759
+ def read_u64(addr):
760
+ """Return little-endian uint64 from inferior memory, or raise gdb.MemoryError."""
761
+ inferior = gdb.selected_inferior()
762
+ data = inferior.read_memory(addr, V8Unwinder.PTR_SIZE)
763
+ return int.from_bytes(data.tobytes(), byteorder="little", signed=False)
764
+
765
+ def __init__(self):
766
+ super(V8Unwinder, self).__init__("V8Unwinder")
767
+ self.enabled = True
768
+
769
+ def __call__(self, pending_frame):
770
+ try:
771
+ arch = pending_frame.architecture()
772
+ if arch.name() != "i386:x86-64":
773
+ return None # Don't use this unwinder if not on x86-64.
774
+ if pending_frame.name() is not None:
775
+ return None # gdb can already symbolicate this, likely not a JIT frame.
776
+
777
+ fp = int(pending_frame.read_register("rbp"))
778
+
779
+ if fp == 0 or (fp & 0x7) != 0: # Chain ends or misaligned.
780
+ return None
781
+
782
+ # Now we know we are likely in a V8 JIT-compiled frame.
783
+ # Stack layout:
784
+ # rbp+16 <-- caller's rsp before `call`
785
+ # rbp+8 [ return address (saved rip) ]
786
+ # rbp+0 [ saved rbp ] <-- current frame pointer
787
+ prev_rsp = fp + self.PTR_SIZE * 2
788
+ ret_addr = self.read_u64(fp + self.PTR_SIZE)
789
+ prev_rbp = self.read_u64(fp)
790
+
791
+ if ret_addr == 0 or prev_rbp == 0:
792
+ return None # Invalid frame.
793
+
794
+ # GDB needs a Frame ID to identify the frame.
795
+ # 1. A stack address that is stable across the lifetime of a frame.
796
+ # We use the previous frame's rsp.
797
+ # 2. A code address that is stable across the lifetime of a frame.
798
+ # Ideally, the function's start address. We don't have symbols here,
799
+ # so it's not easy to find out. Use the return address as an
800
+ # approximation.
801
+ # See https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/frame-id.h
802
+ frame_id = FrameId(prev_rsp, ret_addr)
803
+ unwind_info = pending_frame.create_unwind_info(frame_id)
804
+ unwind_info.add_saved_register("rsp", gdb.Value(prev_rsp))
805
+ unwind_info.add_saved_register("rip", gdb.Value(ret_addr))
806
+ unwind_info.add_saved_register("rbp", gdb.Value(prev_rbp))
807
+ return unwind_info
808
+
809
+ except Exception:
810
+ return None # Give up unwinding on errors.
811
+
812
+ gdb.unwinder.register_unwinder(None, V8Unwinder(), replace=True)
813
+
814
+ end
@@ -218,6 +218,12 @@ def jst(debugger, *args):
218
218
  no_arg_cmd(debugger, "_v8_internal_Print_StackTrace()")
219
219
 
220
220
 
221
+ @lldbCommand
222
+ def jstc(debugger, *args):
223
+ """Print the current JavaScript stack trace in a concise format"""
224
+ no_arg_cmd(debugger, "_v8_internal_Print_StackTraceConcise()")
225
+
226
+
221
227
  @lldbCommand
222
228
  def pn(debugger, param, *args):
223
229
  """Print a v8 TurboFan graph node"""
@@ -746,10 +746,6 @@ collecting code coverage from tests for more details.
746
746
  Enable module mocking in the test runner.
747
747
  This feature requires \fB--allow-worker\fR if used with the Permission Model.
748
748
  .
749
- .It Fl -experimental-transform-types
750
- Enables the transformation of TypeScript-only syntax into JavaScript code.
751
- Implies \fB--enable-source-maps\fR.
752
- .
753
749
  .It Fl -experimental-vm-modules
754
750
  Enable experimental ES Module support in the \fBnode:vm\fR module.
755
751
  .
@@ -1888,8 +1884,6 @@ one is included in the list below.
1888
1884
  .It
1889
1885
  \fB--experimental-top-level-await\fR
1890
1886
  .It
1891
- \fB--experimental-transform-types\fR
1892
- .It
1893
1887
  \fB--experimental-vm-modules\fR
1894
1888
  .It
1895
1889
  \fB--experimental-wasi-unstable-preview1\fR