node-linux-arm64 23.11.0 → 24.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.
- package/CHANGELOG.md +427 -1937
- package/LICENSE +2 -2
- package/README.md +2 -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.h +58 -15
- package/include/node/node_version.h +3 -3
- 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 +4 -1
- package/include/node/cppgc/ephemeron-pair.h +0 -30
|
@@ -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
|
*/
|
|
@@ -21,37 +21,10 @@ class Value;
|
|
|
21
21
|
*/
|
|
22
22
|
class V8_EXPORT EmbedderRootsHandler {
|
|
23
23
|
public:
|
|
24
|
-
enum class RootHandling {
|
|
25
|
-
kQueryEmbedderForNonDroppableReferences,
|
|
26
|
-
kDontQueryEmbedderForAnyReference,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
24
|
virtual ~EmbedderRootsHandler() = default;
|
|
30
25
|
|
|
31
26
|
EmbedderRootsHandler() = default;
|
|
32
27
|
|
|
33
|
-
V8_DEPRECATED("Use the default constructor instead.")
|
|
34
|
-
explicit EmbedderRootsHandler(RootHandling default_traced_reference_handling)
|
|
35
|
-
: default_traced_reference_handling_(default_traced_reference_handling) {}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Returns true if the |TracedReference| handle should be considered as root
|
|
39
|
-
* for the currently running non-tracing garbage collection and false
|
|
40
|
-
* otherwise. The default implementation will keep all |TracedReference|
|
|
41
|
-
* references as roots.
|
|
42
|
-
*
|
|
43
|
-
* If this returns false, then V8 may decide that the object referred to by
|
|
44
|
-
* such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the
|
|
45
|
-
* |TracedReference|.
|
|
46
|
-
*
|
|
47
|
-
* Note that the `handle` is different from the handle that the embedder holds
|
|
48
|
-
* for retaining the object.
|
|
49
|
-
*
|
|
50
|
-
* The concrete implementations must be thread-safe.
|
|
51
|
-
*/
|
|
52
|
-
V8_DEPRECATED("Use TracedReferenceHandling::kDroppable instead.")
|
|
53
|
-
virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
|
|
54
|
-
|
|
55
28
|
/**
|
|
56
29
|
* Used in combination with |IsRoot|. Called by V8 when an
|
|
57
30
|
* object that is backed by a handle is reclaimed by a non-tracing garbage
|
|
@@ -69,14 +42,10 @@ class V8_EXPORT EmbedderRootsHandler {
|
|
|
69
42
|
* |false| is returned, |ResetRoot()| will be recalled for the same handle.
|
|
70
43
|
*/
|
|
71
44
|
virtual bool TryResetRoot(const v8::TracedReference<v8::Value>& handle) {
|
|
72
|
-
|
|
73
|
-
return true;
|
|
45
|
+
return false;
|
|
74
46
|
}
|
|
75
47
|
|
|
76
48
|
private:
|
|
77
|
-
const RootHandling default_traced_reference_handling_ =
|
|
78
|
-
RootHandling::kDontQueryEmbedderForAnyReference;
|
|
79
|
-
|
|
80
49
|
friend class internal::TracedHandles;
|
|
81
50
|
};
|
|
82
51
|
|
|
@@ -45,6 +45,8 @@ class V8_EXPORT Exception {
|
|
|
45
45
|
Local<Value> options = {});
|
|
46
46
|
static Local<Value> WasmRuntimeError(Local<String> message,
|
|
47
47
|
Local<Value> options = {});
|
|
48
|
+
static Local<Value> WasmSuspendError(Local<String> message,
|
|
49
|
+
Local<Value> options = {});
|
|
48
50
|
static Local<Value> Error(Local<String> message, Local<Value> options = {});
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -126,23 +126,6 @@ class FunctionCallbackInfo {
|
|
|
126
126
|
V8_INLINE Local<Value> operator[](int i) const;
|
|
127
127
|
/** Returns the receiver. This corresponds to the "this" value. */
|
|
128
128
|
V8_INLINE Local<Object> This() const;
|
|
129
|
-
/**
|
|
130
|
-
* If the callback was created without a Signature, this is the same
|
|
131
|
-
* value as This(). If there is a signature, and the signature didn't match
|
|
132
|
-
* This() but one of its hidden prototypes, this will be the respective
|
|
133
|
-
* hidden prototype.
|
|
134
|
-
*
|
|
135
|
-
* Note that this is not the prototype of This() on which the accessor
|
|
136
|
-
* referencing this callback was found (which in V8 internally is often
|
|
137
|
-
* referred to as holder [sic]).
|
|
138
|
-
*/
|
|
139
|
-
V8_DEPRECATED(
|
|
140
|
-
"V8 will stop providing access to hidden prototype (i.e. "
|
|
141
|
-
"JSGlobalObject). Use This() instead. \n"
|
|
142
|
-
"DO NOT try to workaround this by accessing JSGlobalObject via "
|
|
143
|
-
"v8::Object::GetPrototype() - it'll be deprecated soon too. \n"
|
|
144
|
-
"See http://crbug.com/333672197. ")
|
|
145
|
-
V8_INLINE Local<Object> Holder() const;
|
|
146
129
|
/** For construct calls, this returns the "new.target" value. */
|
|
147
130
|
V8_INLINE Local<Value> NewTarget() const;
|
|
148
131
|
/** Indicates whether this is a regular call or a construct call. */
|
|
@@ -154,18 +137,16 @@ class FunctionCallbackInfo {
|
|
|
154
137
|
/** The ReturnValue for the call. */
|
|
155
138
|
V8_INLINE ReturnValue<T> GetReturnValue() const;
|
|
156
139
|
|
|
157
|
-
// This is a temporary replacement for Holder() added just for the purpose
|
|
158
|
-
// of testing the deprecated Holder() machinery until it's removed for real.
|
|
159
|
-
// DO NOT use it.
|
|
160
|
-
V8_INLINE Local<Object> HolderSoonToBeDeprecated() const;
|
|
161
|
-
|
|
162
140
|
private:
|
|
163
141
|
friend class internal::FunctionCallbackArguments;
|
|
164
142
|
friend class internal::CustomArguments<FunctionCallbackInfo>;
|
|
165
143
|
friend class debug::ConsoleCallArguments;
|
|
166
144
|
friend void internal::PrintFunctionCallbackInfo(void*);
|
|
167
145
|
|
|
168
|
-
|
|
146
|
+
// TODO(ishell, http://crbug.com/326505377): in case of non-constructor
|
|
147
|
+
// call, don't pass kNewTarget and kUnused. Add IsConstructCall flag to
|
|
148
|
+
// kIsolate field.
|
|
149
|
+
static constexpr int kUnusedIndex = 0;
|
|
169
150
|
static constexpr int kIsolateIndex = 1;
|
|
170
151
|
static constexpr int kContextIndex = 2;
|
|
171
152
|
static constexpr int kReturnValueIndex = 3;
|
|
@@ -649,16 +630,6 @@ Local<Object> FunctionCallbackInfo<T>::This() const {
|
|
|
649
630
|
return Local<Object>::FromSlot(values_ + kThisValuesIndex);
|
|
650
631
|
}
|
|
651
632
|
|
|
652
|
-
template <typename T>
|
|
653
|
-
Local<Object> FunctionCallbackInfo<T>::HolderSoonToBeDeprecated() const {
|
|
654
|
-
return Local<Object>::FromSlot(&implicit_args_[kHolderIndex]);
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
template <typename T>
|
|
658
|
-
Local<Object> FunctionCallbackInfo<T>::Holder() const {
|
|
659
|
-
return HolderSoonToBeDeprecated();
|
|
660
|
-
}
|
|
661
|
-
|
|
662
633
|
template <typename T>
|
|
663
634
|
Local<Value> FunctionCallbackInfo<T>::NewTarget() const {
|
|
664
635
|
return Local<Value>::FromSlot(&implicit_args_[kNewTargetIndex]);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
namespace v8 {
|
|
19
19
|
|
|
20
20
|
class Context;
|
|
21
|
+
class Location;
|
|
21
22
|
class UnboundScript;
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -88,6 +89,12 @@ class V8_EXPORT Function : public Object {
|
|
|
88
89
|
*/
|
|
89
90
|
int GetScriptColumnNumber() const;
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Returns zero based line and column number of function body, else returns
|
|
94
|
+
* {-1, -1}.
|
|
95
|
+
*/
|
|
96
|
+
Location GetScriptLocation() const;
|
|
97
|
+
|
|
91
98
|
/**
|
|
92
99
|
* Returns zero based start position (character offset) of function body and
|
|
93
100
|
* kLineOffsetNotFound if no information available.
|