libv8-node 17.9.1.1-aarch64-linux → 18.8.0.0-aarch64-linux
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 +1 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/aarch64-linux/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +88 -17
- data/vendor/v8/include/cppgc/default-platform.h +2 -10
- data/vendor/v8/include/cppgc/explicit-management.h +22 -4
- data/vendor/v8/include/cppgc/garbage-collected.h +15 -26
- data/vendor/v8/include/cppgc/heap-consistency.h +13 -0
- data/vendor/v8/include/cppgc/heap-state.h +12 -0
- data/vendor/v8/include/cppgc/heap.h +7 -2
- data/vendor/v8/include/cppgc/internal/api-constants.h +8 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +23 -12
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +2 -1
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/persistent-node.h +39 -27
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +4 -4
- data/vendor/v8/include/cppgc/internal/write-barrier.h +26 -32
- data/vendor/v8/include/cppgc/member.h +5 -2
- data/vendor/v8/include/cppgc/persistent.h +30 -31
- data/vendor/v8/include/cppgc/platform.h +3 -1
- data/vendor/v8/include/cppgc/prefinalizer.h +34 -11
- data/vendor/v8/include/cppgc/testing.h +9 -2
- data/vendor/v8/include/cppgc/type-traits.h +6 -13
- data/vendor/v8/include/libplatform/libplatform.h +0 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +14 -2
- data/vendor/v8/include/v8-callbacks.h +26 -6
- data/vendor/v8/include/v8-context.h +3 -14
- data/vendor/v8/include/v8-cppgc.h +16 -126
- data/vendor/v8/include/v8-data.h +15 -0
- data/vendor/v8/include/v8-debug.h +21 -4
- data/vendor/v8/include/v8-embedder-heap.h +10 -30
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +0 -7
- data/vendor/v8/include/v8-fast-api-calls.h +82 -31
- data/vendor/v8/include/v8-function.h +3 -0
- data/vendor/v8/include/v8-initialization.h +64 -31
- data/vendor/v8/include/v8-inspector.h +45 -4
- data/vendor/v8/include/v8-internal.h +189 -102
- data/vendor/v8/include/v8-isolate.h +49 -2
- data/vendor/v8/include/v8-local-handle.h +0 -4
- data/vendor/v8/include/v8-locker.h +2 -1
- data/vendor/v8/include/v8-message.h +19 -44
- data/vendor/v8/include/v8-metrics.h +32 -15
- data/vendor/v8/include/v8-object.h +11 -6
- data/vendor/v8/include/v8-platform.h +365 -6
- data/vendor/v8/include/v8-primitive.h +14 -6
- data/vendor/v8/include/v8-profiler.h +78 -2
- data/vendor/v8/include/v8-script.h +27 -51
- data/vendor/v8/include/v8-snapshot.h +0 -2
- data/vendor/v8/include/v8-statistics.h +2 -0
- data/vendor/v8/include/v8-template.h +31 -4
- data/vendor/v8/include/v8-traced-handle.h +39 -224
- data/vendor/v8/include/v8-unwinder.h +10 -7
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +32 -2
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +13 -1
- data/vendor/v8/include/v8-weak-callback-info.h +20 -6
- data/vendor/v8/include/v8.h +0 -1
- data/vendor/v8/include/v8config.h +56 -11
- metadata +6 -6
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
@@ -12,7 +12,6 @@
|
|
12
12
|
#include "cppgc/common.h"
|
13
13
|
#include "cppgc/custom-space.h"
|
14
14
|
#include "cppgc/heap-statistics.h"
|
15
|
-
#include "cppgc/internal/write-barrier.h"
|
16
15
|
#include "cppgc/visitor.h"
|
17
16
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
18
17
|
#include "v8-platform.h" // NOLINT(build/include_directory)
|
@@ -148,6 +147,14 @@ class V8_EXPORT CppHeap {
|
|
148
147
|
*/
|
149
148
|
void CollectGarbageForTesting(cppgc::EmbedderStackState stack_state);
|
150
149
|
|
150
|
+
/**
|
151
|
+
* Performs a stop-the-world minor garbage collection for testing purposes.
|
152
|
+
*
|
153
|
+
* \param stack_state The stack state to assume for the garbage collection.
|
154
|
+
*/
|
155
|
+
void CollectGarbageInYoungGenerationForTesting(
|
156
|
+
cppgc::EmbedderStackState stack_state);
|
157
|
+
|
151
158
|
private:
|
152
159
|
CppHeap() = default;
|
153
160
|
|
@@ -157,6 +164,7 @@ class V8_EXPORT CppHeap {
|
|
157
164
|
class JSVisitor : public cppgc::Visitor {
|
158
165
|
public:
|
159
166
|
explicit JSVisitor(cppgc::Visitor::Key key) : cppgc::Visitor(key) {}
|
167
|
+
~JSVisitor() override = default;
|
160
168
|
|
161
169
|
void Trace(const TracedReferenceBase& ref) {
|
162
170
|
if (ref.IsEmptyThreadSafe()) return;
|
@@ -169,129 +177,6 @@ class JSVisitor : public cppgc::Visitor {
|
|
169
177
|
virtual void Visit(const TracedReferenceBase& ref) {}
|
170
178
|
};
|
171
179
|
|
172
|
-
/**
|
173
|
-
* **DO NOT USE: Use the appropriate managed types.**
|
174
|
-
*
|
175
|
-
* Consistency helpers that aid in maintaining a consistent internal state of
|
176
|
-
* the garbage collector.
|
177
|
-
*/
|
178
|
-
class V8_EXPORT JSHeapConsistency final {
|
179
|
-
public:
|
180
|
-
using WriteBarrierParams = cppgc::internal::WriteBarrier::Params;
|
181
|
-
using WriteBarrierType = cppgc::internal::WriteBarrier::Type;
|
182
|
-
|
183
|
-
/**
|
184
|
-
* Gets the required write barrier type for a specific write.
|
185
|
-
*
|
186
|
-
* Note: Handling for C++ to JS references.
|
187
|
-
*
|
188
|
-
* \param ref The reference being written to.
|
189
|
-
* \param params Parameters that may be used for actual write barrier calls.
|
190
|
-
* Only filled if return value indicates that a write barrier is needed. The
|
191
|
-
* contents of the `params` are an implementation detail.
|
192
|
-
* \param callback Callback returning the corresponding heap handle. The
|
193
|
-
* callback is only invoked if the heap cannot otherwise be figured out. The
|
194
|
-
* callback must not allocate.
|
195
|
-
* \returns whether a write barrier is needed and which barrier to invoke.
|
196
|
-
*/
|
197
|
-
template <typename HeapHandleCallback>
|
198
|
-
static V8_INLINE WriteBarrierType
|
199
|
-
GetWriteBarrierType(const TracedReferenceBase& ref,
|
200
|
-
WriteBarrierParams& params, HeapHandleCallback callback) {
|
201
|
-
if (ref.IsEmpty()) return WriteBarrierType::kNone;
|
202
|
-
|
203
|
-
if (V8_LIKELY(!cppgc::internal::WriteBarrier::
|
204
|
-
IsAnyIncrementalOrConcurrentMarking())) {
|
205
|
-
return cppgc::internal::WriteBarrier::Type::kNone;
|
206
|
-
}
|
207
|
-
cppgc::HeapHandle& handle = callback();
|
208
|
-
if (!cppgc::subtle::HeapState::IsMarking(handle)) {
|
209
|
-
return cppgc::internal::WriteBarrier::Type::kNone;
|
210
|
-
}
|
211
|
-
params.heap = &handle;
|
212
|
-
#if V8_ENABLE_CHECKS
|
213
|
-
params.type = cppgc::internal::WriteBarrier::Type::kMarking;
|
214
|
-
#endif // !V8_ENABLE_CHECKS
|
215
|
-
return cppgc::internal::WriteBarrier::Type::kMarking;
|
216
|
-
}
|
217
|
-
|
218
|
-
/**
|
219
|
-
* Gets the required write barrier type for a specific write.
|
220
|
-
*
|
221
|
-
* Note: Handling for JS to C++ references.
|
222
|
-
*
|
223
|
-
* \param wrapper The wrapper that has been written into.
|
224
|
-
* \param wrapper_index The wrapper index in `wrapper` that has been written
|
225
|
-
* into.
|
226
|
-
* \param wrappable The value that was written.
|
227
|
-
* \param params Parameters that may be used for actual write barrier calls.
|
228
|
-
* Only filled if return value indicates that a write barrier is needed. The
|
229
|
-
* contents of the `params` are an implementation detail.
|
230
|
-
* \param callback Callback returning the corresponding heap handle. The
|
231
|
-
* callback is only invoked if the heap cannot otherwise be figured out. The
|
232
|
-
* callback must not allocate.
|
233
|
-
* \returns whether a write barrier is needed and which barrier to invoke.
|
234
|
-
*/
|
235
|
-
template <typename HeapHandleCallback>
|
236
|
-
static V8_INLINE WriteBarrierType GetWriteBarrierType(
|
237
|
-
v8::Local<v8::Object>& wrapper, int wrapper_index, const void* wrappable,
|
238
|
-
WriteBarrierParams& params, HeapHandleCallback callback) {
|
239
|
-
#if V8_ENABLE_CHECKS
|
240
|
-
CheckWrapper(wrapper, wrapper_index, wrappable);
|
241
|
-
#endif // V8_ENABLE_CHECKS
|
242
|
-
return cppgc::internal::WriteBarrier::
|
243
|
-
GetWriteBarrierTypeForExternallyReferencedObject(wrappable, params,
|
244
|
-
callback);
|
245
|
-
}
|
246
|
-
|
247
|
-
/**
|
248
|
-
* Conservative Dijkstra-style write barrier that processes an object if it
|
249
|
-
* has not yet been processed.
|
250
|
-
*
|
251
|
-
* \param params The parameters retrieved from `GetWriteBarrierType()`.
|
252
|
-
* \param ref The reference being written to.
|
253
|
-
*/
|
254
|
-
static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params,
|
255
|
-
cppgc::HeapHandle& heap_handle,
|
256
|
-
const TracedReferenceBase& ref) {
|
257
|
-
cppgc::internal::WriteBarrier::CheckParams(WriteBarrierType::kMarking,
|
258
|
-
params);
|
259
|
-
DijkstraMarkingBarrierSlow(heap_handle, ref);
|
260
|
-
}
|
261
|
-
|
262
|
-
/**
|
263
|
-
* Conservative Dijkstra-style write barrier that processes an object if it
|
264
|
-
* has not yet been processed.
|
265
|
-
*
|
266
|
-
* \param params The parameters retrieved from `GetWriteBarrierType()`.
|
267
|
-
* \param object The pointer to the object. May be an interior pointer to a
|
268
|
-
* an interface of the actual object.
|
269
|
-
*/
|
270
|
-
static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params,
|
271
|
-
cppgc::HeapHandle& heap_handle,
|
272
|
-
const void* object) {
|
273
|
-
cppgc::internal::WriteBarrier::DijkstraMarkingBarrier(params, object);
|
274
|
-
}
|
275
|
-
|
276
|
-
/**
|
277
|
-
* Generational barrier for maintaining consistency when running with multiple
|
278
|
-
* generations.
|
279
|
-
*
|
280
|
-
* \param params The parameters retrieved from `GetWriteBarrierType()`.
|
281
|
-
* \param ref The reference being written to.
|
282
|
-
*/
|
283
|
-
static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params,
|
284
|
-
const TracedReferenceBase& ref) {}
|
285
|
-
|
286
|
-
private:
|
287
|
-
JSHeapConsistency() = delete;
|
288
|
-
|
289
|
-
static void CheckWrapper(v8::Local<v8::Object>&, int, const void*);
|
290
|
-
|
291
|
-
static void DijkstraMarkingBarrierSlow(cppgc::HeapHandle&,
|
292
|
-
const TracedReferenceBase& ref);
|
293
|
-
};
|
294
|
-
|
295
180
|
/**
|
296
181
|
* Provided as input to `CppHeap::CollectCustomSpaceStatisticsAtLastGC()`.
|
297
182
|
*
|
@@ -318,8 +203,13 @@ namespace cppgc {
|
|
318
203
|
|
319
204
|
template <typename T>
|
320
205
|
struct TraceTrait<v8::TracedReference<T>> {
|
321
|
-
static
|
322
|
-
|
206
|
+
static cppgc::TraceDescriptor GetTraceDescriptor(const void* self) {
|
207
|
+
return {nullptr, Trace};
|
208
|
+
}
|
209
|
+
|
210
|
+
static void Trace(Visitor* visitor, const void* self) {
|
211
|
+
static_cast<v8::JSVisitor*>(visitor)->Trace(
|
212
|
+
*static_cast<const v8::TracedReference<T>*>(self));
|
323
213
|
}
|
324
214
|
};
|
325
215
|
|
data/vendor/v8/include/v8-data.h
CHANGED
@@ -27,6 +27,11 @@ class V8_EXPORT Data {
|
|
27
27
|
*/
|
28
28
|
bool IsModule() const;
|
29
29
|
|
30
|
+
/**
|
31
|
+
* Returns tru if this data is a |v8::FixedArray|
|
32
|
+
*/
|
33
|
+
bool IsFixedArray() const;
|
34
|
+
|
30
35
|
/**
|
31
36
|
* Returns true if this data is a |v8::Private|.
|
32
37
|
*/
|
@@ -58,6 +63,16 @@ class V8_EXPORT FixedArray : public Data {
|
|
58
63
|
public:
|
59
64
|
int Length() const;
|
60
65
|
Local<Data> Get(Local<Context> context, int i) const;
|
66
|
+
|
67
|
+
V8_INLINE static FixedArray* Cast(Data* data) {
|
68
|
+
#ifdef V8_ENABLE_CHECKS
|
69
|
+
CheckCast(data);
|
70
|
+
#endif
|
71
|
+
return reinterpret_cast<FixedArray*>(data);
|
72
|
+
}
|
73
|
+
|
74
|
+
private:
|
75
|
+
static void CheckCast(Data* obj);
|
61
76
|
};
|
62
77
|
|
63
78
|
} // namespace v8
|
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
#include <stdint.h>
|
9
9
|
|
10
|
-
#include "v8-
|
11
|
-
#include "v8config.h"
|
10
|
+
#include "v8-script.h" // NOLINT(build/include_directory)
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
12
|
|
13
13
|
namespace v8 {
|
14
14
|
|
@@ -20,13 +20,18 @@ class String;
|
|
20
20
|
*/
|
21
21
|
class V8_EXPORT StackFrame {
|
22
22
|
public:
|
23
|
+
/**
|
24
|
+
* Returns the source location, 0-based, for the associated function call.
|
25
|
+
*/
|
26
|
+
Location GetLocation() const;
|
27
|
+
|
23
28
|
/**
|
24
29
|
* Returns the number, 1-based, of the line for the associate function call.
|
25
30
|
* This method will return Message::kNoLineNumberInfo if it is unable to
|
26
31
|
* retrieve the line number, or if kLineNumber was not passed as an option
|
27
32
|
* when capturing the StackTrace.
|
28
33
|
*/
|
29
|
-
int GetLineNumber() const;
|
34
|
+
int GetLineNumber() const { return GetLocation().GetLineNumber() + 1; }
|
30
35
|
|
31
36
|
/**
|
32
37
|
* Returns the 1-based column offset on the line for the associated function
|
@@ -35,7 +40,7 @@ class V8_EXPORT StackFrame {
|
|
35
40
|
* the column number, or if kColumnOffset was not passed as an option when
|
36
41
|
* capturing the StackTrace.
|
37
42
|
*/
|
38
|
-
int GetColumn() const;
|
43
|
+
int GetColumn() const { return GetLocation().GetColumnNumber() + 1; }
|
39
44
|
|
40
45
|
/**
|
41
46
|
* Returns the id of the script for the function for this StackFrame.
|
@@ -144,6 +149,18 @@ class V8_EXPORT StackTrace {
|
|
144
149
|
*/
|
145
150
|
static Local<StackTrace> CurrentStackTrace(
|
146
151
|
Isolate* isolate, int frame_limit, StackTraceOptions options = kDetailed);
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Returns the first valid script name or source URL starting at the top of
|
155
|
+
* the JS stack. The returned string is either an empty handle if no script
|
156
|
+
* name/url was found or a non-zero-length string.
|
157
|
+
*
|
158
|
+
* This method is equivalent to calling StackTrace::CurrentStackTrace and
|
159
|
+
* walking the resulting frames from the beginning until a non-empty script
|
160
|
+
* name/url is found. The difference is that this method won't allocate
|
161
|
+
* a stack trace.
|
162
|
+
*/
|
163
|
+
static Local<String> CurrentScriptNameOrSourceURL(Isolate* isolate);
|
147
164
|
};
|
148
165
|
|
149
166
|
} // namespace v8
|
@@ -34,24 +34,21 @@ class V8_EXPORT EmbedderRootsHandler {
|
|
34
34
|
virtual ~EmbedderRootsHandler() = default;
|
35
35
|
|
36
36
|
/**
|
37
|
-
* Returns true if the
|
38
|
-
* the currently running non-tracing garbage collection and false
|
39
|
-
* The default implementation will keep all
|
37
|
+
* Returns true if the |TracedReference| handle should be considered as root
|
38
|
+
* for the currently running non-tracing garbage collection and false
|
39
|
+
* otherwise. The default implementation will keep all |TracedReference|
|
40
|
+
* references as roots.
|
40
41
|
*
|
41
42
|
* If this returns false, then V8 may decide that the object referred to by
|
42
|
-
* such a handle is reclaimed. In that case
|
43
|
-
*
|
44
|
-
* using |TracedGlobal|.
|
45
|
-
* - When run without destructors, i.e., by using |TracedReference|, V8 calls
|
46
|
-
* |ResetRoot|.
|
43
|
+
* such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the
|
44
|
+
* |TracedReference|.
|
47
45
|
*
|
48
|
-
* Note that the
|
46
|
+
* Note that the `handle` is different from the handle that the embedder holds
|
49
47
|
* for retaining the object. The embedder may use |WrapperClassId()| to
|
50
48
|
* distinguish cases where it wants handles to be treated as roots from not
|
51
49
|
* being treated as roots.
|
52
50
|
*/
|
53
51
|
virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
|
54
|
-
virtual bool IsRoot(const v8::TracedGlobal<v8::Value>& handle) = 0;
|
55
52
|
|
56
53
|
/**
|
57
54
|
* Used in combination with |IsRoot|. Called by V8 when an
|
@@ -83,12 +80,11 @@ class V8_EXPORT EmbedderHeapTracer {
|
|
83
80
|
};
|
84
81
|
|
85
82
|
/**
|
86
|
-
* Interface for iterating through
|
83
|
+
* Interface for iterating through |TracedReference| handles.
|
87
84
|
*/
|
88
85
|
class V8_EXPORT TracedGlobalHandleVisitor {
|
89
86
|
public:
|
90
87
|
virtual ~TracedGlobalHandleVisitor() = default;
|
91
|
-
virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& handle) {}
|
92
88
|
virtual void VisitTracedReference(const TracedReference<Value>& handle) {}
|
93
89
|
};
|
94
90
|
|
@@ -113,8 +109,8 @@ class V8_EXPORT EmbedderHeapTracer {
|
|
113
109
|
virtual ~EmbedderHeapTracer() = default;
|
114
110
|
|
115
111
|
/**
|
116
|
-
* Iterates all
|
117
|
-
* attached to.
|
112
|
+
* Iterates all |TracedReference| handles created for the |v8::Isolate| the
|
113
|
+
* tracer is attached to.
|
118
114
|
*/
|
119
115
|
void IterateTracedGlobalHandles(TracedGlobalHandleVisitor* visitor);
|
120
116
|
|
@@ -124,14 +120,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
|
124
120
|
*/
|
125
121
|
void SetStackStart(void* stack_start);
|
126
122
|
|
127
|
-
/**
|
128
|
-
* Called by the embedder to notify V8 of an empty execution stack.
|
129
|
-
*/
|
130
|
-
V8_DEPRECATE_SOON(
|
131
|
-
"This call only optimized internal caches which V8 is able to figure out "
|
132
|
-
"on its own now.")
|
133
|
-
void NotifyEmptyEmbedderStack();
|
134
|
-
|
135
123
|
/**
|
136
124
|
* Called by v8 to register internal fields of found wrappers.
|
137
125
|
*
|
@@ -197,7 +185,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
|
197
185
|
*/
|
198
186
|
virtual bool IsRootForNonTracingGC(
|
199
187
|
const v8::TracedReference<v8::Value>& handle);
|
200
|
-
virtual bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle);
|
201
188
|
|
202
189
|
/**
|
203
190
|
* See documentation on EmbedderRootsHandler.
|
@@ -205,13 +192,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
|
205
192
|
virtual void ResetHandleInNonTracingGC(
|
206
193
|
const v8::TracedReference<v8::Value>& handle);
|
207
194
|
|
208
|
-
/*
|
209
|
-
* Called by the embedder to immediately perform a full garbage collection.
|
210
|
-
*
|
211
|
-
* Should only be used in testing code.
|
212
|
-
*/
|
213
|
-
void GarbageCollectionForTesting(EmbedderStackState stack_state);
|
214
|
-
|
215
195
|
/*
|
216
196
|
* Called by the embedder to signal newly allocated or freed memory. Not bound
|
217
197
|
* to tracing phases. Embedders should trade off when increments are reported
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// Copyright 2021 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_V8_EMBEDDER_STATE_SCOPE_H_
|
6
|
+
#define INCLUDE_V8_EMBEDDER_STATE_SCOPE_H_
|
7
|
+
|
8
|
+
#include <memory>
|
9
|
+
|
10
|
+
#include "v8-context.h" // NOLINT(build/include_directory)
|
11
|
+
#include "v8-internal.h" // NOLINT(build/include_directory)
|
12
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
13
|
+
|
14
|
+
namespace v8 {
|
15
|
+
|
16
|
+
namespace internal {
|
17
|
+
class EmbedderState;
|
18
|
+
} // namespace internal
|
19
|
+
|
20
|
+
// A StateTag represents a possible state of the embedder.
|
21
|
+
enum class EmbedderStateTag : uint8_t {
|
22
|
+
// reserved
|
23
|
+
EMPTY = 0,
|
24
|
+
OTHER = 1,
|
25
|
+
// embedder can define any state after
|
26
|
+
};
|
27
|
+
|
28
|
+
// A stack-allocated class that manages an embedder state on the isolate.
|
29
|
+
// After an EmbedderState scope has been created, a new embedder state will be
|
30
|
+
// pushed on the isolate stack.
|
31
|
+
class V8_EXPORT EmbedderStateScope {
|
32
|
+
public:
|
33
|
+
EmbedderStateScope(Isolate* isolate, Local<v8::Context> context,
|
34
|
+
EmbedderStateTag tag);
|
35
|
+
|
36
|
+
~EmbedderStateScope();
|
37
|
+
|
38
|
+
private:
|
39
|
+
// Declaring operator new and delete as deleted is not spec compliant.
|
40
|
+
// Therefore declare them private instead to disable dynamic alloc
|
41
|
+
void* operator new(size_t size);
|
42
|
+
void* operator new[](size_t size);
|
43
|
+
void operator delete(void*, size_t);
|
44
|
+
void operator delete[](void*, size_t);
|
45
|
+
|
46
|
+
std::unique_ptr<internal::EmbedderState> embedder_state_;
|
47
|
+
};
|
48
|
+
|
49
|
+
} // namespace v8
|
50
|
+
|
51
|
+
#endif // INCLUDE_V8_EMBEDDER_STATE_SCOPE_H_
|
@@ -169,13 +169,6 @@ class V8_EXPORT TryCatch {
|
|
169
169
|
*/
|
170
170
|
void SetCaptureMessage(bool value);
|
171
171
|
|
172
|
-
V8_DEPRECATE_SOON(
|
173
|
-
"This is private information that should not be exposed by the API")
|
174
|
-
static void* JSStackComparableAddress(TryCatch* handler) {
|
175
|
-
if (handler == nullptr) return nullptr;
|
176
|
-
return reinterpret_cast<void*>(handler->JSStackComparableAddressPrivate());
|
177
|
-
}
|
178
|
-
|
179
172
|
TryCatch(const TryCatch&) = delete;
|
180
173
|
void operator=(const TryCatch&) = delete;
|
181
174
|
|
@@ -249,6 +249,15 @@ class CTypeInfo {
|
|
249
249
|
kV8Value,
|
250
250
|
kApiObject, // This will be deprecated once all users have
|
251
251
|
// migrated from v8::ApiObject to v8::Local<v8::Value>.
|
252
|
+
kAny, // This is added to enable untyped representation of fast
|
253
|
+
// call arguments for test purposes. It can represent any of
|
254
|
+
// the other types stored in the same memory as a union (see
|
255
|
+
// the AnyCType struct declared below). This allows for
|
256
|
+
// uniform passing of arguments w.r.t. their location
|
257
|
+
// (in a register or on the stack), independent of their
|
258
|
+
// actual type. It's currently used by the arm64 simulator
|
259
|
+
// and can be added to the other simulators as well when fast
|
260
|
+
// calls having both GP and FP params need to be supported.
|
252
261
|
};
|
253
262
|
|
254
263
|
// kCallbackOptionsType is not part of the Type enum
|
@@ -404,6 +413,37 @@ class V8_EXPORT CFunctionInfo {
|
|
404
413
|
const CTypeInfo* arg_info_;
|
405
414
|
};
|
406
415
|
|
416
|
+
struct FastApiCallbackOptions;
|
417
|
+
|
418
|
+
// Provided for testing.
|
419
|
+
struct AnyCType {
|
420
|
+
AnyCType() : int64_value(0) {}
|
421
|
+
|
422
|
+
union {
|
423
|
+
bool bool_value;
|
424
|
+
int32_t int32_value;
|
425
|
+
uint32_t uint32_value;
|
426
|
+
int64_t int64_value;
|
427
|
+
uint64_t uint64_value;
|
428
|
+
float float_value;
|
429
|
+
double double_value;
|
430
|
+
Local<Object> object_value;
|
431
|
+
Local<Array> sequence_value;
|
432
|
+
const FastApiTypedArray<int32_t>* int32_ta_value;
|
433
|
+
const FastApiTypedArray<uint32_t>* uint32_ta_value;
|
434
|
+
const FastApiTypedArray<int64_t>* int64_ta_value;
|
435
|
+
const FastApiTypedArray<uint64_t>* uint64_ta_value;
|
436
|
+
const FastApiTypedArray<float>* float_ta_value;
|
437
|
+
const FastApiTypedArray<double>* double_ta_value;
|
438
|
+
FastApiCallbackOptions* options_value;
|
439
|
+
};
|
440
|
+
};
|
441
|
+
|
442
|
+
static_assert(
|
443
|
+
sizeof(AnyCType) == 8,
|
444
|
+
"The AnyCType struct should have size == 64 bits, as this is assumed "
|
445
|
+
"by EffectControlLinearizer.");
|
446
|
+
|
407
447
|
class V8_EXPORT CFunction {
|
408
448
|
public:
|
409
449
|
constexpr CFunction() : address_(nullptr), type_info_(nullptr) {}
|
@@ -460,10 +500,17 @@ class V8_EXPORT CFunction {
|
|
460
500
|
return ArgUnwrap<F*>::Make(func);
|
461
501
|
}
|
462
502
|
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
503
|
+
// Provided for testing purposes.
|
504
|
+
template <typename R, typename... Args, typename R_Patch,
|
505
|
+
typename... Args_Patch>
|
506
|
+
static CFunction Make(R (*func)(Args...),
|
507
|
+
R_Patch (*patching_func)(Args_Patch...)) {
|
508
|
+
CFunction c_func = ArgUnwrap<R (*)(Args...)>::Make(func);
|
509
|
+
static_assert(
|
510
|
+
sizeof...(Args_Patch) == sizeof...(Args),
|
511
|
+
"The patching function must have the same number of arguments.");
|
512
|
+
c_func.address_ = reinterpret_cast<void*>(patching_func);
|
513
|
+
return c_func;
|
467
514
|
}
|
468
515
|
|
469
516
|
CFunction(const void* address, const CFunctionInfo* type_info);
|
@@ -485,10 +532,6 @@ class V8_EXPORT CFunction {
|
|
485
532
|
};
|
486
533
|
};
|
487
534
|
|
488
|
-
struct ApiObject {
|
489
|
-
uintptr_t address;
|
490
|
-
};
|
491
|
-
|
492
535
|
/**
|
493
536
|
* A struct which may be passed to a fast call callback, like so:
|
494
537
|
* \code
|
@@ -561,7 +604,8 @@ class CFunctionInfoImpl : public CFunctionInfo {
|
|
561
604
|
kReturnType == CTypeInfo::Type::kInt32 ||
|
562
605
|
kReturnType == CTypeInfo::Type::kUint32 ||
|
563
606
|
kReturnType == CTypeInfo::Type::kFloat32 ||
|
564
|
-
kReturnType == CTypeInfo::Type::kFloat64
|
607
|
+
kReturnType == CTypeInfo::Type::kFloat64 ||
|
608
|
+
kReturnType == CTypeInfo::Type::kAny,
|
565
609
|
"64-bit int and api object values are not currently "
|
566
610
|
"supported return types.");
|
567
611
|
}
|
@@ -612,7 +656,7 @@ struct CTypeInfoTraits {};
|
|
612
656
|
V(void, kVoid) \
|
613
657
|
V(v8::Local<v8::Value>, kV8Value) \
|
614
658
|
V(v8::Local<v8::Object>, kV8Value) \
|
615
|
-
V(
|
659
|
+
V(AnyCType, kAny)
|
616
660
|
|
617
661
|
// ApiObject was a temporary solution to wrap the pointer to the v8::Value.
|
618
662
|
// Please use v8::Local<v8::Value> in new code for the arguments and
|
@@ -684,17 +728,19 @@ struct TypeInfoHelper<FastApiCallbackOptions&> {
|
|
684
728
|
#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \
|
685
729
|
static_assert(((COND) == 0) || (ASSERTION), MSG)
|
686
730
|
|
731
|
+
} // namespace internal
|
732
|
+
|
687
733
|
template <typename T, CTypeInfo::Flags... Flags>
|
688
|
-
class CTypeInfoBuilder {
|
734
|
+
class V8_EXPORT CTypeInfoBuilder {
|
689
735
|
public:
|
690
736
|
using BaseType = T;
|
691
737
|
|
692
738
|
static constexpr CTypeInfo Build() {
|
693
739
|
constexpr CTypeInfo::Flags kFlags =
|
694
|
-
MergeFlags(TypeInfoHelper<T>::Flags(), Flags...);
|
695
|
-
constexpr CTypeInfo::Type kType = TypeInfoHelper<T>::Type();
|
740
|
+
MergeFlags(internal::TypeInfoHelper<T>::Flags(), Flags...);
|
741
|
+
constexpr CTypeInfo::Type kType = internal::TypeInfoHelper<T>::Type();
|
696
742
|
constexpr CTypeInfo::SequenceType kSequenceType =
|
697
|
-
TypeInfoHelper<T>::SequenceType();
|
743
|
+
internal::TypeInfoHelper<T>::SequenceType();
|
698
744
|
|
699
745
|
STATIC_ASSERT_IMPLIES(
|
700
746
|
uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit),
|
@@ -722,8 +768,8 @@ class CTypeInfoBuilder {
|
|
722
768
|
"TypedArrays are only supported from primitive types or void.");
|
723
769
|
|
724
770
|
// Return the same type with the merged flags.
|
725
|
-
return CTypeInfo(TypeInfoHelper<T>::Type(),
|
726
|
-
TypeInfoHelper<T>::SequenceType(), kFlags);
|
771
|
+
return CTypeInfo(internal::TypeInfoHelper<T>::Type(),
|
772
|
+
internal::TypeInfoHelper<T>::SequenceType(), kFlags);
|
727
773
|
}
|
728
774
|
|
729
775
|
private:
|
@@ -735,6 +781,7 @@ class CTypeInfoBuilder {
|
|
735
781
|
static constexpr CTypeInfo::Flags MergeFlags() { return CTypeInfo::Flags(0); }
|
736
782
|
};
|
737
783
|
|
784
|
+
namespace internal {
|
738
785
|
template <typename RetBuilder, typename... ArgBuilders>
|
739
786
|
class CFunctionBuilderWithFunction {
|
740
787
|
public:
|
@@ -835,14 +882,14 @@ static constexpr CTypeInfo kTypeInfoFloat64 =
|
|
835
882
|
* returns true on success. `type_info` will be used for conversions.
|
836
883
|
*/
|
837
884
|
template <const CTypeInfo* type_info, typename T>
|
838
|
-
|
885
|
+
V8_DEPRECATED(
|
839
886
|
"Use TryToCopyAndConvertArrayToCppBuffer<CTypeInfo::Identifier, T>()")
|
840
887
|
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
841
888
|
TryCopyAndConvertArrayToCppBuffer(Local<Array> src, T* dst,
|
842
889
|
uint32_t max_length);
|
843
890
|
|
844
891
|
template <>
|
845
|
-
|
892
|
+
V8_DEPRECATED(
|
846
893
|
"Use TryToCopyAndConvertArrayToCppBuffer<CTypeInfo::Identifier, T>()")
|
847
894
|
inline bool V8_WARN_UNUSED_RESULT
|
848
895
|
TryCopyAndConvertArrayToCppBuffer<&kTypeInfoInt32, int32_t>(
|
@@ -851,7 +898,7 @@ inline bool V8_WARN_UNUSED_RESULT
|
|
851
898
|
}
|
852
899
|
|
853
900
|
template <>
|
854
|
-
|
901
|
+
V8_DEPRECATED(
|
855
902
|
"Use TryToCopyAndConvertArrayToCppBuffer<CTypeInfo::Identifier, T>()")
|
856
903
|
inline bool V8_WARN_UNUSED_RESULT
|
857
904
|
TryCopyAndConvertArrayToCppBuffer<&kTypeInfoFloat64, double>(
|
@@ -864,24 +911,28 @@ bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer(
|
|
864
911
|
Local<Array> src, T* dst, uint32_t max_length);
|
865
912
|
|
866
913
|
template <>
|
867
|
-
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
868
|
-
|
869
|
-
|
914
|
+
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
915
|
+
TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<int32_t>::Build().GetId(),
|
916
|
+
int32_t>(Local<Array> src, int32_t* dst,
|
917
|
+
uint32_t max_length);
|
870
918
|
|
871
919
|
template <>
|
872
|
-
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
873
|
-
|
874
|
-
|
920
|
+
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
921
|
+
TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<uint32_t>::Build().GetId(),
|
922
|
+
uint32_t>(Local<Array> src, uint32_t* dst,
|
923
|
+
uint32_t max_length);
|
875
924
|
|
876
925
|
template <>
|
877
|
-
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
878
|
-
|
879
|
-
|
926
|
+
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
927
|
+
TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<float>::Build().GetId(),
|
928
|
+
float>(Local<Array> src, float* dst,
|
929
|
+
uint32_t max_length);
|
880
930
|
|
881
931
|
template <>
|
882
|
-
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
883
|
-
|
884
|
-
|
932
|
+
bool V8_EXPORT V8_WARN_UNUSED_RESULT
|
933
|
+
TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<double>::Build().GetId(),
|
934
|
+
double>(Local<Array> src, double* dst,
|
935
|
+
uint32_t max_length);
|
885
936
|
|
886
937
|
} // namespace v8
|
887
938
|
|
@@ -18,6 +18,7 @@
|
|
18
18
|
namespace v8 {
|
19
19
|
|
20
20
|
class Context;
|
21
|
+
class UnboundScript;
|
21
22
|
|
22
23
|
/**
|
23
24
|
* A JavaScript function object (ECMA-262, 15.3).
|
@@ -58,6 +59,8 @@ class V8_EXPORT Function : public Object {
|
|
58
59
|
void SetName(Local<String> name);
|
59
60
|
Local<Value> GetName() const;
|
60
61
|
|
62
|
+
MaybeLocal<UnboundScript> GetUnboundScript() const;
|
63
|
+
|
61
64
|
/**
|
62
65
|
* Name inferred from variable or property assignment of this function.
|
63
66
|
* Used to facilitate debugging and profiling of JavaScript code written
|