libv8-node 15.14.0.1-aarch64-linux-musl → 18.8.0.0-aarch64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libv8-node/location.rb +1 -1
- data/ext/libv8-node/paths.rb +5 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/{out.gn → aarch64-linux-musl}/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +184 -47
- data/vendor/v8/include/cppgc/common.h +9 -6
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +465 -0
- data/vendor/v8/include/cppgc/custom-space.h +37 -2
- data/vendor/v8/include/cppgc/default-platform.h +40 -49
- data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
- data/vendor/v8/include/cppgc/explicit-management.h +100 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +19 -29
- data/vendor/v8/include/cppgc/heap-consistency.h +266 -0
- data/vendor/v8/include/cppgc/heap-state.h +82 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
- data/vendor/v8/include/cppgc/heap.h +73 -6
- data/vendor/v8/include/cppgc/internal/api-constants.h +11 -3
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +27 -15
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
- data/vendor/v8/include/cppgc/internal/gc-info.h +124 -13
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/name-trait.h +122 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -16
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +84 -32
- data/vendor/v8/include/cppgc/internal/write-barrier.h +392 -35
- data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
- data/vendor/v8/include/cppgc/macros.h +2 -0
- data/vendor/v8/include/cppgc/member.h +91 -26
- data/vendor/v8/include/cppgc/name-provider.h +65 -0
- data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
- data/vendor/v8/include/cppgc/persistent.h +70 -41
- data/vendor/v8/include/cppgc/platform.h +52 -26
- data/vendor/v8/include/cppgc/prefinalizer.h +36 -13
- data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
- data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -1
- data/vendor/v8/include/cppgc/testing.h +106 -0
- data/vendor/v8/include/cppgc/trace-trait.h +8 -3
- data/vendor/v8/include/cppgc/type-traits.h +163 -32
- data/vendor/v8/include/cppgc/visitor.h +194 -28
- data/vendor/v8/include/libplatform/libplatform.h +11 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +2 -1
- data/vendor/v8/include/v8-array-buffer.h +445 -0
- data/vendor/v8/include/v8-callbacks.h +397 -0
- data/vendor/v8/include/v8-container.h +129 -0
- data/vendor/v8/include/v8-context.h +407 -0
- data/vendor/v8/include/v8-cppgc.h +151 -159
- data/vendor/v8/include/v8-data.h +80 -0
- data/vendor/v8/include/v8-date.h +43 -0
- data/vendor/v8/include/v8-debug.h +168 -0
- data/vendor/v8/include/v8-embedder-heap.h +218 -0
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +217 -0
- data/vendor/v8/include/v8-extension.h +62 -0
- data/vendor/v8/include/v8-external.h +37 -0
- data/vendor/v8/include/v8-fast-api-calls.h +703 -152
- data/vendor/v8/include/v8-forward.h +81 -0
- data/vendor/v8/include/v8-function-callback.h +475 -0
- data/vendor/v8/include/v8-function.h +125 -0
- data/vendor/v8/include/v8-initialization.h +315 -0
- data/vendor/v8/include/v8-inspector.h +76 -27
- data/vendor/v8/include/v8-internal.h +285 -51
- data/vendor/v8/include/v8-isolate.h +1709 -0
- data/vendor/v8/include/v8-json.h +47 -0
- data/vendor/v8/include/v8-local-handle.h +455 -0
- data/vendor/v8/include/v8-locker.h +149 -0
- data/vendor/v8/include/v8-maybe.h +137 -0
- data/vendor/v8/include/v8-memory-span.h +43 -0
- data/vendor/v8/include/v8-message.h +216 -0
- data/vendor/v8/include/v8-metrics.h +131 -9
- data/vendor/v8/include/v8-microtask-queue.h +152 -0
- data/vendor/v8/include/v8-microtask.h +28 -0
- data/vendor/v8/include/v8-object.h +775 -0
- data/vendor/v8/include/v8-persistent-handle.h +590 -0
- data/vendor/v8/include/v8-platform.h +433 -25
- data/vendor/v8/include/v8-primitive-object.h +118 -0
- data/vendor/v8/include/v8-primitive.h +866 -0
- data/vendor/v8/include/v8-profiler.h +149 -10
- data/vendor/v8/include/v8-promise.h +174 -0
- data/vendor/v8/include/v8-proxy.h +50 -0
- data/vendor/v8/include/v8-regexp.h +105 -0
- data/vendor/v8/include/v8-script.h +747 -0
- data/vendor/v8/include/v8-snapshot.h +196 -0
- data/vendor/v8/include/v8-statistics.h +217 -0
- data/vendor/v8/include/v8-template.h +1079 -0
- data/vendor/v8/include/v8-traced-handle.h +420 -0
- data/vendor/v8/include/v8-typed-array.h +282 -0
- data/vendor/v8/include/v8-unwinder-state.h +31 -0
- data/vendor/v8/include/v8-unwinder.h +132 -0
- data/vendor/v8/include/v8-util.h +8 -2
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +279 -0
- data/vendor/v8/include/v8-value.h +526 -0
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +257 -0
- data/vendor/v8/include/v8-weak-callback-info.h +87 -0
- data/vendor/v8/include/v8.h +41 -12051
- data/vendor/v8/include/v8config.h +142 -21
- metadata +64 -10
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
- data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -0,0 +1,257 @@
|
|
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_WASM_H_
|
6
|
+
#define INCLUDE_V8_WASM_H_
|
7
|
+
|
8
|
+
#include <memory>
|
9
|
+
#include <string>
|
10
|
+
|
11
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
12
|
+
#include "v8-memory-span.h" // NOLINT(build/include_directory)
|
13
|
+
#include "v8-object.h" // NOLINT(build/include_directory)
|
14
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
15
|
+
|
16
|
+
namespace v8 {
|
17
|
+
|
18
|
+
class ArrayBuffer;
|
19
|
+
class Promise;
|
20
|
+
|
21
|
+
namespace internal {
|
22
|
+
namespace wasm {
|
23
|
+
class NativeModule;
|
24
|
+
class StreamingDecoder;
|
25
|
+
} // namespace wasm
|
26
|
+
} // namespace internal
|
27
|
+
|
28
|
+
/**
|
29
|
+
* An owned byte buffer with associated size.
|
30
|
+
*/
|
31
|
+
struct OwnedBuffer {
|
32
|
+
std::unique_ptr<const uint8_t[]> buffer;
|
33
|
+
size_t size = 0;
|
34
|
+
OwnedBuffer(std::unique_ptr<const uint8_t[]> buffer, size_t size)
|
35
|
+
: buffer(std::move(buffer)), size(size) {}
|
36
|
+
OwnedBuffer() = default;
|
37
|
+
};
|
38
|
+
|
39
|
+
// Wrapper around a compiled WebAssembly module, which is potentially shared by
|
40
|
+
// different WasmModuleObjects.
|
41
|
+
class V8_EXPORT CompiledWasmModule {
|
42
|
+
public:
|
43
|
+
/**
|
44
|
+
* Serialize the compiled module. The serialized data does not include the
|
45
|
+
* wire bytes.
|
46
|
+
*/
|
47
|
+
OwnedBuffer Serialize();
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Get the (wasm-encoded) wire bytes that were used to compile this module.
|
51
|
+
*/
|
52
|
+
MemorySpan<const uint8_t> GetWireBytesRef();
|
53
|
+
|
54
|
+
const std::string& source_url() const { return source_url_; }
|
55
|
+
|
56
|
+
private:
|
57
|
+
friend class WasmModuleObject;
|
58
|
+
friend class WasmStreaming;
|
59
|
+
|
60
|
+
explicit CompiledWasmModule(std::shared_ptr<internal::wasm::NativeModule>,
|
61
|
+
const char* source_url, size_t url_length);
|
62
|
+
|
63
|
+
const std::shared_ptr<internal::wasm::NativeModule> native_module_;
|
64
|
+
const std::string source_url_;
|
65
|
+
};
|
66
|
+
|
67
|
+
// An instance of WebAssembly.Memory.
|
68
|
+
class V8_EXPORT WasmMemoryObject : public Object {
|
69
|
+
public:
|
70
|
+
WasmMemoryObject() = delete;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Returns underlying ArrayBuffer.
|
74
|
+
*/
|
75
|
+
Local<ArrayBuffer> Buffer();
|
76
|
+
|
77
|
+
V8_INLINE static WasmMemoryObject* Cast(Value* value) {
|
78
|
+
#ifdef V8_ENABLE_CHECKS
|
79
|
+
CheckCast(value);
|
80
|
+
#endif
|
81
|
+
return static_cast<WasmMemoryObject*>(value);
|
82
|
+
}
|
83
|
+
|
84
|
+
private:
|
85
|
+
static void CheckCast(Value* object);
|
86
|
+
};
|
87
|
+
|
88
|
+
// An instance of WebAssembly.Module.
|
89
|
+
class V8_EXPORT WasmModuleObject : public Object {
|
90
|
+
public:
|
91
|
+
WasmModuleObject() = delete;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Efficiently re-create a WasmModuleObject, without recompiling, from
|
95
|
+
* a CompiledWasmModule.
|
96
|
+
*/
|
97
|
+
static MaybeLocal<WasmModuleObject> FromCompiledModule(
|
98
|
+
Isolate* isolate, const CompiledWasmModule&);
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Get the compiled module for this module object. The compiled module can be
|
102
|
+
* shared by several module objects.
|
103
|
+
*/
|
104
|
+
CompiledWasmModule GetCompiledModule();
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Compile a Wasm module from the provided uncompiled bytes.
|
108
|
+
*/
|
109
|
+
static MaybeLocal<WasmModuleObject> Compile(
|
110
|
+
Isolate* isolate, MemorySpan<const uint8_t> wire_bytes);
|
111
|
+
|
112
|
+
V8_INLINE static WasmModuleObject* Cast(Value* value) {
|
113
|
+
#ifdef V8_ENABLE_CHECKS
|
114
|
+
CheckCast(value);
|
115
|
+
#endif
|
116
|
+
return static_cast<WasmModuleObject*>(value);
|
117
|
+
}
|
118
|
+
|
119
|
+
private:
|
120
|
+
static void CheckCast(Value* obj);
|
121
|
+
};
|
122
|
+
|
123
|
+
/**
|
124
|
+
* The V8 interface for WebAssembly streaming compilation. When streaming
|
125
|
+
* compilation is initiated, V8 passes a {WasmStreaming} object to the embedder
|
126
|
+
* such that the embedder can pass the input bytes for streaming compilation to
|
127
|
+
* V8.
|
128
|
+
*/
|
129
|
+
class V8_EXPORT WasmStreaming final {
|
130
|
+
public:
|
131
|
+
class WasmStreamingImpl;
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Client to receive streaming event notifications.
|
135
|
+
*/
|
136
|
+
class Client {
|
137
|
+
public:
|
138
|
+
virtual ~Client() = default;
|
139
|
+
/**
|
140
|
+
* Passes the fully compiled module to the client. This can be used to
|
141
|
+
* implement code caching.
|
142
|
+
*/
|
143
|
+
virtual void OnModuleCompiled(CompiledWasmModule compiled_module) = 0;
|
144
|
+
};
|
145
|
+
|
146
|
+
explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
|
147
|
+
|
148
|
+
~WasmStreaming();
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Pass a new chunk of bytes to WebAssembly streaming compilation.
|
152
|
+
* The buffer passed into {OnBytesReceived} is owned by the caller.
|
153
|
+
*/
|
154
|
+
void OnBytesReceived(const uint8_t* bytes, size_t size);
|
155
|
+
|
156
|
+
/**
|
157
|
+
* {Finish} should be called after all received bytes where passed to
|
158
|
+
* {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish}
|
159
|
+
* does not have to be called after {Abort} has been called already.
|
160
|
+
* If {can_use_compiled_module} is true and {SetCompiledModuleBytes} was
|
161
|
+
* previously called, the compiled module bytes can be used.
|
162
|
+
* If {can_use_compiled_module} is false, the compiled module bytes previously
|
163
|
+
* set by {SetCompiledModuleBytes} should not be used.
|
164
|
+
*/
|
165
|
+
void Finish(bool can_use_compiled_module = true);
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Abort streaming compilation. If {exception} has a value, then the promise
|
169
|
+
* associated with streaming compilation is rejected with that value. If
|
170
|
+
* {exception} does not have value, the promise does not get rejected.
|
171
|
+
*/
|
172
|
+
void Abort(MaybeLocal<Value> exception);
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Passes previously compiled module bytes. This must be called before
|
176
|
+
* {OnBytesReceived}, {Finish}, or {Abort}. Returns true if the module bytes
|
177
|
+
* can be used, false otherwise. The buffer passed via {bytes} and {size}
|
178
|
+
* is owned by the caller. If {SetCompiledModuleBytes} returns true, the
|
179
|
+
* buffer must remain valid until either {Finish} or {Abort} completes.
|
180
|
+
* The compiled module bytes should not be used until {Finish(true)} is
|
181
|
+
* called, because they can be invalidated later by {Finish(false)}.
|
182
|
+
*/
|
183
|
+
bool SetCompiledModuleBytes(const uint8_t* bytes, size_t size);
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Sets the client object that will receive streaming event notifications.
|
187
|
+
* This must be called before {OnBytesReceived}, {Finish}, or {Abort}.
|
188
|
+
*/
|
189
|
+
void SetClient(std::shared_ptr<Client> client);
|
190
|
+
|
191
|
+
/*
|
192
|
+
* Sets the UTF-8 encoded source URL for the {Script} object. This must be
|
193
|
+
* called before {Finish}.
|
194
|
+
*/
|
195
|
+
void SetUrl(const char* url, size_t length);
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Unpacks a {WasmStreaming} object wrapped in a {Managed} for the embedder.
|
199
|
+
* Since the embedder is on the other side of the API, it cannot unpack the
|
200
|
+
* {Managed} itself.
|
201
|
+
*/
|
202
|
+
static std::shared_ptr<WasmStreaming> Unpack(Isolate* isolate,
|
203
|
+
Local<Value> value);
|
204
|
+
|
205
|
+
private:
|
206
|
+
std::unique_ptr<WasmStreamingImpl> impl_;
|
207
|
+
};
|
208
|
+
|
209
|
+
// TODO(mtrofin): when streaming compilation is done, we can rename this
|
210
|
+
// to simply WasmModuleObjectBuilder
|
211
|
+
class V8_EXPORT WasmModuleObjectBuilderStreaming final {
|
212
|
+
public:
|
213
|
+
explicit WasmModuleObjectBuilderStreaming(Isolate* isolate);
|
214
|
+
/**
|
215
|
+
* The buffer passed into OnBytesReceived is owned by the caller.
|
216
|
+
*/
|
217
|
+
void OnBytesReceived(const uint8_t*, size_t size);
|
218
|
+
void Finish();
|
219
|
+
/**
|
220
|
+
* Abort streaming compilation. If {exception} has a value, then the promise
|
221
|
+
* associated with streaming compilation is rejected with that value. If
|
222
|
+
* {exception} does not have value, the promise does not get rejected.
|
223
|
+
*/
|
224
|
+
void Abort(MaybeLocal<Value> exception);
|
225
|
+
Local<Promise> GetPromise();
|
226
|
+
|
227
|
+
~WasmModuleObjectBuilderStreaming() = default;
|
228
|
+
|
229
|
+
private:
|
230
|
+
WasmModuleObjectBuilderStreaming(const WasmModuleObjectBuilderStreaming&) =
|
231
|
+
delete;
|
232
|
+
WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
|
233
|
+
default;
|
234
|
+
WasmModuleObjectBuilderStreaming& operator=(
|
235
|
+
const WasmModuleObjectBuilderStreaming&) = delete;
|
236
|
+
WasmModuleObjectBuilderStreaming& operator=(
|
237
|
+
WasmModuleObjectBuilderStreaming&&) = default;
|
238
|
+
Isolate* isolate_ = nullptr;
|
239
|
+
|
240
|
+
#if V8_CC_MSVC
|
241
|
+
/**
|
242
|
+
* We don't need the static Copy API, so the default
|
243
|
+
* NonCopyablePersistentTraits would be sufficient, however,
|
244
|
+
* MSVC eagerly instantiates the Copy.
|
245
|
+
* We ensure we don't use Copy, however, by compiling with the
|
246
|
+
* defaults everywhere else.
|
247
|
+
*/
|
248
|
+
Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
|
249
|
+
#else
|
250
|
+
Persistent<Promise> promise_;
|
251
|
+
#endif
|
252
|
+
std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
|
253
|
+
};
|
254
|
+
|
255
|
+
} // namespace v8
|
256
|
+
|
257
|
+
#endif // INCLUDE_V8_WASM_H_
|
@@ -0,0 +1,87 @@
|
|
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_WEAK_CALLBACK_INFO_H_
|
6
|
+
#define INCLUDE_V8_WEAK_CALLBACK_INFO_H_
|
7
|
+
|
8
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
9
|
+
|
10
|
+
namespace v8 {
|
11
|
+
|
12
|
+
class Isolate;
|
13
|
+
|
14
|
+
namespace api_internal {
|
15
|
+
V8_EXPORT void InternalFieldOutOfBounds(int index);
|
16
|
+
} // namespace api_internal
|
17
|
+
|
18
|
+
static const int kInternalFieldsInWeakCallback = 2;
|
19
|
+
static const int kEmbedderFieldsInWeakCallback = 2;
|
20
|
+
|
21
|
+
template <typename T>
|
22
|
+
class WeakCallbackInfo {
|
23
|
+
public:
|
24
|
+
using Callback = void (*)(const WeakCallbackInfo<T>& data);
|
25
|
+
|
26
|
+
WeakCallbackInfo(Isolate* isolate, T* parameter,
|
27
|
+
void* embedder_fields[kEmbedderFieldsInWeakCallback],
|
28
|
+
Callback* callback)
|
29
|
+
: isolate_(isolate), parameter_(parameter), callback_(callback) {
|
30
|
+
for (int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
|
31
|
+
embedder_fields_[i] = embedder_fields[i];
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
V8_INLINE Isolate* GetIsolate() const { return isolate_; }
|
36
|
+
V8_INLINE T* GetParameter() const { return parameter_; }
|
37
|
+
V8_INLINE void* GetInternalField(int index) const;
|
38
|
+
|
39
|
+
// When first called, the embedder MUST Reset() the Global which triggered the
|
40
|
+
// callback. The Global itself is unusable for anything else. No v8 other api
|
41
|
+
// calls may be called in the first callback. Should additional work be
|
42
|
+
// required, the embedder must set a second pass callback, which will be
|
43
|
+
// called after all the initial callbacks are processed.
|
44
|
+
// Calling SetSecondPassCallback on the second pass will immediately crash.
|
45
|
+
void SetSecondPassCallback(Callback callback) const { *callback_ = callback; }
|
46
|
+
|
47
|
+
private:
|
48
|
+
Isolate* isolate_;
|
49
|
+
T* parameter_;
|
50
|
+
Callback* callback_;
|
51
|
+
void* embedder_fields_[kEmbedderFieldsInWeakCallback];
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Weakness type for weak handles.
|
56
|
+
*/
|
57
|
+
enum class WeakCallbackType {
|
58
|
+
/**
|
59
|
+
* Passes a user-defined void* parameter back to the callback.
|
60
|
+
*/
|
61
|
+
kParameter,
|
62
|
+
/**
|
63
|
+
* Passes the first two internal fields of the object back to the callback.
|
64
|
+
*/
|
65
|
+
kInternalFields,
|
66
|
+
/**
|
67
|
+
* Passes a user-defined void* parameter back to the callback. Will do so
|
68
|
+
* before the object is actually reclaimed, allowing it to be resurrected. In
|
69
|
+
* this case it is not possible to set a second-pass callback.
|
70
|
+
*/
|
71
|
+
kFinalizer V8_ENUM_DEPRECATED("Resurrecting finalizers are deprecated "
|
72
|
+
"and will not be supported going forward.")
|
73
|
+
};
|
74
|
+
|
75
|
+
template <class T>
|
76
|
+
void* WeakCallbackInfo<T>::GetInternalField(int index) const {
|
77
|
+
#ifdef V8_ENABLE_CHECKS
|
78
|
+
if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
|
79
|
+
api_internal::InternalFieldOutOfBounds(index);
|
80
|
+
}
|
81
|
+
#endif
|
82
|
+
return embedder_fields_[index];
|
83
|
+
}
|
84
|
+
|
85
|
+
} // namespace v8
|
86
|
+
|
87
|
+
#endif // INCLUDE_V8_WEAK_CALLBACK_INFO_H_
|