node-aix-ppc64 23.11.0 → 24.0.1
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.
- package/CHANGELOG.md +446 -1929
- package/LICENSE +2 -2
- package/README.md +4 -0
- package/bin/node +0 -0
- package/include/node/common.gypi +4 -11
- package/include/node/config.gypi +4 -6
- package/include/node/cppgc/allocation.h +1 -2
- package/include/node/cppgc/default-platform.h +3 -2
- package/include/node/cppgc/heap-consistency.h +1 -1
- package/include/node/cppgc/internal/api-constants.h +0 -17
- package/include/node/cppgc/internal/base-page-handle.h +2 -4
- package/include/node/cppgc/internal/caged-heap-local-data.h +0 -4
- package/include/node/cppgc/internal/caged-heap.h +0 -4
- package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
- package/include/node/cppgc/internal/logging.h +3 -3
- package/include/node/cppgc/internal/member-storage.h +63 -20
- package/include/node/cppgc/internal/persistent-node.h +8 -3
- package/include/node/cppgc/internal/pointer-policies.h +48 -11
- package/include/node/cppgc/macros.h +21 -0
- package/include/node/cppgc/member.h +70 -36
- package/include/node/cppgc/name-provider.h +3 -0
- package/include/node/cppgc/platform.h +11 -0
- package/include/node/cppgc/type-traits.h +1 -0
- package/include/node/cppgc/visitor.h +25 -1
- package/include/node/libplatform/libplatform-export.h +2 -2
- package/include/node/libplatform/v8-tracing.h +0 -1
- package/include/node/node.exp +27719 -25103
- package/include/node/node.h +58 -15
- package/include/node/node_version.h +4 -4
- package/include/node/v8-array-buffer.h +111 -34
- package/include/node/v8-callbacks.h +84 -26
- package/include/node/v8-context.h +7 -6
- package/include/node/v8-cppgc.h +2 -1
- package/include/node/v8-data.h +5 -0
- package/include/node/v8-debug.h +11 -0
- package/include/node/v8-embedder-heap.h +1 -32
- package/include/node/v8-exception.h +2 -0
- package/include/node/v8-function-callback.h +4 -33
- package/include/node/v8-function.h +7 -0
- package/include/node/v8-handle-base.h +18 -0
- package/include/node/v8-initialization.h +9 -1
- package/include/node/v8-internal.h +477 -399
- package/include/node/v8-isolate.h +218 -151
- package/include/node/v8-local-handle.h +56 -28
- package/include/node/v8-maybe.h +2 -1
- package/include/node/v8-memory-span.h +149 -24
- package/include/node/v8-message.h +9 -1
- package/include/node/v8-object.h +7 -2
- package/include/node/v8-persistent-handle.h +17 -17
- package/include/node/v8-platform.h +48 -13
- package/include/node/v8-primitive.h +131 -6
- package/include/node/v8-profiler.h +13 -1
- package/include/node/v8-proxy.h +0 -1
- package/include/node/v8-regexp.h +0 -1
- package/include/node/v8-sandbox.h +3 -3
- package/include/node/v8-script.h +21 -3
- package/include/node/v8-source-location.h +6 -1
- package/include/node/v8-template.h +8 -2
- package/include/node/v8-traced-handle.h +16 -17
- package/include/node/v8-typed-array.h +6 -10
- package/include/node/v8-value.h +18 -0
- package/include/node/v8-version.h +4 -4
- package/include/node/v8-wasm.h +24 -0
- package/include/node/v8-weak-callback-info.h +20 -12
- package/include/node/v8.h +3 -3
- package/include/node/v8config.h +34 -40
- package/package.json +1 -1
- package/share/doc/node/gdbinit +94 -30
- package/share/doc/node/lldb_commands.py +107 -13
- package/share/man/man1/node.1 +3 -0
- package/include/node/cppgc/ephemeron-pair.h +0 -30
package/include/node/node.h
CHANGED
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
#endif
|
|
68
68
|
|
|
69
69
|
#ifdef _WIN32
|
|
70
|
-
#
|
|
70
|
+
#define SIGQUIT 3
|
|
71
|
+
#define SIGKILL 9
|
|
71
72
|
#endif
|
|
72
73
|
|
|
73
74
|
#include "v8.h" // NOLINT(build/include_order)
|
|
@@ -374,10 +375,6 @@ enum OptionEnvvarSettings {
|
|
|
374
375
|
// Disallow the options to be set via the environment variable, like
|
|
375
376
|
// `NODE_OPTIONS`.
|
|
376
377
|
kDisallowedInEnvvar = 1,
|
|
377
|
-
// Deprecated, use kAllowedInEnvvar instead.
|
|
378
|
-
kAllowedInEnvironment = kAllowedInEnvvar,
|
|
379
|
-
// Deprecated, use kDisallowedInEnvvar instead.
|
|
380
|
-
kDisallowedInEnvironment = kDisallowedInEnvvar,
|
|
381
378
|
};
|
|
382
379
|
|
|
383
380
|
// Process the arguments and set up the per-process options.
|
|
@@ -450,8 +447,11 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
|
|
|
450
447
|
|
|
451
448
|
// This function may only be called once per `Isolate`, and discard any
|
|
452
449
|
// pending delayed tasks scheduled for that isolate.
|
|
453
|
-
// This needs to be called right
|
|
450
|
+
// This needs to be called right after calling `Isolate::Dispose()`.
|
|
454
451
|
virtual void UnregisterIsolate(v8::Isolate* isolate) = 0;
|
|
452
|
+
// This disposes, unregisters and frees up an isolate that's allocated using
|
|
453
|
+
// v8::Isolate::Allocate() in the correct order to prevent race conditions.
|
|
454
|
+
void DisposeIsolate(v8::Isolate* isolate);
|
|
455
455
|
|
|
456
456
|
// The platform should call the passed function once all state associated
|
|
457
457
|
// with the given isolate has been cleaned up. This can, but does not have to,
|
|
@@ -492,6 +492,21 @@ struct IsolateSettings {
|
|
|
492
492
|
allow_wasm_code_generation_callback = nullptr;
|
|
493
493
|
v8::ModifyCodeGenerationFromStringsCallback2
|
|
494
494
|
modify_code_generation_from_strings_callback = nullptr;
|
|
495
|
+
|
|
496
|
+
// When the settings is passed to NewIsolate():
|
|
497
|
+
// - If cpp_heap is not nullptr, this CppHeap will be used to create
|
|
498
|
+
// the isolate and its ownership will be passed to V8.
|
|
499
|
+
// - If this is nullptr, Node.js will create a CppHeap that will be
|
|
500
|
+
// owned by V8.
|
|
501
|
+
//
|
|
502
|
+
// When the settings is passed to SetIsolateUpForNode():
|
|
503
|
+
// cpp_heap will be ignored. Embedders must ensure that the
|
|
504
|
+
// v8::Isolate has a CppHeap attached while it's still used by
|
|
505
|
+
// Node.js, for example using v8::CreateParams.
|
|
506
|
+
//
|
|
507
|
+
// See https://issues.chromium.org/issues/42203693. In future version
|
|
508
|
+
// of V8, this CppHeap will be created by V8 if not provided.
|
|
509
|
+
v8::CppHeap* cpp_heap = nullptr;
|
|
495
510
|
};
|
|
496
511
|
|
|
497
512
|
// Represents a startup snapshot blob, e.g. created by passing
|
|
@@ -546,8 +561,8 @@ class EmbedderSnapshotData {
|
|
|
546
561
|
void ToFile(FILE* out) const;
|
|
547
562
|
std::vector<char> ToBlob() const;
|
|
548
563
|
|
|
549
|
-
// Returns whether custom snapshots can be used. Currently, this
|
|
550
|
-
//
|
|
564
|
+
// Returns whether custom snapshots can be used. Currently, this always
|
|
565
|
+
// returns false since V8 enforces shared readonly-heap.
|
|
551
566
|
static bool CanUseCustomSnapshotPerIsolate();
|
|
552
567
|
|
|
553
568
|
EmbedderSnapshotData(const EmbedderSnapshotData&) = delete;
|
|
@@ -1127,16 +1142,37 @@ NODE_EXTERN enum encoding ParseEncoding(
|
|
|
1127
1142
|
NODE_EXTERN void FatalException(v8::Isolate* isolate,
|
|
1128
1143
|
const v8::TryCatch& try_catch);
|
|
1129
1144
|
|
|
1130
|
-
NODE_EXTERN v8::
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1145
|
+
NODE_EXTERN v8::MaybeLocal<v8::Value> TryEncode(
|
|
1146
|
+
v8::Isolate* isolate,
|
|
1147
|
+
const char* buf,
|
|
1148
|
+
size_t len,
|
|
1149
|
+
enum encoding encoding = LATIN1);
|
|
1134
1150
|
|
|
1135
1151
|
// Warning: This reverses endianness on Big Endian platforms, even though the
|
|
1136
1152
|
// signature using uint16_t implies that it should not.
|
|
1137
|
-
NODE_EXTERN v8::
|
|
1138
|
-
|
|
1139
|
-
|
|
1153
|
+
NODE_EXTERN v8::MaybeLocal<v8::Value> TryEncode(v8::Isolate* isolate,
|
|
1154
|
+
const uint16_t* buf,
|
|
1155
|
+
size_t len);
|
|
1156
|
+
|
|
1157
|
+
// The original Encode(...) functions are deprecated because they do not
|
|
1158
|
+
// appropriately propagate exceptions and instead rely on ToLocalChecked()
|
|
1159
|
+
// which crashes the process if an exception occurs. We cannot just remove
|
|
1160
|
+
// these as it would break ABI compatibility, so we keep them around but
|
|
1161
|
+
// deprecate them in favor of the TryEncode(...) variations which return
|
|
1162
|
+
// a MaybeLocal<> and do not crash the process if an exception occurs.
|
|
1163
|
+
NODE_DEPRECATED(
|
|
1164
|
+
"Use TryEncode(...) instead",
|
|
1165
|
+
NODE_EXTERN v8::Local<v8::Value> Encode(v8::Isolate* isolate,
|
|
1166
|
+
const char* buf,
|
|
1167
|
+
size_t len,
|
|
1168
|
+
enum encoding encoding = LATIN1));
|
|
1169
|
+
|
|
1170
|
+
// Warning: This reverses endianness on Big Endian platforms, even though the
|
|
1171
|
+
// signature using uint16_t implies that it should not.
|
|
1172
|
+
NODE_DEPRECATED("Use TryEncode(...) instead",
|
|
1173
|
+
NODE_EXTERN v8::Local<v8::Value> Encode(v8::Isolate* isolate,
|
|
1174
|
+
const uint16_t* buf,
|
|
1175
|
+
size_t len));
|
|
1140
1176
|
|
|
1141
1177
|
// Returns -1 if the handle was not valid for decoding
|
|
1142
1178
|
NODE_EXTERN ssize_t DecodeBytes(v8::Isolate* isolate,
|
|
@@ -1386,6 +1422,12 @@ NODE_EXTERN void RequestInterrupt(Environment* env,
|
|
|
1386
1422
|
* I/O from native code. */
|
|
1387
1423
|
NODE_EXTERN async_id AsyncHooksGetExecutionAsyncId(v8::Isolate* isolate);
|
|
1388
1424
|
|
|
1425
|
+
/* Returns the id of the current execution context. If the return value is
|
|
1426
|
+
* zero then no execution has been set. This will happen if the user handles
|
|
1427
|
+
* I/O from native code. */
|
|
1428
|
+
NODE_EXTERN async_id
|
|
1429
|
+
AsyncHooksGetExecutionAsyncId(v8::Local<v8::Context> context);
|
|
1430
|
+
|
|
1389
1431
|
/* Return same value as async_hooks.triggerAsyncId(); */
|
|
1390
1432
|
NODE_EXTERN async_id AsyncHooksGetTriggerAsyncId(v8::Isolate* isolate);
|
|
1391
1433
|
|
|
@@ -1529,6 +1571,7 @@ class NODE_EXTERN AsyncResource {
|
|
|
1529
1571
|
private:
|
|
1530
1572
|
Environment* env_;
|
|
1531
1573
|
v8::Global<v8::Object> resource_;
|
|
1574
|
+
v8::Global<v8::Value> context_frame_;
|
|
1532
1575
|
async_context async_context_;
|
|
1533
1576
|
};
|
|
1534
1577
|
|
|
@@ -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
|
|
26
|
-
#define NODE_MINOR_VERSION
|
|
27
|
-
#define NODE_PATCH_VERSION
|
|
25
|
+
#define NODE_MAJOR_VERSION 24
|
|
26
|
+
#define NODE_MINOR_VERSION 0
|
|
27
|
+
#define NODE_PATCH_VERSION 1
|
|
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
|
|
98
|
+
#define NODE_MODULE_VERSION 137
|
|
99
99
|
#endif
|
|
100
100
|
|
|
101
101
|
// The NAPI_VERSION supported by the runtime. This is the inclusive range of
|
|
@@ -10,13 +10,20 @@
|
|
|
10
10
|
#include <memory>
|
|
11
11
|
|
|
12
12
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
13
|
+
#include "v8-memory-span.h" // NOLINT(build/include_directory)
|
|
13
14
|
#include "v8-object.h" // NOLINT(build/include_directory)
|
|
15
|
+
#include "v8-platform.h" // NOLINT(build/include_directory)
|
|
14
16
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
15
17
|
|
|
16
18
|
namespace v8 {
|
|
17
19
|
|
|
18
20
|
class SharedArrayBuffer;
|
|
19
21
|
|
|
22
|
+
#if defined(V8_COMPRESS_POINTERS) && \
|
|
23
|
+
!defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE)
|
|
24
|
+
class IsolateGroup;
|
|
25
|
+
#endif
|
|
26
|
+
|
|
20
27
|
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
|
|
21
28
|
// Defined using gn arg `v8_array_buffer_internal_field_count`.
|
|
22
29
|
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
|
|
@@ -24,6 +31,7 @@ class SharedArrayBuffer;
|
|
|
24
31
|
|
|
25
32
|
enum class ArrayBufferCreationMode { kInternalized, kExternalized };
|
|
26
33
|
enum class BackingStoreInitializationMode { kZeroInitialized, kUninitialized };
|
|
34
|
+
enum class BackingStoreOnFailureMode { kReturnNull, kOutOfMemory };
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
37
|
* A wrapper around the backing store (i.e. the raw memory) of an array buffer.
|
|
@@ -83,18 +91,6 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase {
|
|
|
83
91
|
*/
|
|
84
92
|
void operator delete(void* ptr) { ::operator delete(ptr); }
|
|
85
93
|
|
|
86
|
-
/**
|
|
87
|
-
* Wrapper around ArrayBuffer::Allocator::Reallocate that preserves IsShared.
|
|
88
|
-
* Assumes that the backing_store was allocated by the ArrayBuffer allocator
|
|
89
|
-
* of the given isolate.
|
|
90
|
-
*/
|
|
91
|
-
V8_DEPRECATED(
|
|
92
|
-
"Reallocate is unsafe, please do not use. Please allocate a new "
|
|
93
|
-
"BackingStore and copy instead.")
|
|
94
|
-
static std::unique_ptr<BackingStore> Reallocate(
|
|
95
|
-
v8::Isolate* isolate, std::unique_ptr<BackingStore> backing_store,
|
|
96
|
-
size_t byte_length);
|
|
97
|
-
|
|
98
94
|
/**
|
|
99
95
|
* This callback is used only if the memory block for a BackingStore cannot be
|
|
100
96
|
* allocated with an ArrayBuffer::Allocator. In such cases the destructor of
|
|
@@ -172,21 +168,13 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
|
172
168
|
virtual void Free(void* data, size_t length) = 0;
|
|
173
169
|
|
|
174
170
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* The caller guarantees that the memory block was previously allocated
|
|
182
|
-
* using Allocate or AllocateUninitialized.
|
|
183
|
-
*
|
|
184
|
-
* The default implementation allocates a new block and copies data.
|
|
171
|
+
* Returns a size_t that determines the largest ArrayBuffer that can be
|
|
172
|
+
* allocated. Override if your Allocator is more restrictive than the
|
|
173
|
+
* default. Will only be called once, and the value returned will be
|
|
174
|
+
* cached.
|
|
175
|
+
* Should not return a value that is larger than kMaxByteLength.
|
|
185
176
|
*/
|
|
186
|
-
|
|
187
|
-
"Reallocate is unsafe, please do not use. Please allocate new memory "
|
|
188
|
-
"and copy instead.")
|
|
189
|
-
virtual void* Reallocate(void* data, size_t old_length, size_t new_length);
|
|
177
|
+
virtual size_t MaxAllocationSize() const { return kMaxByteLength; }
|
|
190
178
|
|
|
191
179
|
/**
|
|
192
180
|
* ArrayBuffer allocation mode. kNormal is a malloc/free style allocation,
|
|
@@ -195,11 +183,37 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
|
195
183
|
*/
|
|
196
184
|
enum class AllocationMode { kNormal, kReservation };
|
|
197
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Returns page allocator used by this Allocator instance.
|
|
188
|
+
*
|
|
189
|
+
* When the sandbox used by Allocator it is expected that this returns
|
|
190
|
+
* sandbox's page allocator.
|
|
191
|
+
* Otherwise, it should return system page allocator.
|
|
192
|
+
*/
|
|
193
|
+
virtual PageAllocator* GetPageAllocator() { return nullptr; }
|
|
194
|
+
|
|
195
|
+
#if defined(V8_COMPRESS_POINTERS) && \
|
|
196
|
+
!defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE)
|
|
198
197
|
/**
|
|
199
198
|
* Convenience allocator.
|
|
200
199
|
*
|
|
201
200
|
* When the sandbox is enabled, this allocator will allocate its backing
|
|
202
|
-
* memory inside the sandbox
|
|
201
|
+
* memory inside the sandbox that belongs to passed isolate group.
|
|
202
|
+
* Otherwise, it will rely on malloc/free.
|
|
203
|
+
*
|
|
204
|
+
* Caller takes ownership, i.e. the returned object needs to be freed using
|
|
205
|
+
* |delete allocator| once it is no longer in use.
|
|
206
|
+
*/
|
|
207
|
+
static Allocator* NewDefaultAllocator(const IsolateGroup& group);
|
|
208
|
+
#endif // defined(V8_COMPRESS_POINTERS) &&
|
|
209
|
+
// !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE)
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Convenience allocator.
|
|
213
|
+
*
|
|
214
|
+
* When the sandbox is enabled, this allocator will allocate its backing
|
|
215
|
+
* memory inside the default global sandbox. Otherwise, it will rely on
|
|
216
|
+
* malloc/free.
|
|
203
217
|
*
|
|
204
218
|
* Caller takes ownership, i.e. the returned object needs to be freed using
|
|
205
219
|
* |delete allocator| once it is no longer in use.
|
|
@@ -217,6 +231,18 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
|
217
231
|
*/
|
|
218
232
|
size_t MaxByteLength() const;
|
|
219
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Attempt to create a new ArrayBuffer. Allocate |byte_length| bytes.
|
|
236
|
+
* Allocated memory will be owned by a created ArrayBuffer and
|
|
237
|
+
* will be deallocated when it is garbage-collected,
|
|
238
|
+
* unless the object is externalized. If allocation fails, the Maybe
|
|
239
|
+
* returned will be empty.
|
|
240
|
+
*/
|
|
241
|
+
static MaybeLocal<ArrayBuffer> MaybeNew(
|
|
242
|
+
Isolate* isolate, size_t byte_length,
|
|
243
|
+
BackingStoreInitializationMode initialization_mode =
|
|
244
|
+
BackingStoreInitializationMode::kZeroInitialized);
|
|
245
|
+
|
|
220
246
|
/**
|
|
221
247
|
* Create a new ArrayBuffer. Allocate |byte_length| bytes, which are either
|
|
222
248
|
* zero-initialized or uninitialized. Allocated memory will be owned by a
|
|
@@ -246,17 +272,25 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
|
246
272
|
/**
|
|
247
273
|
* Returns a new standalone BackingStore that is allocated using the array
|
|
248
274
|
* buffer allocator of the isolate. The allocation can either be zero
|
|
249
|
-
*
|
|
275
|
+
* initialized, or uninitialized. The result can be later passed to
|
|
250
276
|
* ArrayBuffer::New.
|
|
251
277
|
*
|
|
252
278
|
* If the allocator returns nullptr, then the function may cause GCs in the
|
|
253
|
-
* given isolate and re-try the allocation.
|
|
279
|
+
* given isolate and re-try the allocation.
|
|
280
|
+
*
|
|
281
|
+
* If GCs do not help and on_failure is kOutOfMemory, then the
|
|
254
282
|
* function will crash with an out-of-memory error.
|
|
283
|
+
*
|
|
284
|
+
* Otherwise if GCs do not help (or the allocation is too large for GCs to
|
|
285
|
+
* help) and on_failure is kReturnNull, then a null result is returned.
|
|
255
286
|
*/
|
|
256
287
|
static std::unique_ptr<BackingStore> NewBackingStore(
|
|
257
288
|
Isolate* isolate, size_t byte_length,
|
|
258
289
|
BackingStoreInitializationMode initialization_mode =
|
|
259
|
-
BackingStoreInitializationMode::kZeroInitialized
|
|
290
|
+
BackingStoreInitializationMode::kZeroInitialized,
|
|
291
|
+
BackingStoreOnFailureMode on_failure =
|
|
292
|
+
BackingStoreOnFailureMode::kOutOfMemory);
|
|
293
|
+
|
|
260
294
|
/**
|
|
261
295
|
* Returns a new standalone BackingStore that takes over the ownership of
|
|
262
296
|
* the given buffer. The destructor of the BackingStore invokes the given
|
|
@@ -354,9 +388,21 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
|
354
388
|
V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
|
|
355
389
|
static constexpr int kEmbedderFieldCount = kInternalFieldCount;
|
|
356
390
|
|
|
391
|
+
#if V8_ENABLE_SANDBOX
|
|
392
|
+
static constexpr size_t kMaxByteLength =
|
|
393
|
+
internal::kMaxSafeBufferSizeForSandbox;
|
|
394
|
+
#elif V8_HOST_ARCH_32_BIT
|
|
395
|
+
static constexpr size_t kMaxByteLength = std::numeric_limits<int>::max();
|
|
396
|
+
#else
|
|
397
|
+
// The maximum safe integer (2^53 - 1).
|
|
398
|
+
static constexpr size_t kMaxByteLength =
|
|
399
|
+
static_cast<size_t>((uint64_t{1} << 53) - 1);
|
|
400
|
+
#endif
|
|
401
|
+
|
|
357
402
|
private:
|
|
358
403
|
ArrayBuffer();
|
|
359
404
|
static void CheckCast(Value* obj);
|
|
405
|
+
friend class TypedArray;
|
|
360
406
|
};
|
|
361
407
|
|
|
362
408
|
#ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
|
|
@@ -394,6 +440,16 @@ class V8_EXPORT ArrayBufferView : public Object {
|
|
|
394
440
|
*/
|
|
395
441
|
size_t CopyContents(void* dest, size_t byte_length);
|
|
396
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Returns the contents of the ArrayBufferView's buffer as a MemorySpan. If
|
|
445
|
+
* the contents are on the V8 heap, they get copied into `storage`. Otherwise
|
|
446
|
+
* a view into the off-heap backing store is returned. The provided storage
|
|
447
|
+
* should be at least as large as the maximum on-heap size of a TypedArray,
|
|
448
|
+
* was defined in gn with `typed_array_max_size_in_heap`. The default value is
|
|
449
|
+
* 64 bytes.
|
|
450
|
+
*/
|
|
451
|
+
v8::MemorySpan<uint8_t> GetContents(v8::MemorySpan<uint8_t> storage);
|
|
452
|
+
|
|
397
453
|
/**
|
|
398
454
|
* Returns true if ArrayBufferView's backing ArrayBuffer has already been
|
|
399
455
|
* allocated.
|
|
@@ -463,6 +519,18 @@ class V8_EXPORT SharedArrayBuffer : public Object {
|
|
|
463
519
|
BackingStoreInitializationMode initialization_mode =
|
|
464
520
|
BackingStoreInitializationMode::kZeroInitialized);
|
|
465
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Create a new SharedArrayBuffer. Allocate |byte_length| bytes, which are
|
|
524
|
+
* either zero-initialized or uninitialized. Allocated memory will be owned by
|
|
525
|
+
* a created SharedArrayBuffer and will be deallocated when it is
|
|
526
|
+
* garbage-collected, unless the object is externalized. If allocation
|
|
527
|
+
* fails, the Maybe returned will be empty.
|
|
528
|
+
*/
|
|
529
|
+
static MaybeLocal<SharedArrayBuffer> MaybeNew(
|
|
530
|
+
Isolate* isolate, size_t byte_length,
|
|
531
|
+
BackingStoreInitializationMode initialization_mode =
|
|
532
|
+
BackingStoreInitializationMode::kZeroInitialized);
|
|
533
|
+
|
|
466
534
|
/**
|
|
467
535
|
* Create a new SharedArrayBuffer with an existing backing store.
|
|
468
536
|
* The created array keeps a reference to the backing store until the array
|
|
@@ -481,17 +549,26 @@ class V8_EXPORT SharedArrayBuffer : public Object {
|
|
|
481
549
|
/**
|
|
482
550
|
* Returns a new standalone BackingStore that is allocated using the array
|
|
483
551
|
* buffer allocator of the isolate. The allocation can either be zero
|
|
484
|
-
*
|
|
552
|
+
* initialized, or uninitialized. The result can be later passed to
|
|
485
553
|
* SharedArrayBuffer::New.
|
|
486
554
|
*
|
|
487
555
|
* If the allocator returns nullptr, then the function may cause GCs in the
|
|
488
|
-
* given isolate and re-try the allocation.
|
|
489
|
-
*
|
|
556
|
+
* given isolate and re-try the allocation.
|
|
557
|
+
*
|
|
558
|
+
* If on_failure is kOutOfMemory and GCs do not help, then the function will
|
|
559
|
+
* crash with an out-of-memory error.
|
|
560
|
+
*
|
|
561
|
+
* Otherwise, if on_failure is kReturnNull and GCs do not help (or the
|
|
562
|
+
* byte_length is so large that the allocation cannot succeed), then a null
|
|
563
|
+
* result is returned.
|
|
490
564
|
*/
|
|
491
565
|
static std::unique_ptr<BackingStore> NewBackingStore(
|
|
492
566
|
Isolate* isolate, size_t byte_length,
|
|
493
567
|
BackingStoreInitializationMode initialization_mode =
|
|
494
|
-
BackingStoreInitializationMode::kZeroInitialized
|
|
568
|
+
BackingStoreInitializationMode::kZeroInitialized,
|
|
569
|
+
BackingStoreOnFailureMode on_failure =
|
|
570
|
+
BackingStoreOnFailureMode::kOutOfMemory);
|
|
571
|
+
|
|
495
572
|
/**
|
|
496
573
|
* Returns a new standalone BackingStore that takes over the ownership of
|
|
497
574
|
* the given buffer. The destructor of the BackingStore invokes the given
|
|
@@ -129,7 +129,9 @@ struct JitCodeEvent {
|
|
|
129
129
|
enum JitCodeEventOptions {
|
|
130
130
|
kJitCodeEventDefault = 0,
|
|
131
131
|
// Generate callbacks for already existent code.
|
|
132
|
-
kJitCodeEventEnumExisting = 1
|
|
132
|
+
kJitCodeEventEnumExisting = 1,
|
|
133
|
+
|
|
134
|
+
kLastJitCodeEventOption = kJitCodeEventEnumExisting
|
|
133
135
|
};
|
|
134
136
|
|
|
135
137
|
/**
|
|
@@ -188,6 +190,9 @@ using GCCallback = void (*)(GCType type, GCCallbackFlags flags);
|
|
|
188
190
|
|
|
189
191
|
using InterruptCallback = void (*)(Isolate* isolate, void* data);
|
|
190
192
|
|
|
193
|
+
using PrintCurrentStackTraceFilterCallback =
|
|
194
|
+
bool (*)(Isolate* isolate, Local<String> script_name);
|
|
195
|
+
|
|
191
196
|
/**
|
|
192
197
|
* This callback is invoked when the heap size is close to the heap limit and
|
|
193
198
|
* V8 is likely to abort with out-of-memory error.
|
|
@@ -254,15 +259,7 @@ using AddCrashKeyCallback = void (*)(CrashKeyId id, const std::string& value);
|
|
|
254
259
|
using BeforeCallEnteredCallback = void (*)(Isolate*);
|
|
255
260
|
using CallCompletedCallback = void (*)(Isolate*);
|
|
256
261
|
|
|
257
|
-
// ---
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Callback to check if code generation from strings is allowed. See
|
|
261
|
-
* Context::AllowCodeGenerationFromStrings.
|
|
262
|
-
*/
|
|
263
|
-
using AllowCodeGenerationFromStringsCallback = bool (*)(Local<Context> context,
|
|
264
|
-
Local<String> source);
|
|
265
|
-
|
|
262
|
+
// --- Modify Code Generation From Strings Callback ---
|
|
266
263
|
struct ModifyCodeGenerationFromStringsResult {
|
|
267
264
|
// If true, proceed with the codegen algorithm. Otherwise, block it.
|
|
268
265
|
bool codegen_allowed = false;
|
|
@@ -272,6 +269,20 @@ struct ModifyCodeGenerationFromStringsResult {
|
|
|
272
269
|
MaybeLocal<String> modified_source;
|
|
273
270
|
};
|
|
274
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Callback to check if codegen is allowed from a source object, and convert
|
|
274
|
+
* the source to string if necessary. See: ModifyCodeGenerationFromStrings.
|
|
275
|
+
*/
|
|
276
|
+
using ModifyCodeGenerationFromStringsCallback =
|
|
277
|
+
ModifyCodeGenerationFromStringsResult (*)(Local<Context> context,
|
|
278
|
+
Local<Value> source);
|
|
279
|
+
using ModifyCodeGenerationFromStringsCallback2 =
|
|
280
|
+
ModifyCodeGenerationFromStringsResult (*)(Local<Context> context,
|
|
281
|
+
Local<Value> source,
|
|
282
|
+
bool is_code_like);
|
|
283
|
+
|
|
284
|
+
// --- Failed Access Check Callback ---
|
|
285
|
+
|
|
275
286
|
/**
|
|
276
287
|
* Access type specification.
|
|
277
288
|
*/
|
|
@@ -283,23 +294,9 @@ enum AccessType {
|
|
|
283
294
|
ACCESS_KEYS
|
|
284
295
|
};
|
|
285
296
|
|
|
286
|
-
// --- Failed Access Check Callback ---
|
|
287
|
-
|
|
288
297
|
using FailedAccessCheckCallback = void (*)(Local<Object> target,
|
|
289
298
|
AccessType type, Local<Value> data);
|
|
290
299
|
|
|
291
|
-
/**
|
|
292
|
-
* Callback to check if codegen is allowed from a source object, and convert
|
|
293
|
-
* the source to string if necessary. See: ModifyCodeGenerationFromStrings.
|
|
294
|
-
*/
|
|
295
|
-
using ModifyCodeGenerationFromStringsCallback =
|
|
296
|
-
ModifyCodeGenerationFromStringsResult (*)(Local<Context> context,
|
|
297
|
-
Local<Value> source);
|
|
298
|
-
using ModifyCodeGenerationFromStringsCallback2 =
|
|
299
|
-
ModifyCodeGenerationFromStringsResult (*)(Local<Context> context,
|
|
300
|
-
Local<Value> source,
|
|
301
|
-
bool is_code_like);
|
|
302
|
-
|
|
303
300
|
// --- WebAssembly compilation callbacks ---
|
|
304
301
|
using ExtensionCallback = bool (*)(const FunctionCallbackInfo<Value>&);
|
|
305
302
|
|
|
@@ -377,6 +374,47 @@ using HostImportModuleDynamicallyCallback = MaybeLocal<Promise> (*)(
|
|
|
377
374
|
Local<Value> resource_name, Local<String> specifier,
|
|
378
375
|
Local<FixedArray> import_attributes);
|
|
379
376
|
|
|
377
|
+
/**
|
|
378
|
+
* HostImportModuleWithPhaseDynamicallyCallback is called when we
|
|
379
|
+
* require the embedder to load a module with a specific phase. This is used
|
|
380
|
+
* as part of the dynamic import syntax.
|
|
381
|
+
*
|
|
382
|
+
* The referrer contains metadata about the script/module that calls
|
|
383
|
+
* import.
|
|
384
|
+
*
|
|
385
|
+
* The specifier is the name of the module that should be imported.
|
|
386
|
+
*
|
|
387
|
+
* The phase is the phase of the import requested.
|
|
388
|
+
*
|
|
389
|
+
* The import_attributes are import attributes for this request in the form:
|
|
390
|
+
* [key1, value1, key2, value2, ...] where the keys and values are of type
|
|
391
|
+
* v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and
|
|
392
|
+
* returned from ModuleRequest::GetImportAttributes(), this array does not
|
|
393
|
+
* contain the source Locations of the attributes.
|
|
394
|
+
*
|
|
395
|
+
* The Promise returned from this function is forwarded to userland
|
|
396
|
+
* JavaScript. The embedder must resolve this promise according to the phase
|
|
397
|
+
* requested:
|
|
398
|
+
* - For ModuleImportPhase::kSource, the promise must be resolved with a
|
|
399
|
+
* compiled ModuleSource object, or rejected with a SyntaxError if the
|
|
400
|
+
* module does not support source representation.
|
|
401
|
+
* - For ModuleImportPhase::kEvaluation, the promise must be resolved with a
|
|
402
|
+
* ModuleNamespace object of a module that has been compiled, instantiated,
|
|
403
|
+
* and evaluated.
|
|
404
|
+
*
|
|
405
|
+
* In case of an exception, the embedder must reject this promise with the
|
|
406
|
+
* exception. If the promise creation itself fails (e.g. due to stack
|
|
407
|
+
* overflow), the embedder must propagate that exception by returning an empty
|
|
408
|
+
* MaybeLocal.
|
|
409
|
+
*
|
|
410
|
+
* This callback is still experimental and is only invoked for source phase
|
|
411
|
+
* imports.
|
|
412
|
+
*/
|
|
413
|
+
using HostImportModuleWithPhaseDynamicallyCallback = MaybeLocal<Promise> (*)(
|
|
414
|
+
Local<Context> context, Local<Data> host_defined_options,
|
|
415
|
+
Local<Value> resource_name, Local<String> specifier,
|
|
416
|
+
ModuleImportPhase phase, Local<FixedArray> import_attributes);
|
|
417
|
+
|
|
380
418
|
/**
|
|
381
419
|
* Callback for requesting a compile hint for a function from the embedder. The
|
|
382
420
|
* first parameter is the position of the function in source code and the second
|
|
@@ -412,6 +450,14 @@ using HostInitializeImportMetaObjectCallback = void (*)(Local<Context> context,
|
|
|
412
450
|
using HostCreateShadowRealmContextCallback =
|
|
413
451
|
MaybeLocal<Context> (*)(Local<Context> initiator_context);
|
|
414
452
|
|
|
453
|
+
/**
|
|
454
|
+
* IsJSApiWrapperNativeErrorCallback is called on an JSApiWrapper object to
|
|
455
|
+
* determine if Error.isError should return true or false. For instance, in an
|
|
456
|
+
* HTML embedder, DOMExceptions return true when passed to Error.isError.
|
|
457
|
+
*/
|
|
458
|
+
using IsJSApiWrapperNativeErrorCallback = bool (*)(Isolate* isolate,
|
|
459
|
+
Local<Object> obj);
|
|
460
|
+
|
|
415
461
|
/**
|
|
416
462
|
* PrepareStackTraceCallback is called when the stack property of an error is
|
|
417
463
|
* first accessed. The return value will be used as the stack value. If this
|
|
@@ -452,14 +498,26 @@ using PrepareStackTraceCallback = MaybeLocal<Value> (*)(Local<Context> context,
|
|
|
452
498
|
* with a list of regular expressions that should match the document URL
|
|
453
499
|
* in order to enable ETW tracing:
|
|
454
500
|
* {
|
|
455
|
-
* "version": "
|
|
501
|
+
* "version": "2.0",
|
|
456
502
|
* "filtered_urls": [
|
|
457
503
|
* "https:\/\/.*\.chromium\.org\/.*", "https://v8.dev/";, "..."
|
|
458
|
-
* ]
|
|
504
|
+
* ],
|
|
505
|
+
* "trace_interpreter_frames": true
|
|
459
506
|
* }
|
|
460
507
|
*/
|
|
508
|
+
|
|
461
509
|
using FilterETWSessionByURLCallback =
|
|
462
510
|
bool (*)(Local<Context> context, const std::string& etw_filter_payload);
|
|
511
|
+
|
|
512
|
+
struct FilterETWSessionByURLResult {
|
|
513
|
+
// If true, enable ETW tracing for the current isolate.
|
|
514
|
+
bool enable_etw_tracing;
|
|
515
|
+
|
|
516
|
+
// If true, also enables ETW tracing for interpreter stack frames.
|
|
517
|
+
bool trace_interpreter_frames;
|
|
518
|
+
};
|
|
519
|
+
using FilterETWSessionByURL2Callback = FilterETWSessionByURLResult (*)(
|
|
520
|
+
Local<Context> context, const std::string& etw_filter_payload);
|
|
463
521
|
#endif // V8_OS_WIN
|
|
464
522
|
|
|
465
523
|
} // namespace v8
|
|
@@ -320,7 +320,7 @@ class V8_EXPORT Context : public Data {
|
|
|
320
320
|
* 'Function' constructor are used an exception will be thrown.
|
|
321
321
|
*
|
|
322
322
|
* If code generation from strings is not allowed the
|
|
323
|
-
* V8::
|
|
323
|
+
* V8::ModifyCodeGenerationFromStringsCallback callback will be invoked if
|
|
324
324
|
* set before blocking the call to 'eval' or the 'Function'
|
|
325
325
|
* constructor. If that callback returns true, the call will be
|
|
326
326
|
* allowed, otherwise an exception will be thrown. If no callback is
|
|
@@ -427,7 +427,8 @@ class V8_EXPORT Context : public Data {
|
|
|
427
427
|
|
|
428
428
|
static void CheckCast(Data* obj);
|
|
429
429
|
|
|
430
|
-
internal::
|
|
430
|
+
internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce(
|
|
431
|
+
size_t index);
|
|
431
432
|
Local<Value> SlowGetEmbedderData(int index);
|
|
432
433
|
void* SlowGetAlignedPointerFromEmbedderData(int index);
|
|
433
434
|
};
|
|
@@ -497,10 +498,10 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
|
497
498
|
|
|
498
499
|
template <class T>
|
|
499
500
|
MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
|
|
500
|
-
if (auto
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
return Local<T>::
|
|
501
|
+
if (auto repr = GetDataFromSnapshotOnce(index);
|
|
502
|
+
repr != internal::ValueHelper::kEmpty) {
|
|
503
|
+
internal::PerformCastCheck(internal::ValueHelper::ReprAsValue<T>(repr));
|
|
504
|
+
return Local<T>::FromRepr(repr);
|
|
504
505
|
}
|
|
505
506
|
return {};
|
|
506
507
|
}
|
package/include/node/v8-cppgc.h
CHANGED
|
@@ -87,6 +87,7 @@ class V8_EXPORT CppHeap {
|
|
|
87
87
|
*
|
|
88
88
|
* After this call, object allocation is prohibited.
|
|
89
89
|
*/
|
|
90
|
+
V8_DEPRECATED("Terminate gets automatically called in the CppHeap destructor")
|
|
90
91
|
void Terminate();
|
|
91
92
|
|
|
92
93
|
/**
|
|
@@ -101,7 +102,7 @@ class V8_EXPORT CppHeap {
|
|
|
101
102
|
/**
|
|
102
103
|
* Collects statistics for the given spaces and reports them to the receiver.
|
|
103
104
|
*
|
|
104
|
-
* \param custom_spaces a collection of custom space
|
|
105
|
+
* \param custom_spaces a collection of custom space indices.
|
|
105
106
|
* \param receiver an object that gets the results.
|
|
106
107
|
*/
|
|
107
108
|
void CollectCustomSpaceStatisticsAtLastGC(
|
package/include/node/v8-data.h
CHANGED
package/include/node/v8-debug.h
CHANGED
|
@@ -42,6 +42,12 @@ class V8_EXPORT StackFrame {
|
|
|
42
42
|
*/
|
|
43
43
|
int GetColumn() const { return GetLocation().GetColumnNumber() + 1; }
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Returns zero based source position (character offset) for the associated
|
|
47
|
+
* function.
|
|
48
|
+
*/
|
|
49
|
+
int GetSourcePosition() const;
|
|
50
|
+
|
|
45
51
|
/**
|
|
46
52
|
* Returns the id of the script for the function for this StackFrame.
|
|
47
53
|
* This method will return Message::kNoScriptIdInfo if it is unable to
|
|
@@ -130,6 +136,11 @@ class V8_EXPORT StackTrace {
|
|
|
130
136
|
kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
|
|
131
137
|
};
|
|
132
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Returns the (unique) ID of this stack trace.
|
|
141
|
+
*/
|
|
142
|
+
int GetID() const;
|
|
143
|
+
|
|
133
144
|
/**
|
|
134
145
|
* Returns a StackFrame at a particular index.
|
|
135
146
|
*/
|