@kungfu-tech/libnode-win32-x64 0.0.0-bootstrap.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/LICENSE +201 -0
- package/README.md +3 -0
- 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/index.js +5 -0
- package/libnode.release.json +8 -0
- package/package.json +29 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#ifndef SRC_NODE_PERF_H_
|
|
2
|
+
#define SRC_NODE_PERF_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "base_object-inl.h"
|
|
7
|
+
#include "histogram.h"
|
|
8
|
+
#include "node.h"
|
|
9
|
+
#include "node_internals.h"
|
|
10
|
+
#include "node_perf_common.h"
|
|
11
|
+
|
|
12
|
+
#include "v8.h"
|
|
13
|
+
#include "uv.h"
|
|
14
|
+
|
|
15
|
+
#include <string>
|
|
16
|
+
|
|
17
|
+
namespace node {
|
|
18
|
+
|
|
19
|
+
class Environment;
|
|
20
|
+
class ExternalReferenceRegistry;
|
|
21
|
+
|
|
22
|
+
namespace performance {
|
|
23
|
+
|
|
24
|
+
inline const char* GetPerformanceMilestoneName(
|
|
25
|
+
PerformanceMilestone milestone) {
|
|
26
|
+
switch (milestone) {
|
|
27
|
+
#define V(name, label) case NODE_PERFORMANCE_MILESTONE_##name: return label;
|
|
28
|
+
NODE_PERFORMANCE_MILESTONES(V)
|
|
29
|
+
#undef V
|
|
30
|
+
default:
|
|
31
|
+
UNREACHABLE();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
inline PerformanceMilestone ToPerformanceMilestoneEnum(const char* str) {
|
|
36
|
+
#define V(name, label) \
|
|
37
|
+
if (strcmp(str, label) == 0) return NODE_PERFORMANCE_MILESTONE_##name;
|
|
38
|
+
NODE_PERFORMANCE_MILESTONES(V)
|
|
39
|
+
#undef V
|
|
40
|
+
return NODE_PERFORMANCE_MILESTONE_INVALID;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
inline const char* GetPerformanceEntryTypeName(
|
|
44
|
+
PerformanceEntryType type) {
|
|
45
|
+
switch (type) {
|
|
46
|
+
#define V(name, label) case NODE_PERFORMANCE_ENTRY_TYPE_##name: return label;
|
|
47
|
+
NODE_PERFORMANCE_ENTRY_TYPES(V)
|
|
48
|
+
#undef V
|
|
49
|
+
default:
|
|
50
|
+
UNREACHABLE();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
inline PerformanceEntryType ToPerformanceEntryTypeEnum(
|
|
55
|
+
const char* type) {
|
|
56
|
+
#define V(name, label) \
|
|
57
|
+
if (strcmp(type, label) == 0) return NODE_PERFORMANCE_ENTRY_TYPE_##name;
|
|
58
|
+
NODE_PERFORMANCE_ENTRY_TYPES(V)
|
|
59
|
+
#undef V
|
|
60
|
+
return NODE_PERFORMANCE_ENTRY_TYPE_INVALID;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
enum PerformanceGCKind {
|
|
64
|
+
NODE_PERFORMANCE_GC_MAJOR = v8::GCType::kGCTypeMarkSweepCompact,
|
|
65
|
+
NODE_PERFORMANCE_GC_MINOR = v8::GCType::kGCTypeScavenge,
|
|
66
|
+
NODE_PERFORMANCE_GC_INCREMENTAL = v8::GCType::kGCTypeIncrementalMarking,
|
|
67
|
+
NODE_PERFORMANCE_GC_WEAKCB = v8::GCType::kGCTypeProcessWeakCallbacks
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
enum PerformanceGCFlags {
|
|
71
|
+
NODE_PERFORMANCE_GC_FLAGS_NO =
|
|
72
|
+
v8::GCCallbackFlags::kNoGCCallbackFlags,
|
|
73
|
+
NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED =
|
|
74
|
+
v8::GCCallbackFlags::kGCCallbackFlagConstructRetainedObjectInfos,
|
|
75
|
+
NODE_PERFORMANCE_GC_FLAGS_FORCED =
|
|
76
|
+
v8::GCCallbackFlags::kGCCallbackFlagForced,
|
|
77
|
+
NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING =
|
|
78
|
+
v8::GCCallbackFlags::kGCCallbackFlagSynchronousPhantomCallbackProcessing,
|
|
79
|
+
NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE =
|
|
80
|
+
v8::GCCallbackFlags::kGCCallbackFlagCollectAllAvailableGarbage,
|
|
81
|
+
NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY =
|
|
82
|
+
v8::GCCallbackFlags::kGCCallbackFlagCollectAllExternalMemory,
|
|
83
|
+
NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE =
|
|
84
|
+
v8::GCCallbackFlags::kGCCallbackScheduleIdleGarbageCollection
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
template <typename Traits>
|
|
88
|
+
struct PerformanceEntry {
|
|
89
|
+
using Details = typename Traits::Details;
|
|
90
|
+
std::string name;
|
|
91
|
+
double start_time;
|
|
92
|
+
double duration;
|
|
93
|
+
Details details;
|
|
94
|
+
|
|
95
|
+
PerformanceEntry(
|
|
96
|
+
const std::string& name_,
|
|
97
|
+
double start_time_,
|
|
98
|
+
double duration_,
|
|
99
|
+
const Details& details_)
|
|
100
|
+
: name(name_),
|
|
101
|
+
start_time(start_time_),
|
|
102
|
+
duration(duration_),
|
|
103
|
+
details(details_) {}
|
|
104
|
+
|
|
105
|
+
static v8::MaybeLocal<v8::Object> GetDetails(
|
|
106
|
+
Environment* env,
|
|
107
|
+
const PerformanceEntry<Traits>& entry) {
|
|
108
|
+
return Traits::GetDetails(env, entry);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
void Notify(Environment* env) {
|
|
112
|
+
v8::HandleScope handle_scope(env->isolate());
|
|
113
|
+
v8::Context::Scope scope(env->context());
|
|
114
|
+
AliasedUint32Array& observers = env->performance_state()->observers;
|
|
115
|
+
if (env->performance_entry_callback().IsEmpty() ||
|
|
116
|
+
!observers[Traits::kType]) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
v8::Local<v8::Object> detail;
|
|
121
|
+
if (!Traits::GetDetails(env, *this).ToLocal(&detail)) {
|
|
122
|
+
// TODO(@jasnell): Handle the error here
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
v8::Local<v8::Value> argv[] = {
|
|
127
|
+
OneByteString(env->isolate(), name),
|
|
128
|
+
OneByteString(env->isolate(),
|
|
129
|
+
GetPerformanceEntryTypeName(Traits::kType)),
|
|
130
|
+
v8::Number::New(env->isolate(), start_time),
|
|
131
|
+
v8::Number::New(env->isolate(), duration),
|
|
132
|
+
detail};
|
|
133
|
+
|
|
134
|
+
node::MakeSyncCallback(
|
|
135
|
+
env->isolate(),
|
|
136
|
+
env->context()->Global(),
|
|
137
|
+
env->performance_entry_callback(),
|
|
138
|
+
arraysize(argv),
|
|
139
|
+
argv);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
struct GCPerformanceEntryTraits {
|
|
144
|
+
static constexpr PerformanceEntryType kType =
|
|
145
|
+
NODE_PERFORMANCE_ENTRY_TYPE_GC;
|
|
146
|
+
struct Details {
|
|
147
|
+
PerformanceGCKind kind;
|
|
148
|
+
PerformanceGCFlags flags;
|
|
149
|
+
|
|
150
|
+
Details(PerformanceGCKind kind_, PerformanceGCFlags flags_)
|
|
151
|
+
: kind(kind_), flags(flags_) {}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
static v8::MaybeLocal<v8::Object> GetDetails(
|
|
155
|
+
Environment* env,
|
|
156
|
+
const PerformanceEntry<GCPerformanceEntryTraits>& entry);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
using GCPerformanceEntry = PerformanceEntry<GCPerformanceEntryTraits>;
|
|
160
|
+
|
|
161
|
+
} // namespace performance
|
|
162
|
+
} // namespace node
|
|
163
|
+
|
|
164
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
165
|
+
|
|
166
|
+
#endif // SRC_NODE_PERF_H_
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#ifndef SRC_NODE_PERF_COMMON_H_
|
|
2
|
+
#define SRC_NODE_PERF_COMMON_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "aliased_buffer.h"
|
|
7
|
+
#include "node.h"
|
|
8
|
+
#include "uv.h"
|
|
9
|
+
#include "v8.h"
|
|
10
|
+
|
|
11
|
+
#include <algorithm>
|
|
12
|
+
#include <iostream>
|
|
13
|
+
#include <map>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace node {
|
|
17
|
+
namespace performance {
|
|
18
|
+
|
|
19
|
+
#define PERFORMANCE_NOW() uv_hrtime()
|
|
20
|
+
|
|
21
|
+
// These occur before the environment is created. Cache them
|
|
22
|
+
// here and add them to the milestones when the env is init'd.
|
|
23
|
+
extern const uint64_t performance_process_start;
|
|
24
|
+
extern const double performance_process_start_timestamp;
|
|
25
|
+
extern uint64_t performance_v8_start;
|
|
26
|
+
|
|
27
|
+
#define NODE_PERFORMANCE_MILESTONES(V) \
|
|
28
|
+
V(TIME_ORIGIN_TIMESTAMP, "timeOriginTimestamp") \
|
|
29
|
+
V(TIME_ORIGIN, "timeOrigin") \
|
|
30
|
+
V(ENVIRONMENT, "environment") \
|
|
31
|
+
V(NODE_START, "nodeStart") \
|
|
32
|
+
V(V8_START, "v8Start") \
|
|
33
|
+
V(LOOP_START, "loopStart") \
|
|
34
|
+
V(LOOP_EXIT, "loopExit") \
|
|
35
|
+
V(BOOTSTRAP_COMPLETE, "bootstrapComplete")
|
|
36
|
+
|
|
37
|
+
#define NODE_PERFORMANCE_ENTRY_TYPES(V) \
|
|
38
|
+
V(GC, "gc") \
|
|
39
|
+
V(HTTP, "http") \
|
|
40
|
+
V(HTTP2, "http2") \
|
|
41
|
+
V(NET, "net") \
|
|
42
|
+
V(DNS, "dns")
|
|
43
|
+
|
|
44
|
+
enum PerformanceMilestone {
|
|
45
|
+
#define V(name, _) NODE_PERFORMANCE_MILESTONE_##name,
|
|
46
|
+
NODE_PERFORMANCE_MILESTONES(V)
|
|
47
|
+
#undef V
|
|
48
|
+
NODE_PERFORMANCE_MILESTONE_INVALID
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
enum PerformanceEntryType {
|
|
52
|
+
#define V(name, _) NODE_PERFORMANCE_ENTRY_TYPE_##name,
|
|
53
|
+
NODE_PERFORMANCE_ENTRY_TYPES(V)
|
|
54
|
+
#undef V
|
|
55
|
+
NODE_PERFORMANCE_ENTRY_TYPE_INVALID
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
class PerformanceState {
|
|
59
|
+
public:
|
|
60
|
+
struct SerializeInfo {
|
|
61
|
+
AliasedBufferIndex root;
|
|
62
|
+
AliasedBufferIndex milestones;
|
|
63
|
+
AliasedBufferIndex observers;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
explicit PerformanceState(v8::Isolate* isolate,
|
|
67
|
+
uint64_t time_origin,
|
|
68
|
+
double time_origin_timestamp,
|
|
69
|
+
const SerializeInfo* info);
|
|
70
|
+
SerializeInfo Serialize(v8::Local<v8::Context> context,
|
|
71
|
+
v8::SnapshotCreator* creator);
|
|
72
|
+
void Deserialize(v8::Local<v8::Context> context,
|
|
73
|
+
uint64_t time_origin,
|
|
74
|
+
double time_origin_timestamp);
|
|
75
|
+
friend std::ostream& operator<<(std::ostream& o, const SerializeInfo& i);
|
|
76
|
+
|
|
77
|
+
AliasedUint8Array root;
|
|
78
|
+
AliasedFloat64Array milestones;
|
|
79
|
+
AliasedUint32Array observers;
|
|
80
|
+
|
|
81
|
+
uint64_t performance_last_gc_start_mark = 0;
|
|
82
|
+
uint16_t current_gc_type = 0;
|
|
83
|
+
|
|
84
|
+
void Mark(enum PerformanceMilestone milestone,
|
|
85
|
+
uint64_t ts = PERFORMANCE_NOW());
|
|
86
|
+
|
|
87
|
+
private:
|
|
88
|
+
void Initialize(uint64_t time_origin, double time_origin_timestamp);
|
|
89
|
+
void ResetMilestones();
|
|
90
|
+
struct performance_state_internal {
|
|
91
|
+
// doubles first so that they are always sizeof(double)-aligned
|
|
92
|
+
double milestones[NODE_PERFORMANCE_MILESTONE_INVALID];
|
|
93
|
+
uint32_t observers[NODE_PERFORMANCE_ENTRY_TYPE_INVALID];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace performance
|
|
98
|
+
} // namespace node
|
|
99
|
+
|
|
100
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
101
|
+
|
|
102
|
+
#endif // SRC_NODE_PERF_COMMON_H_
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#ifndef SRC_NODE_PLATFORM_H_
|
|
2
|
+
#define SRC_NODE_PLATFORM_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include <queue>
|
|
7
|
+
#include <unordered_map>
|
|
8
|
+
#include <vector>
|
|
9
|
+
#include <functional>
|
|
10
|
+
|
|
11
|
+
#include "libplatform/libplatform.h"
|
|
12
|
+
#include "node.h"
|
|
13
|
+
#include "node_mutex.h"
|
|
14
|
+
#include "uv.h"
|
|
15
|
+
|
|
16
|
+
namespace node {
|
|
17
|
+
|
|
18
|
+
class NodePlatform;
|
|
19
|
+
class IsolateData;
|
|
20
|
+
class PerIsolatePlatformData;
|
|
21
|
+
|
|
22
|
+
template <class T>
|
|
23
|
+
class TaskQueue {
|
|
24
|
+
public:
|
|
25
|
+
class Locked {
|
|
26
|
+
public:
|
|
27
|
+
void Push(std::unique_ptr<T> task);
|
|
28
|
+
std::unique_ptr<T> Pop();
|
|
29
|
+
std::unique_ptr<T> BlockingPop();
|
|
30
|
+
void NotifyOfCompletion();
|
|
31
|
+
void BlockingDrain();
|
|
32
|
+
void Stop();
|
|
33
|
+
std::queue<std::unique_ptr<T>> PopAll();
|
|
34
|
+
|
|
35
|
+
private:
|
|
36
|
+
friend class TaskQueue;
|
|
37
|
+
explicit Locked(TaskQueue* queue);
|
|
38
|
+
|
|
39
|
+
TaskQueue* queue_;
|
|
40
|
+
Mutex::ScopedLock lock_;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
TaskQueue();
|
|
44
|
+
~TaskQueue() = default;
|
|
45
|
+
|
|
46
|
+
Locked Lock() { return Locked(this); }
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
Mutex lock_;
|
|
50
|
+
ConditionVariable tasks_available_;
|
|
51
|
+
ConditionVariable tasks_drained_;
|
|
52
|
+
int outstanding_tasks_;
|
|
53
|
+
bool stopped_;
|
|
54
|
+
std::queue<std::unique_ptr<T>> task_queue_;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
struct DelayedTask {
|
|
58
|
+
std::unique_ptr<v8::Task> task;
|
|
59
|
+
uv_timer_t timer;
|
|
60
|
+
double timeout;
|
|
61
|
+
std::shared_ptr<PerIsolatePlatformData> platform_data;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
enum class PlatformDebugLogLevel {
|
|
65
|
+
kNone = 0,
|
|
66
|
+
kMinimal = 1,
|
|
67
|
+
kVerbose = 2,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// This acts as the foreground task runner for a given Isolate.
|
|
71
|
+
class PerIsolatePlatformData :
|
|
72
|
+
public IsolatePlatformDelegate,
|
|
73
|
+
public v8::TaskRunner,
|
|
74
|
+
public std::enable_shared_from_this<PerIsolatePlatformData> {
|
|
75
|
+
public:
|
|
76
|
+
PerIsolatePlatformData(
|
|
77
|
+
v8::Isolate* isolate,
|
|
78
|
+
uv_loop_t* loop,
|
|
79
|
+
PlatformDebugLogLevel debug_log_level = PlatformDebugLogLevel::kNone);
|
|
80
|
+
~PerIsolatePlatformData() override;
|
|
81
|
+
|
|
82
|
+
std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner() override;
|
|
83
|
+
void PostTask(std::unique_ptr<v8::Task> task) override;
|
|
84
|
+
void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
|
|
85
|
+
void PostDelayedTask(std::unique_ptr<v8::Task> task,
|
|
86
|
+
double delay_in_seconds) override;
|
|
87
|
+
bool IdleTasksEnabled() override { return false; }
|
|
88
|
+
|
|
89
|
+
// Non-nestable tasks are treated like regular tasks.
|
|
90
|
+
bool NonNestableTasksEnabled() const override { return true; }
|
|
91
|
+
bool NonNestableDelayedTasksEnabled() const override { return true; }
|
|
92
|
+
void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
|
|
93
|
+
void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task,
|
|
94
|
+
double delay_in_seconds) override;
|
|
95
|
+
|
|
96
|
+
void AddShutdownCallback(void (*callback)(void*), void* data);
|
|
97
|
+
void Shutdown();
|
|
98
|
+
|
|
99
|
+
// Returns true if work was dispatched or executed. New tasks that are
|
|
100
|
+
// posted during flushing of the queue are postponed until the next
|
|
101
|
+
// flushing.
|
|
102
|
+
bool FlushForegroundTasksInternal();
|
|
103
|
+
|
|
104
|
+
const uv_loop_t* event_loop() const { return loop_; }
|
|
105
|
+
|
|
106
|
+
private:
|
|
107
|
+
void DeleteFromScheduledTasks(DelayedTask* task);
|
|
108
|
+
void DecreaseHandleCount();
|
|
109
|
+
|
|
110
|
+
static void FlushTasks(uv_async_t* handle);
|
|
111
|
+
void RunForegroundTask(std::unique_ptr<v8::Task> task);
|
|
112
|
+
static void RunForegroundTask(uv_timer_t* timer);
|
|
113
|
+
|
|
114
|
+
uv_async_t* flush_tasks_ = nullptr;
|
|
115
|
+
|
|
116
|
+
struct ShutdownCallback {
|
|
117
|
+
void (*cb)(void*);
|
|
118
|
+
void* data;
|
|
119
|
+
};
|
|
120
|
+
typedef std::vector<ShutdownCallback> ShutdownCbList;
|
|
121
|
+
ShutdownCbList shutdown_callbacks_;
|
|
122
|
+
// shared_ptr to self to keep this object alive during shutdown.
|
|
123
|
+
std::shared_ptr<PerIsolatePlatformData> self_reference_;
|
|
124
|
+
uint32_t uv_handle_count_ = 1; // 1 = flush_tasks_
|
|
125
|
+
|
|
126
|
+
v8::Isolate* const isolate_;
|
|
127
|
+
uv_loop_t* const loop_;
|
|
128
|
+
|
|
129
|
+
// When acquiring locks for both task queues, lock foreground_tasks_
|
|
130
|
+
// first then foreground_delayed_tasks_ to avoid deadlocks.
|
|
131
|
+
TaskQueue<v8::Task> foreground_tasks_;
|
|
132
|
+
TaskQueue<DelayedTask> foreground_delayed_tasks_;
|
|
133
|
+
|
|
134
|
+
// Use a custom deleter because libuv needs to close the handle first.
|
|
135
|
+
typedef std::unique_ptr<DelayedTask, void(*)(DelayedTask*)>
|
|
136
|
+
DelayedTaskPointer;
|
|
137
|
+
std::vector<DelayedTaskPointer> scheduled_delayed_tasks_;
|
|
138
|
+
PlatformDebugLogLevel debug_log_level_ = PlatformDebugLogLevel::kNone;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// This acts as the single worker thread task runner for all Isolates.
|
|
142
|
+
class WorkerThreadsTaskRunner {
|
|
143
|
+
public:
|
|
144
|
+
explicit WorkerThreadsTaskRunner(int thread_pool_size,
|
|
145
|
+
PlatformDebugLogLevel debug_log_level);
|
|
146
|
+
|
|
147
|
+
void PostTask(std::unique_ptr<v8::Task> task);
|
|
148
|
+
void PostDelayedTask(std::unique_ptr<v8::Task> task,
|
|
149
|
+
double delay_in_seconds);
|
|
150
|
+
|
|
151
|
+
void BlockingDrain();
|
|
152
|
+
void Shutdown();
|
|
153
|
+
|
|
154
|
+
int NumberOfWorkerThreads() const;
|
|
155
|
+
|
|
156
|
+
private:
|
|
157
|
+
// A queue shared by all threads. The consumers are the worker threads which
|
|
158
|
+
// take tasks from it to run in PlatformWorkerThread(). The producers can be
|
|
159
|
+
// any thread. Both the foreground thread and the worker threads can push
|
|
160
|
+
// tasks into the queue via v8::Platform::PostTaskOnWorkerThread() which
|
|
161
|
+
// eventually calls PostTask() on this class. When any thread calls
|
|
162
|
+
// v8::Platform::PostDelayedTaskOnWorkerThread(), the DelayedTaskScheduler
|
|
163
|
+
// thread will schedule a timer that pushes the delayed tasks back into this
|
|
164
|
+
// queue when the timer expires.
|
|
165
|
+
TaskQueue<v8::Task> pending_worker_tasks_;
|
|
166
|
+
|
|
167
|
+
class DelayedTaskScheduler;
|
|
168
|
+
std::unique_ptr<DelayedTaskScheduler> delayed_task_scheduler_;
|
|
169
|
+
|
|
170
|
+
std::vector<std::unique_ptr<uv_thread_t>> threads_;
|
|
171
|
+
PlatformDebugLogLevel debug_log_level_ = PlatformDebugLogLevel::kNone;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
class NodePlatform : public MultiIsolatePlatform {
|
|
175
|
+
public:
|
|
176
|
+
NodePlatform(int thread_pool_size,
|
|
177
|
+
v8::TracingController* tracing_controller,
|
|
178
|
+
v8::PageAllocator* page_allocator = nullptr);
|
|
179
|
+
~NodePlatform() override;
|
|
180
|
+
|
|
181
|
+
void DrainTasks(v8::Isolate* isolate) override;
|
|
182
|
+
void Shutdown();
|
|
183
|
+
|
|
184
|
+
// v8::Platform implementation.
|
|
185
|
+
int NumberOfWorkerThreads() override;
|
|
186
|
+
void PostTaskOnWorkerThreadImpl(v8::TaskPriority priority,
|
|
187
|
+
std::unique_ptr<v8::Task> task,
|
|
188
|
+
const v8::SourceLocation& location) override;
|
|
189
|
+
void PostDelayedTaskOnWorkerThreadImpl(
|
|
190
|
+
v8::TaskPriority priority,
|
|
191
|
+
std::unique_ptr<v8::Task> task,
|
|
192
|
+
double delay_in_seconds,
|
|
193
|
+
const v8::SourceLocation& location) override;
|
|
194
|
+
bool IdleTasksEnabled(v8::Isolate* isolate) override;
|
|
195
|
+
double MonotonicallyIncreasingTime() override;
|
|
196
|
+
double CurrentClockTimeMillis() override;
|
|
197
|
+
v8::TracingController* GetTracingController() override;
|
|
198
|
+
bool FlushForegroundTasks(v8::Isolate* isolate) override;
|
|
199
|
+
std::unique_ptr<v8::JobHandle> CreateJobImpl(
|
|
200
|
+
v8::TaskPriority priority,
|
|
201
|
+
std::unique_ptr<v8::JobTask> job_task,
|
|
202
|
+
const v8::SourceLocation& location) override;
|
|
203
|
+
|
|
204
|
+
void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override;
|
|
205
|
+
void RegisterIsolate(v8::Isolate* isolate,
|
|
206
|
+
IsolatePlatformDelegate* delegate) override;
|
|
207
|
+
|
|
208
|
+
void UnregisterIsolate(v8::Isolate* isolate) override;
|
|
209
|
+
void AddIsolateFinishedCallback(v8::Isolate* isolate,
|
|
210
|
+
void (*callback)(void*), void* data) override;
|
|
211
|
+
|
|
212
|
+
std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
|
|
213
|
+
v8::Isolate* isolate) override;
|
|
214
|
+
|
|
215
|
+
Platform::StackTracePrinter GetStackTracePrinter() override;
|
|
216
|
+
v8::PageAllocator* GetPageAllocator() override;
|
|
217
|
+
|
|
218
|
+
private:
|
|
219
|
+
IsolatePlatformDelegate* ForIsolate(v8::Isolate* isolate);
|
|
220
|
+
std::shared_ptr<PerIsolatePlatformData> ForNodeIsolate(v8::Isolate* isolate);
|
|
221
|
+
|
|
222
|
+
Mutex per_isolate_mutex_;
|
|
223
|
+
using DelegatePair = std::pair<
|
|
224
|
+
IsolatePlatformDelegate*, std::shared_ptr<PerIsolatePlatformData>>;
|
|
225
|
+
std::unordered_map<v8::Isolate*, DelegatePair> per_isolate_;
|
|
226
|
+
|
|
227
|
+
v8::TracingController* tracing_controller_;
|
|
228
|
+
v8::PageAllocator* page_allocator_;
|
|
229
|
+
std::shared_ptr<WorkerThreadsTaskRunner> worker_thread_task_runner_;
|
|
230
|
+
bool has_shut_down_ = false;
|
|
231
|
+
PlatformDebugLogLevel debug_log_level_ = PlatformDebugLogLevel::kNone;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
} // namespace node
|
|
235
|
+
|
|
236
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
237
|
+
|
|
238
|
+
#endif // SRC_NODE_PLATFORM_H_
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#ifndef SRC_NODE_PROCESS_INL_H_
|
|
2
|
+
#define SRC_NODE_PROCESS_INL_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "node_process.h"
|
|
7
|
+
#include "v8.h"
|
|
8
|
+
#include "debug_utils-inl.h"
|
|
9
|
+
|
|
10
|
+
namespace node {
|
|
11
|
+
|
|
12
|
+
// Call process.emitWarning(str), fmt is a snprintf() format string
|
|
13
|
+
template <typename... Args>
|
|
14
|
+
inline v8::Maybe<bool> ProcessEmitWarning(Environment* env,
|
|
15
|
+
const char* fmt,
|
|
16
|
+
Args&&... args) {
|
|
17
|
+
std::string warning = SPrintF(fmt, std::forward<Args>(args)...);
|
|
18
|
+
|
|
19
|
+
return ProcessEmitWarningGeneric(env, warning.c_str());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace node
|
|
23
|
+
|
|
24
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
25
|
+
|
|
26
|
+
#endif // SRC_NODE_PROCESS_INL_H_
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#ifndef SRC_NODE_PROCESS_H_
|
|
2
|
+
#define SRC_NODE_PROCESS_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "node_debug.h"
|
|
7
|
+
#include "node_snapshotable.h"
|
|
8
|
+
#include "v8-fast-api-calls.h"
|
|
9
|
+
#include "v8.h"
|
|
10
|
+
|
|
11
|
+
namespace node {
|
|
12
|
+
|
|
13
|
+
class Environment;
|
|
14
|
+
class IsolateData;
|
|
15
|
+
class MemoryTracker;
|
|
16
|
+
class ExternalReferenceRegistry;
|
|
17
|
+
class Realm;
|
|
18
|
+
|
|
19
|
+
void CreateEnvProxyTemplate(IsolateData* isolate_data);
|
|
20
|
+
|
|
21
|
+
// Most of the time, it's best to use `console.error` to write
|
|
22
|
+
// to the process.stderr stream. However, in some cases, such as
|
|
23
|
+
// when debugging the stream.Writable class or the process.nextTick
|
|
24
|
+
// function, it is useful to bypass JavaScript entirely.
|
|
25
|
+
void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
26
|
+
|
|
27
|
+
v8::MaybeLocal<v8::Value> ProcessEmit(Environment* env,
|
|
28
|
+
std::string_view event,
|
|
29
|
+
v8::Local<v8::Value> message);
|
|
30
|
+
|
|
31
|
+
v8::Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
|
|
32
|
+
std::string_view warning,
|
|
33
|
+
std::string_view type = "",
|
|
34
|
+
std::string_view code = "");
|
|
35
|
+
|
|
36
|
+
template <typename... Args>
|
|
37
|
+
inline v8::Maybe<bool> ProcessEmitWarning(Environment* env,
|
|
38
|
+
const char* fmt,
|
|
39
|
+
Args&&... args);
|
|
40
|
+
|
|
41
|
+
v8::Maybe<void> ProcessEmitWarningSync(Environment* env,
|
|
42
|
+
std::string_view message);
|
|
43
|
+
v8::Maybe<bool> ProcessEmitExperimentalWarning(Environment* env,
|
|
44
|
+
const std::string& warning);
|
|
45
|
+
v8::Maybe<bool> ProcessEmitDeprecationWarning(
|
|
46
|
+
Environment* env,
|
|
47
|
+
const std::string& warning,
|
|
48
|
+
std::string_view deprecation_code);
|
|
49
|
+
|
|
50
|
+
v8::MaybeLocal<v8::Object> CreateProcessObject(Realm* env);
|
|
51
|
+
void PatchProcessObject(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
52
|
+
|
|
53
|
+
namespace process {
|
|
54
|
+
class BindingData : public SnapshotableObject {
|
|
55
|
+
public:
|
|
56
|
+
struct InternalFieldInfo : public node::InternalFieldInfoBase {
|
|
57
|
+
AliasedBufferIndex hrtime_buffer;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
static void AddMethods(v8::Isolate* isolate,
|
|
61
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
62
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
63
|
+
|
|
64
|
+
SERIALIZABLE_OBJECT_METHODS()
|
|
65
|
+
SET_BINDING_ID(process_binding_data)
|
|
66
|
+
|
|
67
|
+
BindingData(Realm* realm,
|
|
68
|
+
v8::Local<v8::Object> object,
|
|
69
|
+
InternalFieldInfo* info = nullptr);
|
|
70
|
+
|
|
71
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
72
|
+
SET_MEMORY_INFO_NAME(BindingData)
|
|
73
|
+
SET_SELF_SIZE(BindingData)
|
|
74
|
+
|
|
75
|
+
static BindingData* FromV8Value(v8::Local<v8::Value> receiver);
|
|
76
|
+
static void HrtimeImpl(BindingData* receiver);
|
|
77
|
+
|
|
78
|
+
static void FastHrtime(v8::Local<v8::Value> receiver) {
|
|
79
|
+
TRACK_V8_FAST_API_CALL("process.hrtime");
|
|
80
|
+
HrtimeImpl(FromV8Value(receiver));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static void SlowHrtime(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
84
|
+
|
|
85
|
+
static void HrtimeBigIntImpl(BindingData* receiver);
|
|
86
|
+
|
|
87
|
+
static void FastHrtimeBigInt(v8::Local<v8::Value> receiver) {
|
|
88
|
+
TRACK_V8_FAST_API_CALL("process.hrtimeBigInt");
|
|
89
|
+
HrtimeBigIntImpl(FromV8Value(receiver));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static void SlowHrtimeBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
93
|
+
|
|
94
|
+
static void LoadEnvFile(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
95
|
+
|
|
96
|
+
private:
|
|
97
|
+
// Buffer length in uint32.
|
|
98
|
+
static constexpr size_t kHrTimeBufferLength = 3;
|
|
99
|
+
AliasedUint32Array hrtime_buffer_;
|
|
100
|
+
InternalFieldInfo* internal_field_info_ = nullptr;
|
|
101
|
+
|
|
102
|
+
// These need to be static so that we have their addresses available to
|
|
103
|
+
// register as external references in the snapshot at environment creation
|
|
104
|
+
// time.
|
|
105
|
+
static v8::CFunction fast_hrtime_;
|
|
106
|
+
static v8::CFunction fast_hrtime_bigint_;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
} // namespace process
|
|
110
|
+
} // namespace node
|
|
111
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
112
|
+
#endif // SRC_NODE_PROCESS_H_
|