@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,278 @@
|
|
|
1
|
+
#ifndef SRC_DEBUG_UTILS_INL_H_
|
|
2
|
+
#define SRC_DEBUG_UTILS_INL_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "debug_utils.h"
|
|
7
|
+
#include "env.h"
|
|
8
|
+
#include "util-inl.h"
|
|
9
|
+
|
|
10
|
+
#include <type_traits>
|
|
11
|
+
|
|
12
|
+
namespace node {
|
|
13
|
+
|
|
14
|
+
template <typename T>
|
|
15
|
+
concept StringViewConvertible = requires(T a) {
|
|
16
|
+
{
|
|
17
|
+
a.ToStringView()
|
|
18
|
+
} -> std::convertible_to<std::string_view>;
|
|
19
|
+
};
|
|
20
|
+
template <typename T>
|
|
21
|
+
concept StringConvertible = requires(T a) {
|
|
22
|
+
{
|
|
23
|
+
a.ToString()
|
|
24
|
+
} -> std::convertible_to<std::string>;
|
|
25
|
+
};
|
|
26
|
+
// For std::filesystem::path and similar types
|
|
27
|
+
template <typename T>
|
|
28
|
+
concept StringConvertibleFSPathLike = requires(T a) {
|
|
29
|
+
{
|
|
30
|
+
a.string()
|
|
31
|
+
} -> std::convertible_to<std::string>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
struct ToStringHelper {
|
|
35
|
+
template <typename T>
|
|
36
|
+
requires(StringConvertible<T>) && (!StringViewConvertible<T>)
|
|
37
|
+
static std::string Convert(const T& value) {
|
|
38
|
+
return value.ToString();
|
|
39
|
+
}
|
|
40
|
+
template <typename T>
|
|
41
|
+
requires(StringConvertibleFSPathLike<T>) && (!StringViewConvertible<T>) &&
|
|
42
|
+
(!StringConvertible<T>)
|
|
43
|
+
static std::string Convert(const T& value) {
|
|
44
|
+
return value.string();
|
|
45
|
+
}
|
|
46
|
+
template <typename T>
|
|
47
|
+
requires StringViewConvertible<T>
|
|
48
|
+
static std::string_view Convert(const T& value) {
|
|
49
|
+
return value.ToStringView();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
template <typename T,
|
|
53
|
+
typename test_for_number = typename std::
|
|
54
|
+
enable_if_t<std::is_arithmetic_v<T> || std::is_enum_v<T>, bool>,
|
|
55
|
+
typename dummy = bool>
|
|
56
|
+
static std::string Convert(const T& value) {
|
|
57
|
+
return std::to_string(value);
|
|
58
|
+
}
|
|
59
|
+
static std::string_view Convert(const char* value) {
|
|
60
|
+
return value != nullptr ? value : "(null)";
|
|
61
|
+
}
|
|
62
|
+
static std::string Convert(const std::string& value) { return value; }
|
|
63
|
+
static std::string_view Convert(std::string_view value) { return value; }
|
|
64
|
+
static std::string Convert(bool value) { return value ? "true" : "false"; }
|
|
65
|
+
template <unsigned BASE_BITS,
|
|
66
|
+
typename T,
|
|
67
|
+
typename = std::enable_if_t<std::is_integral_v<T>>>
|
|
68
|
+
static std::string BaseConvert(const T& value) {
|
|
69
|
+
auto v = static_cast<uint64_t>(value);
|
|
70
|
+
char ret[3 * sizeof(T)];
|
|
71
|
+
char* ptr = ret + 3 * sizeof(T) - 1;
|
|
72
|
+
*ptr = '\0';
|
|
73
|
+
const char* digits = "0123456789abcdef";
|
|
74
|
+
do {
|
|
75
|
+
unsigned digit = v & ((1 << BASE_BITS) - 1);
|
|
76
|
+
*--ptr = (BASE_BITS < 4 ? static_cast<char>('0' + digit) : digits[digit]);
|
|
77
|
+
} while ((v >>= BASE_BITS) != 0);
|
|
78
|
+
return ptr;
|
|
79
|
+
}
|
|
80
|
+
template <unsigned BASE_BITS,
|
|
81
|
+
typename T,
|
|
82
|
+
typename = std::enable_if_t<!std::is_integral_v<T>>>
|
|
83
|
+
static auto BaseConvert(T&& value) {
|
|
84
|
+
return Convert(std::forward<T>(value));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
template <typename T>
|
|
89
|
+
auto ToStringOrStringView(const T& value) {
|
|
90
|
+
return ToStringHelper::Convert(value);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
template <typename T>
|
|
94
|
+
std::string ToString(const T& value) {
|
|
95
|
+
return std::string(ToStringOrStringView(value));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
template <unsigned BASE_BITS, typename T>
|
|
99
|
+
auto ToBaseString(const T& value) {
|
|
100
|
+
return ToStringHelper::BaseConvert<BASE_BITS>(value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
inline std::string SPrintFImpl(std::string_view format) {
|
|
104
|
+
auto offset = format.find('%');
|
|
105
|
+
if (offset == std::string_view::npos) return std::string(format);
|
|
106
|
+
CHECK_LT(offset + 1, format.size());
|
|
107
|
+
CHECK_EQ(format[offset + 1],
|
|
108
|
+
'%'); // Only '%%' allowed when there are no arguments.
|
|
109
|
+
|
|
110
|
+
return std::string(format.substr(0, offset + 1)) +
|
|
111
|
+
SPrintFImpl(format.substr(offset + 2));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
template <typename Arg, typename... Args>
|
|
115
|
+
std::string COLD_NOINLINE SPrintFImpl( // NOLINT(runtime/string)
|
|
116
|
+
std::string_view format,
|
|
117
|
+
Arg&& arg,
|
|
118
|
+
Args&&... args) {
|
|
119
|
+
auto offset = format.find('%');
|
|
120
|
+
CHECK_NE(offset, std::string_view::npos); // If you hit this, you passed in
|
|
121
|
+
// too many arguments.
|
|
122
|
+
std::string ret(format.substr(0, offset));
|
|
123
|
+
// Ignore long / size_t modifiers
|
|
124
|
+
while (++offset < format.size() &&
|
|
125
|
+
(format[offset] == 'l' || format[offset] == 'z')) {
|
|
126
|
+
}
|
|
127
|
+
switch (offset == format.size() ? '\0' : format[offset]) {
|
|
128
|
+
case '%': {
|
|
129
|
+
return ret + '%' +
|
|
130
|
+
SPrintFImpl(format.substr(offset + 1),
|
|
131
|
+
std::forward<Arg>(arg),
|
|
132
|
+
std::forward<Args>(args)...);
|
|
133
|
+
}
|
|
134
|
+
default: {
|
|
135
|
+
return ret + '%' +
|
|
136
|
+
SPrintFImpl(format.substr(offset),
|
|
137
|
+
std::forward<Arg>(arg),
|
|
138
|
+
std::forward<Args>(args)...);
|
|
139
|
+
}
|
|
140
|
+
case 'd':
|
|
141
|
+
case 'i':
|
|
142
|
+
case 'u':
|
|
143
|
+
case 's':
|
|
144
|
+
ret += ToStringOrStringView(arg);
|
|
145
|
+
break;
|
|
146
|
+
case 'o':
|
|
147
|
+
ret += ToBaseString<3>(arg);
|
|
148
|
+
break;
|
|
149
|
+
case 'x':
|
|
150
|
+
ret += ToBaseString<4>(arg);
|
|
151
|
+
break;
|
|
152
|
+
case 'X':
|
|
153
|
+
ret += node::ToUpper(ToBaseString<4>(arg));
|
|
154
|
+
break;
|
|
155
|
+
case 'p': {
|
|
156
|
+
CHECK(std::is_pointer_v<typename std::remove_reference_t<Arg>>);
|
|
157
|
+
char out[20];
|
|
158
|
+
int n = snprintf(
|
|
159
|
+
out, sizeof(out), "%p", *reinterpret_cast<const void* const*>(&arg));
|
|
160
|
+
CHECK_GE(n, 0);
|
|
161
|
+
ret += out;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return ret +
|
|
166
|
+
SPrintFImpl(format.substr(offset + 1), std::forward<Args>(args)...);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
template <typename... Args>
|
|
170
|
+
std::string COLD_NOINLINE SPrintF( // NOLINT(runtime/string)
|
|
171
|
+
std::string_view format,
|
|
172
|
+
Args&&... args) {
|
|
173
|
+
return SPrintFImpl(format, std::forward<Args>(args)...);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
template <typename... Args>
|
|
177
|
+
void COLD_NOINLINE FPrintF(FILE* file,
|
|
178
|
+
std::string_view format,
|
|
179
|
+
Args&&... args) {
|
|
180
|
+
FWrite(file, SPrintF(format, std::forward<Args>(args)...));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
template <typename... Args>
|
|
184
|
+
inline void FORCE_INLINE Debug(EnabledDebugList* list,
|
|
185
|
+
DebugCategory cat,
|
|
186
|
+
const char* format,
|
|
187
|
+
Args&&... args) {
|
|
188
|
+
if (!list->enabled(cat)) [[unlikely]]
|
|
189
|
+
return;
|
|
190
|
+
FPrintF(stderr, format, std::forward<Args>(args)...);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
inline void FORCE_INLINE Debug(EnabledDebugList* list,
|
|
194
|
+
DebugCategory cat,
|
|
195
|
+
const char* message) {
|
|
196
|
+
if (!list->enabled(cat)) [[unlikely]]
|
|
197
|
+
return;
|
|
198
|
+
FPrintF(stderr, "%s", message);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
template <typename... Args>
|
|
202
|
+
inline void FORCE_INLINE
|
|
203
|
+
Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args) {
|
|
204
|
+
Debug(env->enabled_debug_list(), cat, format, std::forward<Args>(args)...);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
inline void FORCE_INLINE Debug(Environment* env,
|
|
208
|
+
DebugCategory cat,
|
|
209
|
+
const char* message) {
|
|
210
|
+
Debug(env->enabled_debug_list(), cat, message);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
template <typename... Args>
|
|
214
|
+
inline void Debug(Environment* env,
|
|
215
|
+
DebugCategory cat,
|
|
216
|
+
const std::string& format,
|
|
217
|
+
Args&&... args) {
|
|
218
|
+
Debug(env->enabled_debug_list(),
|
|
219
|
+
cat,
|
|
220
|
+
format.c_str(),
|
|
221
|
+
std::forward<Args>(args)...);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that
|
|
225
|
+
// the FORCE_INLINE flag on them doesn't apply to the contents of this function
|
|
226
|
+
// as well.
|
|
227
|
+
// We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing
|
|
228
|
+
// this function for speed and it should rather focus on keeping it out of
|
|
229
|
+
// hot code paths. In particular, we want to keep the string concatenating code
|
|
230
|
+
// out of the function containing the original `Debug()` call.
|
|
231
|
+
template <typename... Args>
|
|
232
|
+
void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap,
|
|
233
|
+
const char* format,
|
|
234
|
+
Args&&... args) {
|
|
235
|
+
Debug(async_wrap->env(),
|
|
236
|
+
static_cast<DebugCategory>(async_wrap->provider_type()),
|
|
237
|
+
async_wrap->diagnostic_name() + " " + format + "\n",
|
|
238
|
+
std::forward<Args>(args)...);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
template <typename... Args>
|
|
242
|
+
inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
|
|
243
|
+
const char* format,
|
|
244
|
+
Args&&... args) {
|
|
245
|
+
DCHECK_NOT_NULL(async_wrap);
|
|
246
|
+
if (auto cat = static_cast<DebugCategory>(async_wrap->provider_type());
|
|
247
|
+
!async_wrap->env()->enabled_debug_list()->enabled(cat)) [[unlikely]] {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
UnconditionalAsyncWrapDebug(async_wrap, format, std::forward<Args>(args)...);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
template <typename... Args>
|
|
254
|
+
inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
|
|
255
|
+
const std::string& format,
|
|
256
|
+
Args&&... args) {
|
|
257
|
+
Debug(async_wrap, format.c_str(), std::forward<Args>(args)...);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
namespace per_process {
|
|
261
|
+
|
|
262
|
+
template <typename... Args>
|
|
263
|
+
inline void FORCE_INLINE Debug(DebugCategory cat,
|
|
264
|
+
const char* format,
|
|
265
|
+
Args&&... args) {
|
|
266
|
+
Debug(&enabled_debug_list, cat, format, std::forward<Args>(args)...);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
inline void FORCE_INLINE Debug(DebugCategory cat, const char* message) {
|
|
270
|
+
Debug(&enabled_debug_list, cat, message);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
} // namespace per_process
|
|
274
|
+
} // namespace node
|
|
275
|
+
|
|
276
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
277
|
+
|
|
278
|
+
#endif // SRC_DEBUG_UTILS_INL_H_
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#ifndef SRC_DEBUG_UTILS_H_
|
|
2
|
+
#define SRC_DEBUG_UTILS_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "async_wrap.h"
|
|
7
|
+
#include "util.h"
|
|
8
|
+
|
|
9
|
+
#include <algorithm>
|
|
10
|
+
#include <sstream>
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
// Use FORCE_INLINE on functions that have a debug-category-enabled check first
|
|
14
|
+
// and then ideally only a single function call following it, to maintain
|
|
15
|
+
// performance for the common case (no debugging used).
|
|
16
|
+
#ifdef __GNUC__
|
|
17
|
+
#define FORCE_INLINE __attribute__((always_inline))
|
|
18
|
+
#define COLD_NOINLINE __attribute__((cold, noinline))
|
|
19
|
+
#else
|
|
20
|
+
#define FORCE_INLINE
|
|
21
|
+
#define COLD_NOINLINE
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
namespace node {
|
|
25
|
+
class Environment;
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
inline std::string ToString(const T& value);
|
|
29
|
+
template <typename T>
|
|
30
|
+
inline auto ToStringOrStringView(const T& value);
|
|
31
|
+
|
|
32
|
+
// C++-style variant of sprintf()/fprintf() that:
|
|
33
|
+
// - Returns an std::string
|
|
34
|
+
// - Handles \0 bytes correctly
|
|
35
|
+
// - Supports %p and %s. %d, %i and %u are aliases for %s.
|
|
36
|
+
// - Accepts any class that has a ToString() method for stringification.
|
|
37
|
+
template <typename... Args>
|
|
38
|
+
inline std::string SPrintF(std::string_view format, Args&&... args);
|
|
39
|
+
template <typename... Args>
|
|
40
|
+
inline void FPrintF(FILE* file, std::string_view format, Args&&... args);
|
|
41
|
+
void NODE_EXTERN_PRIVATE FWrite(FILE* file, const std::string& str);
|
|
42
|
+
|
|
43
|
+
// Listing the AsyncWrap provider types first enables us to cast directly
|
|
44
|
+
// from a provider type to a debug category.
|
|
45
|
+
#define DEBUG_CATEGORY_NAMES(V) \
|
|
46
|
+
NODE_ASYNC_PROVIDER_TYPES(V) \
|
|
47
|
+
V(CRYPTO) \
|
|
48
|
+
V(COMPILE_CACHE) \
|
|
49
|
+
V(DIAGNOSTICS) \
|
|
50
|
+
V(HUGEPAGES) \
|
|
51
|
+
V(INSPECTOR_SERVER) \
|
|
52
|
+
V(INSPECTOR_CLIENT) \
|
|
53
|
+
V(INSPECTOR_PROFILER) \
|
|
54
|
+
V(CODE_CACHE) \
|
|
55
|
+
V(NGTCP2_DEBUG) \
|
|
56
|
+
V(SEA) \
|
|
57
|
+
V(WASI) \
|
|
58
|
+
V(MODULE) \
|
|
59
|
+
V(MKSNAPSHOT) \
|
|
60
|
+
V(SNAPSHOT_SERDES) \
|
|
61
|
+
V(PERMISSION_MODEL) \
|
|
62
|
+
V(PLATFORM_MINIMAL) \
|
|
63
|
+
V(PLATFORM_VERBOSE) \
|
|
64
|
+
V(QUIC)
|
|
65
|
+
|
|
66
|
+
enum class DebugCategory : unsigned int {
|
|
67
|
+
#define V(name) name,
|
|
68
|
+
DEBUG_CATEGORY_NAMES(V)
|
|
69
|
+
#undef V
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
#define V(name) +1
|
|
73
|
+
constexpr unsigned int kDebugCategoryCount = DEBUG_CATEGORY_NAMES(V);
|
|
74
|
+
#undef V
|
|
75
|
+
|
|
76
|
+
class NODE_EXTERN_PRIVATE EnabledDebugList {
|
|
77
|
+
public:
|
|
78
|
+
bool FORCE_INLINE enabled(DebugCategory category) const {
|
|
79
|
+
DCHECK_LT(static_cast<unsigned int>(category), kDebugCategoryCount);
|
|
80
|
+
return enabled_[static_cast<unsigned int>(category)];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Uses NODE_DEBUG_NATIVE to initialize the categories. env->env_vars()
|
|
84
|
+
// is parsed if it is not a nullptr, otherwise the system environment
|
|
85
|
+
// variables are parsed.
|
|
86
|
+
void Parse(Environment* env);
|
|
87
|
+
|
|
88
|
+
private:
|
|
89
|
+
// Enable all categories matching cats.
|
|
90
|
+
void Parse(const std::string& cats);
|
|
91
|
+
void set_enabled(DebugCategory category) {
|
|
92
|
+
DCHECK_LT(static_cast<unsigned int>(category), kDebugCategoryCount);
|
|
93
|
+
enabled_[static_cast<int>(category)] = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
bool enabled_[kDebugCategoryCount] = {false};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
template <typename... Args>
|
|
100
|
+
inline void FORCE_INLINE Debug(EnabledDebugList* list,
|
|
101
|
+
DebugCategory cat,
|
|
102
|
+
const char* format,
|
|
103
|
+
Args&&... args);
|
|
104
|
+
|
|
105
|
+
inline void FORCE_INLINE Debug(EnabledDebugList* list,
|
|
106
|
+
DebugCategory cat,
|
|
107
|
+
const char* message);
|
|
108
|
+
|
|
109
|
+
template <typename... Args>
|
|
110
|
+
inline void FORCE_INLINE
|
|
111
|
+
Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args);
|
|
112
|
+
|
|
113
|
+
inline void FORCE_INLINE Debug(Environment* env,
|
|
114
|
+
DebugCategory cat,
|
|
115
|
+
const char* message);
|
|
116
|
+
|
|
117
|
+
template <typename... Args>
|
|
118
|
+
inline void Debug(Environment* env,
|
|
119
|
+
DebugCategory cat,
|
|
120
|
+
const std::string& format,
|
|
121
|
+
Args&&... args);
|
|
122
|
+
|
|
123
|
+
// Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that
|
|
124
|
+
// the FORCE_INLINE flag on them doesn't apply to the contents of this function
|
|
125
|
+
// as well.
|
|
126
|
+
// We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing
|
|
127
|
+
// this function for speed and it should rather focus on keeping it out of
|
|
128
|
+
// hot code paths. In particular, we want to keep the string concatenating code
|
|
129
|
+
// out of the function containing the original `Debug()` call.
|
|
130
|
+
template <typename... Args>
|
|
131
|
+
void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap,
|
|
132
|
+
const char* format,
|
|
133
|
+
Args&&... args);
|
|
134
|
+
|
|
135
|
+
template <typename... Args>
|
|
136
|
+
inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
|
|
137
|
+
const char* format,
|
|
138
|
+
Args&&... args);
|
|
139
|
+
|
|
140
|
+
template <typename... Args>
|
|
141
|
+
inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
|
|
142
|
+
const std::string& format,
|
|
143
|
+
Args&&... args);
|
|
144
|
+
|
|
145
|
+
// Debug helper for inspecting the currently running `node` executable.
|
|
146
|
+
class NativeSymbolDebuggingContext {
|
|
147
|
+
public:
|
|
148
|
+
static std::unique_ptr<NativeSymbolDebuggingContext> New();
|
|
149
|
+
|
|
150
|
+
class SymbolInfo {
|
|
151
|
+
public:
|
|
152
|
+
std::string name;
|
|
153
|
+
std::string filename;
|
|
154
|
+
size_t line = 0;
|
|
155
|
+
size_t dis = 0;
|
|
156
|
+
|
|
157
|
+
std::string Display() const;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
NativeSymbolDebuggingContext() = default;
|
|
161
|
+
virtual ~NativeSymbolDebuggingContext() = default;
|
|
162
|
+
|
|
163
|
+
virtual SymbolInfo LookupSymbol(void* address) { return {}; }
|
|
164
|
+
virtual bool IsMapped(void* address) { return false; }
|
|
165
|
+
virtual int GetStackTrace(void** frames, int count) { return 0; }
|
|
166
|
+
|
|
167
|
+
NativeSymbolDebuggingContext(const NativeSymbolDebuggingContext&) = delete;
|
|
168
|
+
NativeSymbolDebuggingContext(NativeSymbolDebuggingContext&&) = delete;
|
|
169
|
+
NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&)
|
|
170
|
+
= delete;
|
|
171
|
+
NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&&)
|
|
172
|
+
= delete;
|
|
173
|
+
static std::vector<std::string> GetLoadedLibraries();
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// Variant of `uv_loop_close` that tries to be as helpful as possible
|
|
177
|
+
// about giving information on currently existing handles, if there are any,
|
|
178
|
+
// but still aborts the process.
|
|
179
|
+
void CheckedUvLoopClose(uv_loop_t* loop);
|
|
180
|
+
void PrintLibuvHandleInformation(uv_loop_t* loop, FILE* stream);
|
|
181
|
+
|
|
182
|
+
namespace per_process {
|
|
183
|
+
extern NODE_EXTERN_PRIVATE EnabledDebugList enabled_debug_list;
|
|
184
|
+
|
|
185
|
+
template <typename... Args>
|
|
186
|
+
inline void FORCE_INLINE Debug(DebugCategory cat,
|
|
187
|
+
const char* format,
|
|
188
|
+
Args&&... args);
|
|
189
|
+
|
|
190
|
+
inline void FORCE_INLINE Debug(DebugCategory cat, const char* message);
|
|
191
|
+
} // namespace per_process
|
|
192
|
+
} // namespace node
|
|
193
|
+
|
|
194
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
195
|
+
|
|
196
|
+
#endif // SRC_DEBUG_UTILS_H_
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#ifndef SRC_DIAGNOSTICFILENAME_INL_H_
|
|
2
|
+
#define SRC_DIAGNOSTICFILENAME_INL_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "node_internals.h"
|
|
7
|
+
namespace node {
|
|
8
|
+
|
|
9
|
+
class Environment;
|
|
10
|
+
|
|
11
|
+
inline DiagnosticFilename::DiagnosticFilename(
|
|
12
|
+
Environment* env,
|
|
13
|
+
const char* prefix,
|
|
14
|
+
const char* ext) :
|
|
15
|
+
filename_(MakeFilename(env->thread_id(), prefix, ext)) {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
inline DiagnosticFilename::DiagnosticFilename(
|
|
19
|
+
uint64_t thread_id,
|
|
20
|
+
const char* prefix,
|
|
21
|
+
const char* ext) :
|
|
22
|
+
filename_(MakeFilename(thread_id, prefix, ext)) {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
inline const char* DiagnosticFilename::operator*() const {
|
|
26
|
+
return filename_.c_str();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
} // namespace node
|
|
30
|
+
|
|
31
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
32
|
+
|
|
33
|
+
#endif // SRC_DIAGNOSTICFILENAME_INL_H_
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#ifndef SRC_EMBEDDED_DATA_H_
|
|
2
|
+
#define SRC_EMBEDDED_DATA_H_
|
|
3
|
+
|
|
4
|
+
#include <cinttypes>
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
// This file must not depend on node.h or other code that depends on
|
|
8
|
+
// the full Node.js implementation because it is used during the
|
|
9
|
+
// compilation of the Node.js implementation itself (especially js2c).
|
|
10
|
+
|
|
11
|
+
namespace node {
|
|
12
|
+
|
|
13
|
+
const std::string& GetOctalCode(uint8_t index);
|
|
14
|
+
|
|
15
|
+
} // namespace node
|
|
16
|
+
|
|
17
|
+
#endif // SRC_EMBEDDED_DATA_H_
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#ifndef SRC_ENCODING_BINDING_H_
|
|
2
|
+
#define SRC_ENCODING_BINDING_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include <cinttypes>
|
|
7
|
+
#include "aliased_buffer.h"
|
|
8
|
+
#include "node_snapshotable.h"
|
|
9
|
+
#include "v8-fast-api-calls.h"
|
|
10
|
+
|
|
11
|
+
namespace node {
|
|
12
|
+
class ExternalReferenceRegistry;
|
|
13
|
+
|
|
14
|
+
namespace encoding_binding {
|
|
15
|
+
class BindingData : public SnapshotableObject {
|
|
16
|
+
public:
|
|
17
|
+
struct InternalFieldInfo : public node::InternalFieldInfoBase {
|
|
18
|
+
AliasedBufferIndex encode_into_results_buffer;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
BindingData(Realm* realm,
|
|
22
|
+
v8::Local<v8::Object> obj,
|
|
23
|
+
InternalFieldInfo* info = nullptr);
|
|
24
|
+
SERIALIZABLE_OBJECT_METHODS()
|
|
25
|
+
SET_BINDING_ID(encoding_binding_data)
|
|
26
|
+
|
|
27
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
28
|
+
SET_SELF_SIZE(BindingData)
|
|
29
|
+
SET_MEMORY_INFO_NAME(BindingData)
|
|
30
|
+
|
|
31
|
+
static void EncodeInto(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
32
|
+
static void EncodeUtf8String(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
33
|
+
static void DecodeUTF8(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
34
|
+
static void DecodeWindows1252(
|
|
35
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
36
|
+
|
|
37
|
+
static void ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
38
|
+
static void ToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
39
|
+
|
|
40
|
+
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
|
41
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
42
|
+
static void CreatePerContextProperties(v8::Local<v8::Object> target,
|
|
43
|
+
v8::Local<v8::Value> unused,
|
|
44
|
+
v8::Local<v8::Context> context,
|
|
45
|
+
void* priv);
|
|
46
|
+
static void RegisterTimerExternalReferences(
|
|
47
|
+
ExternalReferenceRegistry* registry);
|
|
48
|
+
|
|
49
|
+
private:
|
|
50
|
+
static constexpr size_t kEncodeIntoResultsLength = 2;
|
|
51
|
+
AliasedUint32Array encode_into_results_buffer_;
|
|
52
|
+
InternalFieldInfo* internal_field_info_ = nullptr;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace encoding_binding
|
|
56
|
+
|
|
57
|
+
} // namespace node
|
|
58
|
+
|
|
59
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
60
|
+
|
|
61
|
+
#endif // SRC_ENCODING_BINDING_H_
|