@kungfu-tech/libnode-win32-x64 22.22.3-kf.0 → 22.22.3-kf.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.
- package/dist/node/include/acorn_version.h +6 -0
- package/dist/node/include/aliased_buffer-inl.h +244 -0
- package/dist/node/include/aliased_buffer.h +206 -0
- package/dist/node/include/aliased_struct-inl.h +54 -0
- package/dist/node/include/aliased_struct.h +63 -0
- package/dist/node/include/amaro_version.h +6 -0
- package/dist/node/include/async_context_frame.h +33 -0
- package/dist/node/include/async_wrap-inl.h +96 -0
- package/dist/node/include/async_wrap.h +243 -0
- package/dist/node/include/base_object-inl.h +335 -0
- package/dist/node/include/base_object.h +342 -0
- package/dist/node/include/base_object_types.h +74 -0
- package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
- package/dist/node/include/blob_serializer_deserializer.h +132 -0
- package/dist/node/include/callback_queue-inl.h +97 -0
- package/dist/node/include/callback_queue.h +79 -0
- package/dist/node/include/cares_wrap.h +447 -0
- package/dist/node/include/cjs_module_lexer_version.h +6 -0
- package/dist/node/include/cleanup_queue-inl.h +36 -0
- package/dist/node/include/cleanup_queue.h +79 -0
- package/dist/node/include/compile_cache.h +104 -0
- package/dist/node/include/connect_wrap.h +26 -0
- package/dist/node/include/connection_wrap.h +30 -0
- package/dist/node/include/cppgc/allocation.h +310 -0
- package/dist/node/include/cppgc/common.h +28 -0
- package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
- package/dist/node/include/cppgc/custom-space.h +97 -0
- package/dist/node/include/cppgc/default-platform.h +67 -0
- package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
- package/dist/node/include/cppgc/explicit-management.h +100 -0
- package/dist/node/include/cppgc/garbage-collected.h +106 -0
- package/dist/node/include/cppgc/heap-consistency.h +309 -0
- package/dist/node/include/cppgc/heap-handle.h +48 -0
- package/dist/node/include/cppgc/heap-state.h +82 -0
- package/dist/node/include/cppgc/heap-statistics.h +120 -0
- package/dist/node/include/cppgc/heap.h +202 -0
- package/dist/node/include/cppgc/internal/api-constants.h +87 -0
- package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
- package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
- package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
- package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
- package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
- package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
- package/dist/node/include/cppgc/internal/gc-info.h +148 -0
- package/dist/node/include/cppgc/internal/logging.h +50 -0
- package/dist/node/include/cppgc/internal/member-storage.h +256 -0
- package/dist/node/include/cppgc/internal/name-trait.h +137 -0
- package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
- package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
- package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
- package/dist/node/include/cppgc/liveness-broker.h +78 -0
- package/dist/node/include/cppgc/macros.h +35 -0
- package/dist/node/include/cppgc/member.h +629 -0
- package/dist/node/include/cppgc/name-provider.h +65 -0
- package/dist/node/include/cppgc/object-size-trait.h +58 -0
- package/dist/node/include/cppgc/persistent.h +377 -0
- package/dist/node/include/cppgc/platform.h +163 -0
- package/dist/node/include/cppgc/prefinalizer.h +75 -0
- package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
- package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
- package/dist/node/include/cppgc/source-location.h +16 -0
- package/dist/node/include/cppgc/testing.h +106 -0
- package/dist/node/include/cppgc/trace-trait.h +128 -0
- package/dist/node/include/cppgc/type-traits.h +271 -0
- package/dist/node/include/cppgc/visitor.h +504 -0
- package/dist/node/include/crypto/crypto_aes.h +88 -0
- package/dist/node/include/crypto/crypto_bio.h +193 -0
- package/dist/node/include/crypto/crypto_cipher.h +293 -0
- package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
- package/dist/node/include/crypto/crypto_clienthello.h +131 -0
- package/dist/node/include/crypto/crypto_common.h +64 -0
- package/dist/node/include/crypto/crypto_context.h +171 -0
- package/dist/node/include/crypto/crypto_dh.h +126 -0
- package/dist/node/include/crypto/crypto_dsa.h +52 -0
- package/dist/node/include/crypto/crypto_ec.h +164 -0
- package/dist/node/include/crypto/crypto_hash.h +91 -0
- package/dist/node/include/crypto/crypto_hkdf.h +61 -0
- package/dist/node/include/crypto/crypto_hmac.h +92 -0
- package/dist/node/include/crypto/crypto_keygen.h +299 -0
- package/dist/node/include/crypto/crypto_keys.h +392 -0
- package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
- package/dist/node/include/crypto/crypto_random.h +124 -0
- package/dist/node/include/crypto/crypto_rsa.h +136 -0
- package/dist/node/include/crypto/crypto_scrypt.h +85 -0
- package/dist/node/include/crypto/crypto_sig.h +165 -0
- package/dist/node/include/crypto/crypto_spkac.h +21 -0
- package/dist/node/include/crypto/crypto_timing.h +20 -0
- package/dist/node/include/crypto/crypto_tls.h +305 -0
- package/dist/node/include/crypto/crypto_util.h +725 -0
- package/dist/node/include/crypto/crypto_x509.h +140 -0
- package/dist/node/include/dataqueue/queue.h +306 -0
- package/dist/node/include/debug_utils-inl.h +278 -0
- package/dist/node/include/debug_utils.h +196 -0
- package/dist/node/include/diagnosticfilename-inl.h +33 -0
- package/dist/node/include/embedded_data.h +17 -0
- package/dist/node/include/encoding_binding.h +61 -0
- package/dist/node/include/env-inl.h +984 -0
- package/dist/node/include/env.h +1287 -0
- package/dist/node/include/env_properties.h +540 -0
- package/dist/node/include/handle_wrap.h +123 -0
- package/dist/node/include/histogram-inl.h +107 -0
- package/dist/node/include/histogram.h +279 -0
- package/dist/node/include/inspector/io_agent.h +30 -0
- package/dist/node/include/inspector/main_thread_interface.h +116 -0
- package/dist/node/include/inspector/network_agent.h +94 -0
- package/dist/node/include/inspector/network_inspector.h +45 -0
- package/dist/node/include/inspector/network_requests_buffer.h +195 -0
- package/dist/node/include/inspector/network_resource_manager.h +29 -0
- package/dist/node/include/inspector/node_json.h +24 -0
- package/dist/node/include/inspector/node_string.h +101 -0
- package/dist/node/include/inspector/protocol_helper.h +27 -0
- package/dist/node/include/inspector/runtime_agent.h +41 -0
- package/dist/node/include/inspector/target_agent.h +75 -0
- package/dist/node/include/inspector/tracing_agent.h +43 -0
- package/dist/node/include/inspector/worker_agent.h +40 -0
- package/dist/node/include/inspector/worker_inspector.h +124 -0
- package/dist/node/include/inspector_agent.h +165 -0
- package/dist/node/include/inspector_io.h +78 -0
- package/dist/node/include/inspector_profiler.h +149 -0
- package/dist/node/include/inspector_socket.h +60 -0
- package/dist/node/include/inspector_socket_server.h +110 -0
- package/dist/node/include/js_native_api.h +607 -0
- package/dist/node/include/js_native_api_types.h +226 -0
- package/dist/node/include/js_native_api_v8.h +485 -0
- package/dist/node/include/js_native_api_v8_internals.h +45 -0
- package/dist/node/include/js_stream.h +52 -0
- package/dist/node/include/json_utils.h +172 -0
- package/dist/node/include/large_pages/node_large_page.h +34 -0
- package/dist/node/include/libplatform/libplatform-export.h +29 -0
- package/dist/node/include/libplatform/libplatform.h +112 -0
- package/dist/node/include/libplatform/v8-tracing.h +333 -0
- package/dist/node/include/memory_tracker-inl.h +359 -0
- package/dist/node/include/memory_tracker.h +289 -0
- package/dist/node/include/module_wrap.h +216 -0
- package/dist/node/include/node.h +1593 -0
- package/dist/node/include/node_api.h +265 -0
- package/dist/node/include/node_api_internals.h +48 -0
- package/dist/node/include/node_api_types.h +56 -0
- package/dist/node/include/node_binding.h +161 -0
- package/dist/node/include/node_blob.h +159 -0
- package/dist/node/include/node_bob-inl.h +36 -0
- package/dist/node/include/node_bob.h +107 -0
- package/dist/node/include/node_buffer.h +92 -0
- package/dist/node/include/node_builtins.h +220 -0
- package/dist/node/include/node_config_file.h +46 -0
- package/dist/node/include/node_constants.h +82 -0
- package/dist/node/include/node_context_data.h +168 -0
- package/dist/node/include/node_contextify.h +204 -0
- package/dist/node/include/node_crypto.h +56 -0
- package/dist/node/include/node_debug.h +30 -0
- package/dist/node/include/node_dir.h +52 -0
- package/dist/node/include/node_dotenv.h +45 -0
- package/dist/node/include/node_errors.h +380 -0
- package/dist/node/include/node_exit_code.h +54 -0
- package/dist/node/include/node_external_reference.h +165 -0
- package/dist/node/include/node_file-inl.h +406 -0
- package/dist/node/include/node_file.h +537 -0
- package/dist/node/include/node_http2.h +1177 -0
- package/dist/node/include/node_http2_state.h +159 -0
- package/dist/node/include/node_http_common-inl.h +202 -0
- package/dist/node/include/node_http_common.h +535 -0
- package/dist/node/include/node_i18n.h +132 -0
- package/dist/node/include/node_internals.h +483 -0
- package/dist/node/include/node_main_instance.h +67 -0
- package/dist/node/include/node_mem-inl.h +113 -0
- package/dist/node/include/node_mem.h +45 -0
- package/dist/node/include/node_messaging.h +389 -0
- package/dist/node/include/node_metadata.h +164 -0
- package/dist/node/include/node_modules.h +91 -0
- package/dist/node/include/node_mutex.h +323 -0
- package/dist/node/include/node_object_wrap.h +132 -0
- package/dist/node/include/node_options-inl.h +490 -0
- package/dist/node/include/node_options.h +615 -0
- package/dist/node/include/node_perf.h +166 -0
- package/dist/node/include/node_perf_common.h +102 -0
- package/dist/node/include/node_platform.h +238 -0
- package/dist/node/include/node_process-inl.h +26 -0
- package/dist/node/include/node_process.h +112 -0
- package/dist/node/include/node_realm-inl.h +151 -0
- package/dist/node/include/node_realm.h +183 -0
- package/dist/node/include/node_report.h +43 -0
- package/dist/node/include/node_revert.h +82 -0
- package/dist/node/include/node_root_certs.h +3520 -0
- package/dist/node/include/node_sea.h +74 -0
- package/dist/node/include/node_shadow_realm.h +46 -0
- package/dist/node/include/node_snapshot_builder.h +57 -0
- package/dist/node/include/node_snapshotable.h +174 -0
- package/dist/node/include/node_sockaddr-inl.h +257 -0
- package/dist/node/include/node_sockaddr.h +394 -0
- package/dist/node/include/node_sqlite.h +270 -0
- package/dist/node/include/node_stat_watcher.h +73 -0
- package/dist/node/include/node_task_runner.h +92 -0
- package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
- package/dist/node/include/node_threadsafe_cow.h +105 -0
- package/dist/node/include/node_union_bytes.h +81 -0
- package/dist/node/include/node_url.h +96 -0
- package/dist/node/include/node_v8.h +77 -0
- package/dist/node/include/node_v8_platform-inl.h +185 -0
- package/dist/node/include/node_version.h +110 -0
- package/dist/node/include/node_wasi.h +184 -0
- package/dist/node/include/node_wasm_web_api.h +55 -0
- package/dist/node/include/node_watchdog.h +154 -0
- package/dist/node/include/node_webstorage.h +60 -0
- package/dist/node/include/node_worker.h +158 -0
- package/dist/node/include/path.h +33 -0
- package/dist/node/include/permission/addon_permission.h +31 -0
- package/dist/node/include/permission/child_process_permission.h +31 -0
- package/dist/node/include/permission/fs_permission.h +167 -0
- package/dist/node/include/permission/inspector_permission.h +31 -0
- package/dist/node/include/permission/permission.h +138 -0
- package/dist/node/include/permission/permission_base.h +65 -0
- package/dist/node/include/permission/wasi_permission.h +31 -0
- package/dist/node/include/permission/worker_permission.h +31 -0
- package/dist/node/include/pipe_wrap.h +80 -0
- package/dist/node/include/quic/application.h +159 -0
- package/dist/node/include/quic/bindingdata.h +272 -0
- package/dist/node/include/quic/cid.h +127 -0
- package/dist/node/include/quic/data.h +148 -0
- package/dist/node/include/quic/defs.h +245 -0
- package/dist/node/include/quic/endpoint.h +458 -0
- package/dist/node/include/quic/http3.h +15 -0
- package/dist/node/include/quic/logstream.h +81 -0
- package/dist/node/include/quic/packet.h +152 -0
- package/dist/node/include/quic/preferredaddress.h +72 -0
- package/dist/node/include/quic/session.h +443 -0
- package/dist/node/include/quic/sessionticket.h +108 -0
- package/dist/node/include/quic/streams.h +232 -0
- package/dist/node/include/quic/tlscontext.h +227 -0
- package/dist/node/include/quic/tokens.h +256 -0
- package/dist/node/include/quic/transportparams.h +165 -0
- package/dist/node/include/req_wrap-inl.h +171 -0
- package/dist/node/include/req_wrap.h +77 -0
- package/dist/node/include/spawn_sync.h +243 -0
- package/dist/node/include/stream_base-inl.h +173 -0
- package/dist/node/include/stream_base.h +478 -0
- package/dist/node/include/stream_pipe.h +76 -0
- package/dist/node/include/stream_wrap.h +132 -0
- package/dist/node/include/string_bytes.h +113 -0
- package/dist/node/include/string_decoder-inl.h +31 -0
- package/dist/node/include/string_decoder.h +49 -0
- package/dist/node/include/tcp_wrap.h +105 -0
- package/dist/node/include/threadpoolwork-inl.h +70 -0
- package/dist/node/include/timer_wrap-inl.h +32 -0
- package/dist/node/include/timer_wrap.h +85 -0
- package/dist/node/include/timers.h +70 -0
- package/dist/node/include/tracing/agent.h +195 -0
- package/dist/node/include/tracing/node_trace_buffer.h +83 -0
- package/dist/node/include/tracing/node_trace_writer.h +75 -0
- package/dist/node/include/tracing/trace_event.h +722 -0
- package/dist/node/include/tracing/trace_event_common.h +1109 -0
- package/dist/node/include/tracing/traced_value.h +129 -0
- package/dist/node/include/tty_wrap.h +65 -0
- package/dist/node/include/udp_wrap.h +230 -0
- package/dist/node/include/undici_version.h +6 -0
- package/dist/node/include/util-inl.h +700 -0
- package/dist/node/include/util.h +1021 -0
- package/dist/node/include/uv/aix.h +32 -0
- package/dist/node/include/uv/bsd.h +34 -0
- package/dist/node/include/uv/darwin.h +61 -0
- package/dist/node/include/uv/errno.h +483 -0
- package/dist/node/include/uv/linux.h +34 -0
- package/dist/node/include/uv/os390.h +33 -0
- package/dist/node/include/uv/posix.h +31 -0
- package/dist/node/include/uv/sunos.h +44 -0
- package/dist/node/include/uv/threadpool.h +37 -0
- package/dist/node/include/uv/tree.h +521 -0
- package/dist/node/include/uv/unix.h +512 -0
- package/dist/node/include/uv/version.h +43 -0
- package/dist/node/include/uv/win.h +698 -0
- package/dist/node/include/uv.h +1990 -0
- package/dist/node/include/v8-array-buffer.h +525 -0
- package/dist/node/include/v8-callbacks.h +462 -0
- package/dist/node/include/v8-container.h +183 -0
- package/dist/node/include/v8-context.h +485 -0
- package/dist/node/include/v8-cppgc.h +245 -0
- package/dist/node/include/v8-data.h +80 -0
- package/dist/node/include/v8-date.h +48 -0
- package/dist/node/include/v8-debug.h +168 -0
- package/dist/node/include/v8-embedder-heap.h +82 -0
- package/dist/node/include/v8-embedder-state-scope.h +52 -0
- package/dist/node/include/v8-exception.h +223 -0
- package/dist/node/include/v8-extension.h +62 -0
- package/dist/node/include/v8-external.h +37 -0
- package/dist/node/include/v8-fast-api-calls.h +984 -0
- package/dist/node/include/v8-forward.h +82 -0
- package/dist/node/include/v8-function-callback.h +607 -0
- package/dist/node/include/v8-function.h +140 -0
- package/dist/node/include/v8-handle-base.h +137 -0
- package/dist/node/include/v8-initialization.h +289 -0
- package/dist/node/include/v8-inspector-protocol.h +13 -0
- package/dist/node/include/v8-inspector.h +419 -0
- package/dist/node/include/v8-internal.h +1397 -0
- package/dist/node/include/v8-isolate.h +1767 -0
- package/dist/node/include/v8-json.h +47 -0
- package/dist/node/include/v8-local-handle.h +758 -0
- package/dist/node/include/v8-locker.h +138 -0
- package/dist/node/include/v8-maybe.h +160 -0
- package/dist/node/include/v8-memory-span.h +198 -0
- package/dist/node/include/v8-message.h +233 -0
- package/dist/node/include/v8-metrics.h +264 -0
- package/dist/node/include/v8-microtask-queue.h +157 -0
- package/dist/node/include/v8-microtask.h +28 -0
- package/dist/node/include/v8-object.h +824 -0
- package/dist/node/include/v8-persistent-handle.h +582 -0
- package/dist/node/include/v8-platform.h +1358 -0
- package/dist/node/include/v8-primitive-object.h +118 -0
- package/dist/node/include/v8-primitive.h +877 -0
- package/dist/node/include/v8-profiler.h +1302 -0
- package/dist/node/include/v8-promise.h +174 -0
- package/dist/node/include/v8-proxy.h +50 -0
- package/dist/node/include/v8-regexp.h +106 -0
- package/dist/node/include/v8-script.h +904 -0
- package/dist/node/include/v8-snapshot.h +266 -0
- package/dist/node/include/v8-source-location.h +92 -0
- package/dist/node/include/v8-statistics.h +238 -0
- package/dist/node/include/v8-template.h +1297 -0
- package/dist/node/include/v8-traced-handle.h +432 -0
- package/dist/node/include/v8-typed-array.h +390 -0
- package/dist/node/include/v8-unwinder-state.h +31 -0
- package/dist/node/include/v8-unwinder.h +132 -0
- package/dist/node/include/v8-util.h +665 -0
- package/dist/node/include/v8-value-serializer-version.h +24 -0
- package/dist/node/include/v8-value-serializer.h +316 -0
- package/dist/node/include/v8-value.h +655 -0
- package/dist/node/include/v8-version-string.h +38 -0
- package/dist/node/include/v8-version.h +20 -0
- package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
- package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
- package/dist/node/include/v8-wasm.h +201 -0
- package/dist/node/include/v8-weak-callback-info.h +80 -0
- package/dist/node/include/v8.h +88 -0
- package/dist/node/include/v8config.h +981 -0
- package/dist/node/include/zlib_version.h +6 -0
- package/dist/node/libnode.dll +0 -0
- package/dist/node/libnode.lib +0 -0
- package/dist/node/libnodebuildinfo.json +10 -0
- package/dist/node/link_node.lib +0 -0
- package/dist/node/link_node.node +0 -0
- package/libnode.release.json +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#ifndef SRC_NODE_V8_PLATFORM_INL_H_
|
|
2
|
+
#define SRC_NODE_V8_PLATFORM_INL_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <string_view>
|
|
8
|
+
|
|
9
|
+
#include "env-inl.h"
|
|
10
|
+
#include "node.h"
|
|
11
|
+
#include "node_metadata.h"
|
|
12
|
+
#include "node_platform.h"
|
|
13
|
+
#include "node_options.h"
|
|
14
|
+
#include "tracing/node_trace_writer.h"
|
|
15
|
+
#include "tracing/trace_event.h"
|
|
16
|
+
#include "tracing/traced_value.h"
|
|
17
|
+
#include "util.h"
|
|
18
|
+
|
|
19
|
+
namespace node {
|
|
20
|
+
|
|
21
|
+
// Ensures that __metadata trace events are only emitted
|
|
22
|
+
// when tracing is enabled.
|
|
23
|
+
class NodeTraceStateObserver
|
|
24
|
+
: public v8::TracingController::TraceStateObserver {
|
|
25
|
+
public:
|
|
26
|
+
inline void OnTraceEnabled() override {
|
|
27
|
+
std::string title = GetProcessTitle("");
|
|
28
|
+
if (!title.empty()) {
|
|
29
|
+
// Only emit the metadata event if the title can be retrieved
|
|
30
|
+
// successfully. Ignore it otherwise.
|
|
31
|
+
TRACE_EVENT_METADATA1(
|
|
32
|
+
"__metadata", "process_name", "name", TRACE_STR_COPY(title.c_str()));
|
|
33
|
+
}
|
|
34
|
+
TRACE_EVENT_METADATA1("__metadata",
|
|
35
|
+
"version",
|
|
36
|
+
"node",
|
|
37
|
+
per_process::metadata.versions.node.c_str());
|
|
38
|
+
TRACE_EVENT_METADATA1(
|
|
39
|
+
"__metadata", "thread_name", "name", "JavaScriptMainThread");
|
|
40
|
+
|
|
41
|
+
tracing::ProcessMeta trace_process;
|
|
42
|
+
TRACE_EVENT_METADATA1("__metadata",
|
|
43
|
+
"node",
|
|
44
|
+
"process",
|
|
45
|
+
tracing::CastTracedValue(trace_process));
|
|
46
|
+
// This only runs the first time tracing is enabled
|
|
47
|
+
controller_->RemoveTraceStateObserver(this);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
inline void OnTraceDisabled() override {
|
|
51
|
+
// Do nothing here. This should never be called because the
|
|
52
|
+
// observer removes itself when OnTraceEnabled() is called.
|
|
53
|
+
UNREACHABLE();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
explicit NodeTraceStateObserver(v8::TracingController* controller)
|
|
57
|
+
: controller_(controller) {}
|
|
58
|
+
~NodeTraceStateObserver() override = default;
|
|
59
|
+
|
|
60
|
+
private:
|
|
61
|
+
v8::TracingController* controller_;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
struct V8Platform {
|
|
65
|
+
bool initialized_ = false;
|
|
66
|
+
|
|
67
|
+
#if NODE_USE_V8_PLATFORM
|
|
68
|
+
inline void Initialize(int thread_pool_size) {
|
|
69
|
+
CHECK(!initialized_);
|
|
70
|
+
initialized_ = true;
|
|
71
|
+
tracing_agent_ = std::make_unique<tracing::Agent>();
|
|
72
|
+
node::tracing::TraceEventHelper::SetAgent(tracing_agent_.get());
|
|
73
|
+
node::tracing::TracingController* controller =
|
|
74
|
+
tracing_agent_->GetTracingController();
|
|
75
|
+
trace_state_observer_ =
|
|
76
|
+
std::make_unique<NodeTraceStateObserver>(controller);
|
|
77
|
+
controller->AddTraceStateObserver(trace_state_observer_.get());
|
|
78
|
+
tracing_file_writer_ = tracing_agent_->DefaultHandle();
|
|
79
|
+
// Only start the tracing agent if we enabled any tracing categories.
|
|
80
|
+
if (!per_process::cli_options->trace_event_categories.empty()) {
|
|
81
|
+
StartTracingAgent();
|
|
82
|
+
}
|
|
83
|
+
// Tracing must be initialized before platform threads are created.
|
|
84
|
+
platform_ = new NodePlatform(thread_pool_size, controller);
|
|
85
|
+
v8::V8::InitializePlatform(platform_);
|
|
86
|
+
}
|
|
87
|
+
// Make sure V8Platform don not call into Libuv threadpool,
|
|
88
|
+
// see DefaultProcessExitHandlerInternal in environment.cc
|
|
89
|
+
inline void Dispose() {
|
|
90
|
+
if (!initialized_)
|
|
91
|
+
return;
|
|
92
|
+
initialized_ = false;
|
|
93
|
+
node::tracing::TraceEventHelper::SetAgent(nullptr);
|
|
94
|
+
StopTracingAgent();
|
|
95
|
+
platform_->Shutdown();
|
|
96
|
+
delete platform_;
|
|
97
|
+
platform_ = nullptr;
|
|
98
|
+
// Destroy tracing after the platform (and platform threads) have been
|
|
99
|
+
// stopped.
|
|
100
|
+
tracing_agent_.reset(nullptr);
|
|
101
|
+
// The observer remove itself in OnTraceEnabled
|
|
102
|
+
trace_state_observer_.reset(nullptr);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
inline void DrainVMTasks(v8::Isolate* isolate) {
|
|
106
|
+
platform_->DrainTasks(isolate);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
inline void StartTracingAgent() {
|
|
110
|
+
constexpr auto convert_to_set =
|
|
111
|
+
[](std::vector<std::string_view> categories) -> std::set<std::string> {
|
|
112
|
+
std::set<std::string> out;
|
|
113
|
+
for (const auto& s : categories) {
|
|
114
|
+
out.emplace(s);
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
};
|
|
118
|
+
// Attach a new NodeTraceWriter only if this function hasn't been called
|
|
119
|
+
// before.
|
|
120
|
+
if (tracing_file_writer_.IsDefaultHandle()) {
|
|
121
|
+
using std::string_view_literals::operator""sv;
|
|
122
|
+
const std::vector<std::string_view> categories =
|
|
123
|
+
SplitString(per_process::cli_options->trace_event_categories, ","sv);
|
|
124
|
+
|
|
125
|
+
tracing_file_writer_ = tracing_agent_->AddClient(
|
|
126
|
+
convert_to_set(categories),
|
|
127
|
+
std::unique_ptr<tracing::AsyncTraceWriter>(
|
|
128
|
+
new tracing::NodeTraceWriter(
|
|
129
|
+
per_process::cli_options->trace_event_file_pattern)),
|
|
130
|
+
tracing::Agent::kUseDefaultCategories);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
inline void StopTracingAgent() { tracing_file_writer_.reset(); }
|
|
135
|
+
|
|
136
|
+
inline tracing::AgentWriterHandle* GetTracingAgentWriter() {
|
|
137
|
+
return &tracing_file_writer_;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
inline NodePlatform* Platform() { return platform_; }
|
|
141
|
+
|
|
142
|
+
std::unique_ptr<NodeTraceStateObserver> trace_state_observer_;
|
|
143
|
+
std::unique_ptr<tracing::Agent> tracing_agent_;
|
|
144
|
+
tracing::AgentWriterHandle tracing_file_writer_;
|
|
145
|
+
NodePlatform* platform_;
|
|
146
|
+
#else // !NODE_USE_V8_PLATFORM
|
|
147
|
+
inline void Initialize(int thread_pool_size) {}
|
|
148
|
+
inline void Dispose() {}
|
|
149
|
+
inline void DrainVMTasks(v8::Isolate* isolate) {}
|
|
150
|
+
inline void StartTracingAgent() {
|
|
151
|
+
if (!per_process::cli_options->trace_event_categories.empty()) {
|
|
152
|
+
fprintf(stderr,
|
|
153
|
+
"Node compiled with NODE_USE_V8_PLATFORM=0, "
|
|
154
|
+
"so event tracing is not available.\n");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
inline void StopTracingAgent() {}
|
|
158
|
+
|
|
159
|
+
inline tracing::AgentWriterHandle* GetTracingAgentWriter() { return nullptr; }
|
|
160
|
+
|
|
161
|
+
inline NodePlatform* Platform() { return nullptr; }
|
|
162
|
+
#endif // !NODE_USE_V8_PLATFORM
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
namespace per_process {
|
|
166
|
+
extern struct V8Platform v8_platform;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
inline void StartTracingAgent() {
|
|
170
|
+
return per_process::v8_platform.StartTracingAgent();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
inline tracing::AgentWriterHandle* GetTracingAgentWriter() {
|
|
174
|
+
return per_process::v8_platform.GetTracingAgentWriter();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
inline void DisposePlatform() {
|
|
178
|
+
per_process::v8_platform.Dispose();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
} // namespace node
|
|
182
|
+
|
|
183
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
184
|
+
|
|
185
|
+
#endif // SRC_NODE_V8_PLATFORM_INL_H_
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
#ifndef SRC_NODE_VERSION_H_
|
|
23
|
+
#define SRC_NODE_VERSION_H_
|
|
24
|
+
|
|
25
|
+
#define NODE_MAJOR_VERSION 22
|
|
26
|
+
#define NODE_MINOR_VERSION 22
|
|
27
|
+
#define NODE_PATCH_VERSION 3
|
|
28
|
+
|
|
29
|
+
#define NODE_VERSION_IS_LTS 1
|
|
30
|
+
#define NODE_VERSION_LTS_CODENAME "Jod"
|
|
31
|
+
|
|
32
|
+
#define NODE_VERSION_IS_RELEASE 1
|
|
33
|
+
|
|
34
|
+
#ifndef NODE_STRINGIFY
|
|
35
|
+
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
|
|
36
|
+
#define NODE_STRINGIFY_HELPER(n) #n
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#ifndef NODE_RELEASE
|
|
40
|
+
#define NODE_RELEASE "node"
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#ifndef NODE_TAG
|
|
44
|
+
# if NODE_VERSION_IS_RELEASE
|
|
45
|
+
# define NODE_TAG ""
|
|
46
|
+
# else
|
|
47
|
+
# define NODE_TAG "-pre"
|
|
48
|
+
# endif
|
|
49
|
+
#else
|
|
50
|
+
// NODE_TAG is passed without quotes when rc.exe is run from msbuild
|
|
51
|
+
# define NODE_EXE_VERSION NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
|
|
52
|
+
NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
|
|
53
|
+
NODE_STRINGIFY(NODE_PATCH_VERSION) \
|
|
54
|
+
NODE_STRINGIFY(NODE_TAG)
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
# define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
|
|
58
|
+
NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
|
|
59
|
+
NODE_STRINGIFY(NODE_PATCH_VERSION) \
|
|
60
|
+
NODE_TAG
|
|
61
|
+
#ifndef NODE_EXE_VERSION
|
|
62
|
+
# define NODE_EXE_VERSION NODE_VERSION_STRING
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
#define NODE_VERSION "v" NODE_VERSION_STRING
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
#define NODE_VERSION_AT_LEAST(major, minor, patch) \
|
|
69
|
+
(( (major) < NODE_MAJOR_VERSION) \
|
|
70
|
+
|| ((major) == NODE_MAJOR_VERSION && (minor) < NODE_MINOR_VERSION) \
|
|
71
|
+
|| ((major) == NODE_MAJOR_VERSION && \
|
|
72
|
+
(minor) == NODE_MINOR_VERSION && (patch) <= NODE_PATCH_VERSION))
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Node.js will refuse to load modules that weren't compiled against its own
|
|
76
|
+
* module ABI number, exposed as the process.versions.modules property.
|
|
77
|
+
*
|
|
78
|
+
* Node.js will refuse to load modules with a non-matching ABI version. The
|
|
79
|
+
* version number here should be changed whenever an ABI-incompatible API change
|
|
80
|
+
* is made in the C++ side, including in V8 or other dependencies.
|
|
81
|
+
*
|
|
82
|
+
* Node.js will not change the module version during a Major release line
|
|
83
|
+
* We will, at times update the version of V8 shipped in the release line
|
|
84
|
+
* if it can be made ABI compatible with the previous version.
|
|
85
|
+
*
|
|
86
|
+
* Embedders building Node.js can define NODE_EMBEDDER_MODULE_VERSION to
|
|
87
|
+
* override the default value of NODE_MODULE_VERSION.
|
|
88
|
+
*
|
|
89
|
+
* The registry of used NODE_MODULE_VERSION numbers is located at
|
|
90
|
+
* https://github.com/nodejs/node/blob/HEAD/doc/abi_version_registry.json
|
|
91
|
+
* Extenders, embedders and other consumers of Node.js that require ABI
|
|
92
|
+
* version matching should open a pull request to reserve a number in this
|
|
93
|
+
* registry.
|
|
94
|
+
*/
|
|
95
|
+
#if defined(NODE_EMBEDDER_MODULE_VERSION)
|
|
96
|
+
#define NODE_MODULE_VERSION NODE_EMBEDDER_MODULE_VERSION
|
|
97
|
+
#else
|
|
98
|
+
#define NODE_MODULE_VERSION 127
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
// The NAPI_VERSION supported by the runtime. This is the inclusive range of
|
|
102
|
+
// versions which the Node.js binary being built supports.
|
|
103
|
+
#define NODE_API_SUPPORTED_VERSION_MAX 10
|
|
104
|
+
#define NODE_API_SUPPORTED_VERSION_MIN 1
|
|
105
|
+
|
|
106
|
+
// Node API modules use NAPI_VERSION 8 by default if it is not explicitly
|
|
107
|
+
// specified. It must be always 8.
|
|
108
|
+
#define NODE_API_DEFAULT_MODULE_API_VERSION 8
|
|
109
|
+
|
|
110
|
+
#endif // SRC_NODE_VERSION_H_
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#ifndef SRC_NODE_WASI_H_
|
|
2
|
+
#define SRC_NODE_WASI_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "base_object.h"
|
|
7
|
+
#include "node_mem.h"
|
|
8
|
+
#include "uvwasi.h"
|
|
9
|
+
#include "v8-fast-api-calls.h"
|
|
10
|
+
|
|
11
|
+
namespace node {
|
|
12
|
+
namespace wasi {
|
|
13
|
+
|
|
14
|
+
struct WasmMemory {
|
|
15
|
+
char* data;
|
|
16
|
+
size_t size;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class WASI : public BaseObject,
|
|
20
|
+
public mem::NgLibMemoryManager<WASI, uvwasi_mem_t> {
|
|
21
|
+
public:
|
|
22
|
+
WASI(Environment* env,
|
|
23
|
+
v8::Local<v8::Object> object,
|
|
24
|
+
uvwasi_options_t* options);
|
|
25
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
26
|
+
|
|
27
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
28
|
+
SET_MEMORY_INFO_NAME(WASI)
|
|
29
|
+
SET_SELF_SIZE(WASI)
|
|
30
|
+
|
|
31
|
+
static uint32_t ArgsGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
32
|
+
static uint32_t ArgsSizesGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
33
|
+
static uint32_t ClockResGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
34
|
+
static uint32_t ClockTimeGet(WASI&, WasmMemory, uint32_t, uint64_t, uint32_t);
|
|
35
|
+
static uint32_t EnvironGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
36
|
+
static uint32_t EnvironSizesGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
37
|
+
static uint32_t FdAdvise(
|
|
38
|
+
WASI&, WasmMemory, uint32_t, uint64_t, uint64_t, uint32_t);
|
|
39
|
+
static uint32_t FdAllocate(WASI&, WasmMemory, uint32_t, uint64_t, uint64_t);
|
|
40
|
+
static uint32_t FdClose(WASI&, WasmMemory, uint32_t);
|
|
41
|
+
static uint32_t FdDatasync(WASI&, WasmMemory, uint32_t);
|
|
42
|
+
static uint32_t FdFdstatGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
43
|
+
static uint32_t FdFdstatSetFlags(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
44
|
+
static uint32_t FdFdstatSetRights(
|
|
45
|
+
WASI&, WasmMemory, uint32_t, uint64_t, uint64_t);
|
|
46
|
+
static uint32_t FdFilestatGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
47
|
+
static uint32_t FdFilestatSetSize(WASI&, WasmMemory, uint32_t, uint64_t);
|
|
48
|
+
static uint32_t FdFilestatSetTimes(
|
|
49
|
+
WASI&, WasmMemory, uint32_t, uint64_t, uint64_t, uint32_t);
|
|
50
|
+
static uint32_t FdPread(WASI&,
|
|
51
|
+
WasmMemory memory,
|
|
52
|
+
uint32_t,
|
|
53
|
+
uint32_t,
|
|
54
|
+
uint32_t,
|
|
55
|
+
uint64_t,
|
|
56
|
+
uint32_t);
|
|
57
|
+
static uint32_t FdPrestatGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
58
|
+
static uint32_t FdPrestatDirName(
|
|
59
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t);
|
|
60
|
+
static uint32_t FdPwrite(
|
|
61
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint64_t, uint32_t);
|
|
62
|
+
static uint32_t FdRead(
|
|
63
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t);
|
|
64
|
+
static uint32_t FdReaddir(
|
|
65
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint64_t, uint32_t);
|
|
66
|
+
static uint32_t FdRenumber(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
67
|
+
static uint32_t FdSeek(
|
|
68
|
+
WASI&, WasmMemory, uint32_t, int64_t, uint32_t, uint32_t);
|
|
69
|
+
static uint32_t FdSync(WASI&, WasmMemory, uint32_t);
|
|
70
|
+
static uint32_t FdTell(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
71
|
+
static uint32_t FdWrite(
|
|
72
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t);
|
|
73
|
+
static uint32_t PathCreateDirectory(
|
|
74
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t);
|
|
75
|
+
static uint32_t PathFilestatGet(
|
|
76
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
|
77
|
+
static uint32_t PathFilestatSetTimes(WASI&,
|
|
78
|
+
WasmMemory,
|
|
79
|
+
uint32_t,
|
|
80
|
+
uint32_t,
|
|
81
|
+
uint32_t,
|
|
82
|
+
uint32_t,
|
|
83
|
+
uint64_t,
|
|
84
|
+
uint64_t,
|
|
85
|
+
uint32_t);
|
|
86
|
+
static uint32_t PathLink(WASI&,
|
|
87
|
+
WasmMemory,
|
|
88
|
+
uint32_t,
|
|
89
|
+
uint32_t,
|
|
90
|
+
uint32_t,
|
|
91
|
+
uint32_t,
|
|
92
|
+
uint32_t,
|
|
93
|
+
uint32_t,
|
|
94
|
+
uint32_t);
|
|
95
|
+
static uint32_t PathOpen(WASI&,
|
|
96
|
+
WasmMemory,
|
|
97
|
+
uint32_t,
|
|
98
|
+
uint32_t,
|
|
99
|
+
uint32_t,
|
|
100
|
+
uint32_t,
|
|
101
|
+
uint32_t,
|
|
102
|
+
uint64_t,
|
|
103
|
+
uint64_t,
|
|
104
|
+
uint32_t,
|
|
105
|
+
uint32_t);
|
|
106
|
+
static uint32_t PathReadlink(WASI&,
|
|
107
|
+
WasmMemory,
|
|
108
|
+
uint32_t,
|
|
109
|
+
uint32_t,
|
|
110
|
+
uint32_t,
|
|
111
|
+
uint32_t,
|
|
112
|
+
uint32_t,
|
|
113
|
+
uint32_t);
|
|
114
|
+
static uint32_t PathRemoveDirectory(
|
|
115
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t);
|
|
116
|
+
static uint32_t PathRename(WASI&,
|
|
117
|
+
WasmMemory,
|
|
118
|
+
uint32_t,
|
|
119
|
+
uint32_t,
|
|
120
|
+
uint32_t,
|
|
121
|
+
uint32_t,
|
|
122
|
+
uint32_t,
|
|
123
|
+
uint32_t);
|
|
124
|
+
static uint32_t PathSymlink(
|
|
125
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
|
126
|
+
static uint32_t PathUnlinkFile(
|
|
127
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t);
|
|
128
|
+
static uint32_t PollOneoff(
|
|
129
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t);
|
|
130
|
+
static void ProcExit(WASI&, WasmMemory, uint32_t);
|
|
131
|
+
static uint32_t ProcRaise(WASI&, WasmMemory, uint32_t);
|
|
132
|
+
static uint32_t RandomGet(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
133
|
+
static uint32_t SchedYield(WASI&, WasmMemory);
|
|
134
|
+
static uint32_t SockAccept(WASI&, WasmMemory, uint32_t, uint32_t, uint32_t);
|
|
135
|
+
static uint32_t SockRecv(WASI&,
|
|
136
|
+
WasmMemory,
|
|
137
|
+
uint32_t,
|
|
138
|
+
uint32_t,
|
|
139
|
+
uint32_t,
|
|
140
|
+
uint32_t,
|
|
141
|
+
uint32_t,
|
|
142
|
+
uint32_t);
|
|
143
|
+
static uint32_t SockSend(
|
|
144
|
+
WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
|
145
|
+
static uint32_t SockShutdown(WASI&, WasmMemory, uint32_t, uint32_t);
|
|
146
|
+
|
|
147
|
+
static void _SetMemory(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
148
|
+
|
|
149
|
+
// Implementation for mem::NgLibMemoryManager
|
|
150
|
+
void CheckAllocatedSize(size_t previous_size) const;
|
|
151
|
+
void IncreaseAllocatedSize(size_t size);
|
|
152
|
+
void DecreaseAllocatedSize(size_t size);
|
|
153
|
+
|
|
154
|
+
// <typename FT, FT F> as a C++14 desugaring of `<auto F>`
|
|
155
|
+
template <typename FT, FT F, typename R, typename... Args>
|
|
156
|
+
class WasiFunction {
|
|
157
|
+
public:
|
|
158
|
+
static void SetFunction(Environment*,
|
|
159
|
+
const char*,
|
|
160
|
+
v8::Local<v8::FunctionTemplate>);
|
|
161
|
+
|
|
162
|
+
private:
|
|
163
|
+
static R FastCallback(v8::Local<v8::Object> receiver,
|
|
164
|
+
Args...,
|
|
165
|
+
v8::FastApiCallbackOptions&);
|
|
166
|
+
|
|
167
|
+
static void SlowCallback(const v8::FunctionCallbackInfo<v8::Value>&);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
private:
|
|
171
|
+
~WASI() override;
|
|
172
|
+
uvwasi_t uvw_;
|
|
173
|
+
v8::Global<v8::WasmMemoryObject> memory_;
|
|
174
|
+
uvwasi_mem_t alloc_info_;
|
|
175
|
+
size_t current_uvwasi_memory_ = 0;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
} // namespace wasi
|
|
180
|
+
} // namespace node
|
|
181
|
+
|
|
182
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
183
|
+
|
|
184
|
+
#endif // SRC_NODE_WASI_H_
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#ifndef SRC_NODE_WASM_WEB_API_H_
|
|
2
|
+
#define SRC_NODE_WASM_WEB_API_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "base_object-inl.h"
|
|
7
|
+
#include "v8.h"
|
|
8
|
+
|
|
9
|
+
namespace node {
|
|
10
|
+
namespace wasm_web_api {
|
|
11
|
+
|
|
12
|
+
// Wrapper for interacting with a v8::WasmStreaming instance from JavaScript.
|
|
13
|
+
class WasmStreamingObject final : public BaseObject {
|
|
14
|
+
public:
|
|
15
|
+
static v8::Local<v8::Function> Initialize(Environment* env);
|
|
16
|
+
|
|
17
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
18
|
+
|
|
19
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
20
|
+
SET_MEMORY_INFO_NAME(WasmStreamingObject)
|
|
21
|
+
SET_SELF_SIZE(WasmStreamingObject)
|
|
22
|
+
|
|
23
|
+
static v8::MaybeLocal<v8::Object> Create(
|
|
24
|
+
Environment* env, std::shared_ptr<v8::WasmStreaming> streaming);
|
|
25
|
+
|
|
26
|
+
private:
|
|
27
|
+
WasmStreamingObject(Environment* env, v8::Local<v8::Object> object)
|
|
28
|
+
: BaseObject(env, object) {
|
|
29
|
+
MakeWeak();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
~WasmStreamingObject() override {}
|
|
33
|
+
|
|
34
|
+
private:
|
|
35
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
36
|
+
static void SetURL(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
37
|
+
static void Push(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
38
|
+
static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
39
|
+
static void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
40
|
+
|
|
41
|
+
std::shared_ptr<v8::WasmStreaming> streaming_;
|
|
42
|
+
size_t wasm_size_ = 0;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// This is a v8::WasmStreamingCallback implementation that must be passed to
|
|
46
|
+
// v8::Isolate::SetWasmStreamingCallback when setting up the isolate in order to
|
|
47
|
+
// enable the WebAssembly.(compile|instantiate)Streaming APIs.
|
|
48
|
+
void StartStreamingCompilation(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
49
|
+
|
|
50
|
+
} // namespace wasm_web_api
|
|
51
|
+
} // namespace node
|
|
52
|
+
|
|
53
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
54
|
+
|
|
55
|
+
#endif // SRC_NODE_WASM_WEB_API_H_
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
#ifndef SRC_NODE_WATCHDOG_H_
|
|
23
|
+
#define SRC_NODE_WATCHDOG_H_
|
|
24
|
+
|
|
25
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
26
|
+
|
|
27
|
+
#include <vector>
|
|
28
|
+
#include "handle_wrap.h"
|
|
29
|
+
#include "memory_tracker-inl.h"
|
|
30
|
+
#include "node_mutex.h"
|
|
31
|
+
#include "uv.h"
|
|
32
|
+
#include "v8.h"
|
|
33
|
+
|
|
34
|
+
#ifdef __POSIX__
|
|
35
|
+
#include <pthread.h>
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
namespace node {
|
|
39
|
+
|
|
40
|
+
enum class SignalPropagation {
|
|
41
|
+
kContinuePropagation,
|
|
42
|
+
kStopPropagation,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
class Watchdog {
|
|
46
|
+
public:
|
|
47
|
+
explicit Watchdog(v8::Isolate* isolate,
|
|
48
|
+
uint64_t ms,
|
|
49
|
+
bool* timed_out = nullptr);
|
|
50
|
+
~Watchdog();
|
|
51
|
+
v8::Isolate* isolate() { return isolate_; }
|
|
52
|
+
|
|
53
|
+
private:
|
|
54
|
+
static void Run(void* arg);
|
|
55
|
+
static void Timer(uv_timer_t* timer);
|
|
56
|
+
|
|
57
|
+
v8::Isolate* isolate_;
|
|
58
|
+
uv_thread_t thread_;
|
|
59
|
+
uv_loop_t loop_;
|
|
60
|
+
uv_async_t async_;
|
|
61
|
+
uv_timer_t timer_;
|
|
62
|
+
bool* timed_out_;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
class SigintWatchdogBase {
|
|
66
|
+
public:
|
|
67
|
+
virtual ~SigintWatchdogBase() = default;
|
|
68
|
+
virtual SignalPropagation HandleSigint() = 0;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
class SigintWatchdog : public SigintWatchdogBase {
|
|
72
|
+
public:
|
|
73
|
+
explicit SigintWatchdog(v8::Isolate* isolate,
|
|
74
|
+
bool* received_signal = nullptr);
|
|
75
|
+
~SigintWatchdog();
|
|
76
|
+
v8::Isolate* isolate() { return isolate_; }
|
|
77
|
+
SignalPropagation HandleSigint() override;
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
v8::Isolate* isolate_;
|
|
81
|
+
bool* received_signal_;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
class TraceSigintWatchdog : public HandleWrap, public SigintWatchdogBase {
|
|
85
|
+
public:
|
|
86
|
+
static void Init(Environment* env, v8::Local<v8::Object> target);
|
|
87
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
88
|
+
static void Start(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
89
|
+
static void Stop(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
90
|
+
|
|
91
|
+
SignalPropagation HandleSigint() override;
|
|
92
|
+
|
|
93
|
+
inline void MemoryInfo(node::MemoryTracker* tracker) const override {
|
|
94
|
+
tracker->TrackInlineField("handle_", handle_);
|
|
95
|
+
}
|
|
96
|
+
SET_MEMORY_INFO_NAME(TraceSigintWatchdog)
|
|
97
|
+
SET_SELF_SIZE(TraceSigintWatchdog)
|
|
98
|
+
|
|
99
|
+
private:
|
|
100
|
+
enum class SignalFlags { None, FromIdle, FromInterrupt };
|
|
101
|
+
|
|
102
|
+
TraceSigintWatchdog(Environment* env, v8::Local<v8::Object> object);
|
|
103
|
+
void HandleInterrupt();
|
|
104
|
+
|
|
105
|
+
bool interrupting = false;
|
|
106
|
+
uv_async_t handle_;
|
|
107
|
+
SignalFlags signal_flag_ = SignalFlags::None;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
class SigintWatchdogHelper {
|
|
111
|
+
public:
|
|
112
|
+
static SigintWatchdogHelper* GetInstance() { return &instance; }
|
|
113
|
+
static Mutex& GetInstanceActionMutex() { return instance_action_mutex_; }
|
|
114
|
+
void Register(SigintWatchdogBase* watchdog);
|
|
115
|
+
void Unregister(SigintWatchdogBase* watchdog);
|
|
116
|
+
bool HasPendingSignal();
|
|
117
|
+
|
|
118
|
+
int Start();
|
|
119
|
+
bool Stop();
|
|
120
|
+
|
|
121
|
+
private:
|
|
122
|
+
SigintWatchdogHelper();
|
|
123
|
+
~SigintWatchdogHelper();
|
|
124
|
+
|
|
125
|
+
static bool InformWatchdogsAboutSignal();
|
|
126
|
+
static SigintWatchdogHelper instance;
|
|
127
|
+
static Mutex instance_action_mutex_;
|
|
128
|
+
|
|
129
|
+
int start_stop_count_;
|
|
130
|
+
|
|
131
|
+
Mutex mutex_;
|
|
132
|
+
Mutex list_mutex_;
|
|
133
|
+
std::vector<SigintWatchdogBase*> watchdogs_;
|
|
134
|
+
bool has_pending_signal_;
|
|
135
|
+
|
|
136
|
+
#ifdef __POSIX__
|
|
137
|
+
pthread_t thread_;
|
|
138
|
+
uv_sem_t sem_;
|
|
139
|
+
bool has_running_thread_;
|
|
140
|
+
bool stopping_;
|
|
141
|
+
|
|
142
|
+
static void* RunSigintWatchdog(void* arg);
|
|
143
|
+
static void HandleSignal(int signum, siginfo_t* info, void* ucontext);
|
|
144
|
+
#else
|
|
145
|
+
bool watchdog_disabled_;
|
|
146
|
+
static BOOL WINAPI WinCtrlCHandlerRoutine(DWORD dwCtrlType);
|
|
147
|
+
#endif
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
} // namespace node
|
|
151
|
+
|
|
152
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
153
|
+
|
|
154
|
+
#endif // SRC_NODE_WATCHDOG_H_
|