node-linux-arm64 18.10.0 → 19.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 (39) hide show
  1. package/CHANGELOG.md +132 -1597
  2. package/README.md +11 -16
  3. package/bin/node +0 -0
  4. package/include/node/common.gypi +1 -1
  5. package/include/node/config.gypi +251 -248
  6. package/include/node/cppgc/common.h +0 -1
  7. package/include/node/node.h +96 -10
  8. package/include/node/node_version.h +3 -3
  9. package/include/node/v8-callbacks.h +19 -5
  10. package/include/node/v8-context.h +12 -8
  11. package/include/node/v8-date.h +5 -0
  12. package/include/node/v8-embedder-heap.h +8 -3
  13. package/include/node/v8-exception.h +1 -1
  14. package/include/node/v8-function.h +8 -0
  15. package/include/node/v8-initialization.h +23 -49
  16. package/include/node/v8-internal.h +312 -123
  17. package/include/node/v8-isolate.h +26 -42
  18. package/include/node/v8-local-handle.h +5 -5
  19. package/include/node/v8-locker.h +0 -11
  20. package/include/node/v8-maybe.h +24 -1
  21. package/include/node/v8-message.h +2 -4
  22. package/include/node/v8-microtask-queue.h +1 -1
  23. package/include/node/v8-object.h +8 -15
  24. package/include/node/v8-persistent-handle.h +0 -2
  25. package/include/node/v8-platform.h +54 -25
  26. package/include/node/v8-primitive.h +8 -8
  27. package/include/node/v8-profiler.h +84 -22
  28. package/include/node/v8-regexp.h +2 -1
  29. package/include/node/v8-script.h +62 -6
  30. package/include/node/v8-template.h +13 -76
  31. package/include/node/v8-value-serializer.h +46 -23
  32. package/include/node/v8-version.h +3 -3
  33. package/include/node/v8-wasm.h +5 -62
  34. package/include/node/v8-weak-callback-info.h +0 -7
  35. package/include/node/v8config.h +247 -13
  36. package/package.json +1 -1
  37. package/share/doc/node/gdbinit +9 -1
  38. package/share/man/man1/node.1 +13 -6
  39. package/share/systemtap/tapset/node.stp +0 -146
