libv8-node 21.7.2.0-x86_64-linux → 22.5.1.0-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/include/cppgc/internal/api-constants.h +1 -1
- data/vendor/v8/include/cppgc/type-traits.h +25 -4
- data/vendor/v8/include/v8-array-buffer.h +6 -0
- data/vendor/v8/include/v8-callbacks.h +6 -12
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +51 -22
- data/vendor/v8/include/v8-embedder-heap.h +19 -3
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +15 -9
- data/vendor/v8/include/v8-fast-api-calls.h +35 -26
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +129 -20
- data/vendor/v8/include/v8-handle-base.h +32 -80
- data/vendor/v8/include/v8-inspector.h +16 -24
- data/vendor/v8/include/v8-internal.h +472 -65
- data/vendor/v8/include/v8-isolate.h +86 -51
- data/vendor/v8/include/v8-local-handle.h +257 -31
- data/vendor/v8/include/v8-memory-span.h +157 -2
- data/vendor/v8/include/v8-message.h +22 -3
- data/vendor/v8/include/v8-metrics.h +1 -0
- data/vendor/v8/include/v8-object.h +29 -10
- data/vendor/v8/include/v8-persistent-handle.h +5 -3
- data/vendor/v8/include/v8-platform.h +81 -44
- data/vendor/v8/include/v8-script.h +61 -11
- data/vendor/v8/include/v8-snapshot.h +94 -23
- data/vendor/v8/include/v8-statistics.h +10 -24
- data/vendor/v8/include/v8-template.h +410 -131
- data/vendor/v8/include/v8-traced-handle.h +81 -46
- data/vendor/v8/include/v8-typed-array.h +115 -7
- data/vendor/v8/include/v8-util.h +13 -12
- data/vendor/v8/include/v8-value.h +92 -4
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8config.h +35 -10
- data/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a +0 -0
- metadata +2 -2
@@ -6,6 +6,7 @@
|
|
6
6
|
#define INCLUDE_V8_SNAPSHOT_H_
|
7
7
|
|
8
8
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
9
|
+
#include "v8-isolate.h" // NOLINT(build/include_directory)
|
9
10
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
10
11
|
#include "v8config.h" // NOLINT(build/include_directory)
|
11
12
|
|
@@ -13,6 +14,10 @@ namespace v8 {
|
|
13
14
|
|
14
15
|
class Object;
|
15
16
|
|
17
|
+
namespace internal {
|
18
|
+
class SnapshotCreatorImpl;
|
19
|
+
} // namespace internal
|
20
|
+
|
16
21
|
class V8_EXPORT StartupData {
|
17
22
|
public:
|
18
23
|
/**
|
@@ -33,7 +38,7 @@ class V8_EXPORT StartupData {
|
|
33
38
|
|
34
39
|
/**
|
35
40
|
* Callback and supporting data used in SnapshotCreator to implement embedder
|
36
|
-
* logic to serialize internal fields.
|
41
|
+
* logic to serialize internal fields of v8::Objects.
|
37
42
|
* Internal fields that directly reference V8 objects are serialized without
|
38
43
|
* calling this callback. Internal fields that contain aligned pointers are
|
39
44
|
* serialized by this callback if it returns non-zero result. Otherwise it is
|
@@ -48,13 +53,24 @@ struct SerializeInternalFieldsCallback {
|
|
48
53
|
CallbackFunction callback;
|
49
54
|
void* data;
|
50
55
|
};
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Similar to SerializeInternalFieldsCallback, but works with the embedder data
|
59
|
+
* in a v8::Context.
|
60
|
+
*/
|
61
|
+
struct SerializeContextDataCallback {
|
62
|
+
using CallbackFunction = StartupData (*)(Local<Context> holder, int index,
|
63
|
+
void* data);
|
64
|
+
SerializeContextDataCallback(CallbackFunction function = nullptr,
|
65
|
+
void* data_arg = nullptr)
|
66
|
+
: callback(function), data(data_arg) {}
|
67
|
+
CallbackFunction callback;
|
68
|
+
void* data;
|
69
|
+
};
|
54
70
|
|
55
71
|
/**
|
56
72
|
* Callback and supporting data used to implement embedder logic to deserialize
|
57
|
-
* internal fields.
|
73
|
+
* internal fields of v8::Objects.
|
58
74
|
*/
|
59
75
|
struct DeserializeInternalFieldsCallback {
|
60
76
|
using CallbackFunction = void (*)(Local<Object> holder, int index,
|
@@ -62,12 +78,24 @@ struct DeserializeInternalFieldsCallback {
|
|
62
78
|
DeserializeInternalFieldsCallback(CallbackFunction function = nullptr,
|
63
79
|
void* data_arg = nullptr)
|
64
80
|
: callback(function), data(data_arg) {}
|
65
|
-
|
66
|
-
|
81
|
+
|
82
|
+
CallbackFunction callback;
|
67
83
|
void* data;
|
68
84
|
};
|
69
85
|
|
70
|
-
|
86
|
+
/**
|
87
|
+
* Similar to DeserializeInternalFieldsCallback, but works with the embedder
|
88
|
+
* data in a v8::Context.
|
89
|
+
*/
|
90
|
+
struct DeserializeContextDataCallback {
|
91
|
+
using CallbackFunction = void (*)(Local<Context> holder, int index,
|
92
|
+
StartupData payload, void* data);
|
93
|
+
DeserializeContextDataCallback(CallbackFunction function = nullptr,
|
94
|
+
void* data_arg = nullptr)
|
95
|
+
: callback(function), data(data_arg) {}
|
96
|
+
CallbackFunction callback;
|
97
|
+
void* data;
|
98
|
+
};
|
71
99
|
|
72
100
|
/**
|
73
101
|
* Helper class to create a snapshot data blob.
|
@@ -91,10 +119,11 @@ class V8_EXPORT SnapshotCreator {
|
|
91
119
|
* \param owns_isolate whether this SnapshotCreator should call
|
92
120
|
* v8::Isolate::Dispose() during its destructor.
|
93
121
|
*/
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
122
|
+
V8_DEPRECATE_SOON("Use the version that passes CreateParams instead.")
|
123
|
+
explicit SnapshotCreator(Isolate* isolate,
|
124
|
+
const intptr_t* external_references = nullptr,
|
125
|
+
const StartupData* existing_blob = nullptr,
|
126
|
+
bool owns_isolate = true);
|
98
127
|
|
99
128
|
/**
|
100
129
|
* Create and enter an isolate, and set it up for serialization.
|
@@ -104,8 +133,35 @@ class V8_EXPORT SnapshotCreator {
|
|
104
133
|
* \param external_references a null-terminated array of external references
|
105
134
|
* that must be equivalent to CreateParams::external_references.
|
106
135
|
*/
|
107
|
-
|
108
|
-
|
136
|
+
V8_DEPRECATE_SOON("Use the version that passes CreateParams instead.")
|
137
|
+
explicit SnapshotCreator(const intptr_t* external_references = nullptr,
|
138
|
+
const StartupData* existing_blob = nullptr);
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Creates an Isolate for serialization and enters it. The creator fully owns
|
142
|
+
* the Isolate and will invoke `v8::Isolate::Dispose()` during destruction.
|
143
|
+
*
|
144
|
+
* \param params The parameters to initialize the Isolate for. Details:
|
145
|
+
* - `params.external_references` are expected to be a
|
146
|
+
* null-terminated array of external references.
|
147
|
+
* - `params.existing_blob` is an optional snapshot blob from
|
148
|
+
* which can be used to initialize the new blob.
|
149
|
+
*/
|
150
|
+
explicit SnapshotCreator(const v8::Isolate::CreateParams& params);
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Initializes an Isolate for serialization and enters it. The creator does
|
154
|
+
* not own the Isolate but merely initialize it properly.
|
155
|
+
*
|
156
|
+
* \param isolate The isolate that was allocated by `Isolate::Allocate()~.
|
157
|
+
* \param params The parameters to initialize the Isolate for. Details:
|
158
|
+
* - `params.external_references` are expected to be a
|
159
|
+
* null-terminated array of external references.
|
160
|
+
* - `params.existing_blob` is an optional snapshot blob from
|
161
|
+
* which can be used to initialize the new blob.
|
162
|
+
*/
|
163
|
+
SnapshotCreator(v8::Isolate* isolate,
|
164
|
+
const v8::Isolate::CreateParams& params);
|
109
165
|
|
110
166
|
/**
|
111
167
|
* Destroy the snapshot creator, and exit and dispose of the Isolate
|
@@ -123,23 +179,37 @@ class V8_EXPORT SnapshotCreator {
|
|
123
179
|
* The snapshot will not contain the global proxy, and we expect one or a
|
124
180
|
* global object template to create one, to be provided upon deserialization.
|
125
181
|
*
|
126
|
-
* \param
|
182
|
+
* \param internal_fields_serializer An optional callback used to serialize
|
183
|
+
* internal pointer fields set by
|
184
|
+
* v8::Object::SetAlignedPointerInInternalField().
|
185
|
+
*
|
186
|
+
* \param context_data_serializer An optional callback used to serialize
|
187
|
+
* context embedder data set by
|
188
|
+
* v8::Context::SetAlignedPointerInEmbedderData().
|
189
|
+
*
|
127
190
|
*/
|
128
|
-
void SetDefaultContext(
|
129
|
-
|
130
|
-
|
191
|
+
void SetDefaultContext(
|
192
|
+
Local<Context> context,
|
193
|
+
SerializeInternalFieldsCallback internal_fields_serializer =
|
194
|
+
SerializeInternalFieldsCallback(),
|
195
|
+
SerializeContextDataCallback context_data_serializer =
|
196
|
+
SerializeContextDataCallback());
|
131
197
|
|
132
198
|
/**
|
133
199
|
* Add additional context to be included in the snapshot blob.
|
134
200
|
* The snapshot will include the global proxy.
|
135
201
|
*
|
136
|
-
* \param
|
202
|
+
* \param internal_fields_serializer Similar to internal_fields_serializer
|
203
|
+
* in SetDefaultContext() but only applies to the context being added.
|
137
204
|
*
|
138
|
-
* \
|
205
|
+
* \param context_data_serializer Similar to context_data_serializer
|
206
|
+
* in SetDefaultContext() but only applies to the context being added.
|
139
207
|
*/
|
140
208
|
size_t AddContext(Local<Context> context,
|
141
|
-
SerializeInternalFieldsCallback
|
142
|
-
SerializeInternalFieldsCallback()
|
209
|
+
SerializeInternalFieldsCallback internal_fields_serializer =
|
210
|
+
SerializeInternalFieldsCallback(),
|
211
|
+
SerializeContextDataCallback context_data_serializer =
|
212
|
+
SerializeContextDataCallback());
|
143
213
|
|
144
214
|
/**
|
145
215
|
* Attach arbitrary V8::Data to the context snapshot, which can be retrieved
|
@@ -177,7 +247,8 @@ class V8_EXPORT SnapshotCreator {
|
|
177
247
|
size_t AddData(Local<Context> context, internal::Address object);
|
178
248
|
size_t AddData(internal::Address object);
|
179
249
|
|
180
|
-
|
250
|
+
internal::SnapshotCreatorImpl* impl_;
|
251
|
+
friend class internal::SnapshotCreatorImpl;
|
181
252
|
};
|
182
253
|
|
183
254
|
template <class T>
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#include <vector>
|
14
14
|
|
15
15
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
16
|
+
#include "v8-memory-span.h" // NOLINT(build/include_directory)
|
16
17
|
#include "v8-promise.h" // NOLINT(build/include_directory)
|
17
18
|
#include "v8config.h" // NOLINT(build/include_directory)
|
18
19
|
|
@@ -60,42 +61,27 @@ class V8_EXPORT MeasureMemoryDelegate {
|
|
60
61
|
*/
|
61
62
|
virtual bool ShouldMeasure(Local<Context> context) = 0;
|
62
63
|
|
63
|
-
/**
|
64
|
-
* This function is called when memory measurement finishes.
|
65
|
-
*
|
66
|
-
* \param context_sizes_in_bytes a vector of (context, size) pairs that
|
67
|
-
* includes each context for which ShouldMeasure returned true and that
|
68
|
-
* was not garbage collected while the memory measurement was in progress.
|
69
|
-
*
|
70
|
-
* \param unattributed_size_in_bytes total size of objects that were not
|
71
|
-
* attributed to any context (i.e. are likely shared objects).
|
72
|
-
*/
|
73
|
-
V8_DEPRECATE_SOON("Please use the version that takes a result struct")
|
74
|
-
virtual void MeasurementComplete(
|
75
|
-
const std::vector<std::pair<Local<Context>, size_t>>&
|
76
|
-
context_sizes_in_bytes,
|
77
|
-
size_t unattributed_size_in_bytes) {}
|
78
|
-
|
79
64
|
/** Holds the result of a memory measurement request. */
|
80
65
|
struct Result {
|
81
66
|
/**
|
82
|
-
*
|
83
|
-
*
|
84
|
-
*
|
67
|
+
* Two spans of equal length: the first includes each context for which
|
68
|
+
* ShouldMeasure returned true and that was not garbage collected while
|
69
|
+
* the memory measurement was in progress; the second includes the size
|
70
|
+
* of the respective context.
|
85
71
|
*/
|
86
|
-
const
|
87
|
-
|
72
|
+
const MemorySpan<const Local<Context>>& contexts;
|
73
|
+
const MemorySpan<const size_t>& sizes_in_bytes;
|
88
74
|
|
89
75
|
/**
|
90
|
-
*
|
76
|
+
* Total size of objects that were not attributed to any context (i.e. are
|
91
77
|
* likely shared objects).
|
92
78
|
*/
|
93
79
|
size_t unattributed_size_in_bytes;
|
94
80
|
|
95
|
-
/**
|
81
|
+
/** Total size of generated code for Wasm (shared across contexts). */
|
96
82
|
size_t wasm_code_size_in_bytes;
|
97
83
|
|
98
|
-
/**
|
84
|
+
/** Total size of Wasm metadata (except code; shared across contexts). */
|
99
85
|
size_t wasm_metadata_size_in_bytes;
|
100
86
|
};
|
101
87
|
|