@downdraft/native-mobile-android-arm64 0.0.0 → 0.1.1

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.
Files changed (138) hide show
  1. package/README.md +7 -0
  2. package/include/node/cppgc/allocation.h +308 -0
  3. package/include/node/cppgc/common.h +28 -0
  4. package/include/node/cppgc/cross-thread-persistent.h +462 -0
  5. package/include/node/cppgc/custom-space.h +97 -0
  6. package/include/node/cppgc/default-platform.h +68 -0
  7. package/include/node/cppgc/explicit-management.h +100 -0
  8. package/include/node/cppgc/garbage-collected.h +114 -0
  9. package/include/node/cppgc/heap-consistency.h +309 -0
  10. package/include/node/cppgc/heap-handle.h +48 -0
  11. package/include/node/cppgc/heap-state.h +82 -0
  12. package/include/node/cppgc/heap-statistics.h +126 -0
  13. package/include/node/cppgc/heap.h +202 -0
  14. package/include/node/cppgc/internal/api-constants.h +75 -0
  15. package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
  16. package/include/node/cppgc/internal/base-page-handle.h +43 -0
  17. package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
  18. package/include/node/cppgc/internal/caged-heap.h +64 -0
  19. package/include/node/cppgc/internal/compiler-specific.h +46 -0
  20. package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
  21. package/include/node/cppgc/internal/finalizer-trait.h +93 -0
  22. package/include/node/cppgc/internal/gc-info.h +150 -0
  23. package/include/node/cppgc/internal/logging.h +50 -0
  24. package/include/node/cppgc/internal/member-storage.h +305 -0
  25. package/include/node/cppgc/internal/name-trait.h +141 -0
  26. package/include/node/cppgc/internal/persistent-node.h +219 -0
  27. package/include/node/cppgc/internal/pointer-policies.h +280 -0
  28. package/include/node/cppgc/internal/write-barrier.h +487 -0
  29. package/include/node/cppgc/liveness-broker.h +78 -0
  30. package/include/node/cppgc/macros.h +56 -0
  31. package/include/node/cppgc/member.h +669 -0
  32. package/include/node/cppgc/name-provider.h +75 -0
  33. package/include/node/cppgc/object-size-trait.h +58 -0
  34. package/include/node/cppgc/persistent.h +376 -0
  35. package/include/node/cppgc/platform.h +174 -0
  36. package/include/node/cppgc/prefinalizer.h +75 -0
  37. package/include/node/cppgc/process-heap-statistics.h +36 -0
  38. package/include/node/cppgc/sentinel-pointer.h +39 -0
  39. package/include/node/cppgc/source-location.h +16 -0
  40. package/include/node/cppgc/tagged-member.h +114 -0
  41. package/include/node/cppgc/testing.h +106 -0
  42. package/include/node/cppgc/trace-trait.h +127 -0
  43. package/include/node/cppgc/type-traits.h +272 -0
  44. package/include/node/cppgc/visitor.h +534 -0
  45. package/include/node/js_native_api.h +634 -0
  46. package/include/node/js_native_api_types.h +244 -0
  47. package/include/node/libplatform/libplatform-export.h +29 -0
  48. package/include/node/libplatform/libplatform.h +112 -0
  49. package/include/node/libplatform/v8-tracing.h +343 -0
  50. package/include/node/node.h +1744 -0
  51. package/include/node/node_api.h +265 -0
  52. package/include/node/node_api_types.h +58 -0
  53. package/include/node/node_buffer.h +94 -0
  54. package/include/node/node_object_wrap.h +145 -0
  55. package/include/node/node_version.h +116 -0
  56. package/include/node/uv/aix.h +32 -0
  57. package/include/node/uv/bsd.h +34 -0
  58. package/include/node/uv/darwin.h +61 -0
  59. package/include/node/uv/errno.h +483 -0
  60. package/include/node/uv/linux.h +34 -0
  61. package/include/node/uv/os390.h +33 -0
  62. package/include/node/uv/posix.h +31 -0
  63. package/include/node/uv/sunos.h +44 -0
  64. package/include/node/uv/threadpool.h +37 -0
  65. package/include/node/uv/tree.h +521 -0
  66. package/include/node/uv/unix.h +509 -0
  67. package/include/node/uv/version.h +43 -0
  68. package/include/node/uv/win.h +698 -0
  69. package/include/node/uv.h +1994 -0
  70. package/include/node/v8-array-buffer.h +646 -0
  71. package/include/node/v8-callbacks.h +533 -0
  72. package/include/node/v8-container.h +183 -0
  73. package/include/node/v8-context.h +580 -0
  74. package/include/node/v8-cpp-heap-external.h +56 -0
  75. package/include/node/v8-cppgc.h +194 -0
  76. package/include/node/v8-data.h +96 -0
  77. package/include/node/v8-date.h +57 -0
  78. package/include/node/v8-debug.h +210 -0
  79. package/include/node/v8-embedder-heap.h +54 -0
  80. package/include/node/v8-embedder-state-scope.h +52 -0
  81. package/include/node/v8-exception.h +298 -0
  82. package/include/node/v8-extension.h +60 -0
  83. package/include/node/v8-external-memory-accounter.h +60 -0
  84. package/include/node/v8-external.h +73 -0
  85. package/include/node/v8-fast-api-calls.h +784 -0
  86. package/include/node/v8-forward.h +82 -0
  87. package/include/node/v8-function-callback.h +708 -0
  88. package/include/node/v8-function.h +148 -0
  89. package/include/node/v8-handle-base.h +155 -0
  90. package/include/node/v8-initialization.h +343 -0
  91. package/include/node/v8-inspector-protocol.h +13 -0
  92. package/include/node/v8-inspector.h +458 -0
  93. package/include/node/v8-internal.h +1827 -0
  94. package/include/node/v8-isolate.h +1925 -0
  95. package/include/node/v8-json.h +54 -0
  96. package/include/node/v8-local-handle.h +884 -0
  97. package/include/node/v8-locker.h +138 -0
  98. package/include/node/v8-maybe.h +185 -0
  99. package/include/node/v8-memory-span.h +273 -0
  100. package/include/node/v8-message.h +215 -0
  101. package/include/node/v8-metrics.h +273 -0
  102. package/include/node/v8-microtask-queue.h +152 -0
  103. package/include/node/v8-microtask.h +28 -0
  104. package/include/node/v8-object.h +1134 -0
  105. package/include/node/v8-persistent-handle.h +556 -0
  106. package/include/node/v8-platform.h +1552 -0
  107. package/include/node/v8-primitive-object.h +118 -0
  108. package/include/node/v8-primitive.h +1056 -0
  109. package/include/node/v8-profiler.h +1401 -0
  110. package/include/node/v8-promise.h +185 -0
  111. package/include/node/v8-proxy.h +49 -0
  112. package/include/node/v8-regexp.h +105 -0
  113. package/include/node/v8-sandbox.h +170 -0
  114. package/include/node/v8-script.h +996 -0
  115. package/include/node/v8-snapshot.h +302 -0
  116. package/include/node/v8-source-location.h +91 -0
  117. package/include/node/v8-statistics.h +246 -0
  118. package/include/node/v8-template.h +1096 -0
  119. package/include/node/v8-trace-categories.h +28 -0
  120. package/include/node/v8-traced-handle.h +420 -0
  121. package/include/node/v8-typed-array.h +386 -0
  122. package/include/node/v8-unwinder-state.h +30 -0
  123. package/include/node/v8-unwinder.h +146 -0
  124. package/include/node/v8-util.h +549 -0
  125. package/include/node/v8-value-serializer-version.h +24 -0
  126. package/include/node/v8-value-serializer.h +316 -0
  127. package/include/node/v8-value.h +674 -0
  128. package/include/node/v8-version-string.h +38 -0
  129. package/include/node/v8-version.h +20 -0
  130. package/include/node/v8-wasm-trap-handler-posix.h +31 -0
  131. package/include/node/v8-wasm-trap-handler-win.h +28 -0
  132. package/include/node/v8-wasm.h +325 -0
  133. package/include/node/v8-weak-callback-info.h +88 -0
  134. package/include/node/v8.h +88 -0
  135. package/include/node/v8config.h +1077 -0
  136. package/lib/libc++_shared.so +0 -0
  137. package/lib/libnode.so +4 -0
  138. package/package.json +23 -3