@@ -224,11 +224,14 @@ namespace node {
224
224
 
225
225
  class IsolateData;
226
226
  class Environment;
227
+ class MultiIsolatePlatform;
228
+ class InitializationResultImpl;
227
229
 
228
230
  namespace ProcessFlags {
229
231
  enum Flags : uint64_t {
230
232
  kNoFlags = 0,
231
233
  // Enable stdio inheritance, which is disabled by default.
234
+ // This flag is also implied by kNoStdioInitialization.
232
235
  kEnableStdioInheritance = 1 << 0,
233
236
  // Disable reading the NODE_OPTIONS environment variable.
234
237
  kDisableNodeOptionsEnv = 1 << 1,
@@ -236,8 +239,67 @@ enum Flags : uint64_t {
236
239
  kDisableCLIOptions = 1 << 2,
237
240
  // Do not initialize ICU.
238
241
  kNoICU = 1 << 3,
242
+ // Do not modify stdio file descriptor or TTY state.
243
+ kNoStdioInitialization = 1 << 4,
244
+ // Do not register Node.js-specific signal handlers
245
+ // and reset other signal handlers to default state.
246
+ kNoDefaultSignalHandling = 1 << 5,
247
+ // Do not perform V8 initialization.
248
+ kNoInitializeV8 = 1 << 6,
249
+ // Do not initialize a default Node.js-provided V8 platform instance.
250
+ kNoInitializeNodeV8Platform = 1 << 7,
251
+ // Do not initialize OpenSSL config.
252
+ kNoInitOpenSSL = 1 << 8,
253
+ // Do not initialize Node.js debugging based on environment variables.
254
+ kNoParseGlobalDebugVariables = 1 << 9,
255
+ // Do not adjust OS resource limits for this process.
256
+ kNoAdjustResourceLimits = 1 << 10,
257
+ // Do not map code segments into large pages for this process.
258
+ kNoUseLargePages = 1 << 11,
259
+ // Skip printing output for --help, --version, --v8-options.
260
+ kNoPrintHelpOrVersionOutput = 1 << 12,
261
+
262
+ // Emulate the behavior of InitializeNodeWithArgs() when passing
263
+ // a flags argument to the InitializeOncePerProcess() replacement
264
+ // function.
265
+ kLegacyInitializeNodeWithArgsBehavior =
266
+ kNoStdioInitialization | kNoDefaultSignalHandling | kNoInitializeV8 |
267
+ kNoInitializeNodeV8Platform | kNoInitOpenSSL |
268
+ kNoParseGlobalDebugVariables | kNoAdjustResourceLimits |
269
+ kNoUseLargePages | kNoPrintHelpOrVersionOutput,
239
270
  };
240
271
  } // namespace ProcessFlags
272
+ // TODO(addaleax): Make this the canonical name, as it is more descriptive.
273
+ namespace ProcessInitializationFlags = ProcessFlags;
274
+
275
+ class NODE_EXTERN InitializationResult {
276
+ public:
277
+ virtual ~InitializationResult();
278
+
279
+ // Returns a suggested process exit code.
280
+ virtual int exit_code() const = 0;
281
+
282
+ // Returns 'true' if initialization was aborted early due to errors.
283
+ virtual bool early_return() const = 0;
284
+
285
+ // Returns the parsed list of non-Node.js arguments.
286
+ virtual const std::vector<std::string>& args() const = 0;
287
+
288
+ // Returns the parsed list of Node.js arguments.
289
+ virtual const std::vector<std::string>& exec_args() const = 0;
290
+
291
+ // Returns an array of errors. Note that these may be warnings
292
+ // whose existence does not imply a non-zero exit code.
293
+ virtual const std::vector<std::string>& errors() const = 0;
294
+
295
+ // If kNoInitializeNodeV8Platform was not specified, the global Node.js
296
+ // platform instance.
297
+ virtual MultiIsolatePlatform* platform() const = 0;
298
+
299
+ private:
300
+ InitializationResult() = default;
301
+ friend class InitializationResultImpl;
302
+ };
241
303
 
242
304
  // TODO(addaleax): Officially deprecate this and replace it with something
243
305
  // better suited for a public embedder API.
@@ -251,16 +313,40 @@ NODE_EXTERN int Stop(Environment* env);
251
313
  // from argv, fill exec_argv, and possibly add errors resulting from parsing
252
314
  // the arguments to `errors`. The return value is a suggested exit code for the
253
315
  // program; If it is 0, then initializing Node.js succeeded.
254
- NODE_EXTERN int InitializeNodeWithArgs(
255
- std::vector<std::string>* argv,
256
- std::vector<std::string>* exec_argv,
257
- std::vector<std::string>* errors);
258
- // TODO(zcbenz): Turn above overloaded version into below's default argument.
259
- NODE_EXTERN int InitializeNodeWithArgs(
260
- std::vector<std::string>* argv,
261
- std::vector<std::string>* exec_argv,
262
- std::vector<std::string>* errors,
263
- ProcessFlags::Flags flags);
316
+ // This runs a subset of the initialization performed by
317
+ // InitializeOncePerProcess(), which supersedes this function.
318
+ // The subset is roughly equivalent to the one given by
319
+ // `ProcessInitializationFlags::kLegacyInitializeNodeWithArgsBehavior`.
320
+ NODE_DEPRECATED("Use InitializeOncePerProcess() instead",
321
+ NODE_EXTERN int InitializeNodeWithArgs(
322
+ std::vector<std::string>* argv,
323
+ std::vector<std::string>* exec_argv,
324
+ std::vector<std::string>* errors,
325
+ ProcessInitializationFlags::Flags flags =
326
+ ProcessInitializationFlags::kNoFlags));
327
+
328
+ // Set up per-process state needed to run Node.js. This will consume arguments
329
+ // from args, and return information about the initialization success,
330
+ // including the arguments split into argv/exec_argv, a list of potential
331
+ // errors encountered during initialization, and a potential suggested
332
+ // exit code.
333
+ NODE_EXTERN std::unique_ptr<InitializationResult> InitializeOncePerProcess(
334
+ const std::vector<std::string>& args,
335
+ ProcessInitializationFlags::Flags flags =
336
+ ProcessInitializationFlags::kNoFlags);
337
+ // Undoes the initialization performed by InitializeOncePerProcess(),
338
+ // where cleanup is necessary.
339
+ NODE_EXTERN void TearDownOncePerProcess();
340
+ // Convenience overload for specifying multiple flags without having
341
+ // to worry about casts.
342
+ inline std::unique_ptr<InitializationResult> InitializeOncePerProcess(
343
+ const std::vector<std::string>& args,
344
+ std::initializer_list<ProcessInitializationFlags::Flags> list) {
345
+ uint64_t flags_accum = ProcessInitializationFlags::kNoFlags;
346
+ for (const auto flag : list) flags_accum |= static_cast<uint64_t>(flag);
347
+ return InitializeOncePerProcess(
348
+ args, static_cast<ProcessInitializationFlags::Flags>(flags_accum));
349
+ }
264
350
 
265
351
  enum OptionEnvvarSettings {
266
352
  kAllowedInEnvironment,
@@ -22,8 +22,8 @@
22
22
  #ifndef SRC_NODE_VERSION_H_
23
23
  #define SRC_NODE_VERSION_H_
24
24
 
25
- #define NODE_MAJOR_VERSION 18
26
- #define NODE_MINOR_VERSION 10
25
+ #define NODE_MAJOR_VERSION 19
26
+ #define NODE_MINOR_VERSION 0
27
27
  #define NODE_PATCH_VERSION 0
28
28
 
29
29
  #define NODE_VERSION_IS_LTS 0
@@ -89,7 +89,7 @@
89
89
  * version matching should open a pull request to reserve a number in this
90
90
  * registry.
91
91
  */
92
- #define NODE_MODULE_VERSION 108
92
+ #define NODE_MODULE_VERSION 111
93
93
 
94
94
  // The NAPI_VERSION provided by this version of the runtime. This is the version
95
95
  // which the Node binary being built supports.
@@ -12,6 +12,7 @@
12
12
  #include "cppgc/common.h"
13
13
  #include "v8-data.h" // NOLINT(build/include_directory)
14
14
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
15
+ #include "v8-promise.h" // NOLINT(build/include_directory)
15
16
  #include "v8config.h" // NOLINT(build/include_directory)
16
17
 
17
18
  #if defined(V8_OS_WIN)
@@ -105,7 +106,7 @@ struct JitCodeEvent {
105
106
  size_t line_number_table_size;
106
107
  };
107
108
 
108
- wasm_source_info_t* wasm_source_info;
109
+ wasm_source_info_t* wasm_source_info = nullptr;
109
110
 
110
111
  union {
111
112
  // Only valid for CODE_ADDED.
@@ -216,7 +217,13 @@ using AddHistogramSampleCallback = void (*)(void* histogram, int sample);
216
217
 
217
218
  using FatalErrorCallback = void (*)(const char* location, const char* message);
218
219
 
219
- using OOMErrorCallback = void (*)(const char* location, bool is_heap_oom);
220
+ struct OOMDetails {
221
+ bool is_heap_oom = false;
222
+ const char* detail = nullptr;
223
+ };
224
+
225
+ using OOMErrorCallback = void (*)(const char* location,
226
+ const OOMDetails& details);
220
227
 
221
228
  using MessageCallback = void (*)(Local<Message> message, Local<Value> data);
222
229
 
@@ -231,8 +238,11 @@ enum class CrashKeyId {
231
238
  kIsolateAddress,
232
239
  kReadonlySpaceFirstPageAddress,
233
240
  kMapSpaceFirstPageAddress,
241
+ kCodeRangeBaseAddress,
234
242
  kCodeSpaceFirstPageAddress,
235
243
  kDumpType,
244
+ kSnapshotChecksumCalculated,
245
+ kSnapshotChecksumExpected,
236
246
  };
237
247
 
238
248
  using AddCrashKeyCallback = void (*)(CrashKeyId id, const std::string& value);
@@ -300,6 +310,13 @@ using ApiImplementationCallback = void (*)(const FunctionCallbackInfo<Value>&);
300
310
  // --- Callback for WebAssembly.compileStreaming ---
301
311
  using WasmStreamingCallback = void (*)(const FunctionCallbackInfo<Value>&);
302
312
 
313
+ enum class WasmAsyncSuccess { kSuccess, kFail };
314
+
315
+ // --- Callback called when async WebAssembly operations finish ---
316
+ using WasmAsyncResolvePromiseCallback = void (*)(
317
+ Isolate* isolate, Local<Context> context, Local<Promise::Resolver> resolver,
318
+ Local<Value> result, WasmAsyncSuccess success);
319
+
303
320
  // --- Callback for loading source map file for Wasm profiling support
304
321
  using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
305
322
  const char* name);
@@ -310,9 +327,6 @@ using WasmSimdEnabledCallback = bool (*)(Local<Context> context);
310
327
  // --- Callback for checking if WebAssembly exceptions are enabled ---
311
328
  using WasmExceptionsEnabledCallback = bool (*)(Local<Context> context);
312
329
 
313
- // --- Callback for checking if WebAssembly dynamic tiering is enabled ---
314
- using WasmDynamicTieringEnabledCallback = bool (*)(Local<Context> context);
315
-
316
330
  // --- Callback for checking if the SharedArrayBuffer constructor is enabled ---
317
331
  using SharedArrayBufferConstructorEnabledCallback =
318
332
  bool (*)(Local<Context> context);
@@ -244,6 +244,12 @@ class V8_EXPORT Context : public Data {
244
244
  */
245
245
  void SetErrorMessageForCodeGenerationFromStrings(Local<String> message);
246
246
 
247
+ /**
248
+ * Sets the error description for the exception that is thrown when
249
+ * wasm code generation is not allowed.
250
+ */
251
+ void SetErrorMessageForWasmCodeGeneration(Local<String> message);
252
+
247
253
  /**
248
254
  * Return data that was previously attached to the context snapshot via
249
255
  * SnapshotCreator, and removes the reference to it.
@@ -374,15 +380,13 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
374
380
  A ctx = *reinterpret_cast<const A*>(this);
375
381
  A embedder_data =
376
382
  I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
377
- int value_offset =
378
- I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
379
- #ifdef V8_SANDBOXED_EXTERNAL_POINTERS
380
- value_offset += I::kEmbedderDataSlotRawPayloadOffset;
381
- #endif
382
- internal::Isolate* isolate = I::GetIsolateForSandbox(ctx);
383
+ int value_offset = I::kEmbedderDataArrayHeaderSize +
384
+ (I::kEmbedderDataSlotSize * index) +
385
+ I::kEmbedderDataSlotExternalPointerOffset;
386
+ Isolate* isolate = I::GetIsolateForSandbox(ctx);
383
387
  return reinterpret_cast<void*>(
384
- I::ReadExternalPointerField(isolate, embedder_data, value_offset,
385
- internal::kEmbedderDataSlotPayloadTag));
388
+ I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
389
+ isolate, embedder_data, value_offset));
386
390
  #else
387
391
  return SlowGetAlignedPointerFromEmbedderData(index);
388
392
  #endif
@@ -27,6 +27,11 @@ class V8_EXPORT Date : public Object {
27
27
  */
28
28
  double ValueOf() const;
29
29
 
30
+ /**
31
+ * Generates ISO string representation.
32
+ */
33
+ v8::Local<v8::String> ToISOString() const;
34
+
30
35
  V8_INLINE static Date* Cast(Value* value) {
31
36
  #ifdef V8_ENABLE_CHECKS
32
37
  CheckCast(value);
@@ -69,7 +69,12 @@ class V8_EXPORT EmbedderRootsHandler {
69
69
  * trace through its heap and use reporter to report each JavaScript object
70
70
  * reachable from any of the given wrappers.
71
71
  */
72
- class V8_EXPORT EmbedderHeapTracer {
72
+ class V8_EXPORT
73
+ // GCC doesn't like combining __attribute__(()) with [[deprecated]].
74
+ #ifdef __clang__
75
+ V8_DEPRECATE_SOON("Use CppHeap when working with v8::TracedReference.")
76
+ #endif // __clang__
77
+ EmbedderHeapTracer {
73
78
  public:
74
79
  using EmbedderStackState = cppgc::EmbedderStackState;
75
80
 
@@ -205,10 +210,10 @@ class V8_EXPORT EmbedderHeapTracer {
205
210
  * Returns the v8::Isolate this tracer is attached too and |nullptr| if it
206
211
  * is not attached to any v8::Isolate.
207
212
  */
208
- v8::Isolate* isolate() const { return isolate_; }
213
+ v8::Isolate* isolate() const { return v8_isolate_; }
209
214
 
210
215
  protected:
211
- v8::Isolate* isolate_ = nullptr;
216
+ v8::Isolate* v8_isolate_ = nullptr;
212
217
 
213
218
  friend class internal::LocalEmbedderHeapTracer;
214
219
  };
@@ -197,7 +197,7 @@ class V8_EXPORT TryCatch {
197
197
 
198
198
  void ResetInternal();
199
199
 
200
- internal::Isolate* isolate_;
200
+ internal::Isolate* i_isolate_;
201
201
  TryCatch* next_;
202
202
  void* exception_;
203
203
  void* message_obj_;
@@ -106,6 +106,14 @@ class V8_EXPORT Function : public Object {
106
106
  V8_WARN_UNUSED_RESULT MaybeLocal<String> FunctionProtoToString(
107
107
  Local<Context> context);
108
108
 
109
+ /**
110
+ * Returns true if the function does nothing.
111
+ * The function returns false on error.
112
+ * Note that this function is experimental. Embedders should not rely on
113
+ * this existing. We may remove this function in the future.
114
+ */
115
+ V8_WARN_UNUSED_RESULT bool Experimental_IsNopFunction() const;
116
+
109
117
  ScriptOrigin GetScriptOrigin() const;
110
118
  V8_INLINE static Function* Cast(Value* value) {
111
119
  #ifdef V8_ENABLE_CHECKS
@@ -100,9 +100,6 @@ class V8_EXPORT V8 {
100
100
  const int kBuildConfiguration =
101
101
  (internal::PointerCompressionIsEnabled() ? kPointerCompression : 0) |
102
102
  (internal::SmiValuesAre31Bits() ? k31BitSmis : 0) |
103
- (internal::SandboxedExternalPointersAreEnabled()
104
- ? kSandboxedExternalPointers
105
- : 0) |
106
103
  (internal::SandboxIsEnabled() ? kSandbox : 0);
107
104
  return Initialize(kBuildConfiguration);
108
105
  }
@@ -184,30 +181,19 @@ class V8_EXPORT V8 {
184
181
  * V8 was disposed.
185
182
  */
186
183
  static void DisposePlatform();
187
- V8_DEPRECATED("Use DisposePlatform()")
188
- static void ShutdownPlatform() { DisposePlatform(); }
189
-
190
- #ifdef V8_SANDBOX
191
- //
192
- // Sandbox related API.
193
- //
194
- // This API is not yet stable and subject to changes in the future.
195
- //
196
184
 
185
+ #if defined(V8_ENABLE_SANDBOX)
197
186
  /**
198
- * Initializes the V8 sandbox.
199
- *
200
- * This must be invoked after the platform was initialized but before V8 is
201
- * initialized. The sandbox is torn down during platform shutdown.
202
- * Returns true on success, false otherwise.
187
+ * Returns true if the sandbox is configured securely.
203
188
  *
204
- * TODO(saelo) Once it is no longer optional to initialize the sandbox when
205
- * compiling with V8_SANDBOX, the sandbox initialization will likely happen
206
- * as part of V8::Initialize, at which point this function should be removed.
189
+ * If V8 cannot create a regular sandbox during initialization, for example
190
+ * because not enough virtual address space can be reserved, it will instead
191
+ * create a fallback sandbox that still allows it to function normally but
192
+ * does not have the same security properties as a regular sandbox. This API
193
+ * can be used to determine if such a fallback sandbox is being used, in
194
+ * which case it will return false.
207
195
  */
208
- static bool InitializeSandbox();
209
- V8_DEPRECATE_SOON("Use InitializeSandbox()")
210
- static bool InitializeVirtualMemoryCage() { return InitializeSandbox(); }
196
+ static bool IsSandboxConfiguredSecurely();
211
197
 
212
198
  /**
213
199
  * Provides access to the virtual address subspace backing the sandbox.
@@ -220,39 +206,29 @@ class V8_EXPORT V8 {
220
206
  * and so in particular the contents of pages allocagted in this virtual
221
207
  * address space, arbitrarily and concurrently. Due to this, it is
222
208
  * recommended to to only place pure data buffers in them.
223
- *
224
- * This function must only be called after initializing the sandbox.
225
209
  */
226
210
  static VirtualAddressSpace* GetSandboxAddressSpace();
227
- V8_DEPRECATE_SOON("Use GetSandboxAddressSpace()")
228
- static PageAllocator* GetVirtualMemoryCagePageAllocator();
229
211
 
230
212
  /**
231
213
  * Returns the size of the sandbox in bytes.
232
214
  *
233
- * If the sandbox has not been initialized, or if the initialization failed,
234
- * this returns zero.
215
+ * This represents the size of the address space that V8 can directly address
216
+ * and in which it allocates its objects.
235
217
  */
236
218
  static size_t GetSandboxSizeInBytes();
237
- V8_DEPRECATE_SOON("Use GetSandboxSizeInBytes()")
238
- static size_t GetVirtualMemoryCageSizeInBytes() {
239
- return GetSandboxSizeInBytes();
240
- }
241
219
 
242
220
  /**
243
- * Returns whether the sandbox is configured securely.
221
+ * Returns the size of the address space reservation backing the sandbox.
244
222
  *
245
- * If V8 cannot create a proper sandbox, it will fall back to creating a
246
- * sandbox that doesn't have the desired security properties but at least
247
- * still allows V8 to function. This API can be used to determine if such an
248
- * insecure sandbox is being used, in which case it will return false.
223
+ * This may be larger than the sandbox (i.e. |GetSandboxSizeInBytes()|) due
224
+ * to surrounding guard regions, or may be smaller than the sandbox in case a
225
+ * fallback sandbox is being used, which will use a smaller virtual address
226
+ * space reservation. In the latter case this will also be different from
227
+ * |GetSandboxAddressSpace()->size()| as that will cover a larger part of the
228
+ * address space than what has actually been reserved.
249
229
  */
250
- static bool IsSandboxConfiguredSecurely();
251
- V8_DEPRECATE_SOON("Use IsSandboxConfiguredSecurely()")
252
- static bool IsUsingSecureVirtualMemoryCage() {
253
- return IsSandboxConfiguredSecurely();
254
- }
255
- #endif
230
+ static size_t GetSandboxReservationSizeInBytes();
231
+ #endif // V8_ENABLE_SANDBOX
256
232
 
257
233
  /**
258
234
  * Activate trap-based bounds checking for WebAssembly.
@@ -273,7 +249,7 @@ class V8_EXPORT V8 {
273
249
  * exceptions in V8-generated code.
274
250
  */
275
251
  static void SetUnhandledExceptionCallback(
276
- UnhandledExceptionCallback unhandled_exception_callback);
252
+ UnhandledExceptionCallback callback);
277
253
  #endif
278
254
 
279
255
  /**
@@ -281,8 +257,7 @@ class V8_EXPORT V8 {
281
257
  * v8 has encountered a fatal failure to allocate memory and is about to
282
258
  * terminate.
283
259
  */
284
-
285
- static void SetFatalMemoryErrorCallback(OOMErrorCallback oom_error_callback);
260
+ static void SetFatalMemoryErrorCallback(OOMErrorCallback callback);
286
261
 
287
262
  /**
288
263
  * Get statistics about the shared memory usage.
@@ -295,8 +270,7 @@ class V8_EXPORT V8 {
295
270
  enum BuildConfigurationFeatures {
296
271
  kPointerCompression = 1 << 0,
297
272
  k31BitSmis = 1 << 1,
298
- kSandboxedExternalPointers = 1 << 2,
299
- kSandbox = 1 << 3,
273
+ kSandbox = 1 << 2,
300
274
  };
301
275
 
302
276
  /**