node-linux-arm64 24.11.0 → 25.1.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 +270 -1832
- package/README.md +2 -4
- package/bin/node +0 -0
- package/include/node/common.gypi +4 -16
- package/include/node/config.gypi +11 -9
- package/include/node/cppgc/allocation.h +3 -3
- package/include/node/cppgc/cross-thread-persistent.h +25 -29
- package/include/node/cppgc/internal/finalizer-trait.h +1 -1
- package/include/node/cppgc/internal/gc-info.h +3 -3
- package/include/node/cppgc/internal/logging.h +2 -2
- package/include/node/cppgc/internal/name-trait.h +1 -1
- package/include/node/cppgc/internal/pointer-policies.h +3 -3
- package/include/node/cppgc/member.h +10 -4
- package/include/node/cppgc/persistent.h +14 -15
- package/include/node/cppgc/platform.h +1 -1
- package/include/node/cppgc/trace-trait.h +1 -2
- package/include/node/cppgc/visitor.h +14 -9
- package/include/node/js_native_api.h +12 -0
- package/include/node/node.h +42 -78
- package/include/node/node_version.h +5 -5
- package/include/node/v8-array-buffer.h +1 -1
- package/include/node/v8-callbacks.h +3 -4
- package/include/node/v8-context.h +15 -5
- package/include/node/v8-data.h +5 -0
- package/include/node/v8-debug.h +11 -0
- package/include/node/v8-function-callback.h +26 -26
- package/include/node/v8-internal.h +136 -36
- package/include/node/v8-isolate.h +75 -16
- package/include/node/v8-json.h +8 -1
- package/include/node/v8-local-handle.h +112 -13
- package/include/node/v8-maybe.h +34 -10
- package/include/node/v8-memory-span.h +9 -4
- package/include/node/v8-message.h +3 -0
- package/include/node/v8-object.h +87 -24
- package/include/node/v8-persistent-handle.h +4 -4
- package/include/node/v8-platform.h +92 -28
- package/include/node/v8-primitive.h +22 -9
- package/include/node/v8-profiler.h +4 -0
- package/include/node/v8-sandbox.h +16 -0
- package/include/node/v8-script.h +17 -0
- package/include/node/v8-source-location.h +19 -26
- package/include/node/v8-template.h +37 -15
- package/include/node/v8-traced-handle.h +6 -6
- package/include/node/v8-unwinder.h +13 -0
- package/include/node/v8-version.h +4 -4
- package/include/node/v8config.h +65 -5
- package/package.json +1 -1
- package/share/doc/node/gdbinit +221 -4
- package/share/man/man1/node.1 +21 -4
|
@@ -91,7 +91,7 @@ class V8_EXPORT Visitor {
|
|
|
91
91
|
*/
|
|
92
92
|
template <typename T>
|
|
93
93
|
void Trace(const Member<T>& member) {
|
|
94
|
-
const T* value = member.
|
|
94
|
+
const T* value = member.GetAtomic();
|
|
95
95
|
CPPGC_DCHECK(value != kSentinelPointer);
|
|
96
96
|
TraceImpl(value);
|
|
97
97
|
}
|
|
@@ -109,7 +109,7 @@ class V8_EXPORT Visitor {
|
|
|
109
109
|
static_assert(!internal::IsAllocatedOnCompactableSpace<T>::value,
|
|
110
110
|
"Weak references to compactable objects are not allowed");
|
|
111
111
|
|
|
112
|
-
const T* value = weak_member.
|
|
112
|
+
const T* value = weak_member.GetAtomic();
|
|
113
113
|
|
|
114
114
|
// Bailout assumes that WeakMember emits write barrier.
|
|
115
115
|
if (!value) {
|
|
@@ -129,7 +129,7 @@ class V8_EXPORT Visitor {
|
|
|
129
129
|
*/
|
|
130
130
|
template <typename T>
|
|
131
131
|
void Trace(const subtle::UncompressedMember<T>& member) {
|
|
132
|
-
const T* value = member.
|
|
132
|
+
const T* value = member.GetAtomic();
|
|
133
133
|
CPPGC_DCHECK(value != kSentinelPointer);
|
|
134
134
|
TraceImpl(value);
|
|
135
135
|
}
|
|
@@ -232,12 +232,12 @@ class V8_EXPORT Visitor {
|
|
|
232
232
|
template <typename KeyType, typename ValueType>
|
|
233
233
|
void TraceEphemeron(const WeakMember<KeyType>& weak_member_key,
|
|
234
234
|
const Member<ValueType>* member_value) {
|
|
235
|
-
const KeyType* key = weak_member_key.
|
|
235
|
+
const KeyType* key = weak_member_key.GetAtomic();
|
|
236
236
|
if (!key) return;
|
|
237
237
|
|
|
238
238
|
// `value` must always be non-null.
|
|
239
239
|
CPPGC_DCHECK(member_value);
|
|
240
|
-
const ValueType* value = member_value->
|
|
240
|
+
const ValueType* value = member_value->GetAtomic();
|
|
241
241
|
if (!value) return;
|
|
242
242
|
|
|
243
243
|
// KeyType and ValueType may refer to GarbageCollectedMixin.
|
|
@@ -267,7 +267,7 @@ class V8_EXPORT Visitor {
|
|
|
267
267
|
const ValueType* value) {
|
|
268
268
|
static_assert(!IsGarbageCollectedOrMixinTypeV<ValueType>,
|
|
269
269
|
"garbage-collected types must use WeakMember and Member");
|
|
270
|
-
const KeyType* key = weak_member_key.
|
|
270
|
+
const KeyType* key = weak_member_key.GetAtomic();
|
|
271
271
|
if (!key) return;
|
|
272
272
|
|
|
273
273
|
// `value` must always be non-null.
|
|
@@ -293,7 +293,7 @@ class V8_EXPORT Visitor {
|
|
|
293
293
|
*/
|
|
294
294
|
template <typename T>
|
|
295
295
|
void TraceStrongly(const WeakMember<T>& weak_member) {
|
|
296
|
-
const T* value = weak_member.
|
|
296
|
+
const T* value = weak_member.GetAtomic();
|
|
297
297
|
CPPGC_DCHECK(value != kSentinelPointer);
|
|
298
298
|
TraceImpl(value);
|
|
299
299
|
}
|
|
@@ -369,6 +369,11 @@ class V8_EXPORT Visitor {
|
|
|
369
369
|
return false;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Checks whether the visitor is running concurrently to the mutator or not.
|
|
374
|
+
*/
|
|
375
|
+
virtual bool IsConcurrent() const { return false; }
|
|
376
|
+
|
|
372
377
|
protected:
|
|
373
378
|
virtual void Visit(const void* self, TraceDescriptor) {}
|
|
374
379
|
virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback,
|
|
@@ -497,9 +502,9 @@ class V8_EXPORT RootVisitor {
|
|
|
497
502
|
}
|
|
498
503
|
|
|
499
504
|
protected:
|
|
500
|
-
virtual void VisitRoot(const void*, TraceDescriptor,
|
|
505
|
+
virtual void VisitRoot(const void*, TraceDescriptor, SourceLocation) {}
|
|
501
506
|
virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback,
|
|
502
|
-
const void* weak_root,
|
|
507
|
+
const void* weak_root, SourceLocation) {}
|
|
503
508
|
|
|
504
509
|
private:
|
|
505
510
|
template <typename AnyPersistentType>
|
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
#endif
|
|
22
22
|
#endif
|
|
23
23
|
|
|
24
|
+
#if defined(NAPI_EXPERIMENTAL) && \
|
|
25
|
+
!defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \
|
|
26
|
+
!defined(NODE_WANT_INTERNALS)
|
|
27
|
+
#ifdef _MSC_VER
|
|
28
|
+
#pragma message("NAPI_EXPERIMENTAL is enabled. " \
|
|
29
|
+
"Experimental features may be unstable.")
|
|
30
|
+
#else
|
|
31
|
+
#warning "NAPI_EXPERIMENTAL is enabled. " \
|
|
32
|
+
"Experimental features may be unstable."
|
|
33
|
+
#endif
|
|
34
|
+
#endif
|
|
35
|
+
|
|
24
36
|
#include "js_native_api_types.h"
|
|
25
37
|
|
|
26
38
|
// If you need __declspec(dllimport), either include <node_api.h> instead, or
|
package/include/node/node.h
CHANGED
|
@@ -175,35 +175,6 @@ NODE_DEPRECATED("Use UVException(isolate, ...)",
|
|
|
175
175
|
path);
|
|
176
176
|
})
|
|
177
177
|
|
|
178
|
-
/*
|
|
179
|
-
* These methods need to be called in a HandleScope.
|
|
180
|
-
*
|
|
181
|
-
* It is preferred that you use the `MakeCallback` overloads taking
|
|
182
|
-
* `async_context` arguments.
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
|
|
186
|
-
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
|
|
187
|
-
v8::Isolate* isolate,
|
|
188
|
-
v8::Local<v8::Object> recv,
|
|
189
|
-
const char* method,
|
|
190
|
-
int argc,
|
|
191
|
-
v8::Local<v8::Value>* argv));
|
|
192
|
-
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
|
|
193
|
-
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
|
|
194
|
-
v8::Isolate* isolate,
|
|
195
|
-
v8::Local<v8::Object> recv,
|
|
196
|
-
v8::Local<v8::String> symbol,
|
|
197
|
-
int argc,
|
|
198
|
-
v8::Local<v8::Value>* argv));
|
|
199
|
-
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
|
|
200
|
-
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
|
|
201
|
-
v8::Isolate* isolate,
|
|
202
|
-
v8::Local<v8::Object> recv,
|
|
203
|
-
v8::Local<v8::Function> callback,
|
|
204
|
-
int argc,
|
|
205
|
-
v8::Local<v8::Value>* argv));
|
|
206
|
-
|
|
207
178
|
} // namespace node
|
|
208
179
|
|
|
209
180
|
#include <cassert>
|
|
@@ -329,22 +300,6 @@ NODE_EXTERN int Start(int argc, char* argv[]);
|
|
|
329
300
|
NODE_EXTERN int Stop(Environment* env,
|
|
330
301
|
StopFlags::Flags flags = StopFlags::kNoFlags);
|
|
331
302
|
|
|
332
|
-
// Set up per-process state needed to run Node.js. This will consume arguments
|
|
333
|
-
// from argv, fill exec_argv, and possibly add errors resulting from parsing
|
|
334
|
-
// the arguments to `errors`. The return value is a suggested exit code for the
|
|
335
|
-
// program; If it is 0, then initializing Node.js succeeded.
|
|
336
|
-
// This runs a subset of the initialization performed by
|
|
337
|
-
// InitializeOncePerProcess(), which supersedes this function.
|
|
338
|
-
// The subset is roughly equivalent to the one given by
|
|
339
|
-
// `ProcessInitializationFlags::kLegacyInitializeNodeWithArgsBehavior`.
|
|
340
|
-
NODE_DEPRECATED("Use InitializeOncePerProcess() instead",
|
|
341
|
-
NODE_EXTERN int InitializeNodeWithArgs(
|
|
342
|
-
std::vector<std::string>* argv,
|
|
343
|
-
std::vector<std::string>* exec_argv,
|
|
344
|
-
std::vector<std::string>* errors,
|
|
345
|
-
ProcessInitializationFlags::Flags flags =
|
|
346
|
-
ProcessInitializationFlags::kNoFlags));
|
|
347
|
-
|
|
348
303
|
// Set up per-process state needed to run Node.js. This will consume arguments
|
|
349
304
|
// from args, and return information about the initialization success,
|
|
350
305
|
// including the arguments split into argv/exec_argv, a list of potential
|
|
@@ -839,23 +794,23 @@ NODE_EXTERN v8::MaybeLocal<v8::Value> PrepareStackTraceCallback(
|
|
|
839
794
|
// is included in the report.
|
|
840
795
|
// Returns the filename of the written report.
|
|
841
796
|
NODE_EXTERN std::string TriggerNodeReport(v8::Isolate* isolate,
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
797
|
+
std::string_view message,
|
|
798
|
+
std::string_view trigger,
|
|
799
|
+
std::string_view filename,
|
|
845
800
|
v8::Local<v8::Value> error);
|
|
846
801
|
NODE_EXTERN std::string TriggerNodeReport(Environment* env,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
802
|
+
std::string_view message,
|
|
803
|
+
std::string_view trigger,
|
|
804
|
+
std::string_view filename,
|
|
850
805
|
v8::Local<v8::Value> error);
|
|
851
806
|
NODE_EXTERN void GetNodeReport(v8::Isolate* isolate,
|
|
852
|
-
|
|
853
|
-
|
|
807
|
+
std::string_view message,
|
|
808
|
+
std::string_view trigger,
|
|
854
809
|
v8::Local<v8::Value> error,
|
|
855
810
|
std::ostream& out);
|
|
856
811
|
NODE_EXTERN void GetNodeReport(Environment* env,
|
|
857
|
-
|
|
858
|
-
|
|
812
|
+
std::string_view message,
|
|
813
|
+
std::string_view trigger,
|
|
859
814
|
v8::Local<v8::Value> error,
|
|
860
815
|
std::ostream& out);
|
|
861
816
|
|
|
@@ -864,32 +819,21 @@ NODE_EXTERN void GetNodeReport(Environment* env,
|
|
|
864
819
|
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
|
|
865
820
|
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);
|
|
866
821
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
// Get/set the currently active tracing controller. Using CreatePlatform()
|
|
875
|
-
// will implicitly set this by default. This is global and should be initialized
|
|
876
|
-
// along with the v8::Platform instance that is being used. `controller`
|
|
877
|
-
// is allowed to be `nullptr`.
|
|
878
|
-
// This is used for tracing events from Node.js itself. V8 uses the tracing
|
|
879
|
-
// controller returned from the active `v8::Platform` instance.
|
|
822
|
+
// Get/set the currently active tracing controller. Using
|
|
823
|
+
// MultiIsolatePlatform::Create() will implicitly set this by default. This is
|
|
824
|
+
// global and should be initialized along with the v8::Platform instance that is
|
|
825
|
+
// being used. `controller` is allowed to be `nullptr`. This is used for tracing
|
|
826
|
+
// events from Node.js itself. V8 uses the tracing controller returned from the
|
|
827
|
+
// active `v8::Platform` instance.
|
|
880
828
|
NODE_EXTERN v8::TracingController* GetTracingController();
|
|
881
829
|
NODE_EXTERN void SetTracingController(v8::TracingController* controller);
|
|
882
830
|
|
|
883
831
|
// Run `process.emit('beforeExit')` as it would usually happen when Node.js is
|
|
884
832
|
// run in standalone mode.
|
|
885
833
|
NODE_EXTERN v8::Maybe<bool> EmitProcessBeforeExit(Environment* env);
|
|
886
|
-
NODE_DEPRECATED("Use Maybe version (EmitProcessBeforeExit) instead",
|
|
887
|
-
NODE_EXTERN void EmitBeforeExit(Environment* env));
|
|
888
834
|
// Run `process.emit('exit')` as it would usually happen when Node.js is run
|
|
889
835
|
// in standalone mode. The return value corresponds to the exit code.
|
|
890
836
|
NODE_EXTERN v8::Maybe<int> EmitProcessExit(Environment* env);
|
|
891
|
-
NODE_DEPRECATED("Use Maybe version (EmitProcessExit) instead",
|
|
892
|
-
NODE_EXTERN int EmitExit(Environment* env));
|
|
893
837
|
|
|
894
838
|
// Runs hooks added through `AtExit()`. This is part of `FreeEnvironment()`,
|
|
895
839
|
// so calling it manually is typically not necessary.
|
|
@@ -1057,7 +1001,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
|
|
1057
1001
|
|
|
1058
1002
|
#define NODE_DEFINE_CONSTANT(target, constant) \
|
|
1059
1003
|
do { \
|
|
1060
|
-
v8::Isolate* isolate =
|
|
1004
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent(); \
|
|
1061
1005
|
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
|
1062
1006
|
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
|
1063
1007
|
isolate, #constant, v8::NewStringType::kInternalized); \
|
|
@@ -1073,7 +1017,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
|
|
1073
1017
|
|
|
1074
1018
|
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
|
|
1075
1019
|
do { \
|
|
1076
|
-
v8::Isolate* isolate =
|
|
1020
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent(); \
|
|
1077
1021
|
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
|
1078
1022
|
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
|
1079
1023
|
isolate, #constant, v8::NewStringType::kInternalized); \
|
|
@@ -1458,6 +1402,10 @@ NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate,
|
|
|
1458
1402
|
v8::Local<v8::Object> resource,
|
|
1459
1403
|
const char* name,
|
|
1460
1404
|
async_id trigger_async_id = -1);
|
|
1405
|
+
NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate,
|
|
1406
|
+
v8::Local<v8::Object> resource,
|
|
1407
|
+
std::string_view name,
|
|
1408
|
+
async_id trigger_async_id = -1);
|
|
1461
1409
|
|
|
1462
1410
|
NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate,
|
|
1463
1411
|
v8::Local<v8::Object> resource,
|
|
@@ -1500,6 +1448,12 @@ class NODE_EXTERN CallbackScope {
|
|
|
1500
1448
|
CallbackScope(Environment* env,
|
|
1501
1449
|
v8::Local<v8::Object> resource,
|
|
1502
1450
|
async_context asyncContext);
|
|
1451
|
+
// `resource` needs to outlive the scope in this case.
|
|
1452
|
+
// This is for the rare situation in which `CallbackScope` cannot be
|
|
1453
|
+
// stack-allocated. `resource` needs to outlive this scope.
|
|
1454
|
+
CallbackScope(Environment* env,
|
|
1455
|
+
v8::Global<v8::Object>* resource,
|
|
1456
|
+
async_context asyncContext);
|
|
1503
1457
|
~CallbackScope();
|
|
1504
1458
|
|
|
1505
1459
|
void operator=(const CallbackScope&) = delete;
|
|
@@ -1508,6 +1462,11 @@ class NODE_EXTERN CallbackScope {
|
|
|
1508
1462
|
CallbackScope(CallbackScope&&) = delete;
|
|
1509
1463
|
|
|
1510
1464
|
private:
|
|
1465
|
+
void* resource_storage_global_;
|
|
1466
|
+
union {
|
|
1467
|
+
v8::Local<v8::Object> local;
|
|
1468
|
+
v8::Global<v8::Object>* global_ptr;
|
|
1469
|
+
} resource_storage_;
|
|
1511
1470
|
InternalCallbackScope* private_;
|
|
1512
1471
|
v8::TryCatch try_catch_;
|
|
1513
1472
|
};
|
|
@@ -1553,6 +1512,10 @@ class NODE_EXTERN AsyncResource {
|
|
|
1553
1512
|
v8::Local<v8::Object> resource,
|
|
1554
1513
|
const char* name,
|
|
1555
1514
|
async_id trigger_async_id = -1);
|
|
1515
|
+
AsyncResource(v8::Isolate* isolate,
|
|
1516
|
+
v8::Local<v8::Object> resource,
|
|
1517
|
+
std::string_view name,
|
|
1518
|
+
async_id trigger_async_id = -1);
|
|
1556
1519
|
|
|
1557
1520
|
virtual ~AsyncResource();
|
|
1558
1521
|
|
|
@@ -1610,10 +1573,11 @@ void RegisterSignalHandler(int signal,
|
|
|
1610
1573
|
// objects on Node.js versions without v8::Object::Wrap(). Addons created to
|
|
1611
1574
|
// work with only Node.js versions with v8::Object::Wrap() should use that
|
|
1612
1575
|
// instead.
|
|
1613
|
-
NODE_DEPRECATED(
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1576
|
+
NODE_DEPRECATED(
|
|
1577
|
+
"Use v8::Object::Wrap()",
|
|
1578
|
+
NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
|
1579
|
+
v8::Local<v8::Object> object,
|
|
1580
|
+
v8::Object::Wrappable* wrappable));
|
|
1617
1581
|
|
|
1618
1582
|
} // namespace node
|
|
1619
1583
|
|
|
@@ -22,12 +22,12 @@
|
|
|
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
|
|
25
|
+
#define NODE_MAJOR_VERSION 25
|
|
26
|
+
#define NODE_MINOR_VERSION 1
|
|
27
27
|
#define NODE_PATCH_VERSION 0
|
|
28
28
|
|
|
29
|
-
#define NODE_VERSION_IS_LTS
|
|
30
|
-
#define NODE_VERSION_LTS_CODENAME "
|
|
29
|
+
#define NODE_VERSION_IS_LTS 0
|
|
30
|
+
#define NODE_VERSION_LTS_CODENAME ""
|
|
31
31
|
|
|
32
32
|
#define NODE_VERSION_IS_RELEASE 1
|
|
33
33
|
|
|
@@ -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 141
|
|
99
99
|
#endif
|
|
100
100
|
|
|
101
101
|
// The NAPI_VERSION supported by the runtime. This is the inclusive range of
|
|
@@ -198,7 +198,7 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
|
198
198
|
* Convenience allocator.
|
|
199
199
|
*
|
|
200
200
|
* When the sandbox is enabled, this allocator will allocate its backing
|
|
201
|
-
* memory inside the sandbox that belongs to passed isolate group.
|
|
201
|
+
* memory inside the sandbox that belongs to the passed isolate group.
|
|
202
202
|
* Otherwise, it will rely on malloc/free.
|
|
203
203
|
*
|
|
204
204
|
* Caller takes ownership, i.e. the returned object needs to be freed using
|
|
@@ -324,14 +324,13 @@ using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
|
|
|
324
324
|
// --- Callback for checking if WebAssembly imported strings are enabled ---
|
|
325
325
|
using WasmImportedStringsEnabledCallback = bool (*)(Local<Context> context);
|
|
326
326
|
|
|
327
|
+
// --- Callback for checking if WebAssembly Custom Descriptors are enabled ---
|
|
328
|
+
using WasmCustomDescriptorsEnabledCallback = bool (*)(Local<Context> context);
|
|
329
|
+
|
|
327
330
|
// --- Callback for checking if the SharedArrayBuffer constructor is enabled ---
|
|
328
331
|
using SharedArrayBufferConstructorEnabledCallback =
|
|
329
332
|
bool (*)(Local<Context> context);
|
|
330
333
|
|
|
331
|
-
// --- Callback for checking if the compile hints magic comments are enabled ---
|
|
332
|
-
using JavaScriptCompileHintsMagicEnabledCallback =
|
|
333
|
-
bool (*)(Local<Context> context);
|
|
334
|
-
|
|
335
334
|
// --- Callback for checking if WebAssembly JSPI is enabled ---
|
|
336
335
|
using WasmJSPIEnabledCallback = bool (*)(Local<Context> context);
|
|
337
336
|
|
|
@@ -256,6 +256,9 @@ class V8_EXPORT Context : public Data {
|
|
|
256
256
|
Maybe<void> DeepFreeze(DeepFreezeDelegate* delegate = nullptr);
|
|
257
257
|
|
|
258
258
|
/** Returns the isolate associated with a current context. */
|
|
259
|
+
V8_DEPRECATED(
|
|
260
|
+
"Use Isolate::GetCurrent() instead, which is guaranteed to return the "
|
|
261
|
+
"same isolate since https://crrev.com/c/6458560.")
|
|
259
262
|
Isolate* GetIsolate();
|
|
260
263
|
|
|
261
264
|
/** Returns the microtask queue associated with a current context. */
|
|
@@ -311,8 +314,14 @@ class V8_EXPORT Context : public Data {
|
|
|
311
314
|
* index, growing the data as needed. Note that index 0 currently has a
|
|
312
315
|
* special meaning for Chrome's debugger.
|
|
313
316
|
*/
|
|
317
|
+
V8_DEPRECATE_SOON(
|
|
318
|
+
"Use SetAlignedPointerInEmbedderData with EmbedderDataTypeTag parameter "
|
|
319
|
+
"instead.")
|
|
314
320
|
void SetAlignedPointerInEmbedderData(int index, void* value);
|
|
315
321
|
|
|
322
|
+
void SetAlignedPointerInEmbedderData(int index, void* value,
|
|
323
|
+
EmbedderDataTypeTag slot);
|
|
324
|
+
|
|
316
325
|
/**
|
|
317
326
|
* Control whether code generation from strings is allowed. Calling
|
|
318
327
|
* this method with false will disable 'eval' and the 'Function'
|
|
@@ -451,8 +460,7 @@ Local<Value> Context::GetEmbedderData(int index) {
|
|
|
451
460
|
value = I::DecompressTaggedField(embedder_data, static_cast<uint32_t>(value));
|
|
452
461
|
#endif
|
|
453
462
|
|
|
454
|
-
auto isolate =
|
|
455
|
-
internal::IsolateFromNeverReadOnlySpaceObject(ctx));
|
|
463
|
+
auto* isolate = I::GetCurrentIsolate();
|
|
456
464
|
return Local<Value>::New(isolate, value);
|
|
457
465
|
#else
|
|
458
466
|
return SlowGetEmbedderData(index);
|
|
@@ -470,7 +478,8 @@ void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index) {
|
|
|
470
478
|
(I::kEmbedderDataSlotSize * index) +
|
|
471
479
|
I::kEmbedderDataSlotExternalPointerOffset;
|
|
472
480
|
return reinterpret_cast<void*>(
|
|
473
|
-
I::ReadExternalPointerField<internal::
|
|
481
|
+
I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
|
|
482
|
+
internal::kLastEmbedderDataTag}>(
|
|
474
483
|
isolate, embedder_data, value_offset));
|
|
475
484
|
#else
|
|
476
485
|
return SlowGetAlignedPointerFromEmbedderData(index);
|
|
@@ -487,9 +496,10 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
|
487
496
|
int value_offset = I::kEmbedderDataArrayHeaderSize +
|
|
488
497
|
(I::kEmbedderDataSlotSize * index) +
|
|
489
498
|
I::kEmbedderDataSlotExternalPointerOffset;
|
|
490
|
-
Isolate* isolate = I::
|
|
499
|
+
Isolate* isolate = I::GetCurrentIsolateForSandbox();
|
|
491
500
|
return reinterpret_cast<void*>(
|
|
492
|
-
I::ReadExternalPointerField<internal::
|
|
501
|
+
I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
|
|
502
|
+
internal::kLastEmbedderDataTag}>(
|
|
493
503
|
isolate, embedder_data, value_offset));
|
|
494
504
|
#else
|
|
495
505
|
return SlowGetAlignedPointerFromEmbedderData(index);
|
package/include/node/v8-data.h
CHANGED
package/include/node/v8-debug.h
CHANGED
|
@@ -172,6 +172,17 @@ class V8_EXPORT StackTrace {
|
|
|
172
172
|
* a stack trace.
|
|
173
173
|
*/
|
|
174
174
|
static Local<String> CurrentScriptNameOrSourceURL(Isolate* isolate);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Returns the first valid script id at the top of
|
|
178
|
+
* the JS stack. The returned value is Message::kNoScriptIdInfo if no id
|
|
179
|
+
* was found.
|
|
180
|
+
*
|
|
181
|
+
* This method is equivalent to calling StackTrace::CurrentStackTrace and
|
|
182
|
+
* walking the resulting frames from the beginning until a non-empty id is
|
|
183
|
+
* found. The difference is that this method won't allocate a stack trace.
|
|
184
|
+
*/
|
|
185
|
+
static int CurrentScriptId(Isolate* isolate);
|
|
175
186
|
};
|
|
176
187
|
|
|
177
188
|
} // namespace v8
|
|
@@ -42,7 +42,7 @@ class ReturnValue {
|
|
|
42
42
|
public:
|
|
43
43
|
template <class S>
|
|
44
44
|
V8_INLINE ReturnValue(const ReturnValue<S>& that) : value_(that.value_) {
|
|
45
|
-
static_assert(std::
|
|
45
|
+
static_assert(std::is_base_of_v<T, S>, "type check");
|
|
46
46
|
}
|
|
47
47
|
// Handle-based setters.
|
|
48
48
|
template <typename S>
|
|
@@ -66,12 +66,12 @@ class ReturnValue {
|
|
|
66
66
|
V8_INLINE void Set(uint16_t i);
|
|
67
67
|
V8_INLINE void Set(uint32_t i);
|
|
68
68
|
V8_INLINE void Set(uint64_t i);
|
|
69
|
-
// Fast JS primitive setters
|
|
69
|
+
// Fast JS primitive setters.
|
|
70
70
|
V8_INLINE void SetNull();
|
|
71
71
|
V8_INLINE void SetUndefined();
|
|
72
72
|
V8_INLINE void SetFalse();
|
|
73
73
|
V8_INLINE void SetEmptyString();
|
|
74
|
-
// Convenience getter for Isolate
|
|
74
|
+
// Convenience getter for the Isolate.
|
|
75
75
|
V8_INLINE Isolate* GetIsolate() const;
|
|
76
76
|
|
|
77
77
|
// Pointer setter: Uncompilable to prevent inadvertent misuse.
|
|
@@ -250,7 +250,7 @@ class PropertyCallbackInfo {
|
|
|
250
250
|
*
|
|
251
251
|
* \note For security reasons, do not pass the object back into the runtime.
|
|
252
252
|
*/
|
|
253
|
-
|
|
253
|
+
V8_DEPRECATED(
|
|
254
254
|
"V8 will stop providing access to hidden prototype (i.e. "
|
|
255
255
|
"JSGlobalObject). Use HolderV2() instead. \n"
|
|
256
256
|
"DO NOT try to workaround this by accessing JSGlobalObject via "
|
|
@@ -335,7 +335,7 @@ void ReturnValue<T>::SetInternal(internal::Address value) {
|
|
|
335
335
|
template <typename T>
|
|
336
336
|
template <typename S>
|
|
337
337
|
void ReturnValue<T>::Set(const Global<S>& handle) {
|
|
338
|
-
static_assert(std::
|
|
338
|
+
static_assert(std::is_base_of_v<T, S>, "type check");
|
|
339
339
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
|
340
340
|
SetDefaultValue();
|
|
341
341
|
} else {
|
|
@@ -346,7 +346,7 @@ void ReturnValue<T>::Set(const Global<S>& handle) {
|
|
|
346
346
|
template <typename T>
|
|
347
347
|
template <typename S>
|
|
348
348
|
void ReturnValue<T>::SetNonEmpty(const Global<S>& handle) {
|
|
349
|
-
static_assert(std::
|
|
349
|
+
static_assert(std::is_base_of_v<T, S>, "type check");
|
|
350
350
|
#ifdef V8_ENABLE_CHECKS
|
|
351
351
|
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
|
352
352
|
#endif // V8_ENABLE_CHECKS
|
|
@@ -356,7 +356,7 @@ void ReturnValue<T>::SetNonEmpty(const Global<S>& handle) {
|
|
|
356
356
|
template <typename T>
|
|
357
357
|
template <typename S>
|
|
358
358
|
void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
|
|
359
|
-
static_assert(std::
|
|
359
|
+
static_assert(std::is_base_of_v<T, S>, "type check");
|
|
360
360
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
|
361
361
|
SetDefaultValue();
|
|
362
362
|
} else {
|
|
@@ -367,7 +367,7 @@ void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
|
|
|
367
367
|
template <typename T>
|
|
368
368
|
template <typename S>
|
|
369
369
|
void ReturnValue<T>::SetNonEmpty(const BasicTracedReference<S>& handle) {
|
|
370
|
-
static_assert(std::
|
|
370
|
+
static_assert(std::is_base_of_v<T, S>, "type check");
|
|
371
371
|
#ifdef V8_ENABLE_CHECKS
|
|
372
372
|
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
|
373
373
|
#endif // V8_ENABLE_CHECKS
|
|
@@ -380,16 +380,16 @@ void ReturnValue<T>::Set(const Local<S> handle) {
|
|
|
380
380
|
// "V8_DEPRECATE_SOON" this method if |T| is |void|.
|
|
381
381
|
#ifdef V8_IMMINENT_DEPRECATION_WARNINGS
|
|
382
382
|
static constexpr bool is_allowed_void = false;
|
|
383
|
-
static_assert(!std::
|
|
383
|
+
static_assert(!std::is_void_v<T>,
|
|
384
384
|
"ReturnValue<void>::Set(const Local<S>) is deprecated. "
|
|
385
385
|
"Do nothing to indicate that the operation succeeded or use "
|
|
386
386
|
"SetFalse() to indicate that the operation failed (don't "
|
|
387
387
|
"forget to handle info.ShouldThrowOnError()). "
|
|
388
388
|
"See http://crbug.com/348660658 for details.");
|
|
389
389
|
#else
|
|
390
|
-
static constexpr bool is_allowed_void = std::
|
|
390
|
+
static constexpr bool is_allowed_void = std::is_void_v<T>;
|
|
391
391
|
#endif // V8_IMMINENT_DEPRECATION_WARNINGS
|
|
392
|
-
static_assert(is_allowed_void || std::
|
|
392
|
+
static_assert(is_allowed_void || std::is_base_of_v<T, S>, "type check");
|
|
393
393
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
|
394
394
|
SetDefaultValue();
|
|
395
395
|
} else if constexpr (is_allowed_void) {
|
|
@@ -407,16 +407,16 @@ void ReturnValue<T>::SetNonEmpty(const Local<S> handle) {
|
|
|
407
407
|
// "V8_DEPRECATE_SOON" this method if |T| is |void|.
|
|
408
408
|
#ifdef V8_IMMINENT_DEPRECATION_WARNINGS
|
|
409
409
|
static constexpr bool is_allowed_void = false;
|
|
410
|
-
static_assert(!std::
|
|
410
|
+
static_assert(!std::is_void_v<T>,
|
|
411
411
|
"ReturnValue<void>::SetNonEmpty(const Local<S>) is deprecated. "
|
|
412
412
|
"Do nothing to indicate that the operation succeeded or use "
|
|
413
413
|
"SetFalse() to indicate that the operation failed (don't "
|
|
414
414
|
"forget to handle info.ShouldThrowOnError()). "
|
|
415
415
|
"See http://crbug.com/348660658 for details.");
|
|
416
416
|
#else
|
|
417
|
-
static constexpr bool is_allowed_void = std::
|
|
417
|
+
static constexpr bool is_allowed_void = std::is_void_v<T>;
|
|
418
418
|
#endif // V8_IMMINENT_DEPRECATION_WARNINGS
|
|
419
|
-
static_assert(is_allowed_void || std::
|
|
419
|
+
static_assert(is_allowed_void || std::is_base_of_v<T, S>, "type check");
|
|
420
420
|
#ifdef V8_ENABLE_CHECKS
|
|
421
421
|
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
|
422
422
|
#endif // V8_ENABLE_CHECKS
|
|
@@ -431,13 +431,13 @@ void ReturnValue<T>::SetNonEmpty(const Local<S> handle) {
|
|
|
431
431
|
|
|
432
432
|
template <typename T>
|
|
433
433
|
void ReturnValue<T>::Set(double i) {
|
|
434
|
-
static_assert(std::
|
|
434
|
+
static_assert(std::is_base_of_v<T, Number>, "type check");
|
|
435
435
|
SetNonEmpty(Number::New(GetIsolate(), i));
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
template <typename T>
|
|
439
439
|
void ReturnValue<T>::Set(int16_t i) {
|
|
440
|
-
static_assert(std::
|
|
440
|
+
static_assert(std::is_base_of_v<T, Integer>, "type check");
|
|
441
441
|
using I = internal::Internals;
|
|
442
442
|
static_assert(I::IsValidSmi(std::numeric_limits<int16_t>::min()));
|
|
443
443
|
static_assert(I::IsValidSmi(std::numeric_limits<int16_t>::max()));
|
|
@@ -446,7 +446,7 @@ void ReturnValue<T>::Set(int16_t i) {
|
|
|
446
446
|
|
|
447
447
|
template <typename T>
|
|
448
448
|
void ReturnValue<T>::Set(int32_t i) {
|
|
449
|
-
static_assert(std::
|
|
449
|
+
static_assert(std::is_base_of_v<T, Integer>, "type check");
|
|
450
450
|
if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
|
|
451
451
|
SetInternal(*result);
|
|
452
452
|
return;
|
|
@@ -456,7 +456,7 @@ void ReturnValue<T>::Set(int32_t i) {
|
|
|
456
456
|
|
|
457
457
|
template <typename T>
|
|
458
458
|
void ReturnValue<T>::Set(int64_t i) {
|
|
459
|
-
static_assert(std::
|
|
459
|
+
static_assert(std::is_base_of_v<T, Integer>, "type check");
|
|
460
460
|
if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
|
|
461
461
|
SetInternal(*result);
|
|
462
462
|
return;
|
|
@@ -466,7 +466,7 @@ void ReturnValue<T>::Set(int64_t i) {
|
|
|
466
466
|
|
|
467
467
|
template <typename T>
|
|
468
468
|
void ReturnValue<T>::Set(uint16_t i) {
|
|
469
|
-
static_assert(std::
|
|
469
|
+
static_assert(std::is_base_of_v<T, Integer>, "type check");
|
|
470
470
|
using I = internal::Internals;
|
|
471
471
|
static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::min()));
|
|
472
472
|
static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::max()));
|
|
@@ -475,7 +475,7 @@ void ReturnValue<T>::Set(uint16_t i) {
|
|
|
475
475
|
|
|
476
476
|
template <typename T>
|
|
477
477
|
void ReturnValue<T>::Set(uint32_t i) {
|
|
478
|
-
static_assert(std::
|
|
478
|
+
static_assert(std::is_base_of_v<T, Integer>, "type check");
|
|
479
479
|
if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
|
|
480
480
|
SetInternal(*result);
|
|
481
481
|
return;
|
|
@@ -485,7 +485,7 @@ void ReturnValue<T>::Set(uint32_t i) {
|
|
|
485
485
|
|
|
486
486
|
template <typename T>
|
|
487
487
|
void ReturnValue<T>::Set(uint64_t i) {
|
|
488
|
-
static_assert(std::
|
|
488
|
+
static_assert(std::is_base_of_v<T, Integer>, "type check");
|
|
489
489
|
if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
|
|
490
490
|
SetInternal(*result);
|
|
491
491
|
return;
|
|
@@ -495,7 +495,7 @@ void ReturnValue<T>::Set(uint64_t i) {
|
|
|
495
495
|
|
|
496
496
|
template <typename T>
|
|
497
497
|
void ReturnValue<T>::Set(bool value) {
|
|
498
|
-
static_assert(std::
|
|
498
|
+
static_assert(std::is_void_v<T> || std::is_base_of_v<T, Boolean>,
|
|
499
499
|
"type check");
|
|
500
500
|
using I = internal::Internals;
|
|
501
501
|
#if V8_STATIC_ROOTS_BOOL
|
|
@@ -535,7 +535,7 @@ void ReturnValue<T>::SetDefaultValue() {
|
|
|
535
535
|
|
|
536
536
|
template <typename T>
|
|
537
537
|
void ReturnValue<T>::SetNull() {
|
|
538
|
-
static_assert(std::
|
|
538
|
+
static_assert(std::is_base_of_v<T, Primitive>, "type check");
|
|
539
539
|
using I = internal::Internals;
|
|
540
540
|
#if V8_STATIC_ROOTS_BOOL
|
|
541
541
|
#ifdef V8_ENABLE_CHECKS
|
|
@@ -550,7 +550,7 @@ void ReturnValue<T>::SetNull() {
|
|
|
550
550
|
|
|
551
551
|
template <typename T>
|
|
552
552
|
void ReturnValue<T>::SetUndefined() {
|
|
553
|
-
static_assert(std::
|
|
553
|
+
static_assert(std::is_base_of_v<T, Primitive>, "type check");
|
|
554
554
|
using I = internal::Internals;
|
|
555
555
|
#if V8_STATIC_ROOTS_BOOL
|
|
556
556
|
#ifdef V8_ENABLE_CHECKS
|
|
@@ -565,7 +565,7 @@ void ReturnValue<T>::SetUndefined() {
|
|
|
565
565
|
|
|
566
566
|
template <typename T>
|
|
567
567
|
void ReturnValue<T>::SetFalse() {
|
|
568
|
-
static_assert(std::
|
|
568
|
+
static_assert(std::is_void_v<T> || std::is_base_of_v<T, Boolean>,
|
|
569
569
|
"type check");
|
|
570
570
|
using I = internal::Internals;
|
|
571
571
|
#if V8_STATIC_ROOTS_BOOL
|
|
@@ -581,7 +581,7 @@ void ReturnValue<T>::SetFalse() {
|
|
|
581
581
|
|
|
582
582
|
template <typename T>
|
|
583
583
|
void ReturnValue<T>::SetEmptyString() {
|
|
584
|
-
static_assert(std::
|
|
584
|
+
static_assert(std::is_base_of_v<T, String>, "type check");
|
|
585
585
|
using I = internal::Internals;
|
|
586
586
|
#if V8_STATIC_ROOTS_BOOL
|
|
587
587
|
#ifdef V8_ENABLE_CHECKS
|