libv8-node 21.7.2.0-aarch64-linux-musl → 24.12.0.0-aarch64-linux-musl
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.
- checksums.yaml +4 -4
- data/ext/libv8-node/location.rb +3 -5
- data/ext/libv8-node/paths.rb +2 -0
- data/lib/libv8/node/version.rb +7 -4
- data/lib/libv8/node.rb +2 -0
- data/lib/libv8-node.rb +2 -0
- data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +11 -13
- data/vendor/v8/include/cppgc/default-platform.h +3 -2
- data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
- data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
- data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
- data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
- data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
- data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
- data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
- data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
- data/vendor/v8/include/cppgc/macros.h +21 -0
- data/vendor/v8/include/cppgc/member.h +70 -36
- data/vendor/v8/include/cppgc/name-provider.h +10 -0
- data/vendor/v8/include/cppgc/platform.h +11 -0
- data/vendor/v8/include/cppgc/type-traits.h +26 -4
- data/vendor/v8/include/cppgc/visitor.h +25 -1
- data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +149 -46
- data/vendor/v8/include/v8-callbacks.h +100 -43
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +92 -30
- data/vendor/v8/include/v8-cppgc.h +5 -56
- data/vendor/v8/include/v8-data.h +5 -0
- data/vendor/v8/include/v8-date.h +9 -0
- data/vendor/v8/include/v8-debug.h +11 -0
- data/vendor/v8/include/v8-embedder-heap.h +8 -20
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +87 -9
- data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
- data/vendor/v8/include/v8-fast-api-calls.h +67 -223
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +296 -75
- data/vendor/v8/include/v8-function.h +11 -3
- data/vendor/v8/include/v8-handle-base.h +52 -82
- data/vendor/v8/include/v8-initialization.h +26 -1
- data/vendor/v8/include/v8-inspector.h +26 -27
- data/vendor/v8/include/v8-internal.h +960 -230
- data/vendor/v8/include/v8-isolate.h +347 -226
- data/vendor/v8/include/v8-local-handle.h +307 -55
- data/vendor/v8/include/v8-maybe.h +2 -1
- data/vendor/v8/include/v8-memory-span.h +284 -4
- data/vendor/v8/include/v8-message.h +11 -5
- data/vendor/v8/include/v8-metrics.h +15 -0
- data/vendor/v8/include/v8-microtask-queue.h +0 -5
- data/vendor/v8/include/v8-object.h +314 -41
- data/vendor/v8/include/v8-persistent-handle.h +29 -39
- data/vendor/v8/include/v8-platform.h +135 -77
- data/vendor/v8/include/v8-primitive.h +223 -5
- data/vendor/v8/include/v8-profiler.h +51 -2
- data/vendor/v8/include/v8-promise.h +2 -2
- data/vendor/v8/include/v8-proxy.h +0 -1
- data/vendor/v8/include/v8-regexp.h +0 -1
- data/vendor/v8/include/v8-sandbox.h +173 -0
- data/vendor/v8/include/v8-script.h +125 -27
- data/vendor/v8/include/v8-snapshot.h +130 -23
- data/vendor/v8/include/v8-source-location.h +6 -1
- data/vendor/v8/include/v8-statistics.h +10 -24
- data/vendor/v8/include/v8-template.h +320 -193
- data/vendor/v8/include/v8-trace-categories.h +23 -0
- data/vendor/v8/include/v8-traced-handle.h +99 -76
- data/vendor/v8/include/v8-typed-array.h +111 -7
- data/vendor/v8/include/v8-unwinder-state.h +2 -3
- data/vendor/v8/include/v8-unwinder.h +2 -1
- data/vendor/v8/include/v8-util.h +10 -125
- data/vendor/v8/include/v8-value-serializer-version.h +3 -3
- data/vendor/v8/include/v8-value.h +113 -6
- data/vendor/v8/include/v8-version.h +3 -3
- data/vendor/v8/include/v8-wasm.h +27 -0
- data/vendor/v8/include/v8-weak-callback-info.h +20 -12
- data/vendor/v8/include/v8.h +3 -3
- data/vendor/v8/include/v8config.h +116 -53
- metadata +55 -12
- data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
|
@@ -84,6 +84,33 @@ class V8_EXPORT Context : public Data {
|
|
|
84
84
|
* created by a previous call to Context::New with the same global
|
|
85
85
|
* template. The state of the global object will be completely reset
|
|
86
86
|
* and only object identify will remain.
|
|
87
|
+
*
|
|
88
|
+
* \param internal_fields_deserializer An optional callback used
|
|
89
|
+
* to deserialize fields set by
|
|
90
|
+
* v8::Object::SetAlignedPointerInInternalField() in wrapper objects
|
|
91
|
+
* from the default context snapshot. It should match the
|
|
92
|
+
* SerializeInternalFieldsCallback() used by
|
|
93
|
+
* v8::SnapshotCreator::SetDefaultContext() when the default context
|
|
94
|
+
* snapshot is created. It does not need to be configured if the default
|
|
95
|
+
* context snapshot contains no wrapper objects with pointer internal
|
|
96
|
+
* fields, or if no custom startup snapshot is configured
|
|
97
|
+
* in the v8::CreateParams used to create the isolate.
|
|
98
|
+
*
|
|
99
|
+
* \param microtask_queue An optional microtask queue used to manage
|
|
100
|
+
* the microtasks created in this context. If not set the per-isolate
|
|
101
|
+
* default microtask queue would be used.
|
|
102
|
+
*
|
|
103
|
+
* \param context_data_deserializer An optional callback used
|
|
104
|
+
* to deserialize embedder data set by
|
|
105
|
+
* v8::Context::SetAlignedPointerInEmbedderData() in the default
|
|
106
|
+
* context from the default context snapshot. It does not need to be
|
|
107
|
+
* configured if the default context snapshot contains no pointer embedder
|
|
108
|
+
* data, or if no custom startup snapshot is configured in the
|
|
109
|
+
* v8::CreateParams used to create the isolate.
|
|
110
|
+
*
|
|
111
|
+
* \param api_wrapper_deserializer An optional callback used to deserialize
|
|
112
|
+
* API wrapper objects that was initially set with v8::Object::Wrap() and then
|
|
113
|
+
* serialized using SerializeAPIWrapperCallback.
|
|
87
114
|
*/
|
|
88
115
|
static Local<Context> New(
|
|
89
116
|
Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
|
|
@@ -91,33 +118,59 @@ class V8_EXPORT Context : public Data {
|
|
|
91
118
|
MaybeLocal<Value> global_object = MaybeLocal<Value>(),
|
|
92
119
|
DeserializeInternalFieldsCallback internal_fields_deserializer =
|
|
93
120
|
DeserializeInternalFieldsCallback(),
|
|
94
|
-
MicrotaskQueue* microtask_queue = nullptr
|
|
121
|
+
MicrotaskQueue* microtask_queue = nullptr,
|
|
122
|
+
DeserializeContextDataCallback context_data_deserializer =
|
|
123
|
+
DeserializeContextDataCallback(),
|
|
124
|
+
DeserializeAPIWrapperCallback api_wrapper_deserializer =
|
|
125
|
+
DeserializeAPIWrapperCallback());
|
|
95
126
|
|
|
96
127
|
/**
|
|
97
128
|
* Create a new context from a (non-default) context snapshot. There
|
|
98
129
|
* is no way to provide a global object template since we do not create
|
|
99
130
|
* a new global object from template, but we can reuse a global object.
|
|
100
131
|
*
|
|
101
|
-
* \param isolate See v8::Context::New.
|
|
132
|
+
* \param isolate See v8::Context::New().
|
|
102
133
|
*
|
|
103
134
|
* \param context_snapshot_index The index of the context snapshot to
|
|
104
|
-
* deserialize from. Use v8::Context::New for the default snapshot.
|
|
135
|
+
* deserialize from. Use v8::Context::New() for the default snapshot.
|
|
136
|
+
*
|
|
137
|
+
* \param internal_fields_deserializer An optional callback used
|
|
138
|
+
* to deserialize fields set by
|
|
139
|
+
* v8::Object::SetAlignedPointerInInternalField() in wrapper objects
|
|
140
|
+
* from the default context snapshot. It does not need to be
|
|
141
|
+
* configured if there are no wrapper objects with no internal
|
|
142
|
+
* pointer fields in the default context snapshot or if no startup
|
|
143
|
+
* snapshot is configured when the isolate is created.
|
|
144
|
+
*
|
|
145
|
+
* \param extensions See v8::Context::New().
|
|
146
|
+
*
|
|
147
|
+
* \param global_object See v8::Context::New().
|
|
148
|
+
*
|
|
149
|
+
* \param internal_fields_deserializer Similar to
|
|
150
|
+
* internal_fields_deserializer in v8::Context::New() but applies to
|
|
151
|
+
* the context specified by the context_snapshot_index.
|
|
105
152
|
*
|
|
106
|
-
* \param
|
|
107
|
-
* internal fields. It should match the SerializeInternalFieldCallback used
|
|
108
|
-
* to serialize.
|
|
153
|
+
* \param microtask_queue See v8::Context::New().
|
|
109
154
|
*
|
|
110
|
-
* \param
|
|
155
|
+
* \param context_data_deserializer Similar to
|
|
156
|
+
* context_data_deserializer in v8::Context::New() but applies to
|
|
157
|
+
* the context specified by the context_snapshot_index.
|
|
111
158
|
*
|
|
112
|
-
|
|
159
|
+
*\param api_wrapper_deserializer Similar to api_wrapper_deserializer in
|
|
160
|
+
* v8::Context::New() but applies to the context specified by the
|
|
161
|
+
* context_snapshot_index.
|
|
113
162
|
*/
|
|
114
163
|
static MaybeLocal<Context> FromSnapshot(
|
|
115
164
|
Isolate* isolate, size_t context_snapshot_index,
|
|
116
|
-
DeserializeInternalFieldsCallback
|
|
165
|
+
DeserializeInternalFieldsCallback internal_fields_deserializer =
|
|
117
166
|
DeserializeInternalFieldsCallback(),
|
|
118
167
|
ExtensionConfiguration* extensions = nullptr,
|
|
119
168
|
MaybeLocal<Value> global_object = MaybeLocal<Value>(),
|
|
120
|
-
MicrotaskQueue* microtask_queue = nullptr
|
|
169
|
+
MicrotaskQueue* microtask_queue = nullptr,
|
|
170
|
+
DeserializeContextDataCallback context_data_deserializer =
|
|
171
|
+
DeserializeContextDataCallback(),
|
|
172
|
+
DeserializeAPIWrapperCallback api_wrapper_deserializer =
|
|
173
|
+
DeserializeAPIWrapperCallback());
|
|
121
174
|
|
|
122
175
|
/**
|
|
123
176
|
* Returns an global object that isn't backed by an actual context.
|
|
@@ -182,7 +235,7 @@ class V8_EXPORT Context : public Data {
|
|
|
182
235
|
* parameter. Returns true if the operation completed successfully.
|
|
183
236
|
*/
|
|
184
237
|
virtual bool FreezeEmbedderObjectAndGetChildren(
|
|
185
|
-
Local<Object> obj,
|
|
238
|
+
Local<Object> obj, LocalVector<Object>& children_out) = 0;
|
|
186
239
|
};
|
|
187
240
|
|
|
188
241
|
/**
|
|
@@ -249,6 +302,8 @@ class V8_EXPORT Context : public Data {
|
|
|
249
302
|
* SetAlignedPointerInEmbedderData with the same index. Note that index 0
|
|
250
303
|
* currently has a special meaning for Chrome's debugger.
|
|
251
304
|
*/
|
|
305
|
+
V8_INLINE void* GetAlignedPointerFromEmbedderData(Isolate* isolate,
|
|
306
|
+
int index);
|
|
252
307
|
V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
|
|
253
308
|
|
|
254
309
|
/**
|
|
@@ -265,7 +320,7 @@ class V8_EXPORT Context : public Data {
|
|
|
265
320
|
* 'Function' constructor are used an exception will be thrown.
|
|
266
321
|
*
|
|
267
322
|
* If code generation from strings is not allowed the
|
|
268
|
-
* V8::
|
|
323
|
+
* V8::ModifyCodeGenerationFromStringsCallback callback will be invoked if
|
|
269
324
|
* set before blocking the call to 'eval' or the 'Function'
|
|
270
325
|
* constructor. If that callback returns true, the call will be
|
|
271
326
|
* allowed, otherwise an exception will be thrown. If no callback is
|
|
@@ -309,18 +364,6 @@ class V8_EXPORT Context : public Data {
|
|
|
309
364
|
Local<Context> context);
|
|
310
365
|
void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
|
|
311
366
|
|
|
312
|
-
/**
|
|
313
|
-
* Returns the value that was set or restored by
|
|
314
|
-
* SetContinuationPreservedEmbedderData(), if any.
|
|
315
|
-
*/
|
|
316
|
-
Local<Value> GetContinuationPreservedEmbedderData() const;
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Sets a value that will be stored on continuations and reset while the
|
|
320
|
-
* continuation runs.
|
|
321
|
-
*/
|
|
322
|
-
void SetContinuationPreservedEmbedderData(Local<Value> context);
|
|
323
|
-
|
|
324
367
|
/**
|
|
325
368
|
* Set or clear hooks to be invoked for promise lifecycle operations.
|
|
326
369
|
* To clear a hook, set it to an empty v8::Function. Each function will
|
|
@@ -384,7 +427,8 @@ class V8_EXPORT Context : public Data {
|
|
|
384
427
|
|
|
385
428
|
static void CheckCast(Data* obj);
|
|
386
429
|
|
|
387
|
-
internal::
|
|
430
|
+
internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce(
|
|
431
|
+
size_t index);
|
|
388
432
|
Local<Value> SlowGetEmbedderData(int index);
|
|
389
433
|
void* SlowGetAlignedPointerFromEmbedderData(int index);
|
|
390
434
|
};
|
|
@@ -415,6 +459,24 @@ Local<Value> Context::GetEmbedderData(int index) {
|
|
|
415
459
|
#endif
|
|
416
460
|
}
|
|
417
461
|
|
|
462
|
+
void* Context::GetAlignedPointerFromEmbedderData(Isolate* isolate, int index) {
|
|
463
|
+
#if !defined(V8_ENABLE_CHECKS)
|
|
464
|
+
using A = internal::Address;
|
|
465
|
+
using I = internal::Internals;
|
|
466
|
+
A ctx = internal::ValueHelper::ValueAsAddress(this);
|
|
467
|
+
A embedder_data =
|
|
468
|
+
I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
|
|
469
|
+
int value_offset = I::kEmbedderDataArrayHeaderSize +
|
|
470
|
+
(I::kEmbedderDataSlotSize * index) +
|
|
471
|
+
I::kEmbedderDataSlotExternalPointerOffset;
|
|
472
|
+
return reinterpret_cast<void*>(
|
|
473
|
+
I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
|
|
474
|
+
isolate, embedder_data, value_offset));
|
|
475
|
+
#else
|
|
476
|
+
return SlowGetAlignedPointerFromEmbedderData(index);
|
|
477
|
+
#endif
|
|
478
|
+
}
|
|
479
|
+
|
|
418
480
|
void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
419
481
|
#if !defined(V8_ENABLE_CHECKS)
|
|
420
482
|
using A = internal::Address;
|
|
@@ -436,12 +498,12 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
|
436
498
|
|
|
437
499
|
template <class T>
|
|
438
500
|
MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
|
|
439
|
-
auto
|
|
440
|
-
|
|
441
|
-
internal::PerformCastCheck(
|
|
442
|
-
|
|
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);
|
|
443
505
|
}
|
|
444
|
-
return
|
|
506
|
+
return {};
|
|
445
507
|
}
|
|
446
508
|
|
|
447
509
|
Context* Context::Cast(v8::Data* data) {
|
|
@@ -32,62 +32,15 @@ class CppHeap;
|
|
|
32
32
|
|
|
33
33
|
class CustomSpaceStatisticsReceiver;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Describes how V8 wrapper objects maintain references to garbage-collected C++
|
|
37
|
-
* objects.
|
|
38
|
-
*/
|
|
39
|
-
struct WrapperDescriptor final {
|
|
40
|
-
/**
|
|
41
|
-
* The index used on `v8::Ojbect::SetAlignedPointerFromInternalField()` and
|
|
42
|
-
* related APIs to add additional data to an object which is used to identify
|
|
43
|
-
* JS->C++ references.
|
|
44
|
-
*/
|
|
45
|
-
using InternalFieldIndex = int;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Unknown embedder id. The value is reserved for internal usages and must not
|
|
49
|
-
* be used with `CppHeap`.
|
|
50
|
-
*/
|
|
51
|
-
static constexpr uint16_t kUnknownEmbedderId = UINT16_MAX;
|
|
52
|
-
|
|
53
|
-
constexpr WrapperDescriptor(InternalFieldIndex wrappable_type_index,
|
|
54
|
-
InternalFieldIndex wrappable_instance_index,
|
|
55
|
-
uint16_t embedder_id_for_garbage_collected)
|
|
56
|
-
: wrappable_type_index(wrappable_type_index),
|
|
57
|
-
wrappable_instance_index(wrappable_instance_index),
|
|
58
|
-
embedder_id_for_garbage_collected(embedder_id_for_garbage_collected) {}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Index of the wrappable type.
|
|
62
|
-
*/
|
|
63
|
-
InternalFieldIndex wrappable_type_index;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Index of the wrappable instance.
|
|
67
|
-
*/
|
|
68
|
-
InternalFieldIndex wrappable_instance_index;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Embedder id identifying instances of garbage-collected objects. It is
|
|
72
|
-
* expected that the first field of the wrappable type is a uint16_t holding
|
|
73
|
-
* the id. Only references to instances of wrappables types with an id of
|
|
74
|
-
* `embedder_id_for_garbage_collected` will be considered by CppHeap.
|
|
75
|
-
*/
|
|
76
|
-
uint16_t embedder_id_for_garbage_collected;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
35
|
struct V8_EXPORT CppHeapCreateParams {
|
|
80
|
-
CppHeapCreateParams(
|
|
81
|
-
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces
|
|
82
|
-
|
|
83
|
-
: custom_spaces(std::move(custom_spaces)),
|
|
84
|
-
wrapper_descriptor(wrapper_descriptor) {}
|
|
36
|
+
explicit CppHeapCreateParams(
|
|
37
|
+
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces)
|
|
38
|
+
: custom_spaces(std::move(custom_spaces)) {}
|
|
85
39
|
|
|
86
40
|
CppHeapCreateParams(const CppHeapCreateParams&) = delete;
|
|
87
41
|
CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete;
|
|
88
42
|
|
|
89
43
|
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces;
|
|
90
|
-
WrapperDescriptor wrapper_descriptor;
|
|
91
44
|
/**
|
|
92
45
|
* Specifies which kind of marking are supported by the heap. The type may be
|
|
93
46
|
* further reduced via runtime flags when attaching the heap to an Isolate.
|
|
@@ -134,6 +87,7 @@ class V8_EXPORT CppHeap {
|
|
|
134
87
|
*
|
|
135
88
|
* After this call, object allocation is prohibited.
|
|
136
89
|
*/
|
|
90
|
+
V8_DEPRECATED("Terminate gets automatically called in the CppHeap destructor")
|
|
137
91
|
void Terminate();
|
|
138
92
|
|
|
139
93
|
/**
|
|
@@ -148,7 +102,7 @@ class V8_EXPORT CppHeap {
|
|
|
148
102
|
/**
|
|
149
103
|
* Collects statistics for the given spaces and reports them to the receiver.
|
|
150
104
|
*
|
|
151
|
-
* \param custom_spaces a collection of custom space
|
|
105
|
+
* \param custom_spaces a collection of custom space indices.
|
|
152
106
|
* \param receiver an object that gets the results.
|
|
153
107
|
*/
|
|
154
108
|
void CollectCustomSpaceStatisticsAtLastGC(
|
|
@@ -177,11 +131,6 @@ class V8_EXPORT CppHeap {
|
|
|
177
131
|
void CollectGarbageInYoungGenerationForTesting(
|
|
178
132
|
cppgc::EmbedderStackState stack_state);
|
|
179
133
|
|
|
180
|
-
/**
|
|
181
|
-
* \returns the wrapper descriptor of this CppHeap.
|
|
182
|
-
*/
|
|
183
|
-
v8::WrapperDescriptor wrapper_descriptor() const;
|
|
184
|
-
|
|
185
134
|
private:
|
|
186
135
|
CppHeap() = default;
|
|
187
136
|
|
data/vendor/v8/include/v8-data.h
CHANGED
data/vendor/v8/include/v8-date.h
CHANGED
|
@@ -21,6 +21,10 @@ class V8_EXPORT Date : public Object {
|
|
|
21
21
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
|
|
22
22
|
double time);
|
|
23
23
|
|
|
24
|
+
static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse(
|
|
25
|
+
Local<Context> context,
|
|
26
|
+
Local<String> date_string);
|
|
27
|
+
|
|
24
28
|
/**
|
|
25
29
|
* A specialization of Value::NumberValue that is more efficient
|
|
26
30
|
* because we know the structure of this object.
|
|
@@ -32,6 +36,11 @@ class V8_EXPORT Date : public Object {
|
|
|
32
36
|
*/
|
|
33
37
|
v8::Local<v8::String> ToISOString() const;
|
|
34
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Generates UTC string representation.
|
|
41
|
+
*/
|
|
42
|
+
v8::Local<v8::String> ToUTCString() const;
|
|
43
|
+
|
|
35
44
|
V8_INLINE static Date* Cast(Value* value) {
|
|
36
45
|
#ifdef V8_ENABLE_CHECKS
|
|
37
46
|
CheckCast(value);
|
|
@@ -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
|
*/
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
10
10
|
|
|
11
11
|
namespace v8 {
|
|
12
|
+
namespace internal {
|
|
13
|
+
class TracedHandles;
|
|
14
|
+
} // namespace internal
|
|
12
15
|
|
|
13
16
|
class Isolate;
|
|
14
17
|
class Value;
|
|
@@ -20,24 +23,7 @@ class V8_EXPORT EmbedderRootsHandler {
|
|
|
20
23
|
public:
|
|
21
24
|
virtual ~EmbedderRootsHandler() = default;
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
* Returns true if the |TracedReference| handle should be considered as root
|
|
25
|
-
* for the currently running non-tracing garbage collection and false
|
|
26
|
-
* otherwise. The default implementation will keep all |TracedReference|
|
|
27
|
-
* references as roots.
|
|
28
|
-
*
|
|
29
|
-
* If this returns false, then V8 may decide that the object referred to by
|
|
30
|
-
* such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the
|
|
31
|
-
* |TracedReference|.
|
|
32
|
-
*
|
|
33
|
-
* Note that the `handle` is different from the handle that the embedder holds
|
|
34
|
-
* for retaining the object. The embedder may use |WrapperClassId()| to
|
|
35
|
-
* distinguish cases where it wants handles to be treated as roots from not
|
|
36
|
-
* being treated as roots.
|
|
37
|
-
*
|
|
38
|
-
* The concrete implementations must be thread-safe.
|
|
39
|
-
*/
|
|
40
|
-
virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
|
|
26
|
+
EmbedderRootsHandler() = default;
|
|
41
27
|
|
|
42
28
|
/**
|
|
43
29
|
* Used in combination with |IsRoot|. Called by V8 when an
|
|
@@ -56,9 +42,11 @@ class V8_EXPORT EmbedderRootsHandler {
|
|
|
56
42
|
* |false| is returned, |ResetRoot()| will be recalled for the same handle.
|
|
57
43
|
*/
|
|
58
44
|
virtual bool TryResetRoot(const v8::TracedReference<v8::Value>& handle) {
|
|
59
|
-
|
|
60
|
-
return true;
|
|
45
|
+
return false;
|
|
61
46
|
}
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
friend class internal::TracedHandles;
|
|
62
50
|
};
|
|
63
51
|
|
|
64
52
|
} // namespace v8
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
#include <memory>
|
|
9
9
|
|
|
10
|
-
#include "v8-context.h" // NOLINT(build/include_directory)
|
|
11
10
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
|
12
11
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
13
12
|
|
|
14
13
|
namespace v8 {
|
|
15
14
|
|
|
15
|
+
class Context;
|
|
16
|
+
|
|
16
17
|
namespace internal {
|
|
17
18
|
class EmbedderState;
|
|
18
19
|
} // namespace internal
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include <stddef.h>
|
|
9
9
|
|
|
10
10
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
11
|
+
#include "v8-object.h" // NOLINT(build/include_directory)
|
|
11
12
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
12
13
|
|
|
13
14
|
namespace v8 {
|
|
@@ -30,14 +31,23 @@ class ThreadLocalTop;
|
|
|
30
31
|
*/
|
|
31
32
|
class V8_EXPORT Exception {
|
|
32
33
|
public:
|
|
33
|
-
static Local<Value> RangeError(Local<String> message
|
|
34
|
-
|
|
35
|
-
static Local<Value>
|
|
36
|
-
|
|
37
|
-
static Local<Value>
|
|
38
|
-
|
|
39
|
-
static Local<Value>
|
|
40
|
-
|
|
34
|
+
static Local<Value> RangeError(Local<String> message,
|
|
35
|
+
Local<Value> options = {});
|
|
36
|
+
static Local<Value> ReferenceError(Local<String> message,
|
|
37
|
+
Local<Value> options = {});
|
|
38
|
+
static Local<Value> SyntaxError(Local<String> message,
|
|
39
|
+
Local<Value> options = {});
|
|
40
|
+
static Local<Value> TypeError(Local<String> message,
|
|
41
|
+
Local<Value> options = {});
|
|
42
|
+
static Local<Value> WasmCompileError(Local<String> message,
|
|
43
|
+
Local<Value> options = {});
|
|
44
|
+
static Local<Value> WasmLinkError(Local<String> message,
|
|
45
|
+
Local<Value> options = {});
|
|
46
|
+
static Local<Value> WasmRuntimeError(Local<String> message,
|
|
47
|
+
Local<Value> options = {});
|
|
48
|
+
static Local<Value> WasmSuspendError(Local<String> message,
|
|
49
|
+
Local<Value> options = {});
|
|
50
|
+
static Local<Value> Error(Local<String> message, Local<Value> options = {});
|
|
41
51
|
|
|
42
52
|
/**
|
|
43
53
|
* Creates an error message for the given exception.
|
|
@@ -51,8 +61,77 @@ class V8_EXPORT Exception {
|
|
|
51
61
|
* of a given exception, or an empty handle if not available.
|
|
52
62
|
*/
|
|
53
63
|
static Local<StackTrace> GetStackTrace(Local<Value> exception);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Captures the current stack trace and attaches it to the given object in the
|
|
67
|
+
* form of `stack` property.
|
|
68
|
+
*/
|
|
69
|
+
static Maybe<bool> CaptureStackTrace(Local<Context> context,
|
|
70
|
+
Local<Object> object);
|
|
54
71
|
};
|
|
55
72
|
|
|
73
|
+
/**
|
|
74
|
+
* This is a part of experimental Api and might be changed without further
|
|
75
|
+
* notice.
|
|
76
|
+
* Do not use it.
|
|
77
|
+
*/
|
|
78
|
+
enum class ExceptionContext : uint32_t {
|
|
79
|
+
kUnknown,
|
|
80
|
+
kConstructor,
|
|
81
|
+
kOperation,
|
|
82
|
+
kAttributeGet,
|
|
83
|
+
kAttributeSet,
|
|
84
|
+
kIndexedQuery,
|
|
85
|
+
kIndexedGetter,
|
|
86
|
+
kIndexedDescriptor,
|
|
87
|
+
kIndexedSetter,
|
|
88
|
+
kIndexedDefiner,
|
|
89
|
+
kIndexedDeleter,
|
|
90
|
+
kNamedQuery,
|
|
91
|
+
kNamedGetter,
|
|
92
|
+
kNamedDescriptor,
|
|
93
|
+
kNamedSetter,
|
|
94
|
+
kNamedDefiner,
|
|
95
|
+
kNamedDeleter,
|
|
96
|
+
kNamedEnumerator
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* This is a part of experimental Api and might be changed without further
|
|
101
|
+
* notice.
|
|
102
|
+
* Do not use it.
|
|
103
|
+
*/
|
|
104
|
+
class ExceptionPropagationMessage {
|
|
105
|
+
public:
|
|
106
|
+
ExceptionPropagationMessage(v8::Isolate* isolate, Local<Object> exception,
|
|
107
|
+
Local<String> interface_name,
|
|
108
|
+
Local<String> property_name,
|
|
109
|
+
ExceptionContext exception_context)
|
|
110
|
+
: isolate_(isolate),
|
|
111
|
+
exception_(exception),
|
|
112
|
+
interface_name_(interface_name),
|
|
113
|
+
property_name_(property_name),
|
|
114
|
+
exception_context_(exception_context) {}
|
|
115
|
+
|
|
116
|
+
V8_INLINE Isolate* GetIsolate() const { return isolate_; }
|
|
117
|
+
V8_INLINE Local<Object> GetException() const { return exception_; }
|
|
118
|
+
V8_INLINE Local<String> GetInterfaceName() const { return interface_name_; }
|
|
119
|
+
V8_INLINE Local<String> GetPropertyName() const { return property_name_; }
|
|
120
|
+
V8_INLINE ExceptionContext GetExceptionContext() const {
|
|
121
|
+
return exception_context_;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private:
|
|
125
|
+
Isolate* isolate_;
|
|
126
|
+
Local<Object> exception_;
|
|
127
|
+
Local<String> interface_name_;
|
|
128
|
+
Local<String> property_name_;
|
|
129
|
+
ExceptionContext exception_context_;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
using ExceptionPropagationCallback =
|
|
133
|
+
void (*)(ExceptionPropagationMessage message);
|
|
134
|
+
|
|
56
135
|
/**
|
|
57
136
|
* An external exception handler.
|
|
58
137
|
*/
|
|
@@ -206,7 +285,6 @@ class V8_EXPORT TryCatch {
|
|
|
206
285
|
bool can_continue_ : 1;
|
|
207
286
|
bool capture_message_ : 1;
|
|
208
287
|
bool rethrow_ : 1;
|
|
209
|
-
bool has_terminated_ : 1;
|
|
210
288
|
|
|
211
289
|
friend class internal::Isolate;
|
|
212
290
|
friend class internal::ThreadLocalTop;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright 2024 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_EXTERNAL_MEMORY_ACCOUNTER_H_
|
|
6
|
+
#define INCLUDE_EXTERNAL_MEMORY_ACCOUNTER_H_
|
|
7
|
+
|
|
8
|
+
#include <stdint.h>
|
|
9
|
+
|
|
10
|
+
#include "v8-isolate.h"
|
|
11
|
+
|
|
12
|
+
namespace v8 {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This class is used to give V8 an indication of the amount of externally
|
|
16
|
+
* allocated memory that is kept alive by JavaScript objects. V8 uses this to
|
|
17
|
+
* decide when to perform garbage collections. Registering externally allocated
|
|
18
|
+
* memory will trigger garbage collections more often than it would otherwise in
|
|
19
|
+
* an attempt to garbage collect the JavaScript objects that keep the externally
|
|
20
|
+
* allocated memory alive. Instances of ExternalMemoryAccounter check that the
|
|
21
|
+
* reported external memory is back to 0 on destruction.
|
|
22
|
+
*/
|
|
23
|
+
class V8_EXPORT ExternalMemoryAccounter {
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Returns the amount of external memory registered for `isolate`.
|
|
27
|
+
*/
|
|
28
|
+
static int64_t GetTotalAmountOfExternalAllocatedMemoryForTesting(
|
|
29
|
+
const Isolate* isolate);
|
|
30
|
+
|
|
31
|
+
ExternalMemoryAccounter() = default;
|
|
32
|
+
~ExternalMemoryAccounter();
|
|
33
|
+
ExternalMemoryAccounter(ExternalMemoryAccounter&&);
|
|
34
|
+
ExternalMemoryAccounter& operator=(ExternalMemoryAccounter&&);
|
|
35
|
+
ExternalMemoryAccounter(const ExternalMemoryAccounter&) = delete;
|
|
36
|
+
ExternalMemoryAccounter& operator=(const ExternalMemoryAccounter&) = delete;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Reports an increase of `size` bytes of external memory.
|
|
40
|
+
*/
|
|
41
|
+
void Increase(Isolate* isolate, size_t size);
|
|
42
|
+
/**
|
|
43
|
+
* Reports an update of `delta` bytes of external memory.
|
|
44
|
+
*/
|
|
45
|
+
void Update(Isolate* isolate, int64_t delta);
|
|
46
|
+
/**
|
|
47
|
+
* Reports an decrease of `size` bytes of external memory.
|
|
48
|
+
*/
|
|
49
|
+
void Decrease(Isolate* isolate, size_t size);
|
|
50
|
+
|
|
51
|
+
private:
|
|
52
|
+
#ifdef V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
|
|
53
|
+
size_t amount_of_external_memory_ = 0;
|
|
54
|
+
v8::Isolate* isolate_ = nullptr;
|
|
55
|
+
#endif
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace v8
|
|
59
|
+
|
|
60
|
+
#endif // INCLUDE_EXTERNAL_MEMORY_ACCOUNTER_H_
|