@@ -0,0 +1,20 @@
1
+ // Copyright 2015 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 V8_INCLUDE_VERSION_H_ // V8_VERSION_H_ conflicts with src/version.h
6
+ #define V8_INCLUDE_VERSION_H_
7
+
8
+ // These macros define the version number for the current version.
9
+ // NOTE these macros are used by some of the tool scripts and the build
10
+ // system so their names cannot be changed without changing the scripts.
11
+ #define V8_MAJOR_VERSION 14
12
+ #define V8_MINOR_VERSION 6
13
+ #define V8_BUILD_NUMBER 202
14
+ #define V8_PATCH_LEVEL 34
15
+
16
+ // Use 1 for candidates and 0 otherwise.
17
+ // (Boolean macro values are not supported by all preprocessors.)
18
+ #define V8_IS_CANDIDATE_VERSION 0
19
+
20
+ #endif // V8_INCLUDE_VERSION_H_
@@ -0,0 +1,31 @@
1
+ // Copyright 2018 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 V8_WASM_TRAP_HANDLER_POSIX_H_
6
+ #define V8_WASM_TRAP_HANDLER_POSIX_H_
7
+
8
+ #include <signal.h>
9
+
10
+ #include "v8config.h" // NOLINT(build/include_directory)
11
+
12
+ namespace v8 {
13
+ /**
14
+ * This function determines whether a memory access violation has been an
15
+ * out-of-bounds memory access in WebAssembly. If so, it will modify the context
16
+ * parameter and add a return address where the execution can continue after the
17
+ * signal handling, and return true. Otherwise, false will be returned.
18
+ *
19
+ * The parameters to this function correspond to those passed to a Posix signal
20
+ * handler. Use this function only on Linux and Mac.
21
+ *
22
+ * \param sig_code The signal code, e.g. SIGSEGV.
23
+ * \param info A pointer to the siginfo_t struct provided to the signal handler.
24
+ * \param context A pointer to a ucontext_t struct provided to the signal
25
+ * handler.
26
+ */
27
+ V8_EXPORT bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info,
28
+ void* context);
29
+
30
+ } // namespace v8
31
+ #endif // V8_WASM_TRAP_HANDLER_POSIX_H_
@@ -0,0 +1,28 @@
1
+ // Copyright 2018 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 V8_WASM_TRAP_HANDLER_WIN_H_
6
+ #define V8_WASM_TRAP_HANDLER_WIN_H_
7
+
8
+ #include <windows.h>
9
+
10
+ #include "v8config.h" // NOLINT(build/include_directory)
11
+
12
+ namespace v8 {
13
+ /**
14
+ * This function determines whether a memory access violation has been an
15
+ * out-of-bounds memory access in WebAssembly. If so, it will modify the
16
+ * exception parameter and add a return address where the execution can continue
17
+ * after the exception handling, and return true. Otherwise the return value
18
+ * will be false.
19
+ *
20
+ * The parameter to this function corresponds to the one passed to a Windows
21
+ * vectored exception handler. Use this function only on Windows.
22
+ *
23
+ * \param exception An EXCEPTION_POINTERS* as provided to the exception handler.
24
+ */
25
+ V8_EXPORT bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS* exception);
26
+
27
+ } // namespace v8
28
+ #endif // V8_WASM_TRAP_HANDLER_WIN_H_
@@ -0,0 +1,325 @@
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 <functional>
9
+ #include <memory>
10
+ #include <string>
11
+ #include <variant>
12
+
13
+ #include "v8-internal.h" // NOLINT(build/include_directory)
14
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
15
+ #include "v8-memory-span.h" // NOLINT(build/include_directory)
16
+ #include "v8-object.h" // NOLINT(build/include_directory)
17
+ #include "v8config.h" // NOLINT(build/include_directory)
18
+
19
+ namespace v8 {
20
+
21
+ class ArrayBuffer;
22
+ class Promise;
23
+
24
+ namespace internal::wasm {
25
+ class NativeModule;
26
+ } // namespace internal::wasm
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
+ /**
40
+ * Wrapper around a compiled WebAssembly module, which is potentially shared by
41
+ * different WasmModuleObjects.
42
+ */
43
+ class V8_EXPORT CompiledWasmModule {
44
+ public:
45
+ /**
46
+ * Serialize the compiled module. The serialized data does not include the
47
+ * wire bytes.
48
+ */
49
+ OwnedBuffer Serialize();
50
+
51
+ /**
52
+ * Get the (wasm-encoded) wire bytes that were used to compile this module.
53
+ */
54
+ MemorySpan<const uint8_t> GetWireBytesRef();
55
+
56
+ const std::string& source_url() const { return source_url_; }
57
+
58
+ private:
59
+ friend class WasmModuleCompilation;
60
+ friend class WasmModuleObject;
61
+ friend class WasmStreaming;
62
+
63
+ explicit CompiledWasmModule(std::shared_ptr<internal::wasm::NativeModule>,
64
+ std::string source_url);
65
+
66
+ const std::shared_ptr<internal::wasm::NativeModule> native_module_;
67
+ const std::string source_url_;
68
+ };
69
+
70
+ // An instance of WebAssembly.Memory.
71
+ class V8_EXPORT WasmMemoryObject : public Object {
72
+ public:
73
+ WasmMemoryObject() = delete;
74
+
75
+ /**
76
+ * Returns underlying ArrayBuffer.
77
+ */
78
+ Local<ArrayBuffer> Buffer();
79
+
80
+ V8_INLINE static WasmMemoryObject* Cast(Value* value) {
81
+ #ifdef V8_ENABLE_CHECKS
82
+ CheckCast(value);
83
+ #endif
84
+ return static_cast<WasmMemoryObject*>(value);
85
+ }
86
+
87
+ private:
88
+ static void CheckCast(Value* object);
89
+ };
90
+
91
+ // An instance of WebAssembly.Module.
92
+ class V8_EXPORT WasmModuleObject : public Object {
93
+ public:
94
+ WasmModuleObject() = delete;
95
+
96
+ /**
97
+ * Efficiently re-create a WasmModuleObject, without recompiling, from
98
+ * a CompiledWasmModule.
99
+ */
100
+ static MaybeLocal<WasmModuleObject> FromCompiledModule(
101
+ Isolate* isolate, const CompiledWasmModule&);
102
+
103
+ /**
104
+ * Get the compiled module for this module object. The compiled module can be
105
+ * shared by several module objects.
106
+ */
107
+ CompiledWasmModule GetCompiledModule();
108
+
109
+ /**
110
+ * Compile a Wasm module from the provided uncompiled bytes.
111
+ */
112
+ static MaybeLocal<WasmModuleObject> Compile(
113
+ Isolate* isolate, MemorySpan<const uint8_t> wire_bytes);
114
+
115
+ V8_INLINE static WasmModuleObject* Cast(Value* value) {
116
+ #ifdef V8_ENABLE_CHECKS
117
+ CheckCast(value);
118
+ #endif
119
+ return static_cast<WasmModuleObject*>(value);
120
+ }
121
+
122
+ private:
123
+ static void CheckCast(Value* obj);
124
+ };
125
+
126
+ /**
127
+ * The V8 interface for WebAssembly streaming compilation. When streaming
128
+ * compilation is initiated, V8 passes a {WasmStreaming} object to the embedder
129
+ * such that the embedder can pass the input bytes for streaming compilation to
130
+ * V8.
131
+ */
132
+ class V8_EXPORT WasmStreaming final {
133
+ public:
134
+ static constexpr internal::ExternalPointerTag kManagedTag =
135
+ internal::kWasmWasmStreamingTag;
136
+ class WasmStreamingImpl;
137
+
138
+ class ModuleCachingInterface {
139
+ public:
140
+ // Get the full wire bytes, to check against the cached version.
141
+ virtual MemorySpan<const uint8_t> GetWireBytes() const = 0;
142
+ // Pass serialized (cached) compiled module bytes, to be deserialized and
143
+ // used as the result of this streaming compilation.
144
+ // The passed bytes will only be accessed inside this callback, i.e.
145
+ // lifetime can end after the call.
146
+ // The return value indicates whether V8 could use the passed bytes; {false}
147
+ // would be returned on e.g. version mismatch.
148
+ // This method can only be called once.
149
+ virtual bool SetCachedCompiledModuleBytes(MemorySpan<const uint8_t>) = 0;
150
+ };
151
+
152
+ using ModuleCachingCallback = std::function<void(ModuleCachingInterface&)>;
153
+
154
+ explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
155
+
156
+ ~WasmStreaming();
157
+
158
+ /**
159
+ * Pass a new chunk of bytes to WebAssembly streaming compilation.
160
+ * The buffer passed into {OnBytesReceived} is owned by the caller.
161
+ */
162
+ void OnBytesReceived(const uint8_t* bytes, size_t size);
163
+
164
+ /**
165
+ * {Finish} should be called after all received bytes where passed to
166
+ * {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish}
167
+ * must not be called after {Abort} has been called already.
168
+ * If {SetHasCompiledModuleBytes()} was called before, a {caching_callback}
169
+ * can be passed which can inspect the full received wire bytes and set cached
170
+ * module bytes which will be deserialized then. This callback will happen
171
+ * synchronously within this call; the callback is not stored.
172
+ */
173
+ void Finish(const ModuleCachingCallback& caching_callback);
174
+
175
+ /**
176
+ * Abort streaming compilation. If {exception} has a value, then the promise
177
+ * associated with streaming compilation is rejected with that value. If
178
+ * {exception} does not have value, the promise does not get rejected.
179
+ * {Abort} must not be called repeatedly, or after {Finish}.
180
+ */
181
+ void Abort(MaybeLocal<Value> exception);
182
+
183
+ /**
184
+ * Mark that the embedder has (potentially) cached compiled module bytes (i.e.
185
+ * a serialized {CompiledWasmModule}) that could match this streaming request.
186
+ * This will cause V8 to skip streaming compilation.
187
+ * The embedder should then pass a callback to the {Finish} method to pass the
188
+ * serialized bytes, after potentially checking their validity against the
189
+ * full received wire bytes.
190
+ */
191
+ void SetHasCompiledModuleBytes();
192
+
193
+ /**
194
+ * Sets a callback which is called whenever a significant number of new
195
+ * functions are ready for serialization.
196
+ */
197
+ void SetMoreFunctionsCanBeSerializedCallback(
198
+ std::function<void(CompiledWasmModule)>);
199
+
200
+ /*
201
+ * Sets the UTF-8 encoded source URL for the {Script} object. This must be
202
+ * called before {Finish}.
203
+ */
204
+ void SetUrl(const char* url, size_t length);
205
+
206
+ /**
207
+ * Unpacks a {WasmStreaming} object wrapped in a {Managed} for the embedder.
208
+ * Since the embedder is on the other side of the API, it cannot unpack the
209
+ * {Managed} itself.
210
+ */
211
+ static std::shared_ptr<WasmStreaming> Unpack(Isolate* isolate,
212
+ Local<Value> value);
213
+
214
+ private:
215
+ std::unique_ptr<WasmStreamingImpl> impl_;
216
+ };
217
+
218
+ /**
219
+ * An interface for asynchronous WebAssembly module compilation, to be used e.g.
220
+ * for implementing source phase imports.
221
+ * Note: This interface is experimental and can change or be removed without
222
+ * notice.
223
+ */
224
+ class V8_EXPORT WasmModuleCompilation final {
225
+ public:
226
+ using ModuleCachingCallback = WasmStreaming::ModuleCachingCallback;
227
+
228
+ /**
229
+ * Start an asynchronous module compilation. This can be called on any thread.
230
+ * TODO(clemensb): Add some way to pass enabled features.
231
+ * TODO(clemensb): Add some way to pass compile time imports.
232
+ */
233
+ WasmModuleCompilation();
234
+
235
+ ~WasmModuleCompilation();
236
+
237
+ WasmModuleCompilation(const WasmModuleCompilation&) = delete;
238
+ WasmModuleCompilation& operator=(const WasmModuleCompilation&) = delete;
239
+
240
+ /**
241
+ * Pass a new chunk of bytes to WebAssembly compilation.
242
+ * The buffer passed into {OnBytesReceived} is owned by the caller and will
243
+ * not be accessed any more after this call returns.
244
+ */
245
+ void OnBytesReceived(const uint8_t* bytes, size_t size);
246
+
247
+ /**
248
+ * {Finish} must be called on the main thread after all bytes were passed to
249
+ * {OnBytesReceived}.
250
+ * It eventually calls the provided callback to deliver the compiled module or
251
+ * an error. This callback will also be called in foreground, but not
252
+ * necessarily within this call.
253
+ * {Finish} must not be called after {Abort} has been called already.
254
+ * If {SetHasCompiledModuleBytes()} was called before, a {caching_callback}
255
+ * can be passed which can inspect the full received wire bytes and set cached
256
+ * module bytes which will be deserialized then. This callback will happen
257
+ * synchronously within this call; the callback is not stored.
258
+ */
259
+ void Finish(
260
+ Isolate*, const ModuleCachingCallback& caching_callback,
261
+ const std::function<void(
262
+ std::variant<Local<WasmModuleObject>, Local<Value>> module_or_error)>&
263
+ resolution_callback);
264
+
265
+ /**
266
+ * Abort compilation. This can be called from any thread.
267
+ * {Abort} must not be called repeatedly, or after {Finish}.
268
+ */
269
+ void Abort();
270
+
271
+ /**
272
+ * Mark that the embedder has (potentially) cached compiled module bytes (i.e.
273
+ * a serialized {CompiledWasmModule}) that could match this streaming request.
274
+ * This will cause V8 to skip streaming compilation.
275
+ * The embedder should then pass a callback to the {Finish} method to pass the
276
+ * serialized bytes, after potentially checking their validity against the
277
+ * full received wire bytes.
278
+ */
279
+ void SetHasCompiledModuleBytes();
280
+
281
+ /**
282
+ * Sets a callback which is called whenever a significant number of new
283
+ * functions are ready for serialization.
284
+ */
285
+ void SetMoreFunctionsCanBeSerializedCallback(
286
+ std::function<void(CompiledWasmModule)>);
287
+
288
+ /*
289
+ * Sets the UTF-8 encoded source URL for the {Script} object. This must be
290
+ * called before {Finish}.
291
+ */
292
+ void SetUrl(const char* url, size_t length);
293
+
294
+ private:
295
+ class Impl;
296
+ const std::unique_ptr<Impl> impl_;
297
+ };
298
+
299
+ /**
300
+ * The V8 interface for a WebAssembly memory map descriptor. This is an
301
+ * experimental feature that may change and be removed without further
302
+ * communication.
303
+ */
304
+ class V8_EXPORT WasmMemoryMapDescriptor : public Object {
305
+ public:
306
+ WasmMemoryMapDescriptor() = delete;
307
+
308
+ V8_INLINE static WasmMemoryMapDescriptor* Cast(Value* value) {
309
+ #ifdef V8_ENABLE_CHECKS
310
+ CheckCast(value);
311
+ #endif
312
+ return static_cast<WasmMemoryMapDescriptor*>(value);
313
+ }
314
+
315
+ using WasmFileDescriptor = int32_t;
316
+
317
+ static Local<WasmMemoryMapDescriptor> New(Isolate* isolate,
318
+ WasmFileDescriptor fd);
319
+
320
+ private:
321
+ static void CheckCast(Value* object);
322
+ };
323
+ } // namespace v8
324
+
325
+ #endif // INCLUDE_V8_WASM_H_
@@ -0,0 +1,88 @@
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 <cstring>
9
+
10
+ #include "cppgc/internal/conditional-stack-allocated.h" // NOLINT(build/include_directory)
11
+ #include "v8config.h" // NOLINT(build/include_directory)
12
+
13
+ namespace v8 {
14
+
15
+ class Isolate;
16
+
17
+ namespace api_internal {
18
+ V8_EXPORT void InternalFieldOutOfBounds(int index);
19
+ } // namespace api_internal
20
+
21
+ static constexpr int kInternalFieldsInWeakCallback = 2;
22
+ static constexpr int kEmbedderFieldsInWeakCallback = 2;
23
+
24
+ template <typename T>
25
+ class WeakCallbackInfo
26
+ : public cppgc::internal::ConditionalStackAllocatedBase<T> {
27
+ public:
28
+ using Callback = void (*)(const WeakCallbackInfo<T>& data);
29
+
30
+ WeakCallbackInfo(Isolate* isolate, T* parameter,
31
+ void* embedder_fields[kEmbedderFieldsInWeakCallback],
32
+ Callback* callback)
33
+ : isolate_(isolate), parameter_(parameter), callback_(callback) {
34
+ memcpy(embedder_fields_, embedder_fields,
35
+ sizeof(embedder_fields[0]) * kEmbedderFieldsInWeakCallback);
36
+ }
37
+
38
+ V8_INLINE Isolate* GetIsolate() const { return isolate_; }
39
+ V8_INLINE T* GetParameter() const { return parameter_; }
40
+ V8_INLINE void* GetInternalField(int index) const;
41
+
42
+ /**
43
+ * When a weak callback is first invoked the embedders _must_ Reset() the
44
+ * handle which triggered the callback. The handle itself is unusable for
45
+ * anything else. No other V8 API calls may be called in the first callback.
46
+ * Additional work requires scheduling a second invocation via
47
+ * `SetSecondPassCallback()` which will be called some time after all the
48
+ * initial callbacks are processed.
49
+ *
50
+ * The second pass callback is prohibited from executing JavaScript. Embedders
51
+ * should schedule another callback in case this is required.
52
+ */
53
+ void SetSecondPassCallback(Callback callback) const { *callback_ = callback; }
54
+
55
+ private:
56
+ Isolate* isolate_;
57
+ T* parameter_;
58
+ Callback* callback_;
59
+ void* embedder_fields_[kEmbedderFieldsInWeakCallback];
60
+ };
61
+
62
+ /**
63
+ * Weakness type for weak handles.
64
+ */
65
+ enum class WeakCallbackType {
66
+ /**
67
+ * Passes a user-defined void* parameter back to the callback.
68
+ */
69
+ kParameter,
70
+ /**
71
+ * Passes the first two internal fields of the object back to the callback.
72
+ */
73
+ kInternalFields,
74
+ };
75
+
76
+ template <class T>
77
+ void* WeakCallbackInfo<T>::GetInternalField(int index) const {
78
+ #ifdef V8_ENABLE_CHECKS
79
+ if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
80
+ api_internal::InternalFieldOutOfBounds(index);
81
+ }
82
+ #endif
83
+ return embedder_fields_[index];
84
+ }
85
+
86
+ } // namespace v8
87
+
88
+ #endif // INCLUDE_V8_WEAK_CALLBACK_INFO_H_
@@ -0,0 +1,88 @@
1
+ // Copyright 2012 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_H_
6
+ #define INCLUDE_V8_H_
7
+
8
+ /** \mainpage V8 API Reference Guide
9
+ *
10
+ * V8 is Google's open source JavaScript engine.
11
+ *
12
+ * This set of documents provides reference material generated from the
13
+ * V8 header files in the include/ subdirectory.
14
+ *
15
+ * For other documentation see https://v8.dev/.
16
+ */
17
+
18
+ #include <stddef.h>
19
+ #include <stdint.h>
20
+
21
+ #include <memory>
22
+
23
+ #include "cppgc/common.h"
24
+ #include "v8-array-buffer.h" // NOLINT(build/include_directory)
25
+ #include "v8-container.h" // NOLINT(build/include_directory)
26
+ #include "v8-context.h" // NOLINT(build/include_directory)
27
+ #include "v8-data.h" // NOLINT(build/include_directory)
28
+ #include "v8-date.h" // NOLINT(build/include_directory)
29
+ #include "v8-debug.h" // NOLINT(build/include_directory)
30
+ #include "v8-exception.h" // NOLINT(build/include_directory)
31
+ #include "v8-extension.h" // NOLINT(build/include_directory)
32
+ #include "v8-external.h" // NOLINT(build/include_directory)
33
+ #include "v8-function.h" // NOLINT(build/include_directory)
34
+ #include "v8-initialization.h" // NOLINT(build/include_directory)
35
+ #include "v8-internal.h" // NOLINT(build/include_directory)
36
+ #include "v8-isolate.h" // NOLINT(build/include_directory)
37
+ #include "v8-json.h" // NOLINT(build/include_directory)
38
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
39
+ #include "v8-locker.h" // NOLINT(build/include_directory)
40
+ #include "v8-maybe.h" // NOLINT(build/include_directory)
41
+ #include "v8-memory-span.h" // NOLINT(build/include_directory)
42
+ #include "v8-message.h" // NOLINT(build/include_directory)
43
+ #include "v8-microtask-queue.h" // NOLINT(build/include_directory)
44
+ #include "v8-microtask.h" // NOLINT(build/include_directory)
45
+ #include "v8-object.h" // NOLINT(build/include_directory)
46
+ #include "v8-persistent-handle.h" // NOLINT(build/include_directory)
47
+ #include "v8-primitive-object.h" // NOLINT(build/include_directory)
48
+ #include "v8-primitive.h" // NOLINT(build/include_directory)
49
+ #include "v8-promise.h" // NOLINT(build/include_directory)
50
+ #include "v8-proxy.h" // NOLINT(build/include_directory)
51
+ #include "v8-regexp.h" // NOLINT(build/include_directory)
52
+ #include "v8-script.h" // NOLINT(build/include_directory)
53
+ #include "v8-snapshot.h" // NOLINT(build/include_directory)
54
+ #include "v8-statistics.h" // NOLINT(build/include_directory)
55
+ #include "v8-template.h" // NOLINT(build/include_directory)
56
+ #include "v8-traced-handle.h" // NOLINT(build/include_directory)
57
+ #include "v8-typed-array.h" // NOLINT(build/include_directory)
58
+ #include "v8-unwinder.h" // NOLINT(build/include_directory)
59
+ #include "v8-value-serializer.h" // NOLINT(build/include_directory)
60
+ #include "v8-value.h" // NOLINT(build/include_directory)
61
+ #include "v8-version.h" // NOLINT(build/include_directory)
62
+ #include "v8-wasm.h" // NOLINT(build/include_directory)
63
+ #include "v8config.h" // NOLINT(build/include_directory)
64
+
65
+ // We reserve the V8_* prefix for macros defined in V8 public API and
66
+ // assume there are no name conflicts with the embedder's code.
67
+
68
+ /**
69
+ * The v8 JavaScript engine.
70
+ */
71
+ namespace v8 {
72
+
73
+ class Platform;
74
+
75
+ /**
76
+ * \example shell.cc
77
+ * A simple shell that takes a list of expressions on the
78
+ * command-line and executes them.
79
+ */
80
+
81
+ /**
82
+ * \example process.cc
83
+ */
84
+
85
+
86
+ } // namespace v8
87
+
88
+ #endif // INCLUDE_V8_H_