libv8-node 20.12.1.0-x86_64-darwin → 22.5.1.0-x86_64-darwin
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 +24 -5
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +16 -6
- data/vendor/v8/include/cppgc/internal/caged-heap.h +12 -5
- data/vendor/v8/include/cppgc/internal/gc-info.h +82 -91
- data/vendor/v8/include/cppgc/internal/member-storage.h +16 -8
- data/vendor/v8/include/cppgc/member.h +25 -0
- data/vendor/v8/include/cppgc/persistent.h +4 -0
- data/vendor/v8/include/cppgc/platform.h +6 -1
- data/vendor/v8/include/cppgc/sentinel-pointer.h +7 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -78
- data/vendor/v8/include/cppgc/trace-trait.h +8 -0
- data/vendor/v8/include/cppgc/type-traits.h +25 -4
- data/vendor/v8/include/cppgc/visitor.h +82 -4
- data/vendor/v8/include/libplatform/libplatform.h +7 -1
- data/vendor/v8/include/v8-array-buffer.h +6 -0
- data/vendor/v8/include/v8-callbacks.h +57 -19
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +58 -32
- data/vendor/v8/include/v8-embedder-heap.h +31 -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 +58 -31
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +135 -30
- data/vendor/v8/include/v8-function.h +6 -0
- data/vendor/v8/include/v8-handle-base.h +137 -0
- data/vendor/v8/include/v8-inspector.h +35 -13
- data/vendor/v8/include/v8-internal.h +510 -71
- data/vendor/v8/include/v8-isolate.h +176 -100
- data/vendor/v8/include/v8-local-handle.h +383 -112
- 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 +98 -77
- data/vendor/v8/include/v8-persistent-handle.h +68 -90
- data/vendor/v8/include/v8-platform.h +191 -23
- data/vendor/v8/include/v8-primitive.h +12 -8
- data/vendor/v8/include/v8-profiler.h +16 -2
- data/vendor/v8/include/v8-script.h +88 -14
- data/vendor/v8/include/v8-snapshot.h +96 -22
- data/vendor/v8/include/v8-source-location.h +92 -0
- data/vendor/v8/include/v8-statistics.h +31 -10
- data/vendor/v8/include/v8-template.h +410 -131
- data/vendor/v8/include/v8-traced-handle.h +108 -90
- data/vendor/v8/include/v8-typed-array.h +115 -7
- data/vendor/v8/include/v8-unwinder.h +1 -1
- data/vendor/v8/include/v8-util.h +23 -20
- data/vendor/v8/include/v8-value-serializer.h +14 -0
- data/vendor/v8/include/v8-value.h +105 -3
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8config.h +54 -20
- data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
- metadata +5 -3
@@ -0,0 +1,137 @@
|
|
1
|
+
// Copyright 2023 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_HANDLE_BASE_H_
|
6
|
+
#define INCLUDE_V8_HANDLE_BASE_H_
|
7
|
+
|
8
|
+
#include "v8-internal.h" // NOLINT(build/include_directory)
|
9
|
+
|
10
|
+
namespace v8::api_internal {
|
11
|
+
|
12
|
+
template <bool check_statically_enabled>
|
13
|
+
class StackAllocated {
|
14
|
+
public:
|
15
|
+
V8_INLINE StackAllocated() = default;
|
16
|
+
|
17
|
+
protected:
|
18
|
+
struct no_checking_tag {};
|
19
|
+
static constexpr no_checking_tag do_not_check{};
|
20
|
+
|
21
|
+
V8_INLINE explicit StackAllocated(no_checking_tag) {}
|
22
|
+
V8_INLINE explicit StackAllocated(const StackAllocated& other,
|
23
|
+
no_checking_tag) {}
|
24
|
+
|
25
|
+
V8_INLINE void VerifyOnStack() const {}
|
26
|
+
};
|
27
|
+
|
28
|
+
template <>
|
29
|
+
class V8_TRIVIAL_ABI StackAllocated<true> : public StackAllocated<false> {
|
30
|
+
public:
|
31
|
+
V8_INLINE StackAllocated() { VerifyOnStack(); }
|
32
|
+
|
33
|
+
#if V8_HAS_ATTRIBUTE_TRIVIAL_ABI
|
34
|
+
// In this case, StackAllocated becomes not trivially copyable.
|
35
|
+
V8_INLINE StackAllocated(const StackAllocated& other) { VerifyOnStack(); }
|
36
|
+
StackAllocated& operator=(const StackAllocated&) = default;
|
37
|
+
#endif
|
38
|
+
|
39
|
+
protected:
|
40
|
+
V8_INLINE explicit StackAllocated(no_checking_tag tag)
|
41
|
+
: StackAllocated<false>(tag) {}
|
42
|
+
V8_INLINE explicit StackAllocated(const StackAllocated& other,
|
43
|
+
no_checking_tag tag)
|
44
|
+
: StackAllocated<false>(other, tag) {}
|
45
|
+
|
46
|
+
V8_EXPORT void VerifyOnStack() const;
|
47
|
+
};
|
48
|
+
|
49
|
+
/**
|
50
|
+
* A base class for abstract handles containing indirect pointers.
|
51
|
+
* These are useful regardless of whether direct local support is enabled.
|
52
|
+
*/
|
53
|
+
class IndirectHandleBase {
|
54
|
+
public:
|
55
|
+
// Returns true if the handle is empty.
|
56
|
+
V8_INLINE bool IsEmpty() const { return location_ == nullptr; }
|
57
|
+
|
58
|
+
// Sets the handle to be empty. IsEmpty() will then return true.
|
59
|
+
V8_INLINE void Clear() { location_ = nullptr; }
|
60
|
+
|
61
|
+
protected:
|
62
|
+
friend class internal::ValueHelper;
|
63
|
+
friend class internal::HandleHelper;
|
64
|
+
|
65
|
+
V8_INLINE IndirectHandleBase() = default;
|
66
|
+
V8_INLINE IndirectHandleBase(const IndirectHandleBase& other) = default;
|
67
|
+
V8_INLINE IndirectHandleBase& operator=(const IndirectHandleBase& that) =
|
68
|
+
default;
|
69
|
+
|
70
|
+
V8_INLINE explicit IndirectHandleBase(internal::Address* location)
|
71
|
+
: location_(location) {}
|
72
|
+
|
73
|
+
// Returns the address of the actual heap object (tagged).
|
74
|
+
// This method must be called only if the handle is not empty, otherwise it
|
75
|
+
// will crash.
|
76
|
+
V8_INLINE internal::Address ptr() const { return *location_; }
|
77
|
+
|
78
|
+
// Returns a reference to the slot (indirect pointer).
|
79
|
+
V8_INLINE internal::Address* const& slot() const { return location_; }
|
80
|
+
V8_INLINE internal::Address*& slot() { return location_; }
|
81
|
+
|
82
|
+
// Returns the handler's "value" (direct or indirect pointer, depending on
|
83
|
+
// whether direct local support is enabled).
|
84
|
+
template <typename T, bool check_null = false>
|
85
|
+
V8_INLINE T* value() const {
|
86
|
+
return internal::ValueHelper::SlotAsValue<T, check_null>(slot());
|
87
|
+
}
|
88
|
+
|
89
|
+
private:
|
90
|
+
internal::Address* location_ = nullptr;
|
91
|
+
};
|
92
|
+
|
93
|
+
#ifdef V8_ENABLE_DIRECT_LOCAL
|
94
|
+
|
95
|
+
/**
|
96
|
+
* A base class for abstract handles containing direct pointers.
|
97
|
+
* These are only possible when conservative stack scanning is enabled.
|
98
|
+
*/
|
99
|
+
class DirectHandleBase {
|
100
|
+
public:
|
101
|
+
// Returns true if the handle is empty.
|
102
|
+
V8_INLINE bool IsEmpty() const {
|
103
|
+
return ptr_ == internal::ValueHelper::kEmpty;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Sets the handle to be empty. IsEmpty() will then return true.
|
107
|
+
V8_INLINE void Clear() { ptr_ = internal::ValueHelper::kEmpty; }
|
108
|
+
|
109
|
+
protected:
|
110
|
+
friend class internal::ValueHelper;
|
111
|
+
friend class internal::HandleHelper;
|
112
|
+
|
113
|
+
V8_INLINE DirectHandleBase() = default;
|
114
|
+
V8_INLINE DirectHandleBase(const DirectHandleBase& other) = default;
|
115
|
+
V8_INLINE DirectHandleBase& operator=(const DirectHandleBase& that) = default;
|
116
|
+
|
117
|
+
V8_INLINE explicit DirectHandleBase(internal::Address ptr) : ptr_(ptr) {}
|
118
|
+
|
119
|
+
// Returns the address of the referenced object.
|
120
|
+
V8_INLINE internal::Address ptr() const { return ptr_; }
|
121
|
+
|
122
|
+
// Returns the handler's "value" (direct pointer, as direct local support
|
123
|
+
// is guaranteed to be enabled here).
|
124
|
+
template <typename T, bool check_null = false>
|
125
|
+
V8_INLINE T* value() const {
|
126
|
+
return reinterpret_cast<T*>(ptr_);
|
127
|
+
}
|
128
|
+
|
129
|
+
private:
|
130
|
+
internal::Address ptr_ = internal::ValueHelper::kEmpty;
|
131
|
+
};
|
132
|
+
|
133
|
+
#endif // V8_ENABLE_DIRECT_LOCAL
|
134
|
+
|
135
|
+
} // namespace v8::api_internal
|
136
|
+
|
137
|
+
#endif // INCLUDE_V8_HANDLE_BASE_H_
|
@@ -172,10 +172,6 @@ class V8_EXPORT V8InspectorSession {
|
|
172
172
|
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
|
173
173
|
virtual ~Inspectable() = default;
|
174
174
|
};
|
175
|
-
class V8_EXPORT CommandLineAPIScope {
|
176
|
-
public:
|
177
|
-
virtual ~CommandLineAPIScope() = default;
|
178
|
-
};
|
179
175
|
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
|
180
176
|
|
181
177
|
// Dispatching protocol messages.
|
@@ -185,9 +181,6 @@ class V8_EXPORT V8InspectorSession {
|
|
185
181
|
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
186
182
|
supportedDomains() = 0;
|
187
183
|
|
188
|
-
virtual std::unique_ptr<V8InspectorSession::CommandLineAPIScope>
|
189
|
-
initializeCommandLineAPIScope(int executionContextId) = 0;
|
190
|
-
|
191
184
|
// Debugger actions.
|
192
185
|
virtual void schedulePauseOnNextStatement(StringView breakReason,
|
193
186
|
StringView breakDetails) = 0;
|
@@ -213,19 +206,47 @@ class V8_EXPORT V8InspectorSession {
|
|
213
206
|
virtual void releaseObjectGroup(StringView) = 0;
|
214
207
|
virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0;
|
215
208
|
|
209
|
+
struct V8_EXPORT EvaluateResult {
|
210
|
+
enum class ResultType {
|
211
|
+
kNotRun,
|
212
|
+
kSuccess,
|
213
|
+
kException,
|
214
|
+
};
|
215
|
+
|
216
|
+
ResultType type;
|
217
|
+
v8::Local<v8::Value> value;
|
218
|
+
};
|
219
|
+
// Evalaute 'expression' in the provided context. Does the same as
|
220
|
+
// Runtime#evaluate under-the-hood but exposed on the C++ side.
|
221
|
+
virtual EvaluateResult evaluate(v8::Local<v8::Context> context,
|
222
|
+
StringView expression,
|
223
|
+
bool includeCommandLineAPI = false) = 0;
|
224
|
+
|
216
225
|
// Prepare for shutdown (disables debugger pausing, etc.).
|
217
226
|
virtual void stop() = 0;
|
218
227
|
};
|
219
228
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
v8::MaybeLocal<v8::Value> value = {})
|
229
|
+
struct V8_EXPORT DeepSerializedValue {
|
230
|
+
explicit DeepSerializedValue(std::unique_ptr<StringBuffer> type,
|
231
|
+
v8::MaybeLocal<v8::Value> value = {})
|
224
232
|
: type(std::move(type)), value(value) {}
|
225
233
|
std::unique_ptr<StringBuffer> type;
|
226
234
|
v8::MaybeLocal<v8::Value> value;
|
227
235
|
};
|
228
236
|
|
237
|
+
struct V8_EXPORT DeepSerializationResult {
|
238
|
+
explicit DeepSerializationResult(
|
239
|
+
std::unique_ptr<DeepSerializedValue> serializedValue)
|
240
|
+
: serializedValue(std::move(serializedValue)), isSuccess(true) {}
|
241
|
+
explicit DeepSerializationResult(std::unique_ptr<StringBuffer> errorMessage)
|
242
|
+
: errorMessage(std::move(errorMessage)), isSuccess(false) {}
|
243
|
+
|
244
|
+
// Use std::variant when available.
|
245
|
+
std::unique_ptr<DeepSerializedValue> serializedValue;
|
246
|
+
std::unique_ptr<StringBuffer> errorMessage;
|
247
|
+
bool isSuccess;
|
248
|
+
};
|
249
|
+
|
229
250
|
class V8_EXPORT V8InspectorClient {
|
230
251
|
public:
|
231
252
|
virtual ~V8InspectorClient() = default;
|
@@ -243,8 +264,9 @@ class V8_EXPORT V8InspectorClient {
|
|
243
264
|
virtual void beginUserGesture() {}
|
244
265
|
virtual void endUserGesture() {}
|
245
266
|
|
246
|
-
virtual std::unique_ptr<
|
247
|
-
v8::Local<v8::Value>
|
267
|
+
virtual std::unique_ptr<DeepSerializationResult> deepSerialize(
|
268
|
+
v8::Local<v8::Value> v8Value, int maxDepth,
|
269
|
+
v8::Local<v8::Object> additionalParameters) {
|
248
270
|
return nullptr;
|
249
271
|
}
|
250
272
|
virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
|