From 9305239c7301f3d6924ab90dbbfb3fe2aef40256 Mon Sep 17 00:00:00 2001 From: Zijian Zhang Date: Sun, 21 Jan 2024 15:19:56 +0800 Subject: [PATCH] build: add ScriptX prebuilt package --- .github/ISSUE_TEMPLATE/bug_report.md | 38 - .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/feature_request.md | 24 - .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/build.yml | 40 +- .github/workflows/release.yml | 42 +- COPYING | 674 + LICENSE | 165 - .../include/backend/Lua/LuaByteBufferImpl.h | 43 - .../include/backend/Lua/LuaEngine.h | 290 - .../include/backend/Lua/LuaEngine.hpp | 311 - .../include/backend/Lua/LuaHelper.h | 54 - .../include/backend/Lua/LuaHelper.hpp | 149 - .../include/backend/Lua/LuaNative.hpp | 66 - .../include/backend/Lua/LuaReference.hpp | 290 - .../include/backend/Lua/LuaScope.hpp | 30 - .../include/backend/Lua/trait/TraitEngine.h | 33 - .../backend/Lua/trait/TraitException.h | 39 - .../include/backend/Lua/trait/TraitIncludes.h | 27 - .../include/backend/Lua/trait/TraitNative.h | 51 - .../backend/Lua/trait/TraitReference.h | 71 - .../include/backend/Lua/trait/TraitScope.h | 85 - .../include/backend/Lua/trait/TraitUtils.h | 38 - .../include/backend/Python/PyEngine.h | 702 - .../include/backend/Python/PyHelper.h | 136 - .../include/backend/Python/PyHelper.hpp | 153 - .../include/backend/Python/PyInternalHelper.h | 34 - .../include/backend/Python/PyNative.hpp | 46 - .../include/backend/Python/PyReference.hpp | 163 - .../backend/Python/PyRuntimeSettings.h | 38 - .../include/backend/Python/PyScope.h | 57 - .../backend/Python/trait/TraitEngine.h | 36 - .../backend/Python/trait/TraitException.h | 57 - .../backend/Python/trait/TraitIncludes.h | 26 - .../backend/Python/trait/TraitNative.h | 49 - .../backend/Python/trait/TraitReference.h | 94 - .../include/backend/Python/trait/TraitScope.h | 40 - .../include/backend/Python/trait/TraitUtils.h | 36 - .../include/backend/QuickJs/QjsEngine.h | 198 - .../include/backend/QuickJs/QjsEngine.hpp | 234 - .../include/backend/QuickJs/QjsHelper.h | 53 - .../include/backend/QuickJs/QjsHelper.hpp | 104 - .../include/backend/QuickJs/QjsNative.hpp | 48 - .../include/backend/QuickJs/QjsReference.hpp | 290 - .../backend/QuickJs/trait/TraitEngine.h | 34 - .../backend/QuickJs/trait/TraitException.h | 43 - .../backend/QuickJs/trait/TraitIncludes.h | 27 - .../backend/QuickJs/trait/TraitNative.h | 49 - .../backend/QuickJs/trait/TraitReference.h | 110 - .../backend/QuickJs/trait/TraitScope.h | 75 - .../backend/QuickJs/trait/TraitUtils.h | 45 - .../include/backend/V8/V8Engine.h | 272 - .../include/backend/V8/V8Engine.hpp | 270 - .../include/backend/V8/V8Helper.h | 50 - .../include/backend/V8/V8Helper.hpp | 102 - .../include/backend/V8/V8Native.hpp | 49 - .../include/backend/V8/V8Platform.h | 141 - .../include/backend/V8/V8Reference.hpp | 259 - .../include/backend/V8/V8Scope.h | 58 - .../include/backend/V8/V8Scope.hpp | 31 - .../backend/V8/thirdparty/utfcpp/utf8-min.h | 133 - .../include/backend/V8/trait/TraitEngine.h | 33 - .../include/backend/V8/trait/TraitException.h | 44 - .../include/backend/V8/trait/TraitIncludes.h | 29 - .../include/backend/V8/trait/TraitNative.h | 50 - .../include/backend/V8/trait/TraitReference.h | 130 - .../include/backend/V8/trait/TraitScope.h | 42 - .../include/backend/V8/trait/TraitUtils.h | 35 - .../include/libnode/aliased_buffer.h | 315 - .../include/libnode/aliased_struct-inl.h | 54 - .../include/libnode/aliased_struct.h | 63 - .../include/libnode/allocated_buffer-inl.h | 110 - .../include/libnode/allocated_buffer.h | 73 - .../include/libnode/async_wrap-inl.h | 94 - .../include/libnode/async_wrap.h | 246 - .../include/libnode/base64-inl.h | 189 - .../s/scriptx-legacy/include/libnode/base64.h | 69 - .../include/libnode/base_object-inl.h | 374 - .../include/libnode/base_object.h | 294 - .../include/libnode/callback_queue-inl.h | 97 - .../include/libnode/callback_queue.h | 78 - .../include/libnode/cares_wrap.h | 523 - .../include/libnode/connect_wrap.h | 26 - .../include/libnode/connection_wrap.h | 30 - .../include/libnode/crypto/crypto_aes.h | 90 - .../include/libnode/crypto/crypto_bio.h | 194 - .../include/libnode/crypto/crypto_cipher.h | 291 - .../libnode/crypto/crypto_clienthello-inl.h | 90 - .../libnode/crypto/crypto_clienthello.h | 131 - .../include/libnode/crypto/crypto_common.h | 164 - .../include/libnode/crypto/crypto_context.h | 148 - .../include/libnode/crypto/crypto_dh.h | 158 - .../include/libnode/crypto/crypto_dsa.h | 77 - .../include/libnode/crypto/crypto_ec.h | 171 - .../include/libnode/crypto/crypto_groups.h | 415 - .../include/libnode/crypto/crypto_hash.h | 90 - .../include/libnode/crypto/crypto_hkdf.h | 66 - .../include/libnode/crypto/crypto_hmac.h | 95 - .../include/libnode/crypto/crypto_keygen.h | 306 - .../include/libnode/crypto/crypto_keys.h | 420 - .../include/libnode/crypto/crypto_pbkdf2.h | 76 - .../include/libnode/crypto/crypto_random.h | 131 - .../include/libnode/crypto/crypto_rsa.h | 142 - .../include/libnode/crypto/crypto_scrypt.h | 87 - .../include/libnode/crypto/crypto_sig.h | 169 - .../include/libnode/crypto/crypto_spkac.h | 21 - .../include/libnode/crypto/crypto_timing.h | 20 - .../include/libnode/crypto/crypto_tls.h | 293 - .../include/libnode/crypto/crypto_util.h | 792 - .../include/libnode/crypto/crypto_x509.h | 143 - .../include/libnode/debug_utils-inl.h | 223 - .../include/libnode/debug_utils.h | 184 - .../include/libnode/diagnosticfilename-inl.h | 33 - .../scriptx-legacy/include/libnode/env-inl.h | 1297 -- .../s/scriptx-legacy/include/libnode/env.h | 1644 -- .../include/libnode/handle_wrap.h | 121 - .../include/libnode/histogram-inl.h | 107 - .../include/libnode/histogram.h | 239 - .../libnode/inspector/main_thread_interface.h | 106 - .../include/libnode/inspector/node_string.h | 105 - .../include/libnode/inspector/runtime_agent.h | 31 - .../include/libnode/inspector/tracing_agent.h | 43 - .../include/libnode/inspector/worker_agent.h | 40 - .../libnode/inspector/worker_inspector.h | 113 - .../include/libnode/inspector_agent.h | 144 - .../include/libnode/inspector_io.h | 78 - .../include/libnode/inspector_profiler.h | 149 - .../include/libnode/inspector_socket.h | 60 - .../include/libnode/inspector_socket_server.h | 110 - .../include/libnode/js_native_api.h | 578 - .../include/libnode/js_native_api_types.h | 160 - .../include/libnode/js_native_api_v8.h | 453 - .../libnode/js_native_api_v8_internals.h | 39 - .../include/libnode/js_stream.h | 52 - .../include/libnode/json_utils.h | 161 - .../libnode/large_pages/node_large_page.h | 34 - .../include/libnode/memory_tracker-inl.h | 356 - .../include/libnode/memory_tracker.h | 284 - .../include/libnode/module_wrap.h | 116 - .../s/scriptx-legacy/include/libnode/node.h | 1158 -- .../scriptx-legacy/include/libnode/node_api.h | 275 - .../include/libnode/node_api_internals.h | 30 - .../include/libnode/node_api_types.h | 50 - .../include/libnode/node_binding.h | 99 - .../include/libnode/node_blob.h | 191 - .../include/libnode/node_bob-inl.h | 37 - .../scriptx-legacy/include/libnode/node_bob.h | 111 - .../include/libnode/node_buffer.h | 92 - .../include/libnode/node_constants.h | 84 - .../include/libnode/node_context_data.h | 44 - .../include/libnode/node_contextify.h | 196 - .../include/libnode/node_crypto.h | 57 - .../scriptx-legacy/include/libnode/node_dir.h | 52 - .../include/libnode/node_dtrace.h | 86 - .../include/libnode/node_errors.h | 277 - .../include/libnode/node_external_reference.h | 143 - .../include/libnode/node_file-inl.h | 306 - .../include/libnode/node_file.h | 426 - .../include/libnode/node_http2.h | 1145 -- .../include/libnode/node_http2_state.h | 149 - .../include/libnode/node_http_common-inl.h | 201 - .../include/libnode/node_http_common.h | 531 - .../include/libnode/node_i18n.h | 145 - .../include/libnode/node_internals.h | 422 - .../include/libnode/node_main_instance.h | 103 - .../include/libnode/node_mem-inl.h | 112 - .../scriptx-legacy/include/libnode/node_mem.h | 45 - .../include/libnode/node_messaging.h | 373 - .../include/libnode/node_metadata.h | 122 - .../include/libnode/node_mutex.h | 323 - .../include/libnode/node_native_module.h | 101 - .../include/libnode/node_native_module_env.h | 68 - .../include/libnode/node_object_wrap.h | 132 - .../include/libnode/node_options-inl.h | 477 - .../include/libnode/node_options.h | 495 - .../include/libnode/node_perf.h | 168 - .../include/libnode/node_perf_common.h | 89 - .../include/libnode/node_platform.h | 192 - .../include/libnode/node_process-inl.h | 26 - .../include/libnode/node_process.h | 97 - .../include/libnode/node_report.h | 47 - .../include/libnode/node_revert.h | 84 - .../include/libnode/node_root_certs.h | 3246 ---- .../include/libnode/node_snapshotable.h | 138 - .../include/libnode/node_sockaddr-inl.h | 266 - .../include/libnode/node_sockaddr.h | 405 - .../include/libnode/node_stat_watcher.h | 72 - .../include/libnode/node_union_bytes.h | 103 - .../scriptx-legacy/include/libnode/node_url.h | 205 - .../scriptx-legacy/include/libnode/node_v8.h | 41 - .../include/libnode/node_v8_platform-inl.h | 194 - .../include/libnode/node_version.h | 98 - .../include/libnode/node_wasi.h | 108 - .../include/libnode/node_watchdog.h | 152 - .../libnode/node_win32_etw_provider-inl.h | 288 - .../include/libnode/node_win32_etw_provider.h | 99 - .../include/libnode/node_worker.h | 145 - .../include/libnode/pipe_wrap.h | 80 - .../include/libnode/req_wrap-inl.h | 170 - .../scriptx-legacy/include/libnode/req_wrap.h | 77 - .../include/libnode/spawn_sync.h | 242 - .../include/libnode/stream_base-inl.h | 308 - .../include/libnode/stream_base.h | 459 - .../include/libnode/stream_pipe.h | 77 - .../include/libnode/stream_wrap.h | 133 - .../include/libnode/string_bytes.h | 122 - .../include/libnode/string_decoder-inl.h | 37 - .../include/libnode/string_decoder.h | 50 - .../include/libnode/string_search.h | 638 - .../scriptx-legacy/include/libnode/tcp_wrap.h | 103 - .../include/libnode/threadpoolwork-inl.h | 57 - .../include/libnode/timer_wrap-inl.h | 32 - .../include/libnode/timer_wrap.h | 85 - .../include/libnode/tracing/agent.h | 195 - .../libnode/tracing/node_trace_buffer.h | 83 - .../libnode/tracing/node_trace_writer.h | 75 - .../include/libnode/tracing/trace_event.h | 720 - .../libnode/tracing/trace_event_common.h | 1109 -- .../include/libnode/tracing/traced_value.h | 70 - .../scriptx-legacy/include/libnode/tty_wrap.h | 66 - .../scriptx-legacy/include/libnode/udp_wrap.h | 227 - .../scriptx-legacy/include/libnode/util-inl.h | 575 - .../s/scriptx-legacy/include/libnode/util.h | 825 - .../s/scriptx-legacy/include/libnode/uv/uv.h | 1849 --- .../include/libnode/uv/uv/aix.h | 32 - .../include/libnode/uv/uv/android-ifaddrs.h | 54 - .../include/libnode/uv/uv/bsd.h | 34 - .../include/libnode/uv/uv/darwin.h | 61 - .../include/libnode/uv/uv/errno.h | 460 - .../include/libnode/uv/uv/linux.h | 34 - .../include/libnode/uv/uv/os390.h | 33 - .../include/libnode/uv/uv/posix.h | 31 - .../include/libnode/uv/uv/stdint-msvc2008.h | 247 - .../include/libnode/uv/uv/sunos.h | 44 - .../include/libnode/uv/uv/threadpool.h | 37 - .../include/libnode/uv/uv/tree.h | 768 - .../include/libnode/uv/uv/unix.h | 505 - .../include/libnode/uv/uv/version.h | 43 - .../include/libnode/uv/uv/win.h | 698 - .../include/libnode/v8/APIDesign.md | 72 - .../s/scriptx-legacy/include/libnode/v8/DEPS | 10 - .../include/libnode/v8/DIR_METADATA | 11 - .../scriptx-legacy/include/libnode/v8/OWNERS | 20 - .../include/libnode/v8/cppgc/DEPS | 8 - .../include/libnode/v8/cppgc/OWNERS | 2 - .../include/libnode/v8/cppgc/README.md | 5 - .../include/libnode/v8/cppgc/allocation.h | 233 - .../include/libnode/v8/cppgc/common.h | 29 - .../v8/cppgc/cross-thread-persistent.h | 413 - .../include/libnode/v8/cppgc/custom-space.h | 97 - .../libnode/v8/cppgc/default-platform.h | 75 - .../include/libnode/v8/cppgc/ephemeron-pair.h | 30 - .../libnode/v8/cppgc/explicit-management.h | 82 - .../libnode/v8/cppgc/garbage-collected.h | 117 - .../libnode/v8/cppgc/heap-consistency.h | 253 - .../include/libnode/v8/cppgc/heap-state.h | 70 - .../libnode/v8/cppgc/heap-statistics.h | 120 - .../include/libnode/v8/cppgc/heap.h | 201 - .../libnode/v8/cppgc/internal/api-constants.h | 47 - .../v8/cppgc/internal/atomic-entry-flag.h | 48 - .../v8/cppgc/internal/caged-heap-local-data.h | 68 - .../v8/cppgc/internal/compiler-specific.h | 38 - .../v8/cppgc/internal/finalizer-trait.h | 90 - .../libnode/v8/cppgc/internal/gc-info.h | 76 - .../libnode/v8/cppgc/internal/logging.h | 50 - .../libnode/v8/cppgc/internal/name-trait.h | 111 - .../v8/cppgc/internal/persistent-node.h | 172 - .../v8/cppgc/internal/pointer-policies.h | 175 - .../v8/cppgc/internal/prefinalizer-handler.h | 30 - .../libnode/v8/cppgc/internal/write-barrier.h | 433 - .../libnode/v8/cppgc/liveness-broker.h | 77 - .../include/libnode/v8/cppgc/macros.h | 26 - .../include/libnode/v8/cppgc/member.h | 288 - .../include/libnode/v8/cppgc/name-provider.h | 65 - .../libnode/v8/cppgc/object-size-trait.h | 58 - .../include/libnode/v8/cppgc/persistent.h | 371 - .../include/libnode/v8/cppgc/platform.h | 154 - .../include/libnode/v8/cppgc/prefinalizer.h | 52 - .../v8/cppgc/process-heap-statistics.h | 36 - .../libnode/v8/cppgc/sentinel-pointer.h | 32 - .../libnode/v8/cppgc/source-location.h | 92 - .../include/libnode/v8/cppgc/testing.h | 99 - .../include/libnode/v8/cppgc/trace-trait.h | 116 - .../include/libnode/v8/cppgc/type-traits.h | 247 - .../include/libnode/v8/cppgc/visitor.h | 379 - .../include/libnode/v8/js_protocol-1.2.json | 997 -- .../include/libnode/v8/js_protocol-1.3.json | 1205 -- .../include/libnode/v8/js_protocol.pdl | 1693 --- .../include/libnode/v8/libplatform/DEPS | 9 - .../v8/libplatform/libplatform-export.h | 29 - .../libnode/v8/libplatform/libplatform.h | 117 - .../libnode/v8/libplatform/v8-tracing.h | 334 - .../include/libnode/v8/v8-cppgc.h | 325 - .../include/libnode/v8/v8-fast-api-calls.h | 836 - .../libnode/v8/v8-inspector-protocol.h | 13 - .../include/libnode/v8/v8-inspector.h | 345 - .../include/libnode/v8/v8-internal.h | 511 - .../include/libnode/v8/v8-metrics.h | 202 - .../include/libnode/v8/v8-platform.h | 709 - .../include/libnode/v8/v8-profiler.h | 1123 -- .../include/libnode/v8/v8-unwinder-state.h | 30 - .../include/libnode/v8/v8-util.h | 652 - .../libnode/v8/v8-value-serializer-version.h | 24 - .../include/libnode/v8/v8-version-string.h | 38 - .../include/libnode/v8/v8-version.h | 20 - .../libnode/v8/v8-wasm-trap-handler-posix.h | 31 - .../libnode/v8/v8-wasm-trap-handler-win.h | 28 - .../s/scriptx-legacy/include/libnode/v8/v8.h | 12652 ---------------- .../include/libnode/v8/v8config.h | 560 - .../s/scriptx-legacy/include/libnode/v8abbr.h | 123 - .../s/scriptx-legacy/include/lua/lapi.h | 49 - .../s/scriptx-legacy/include/lua/lauxlib.h | 293 - .../s/scriptx-legacy/include/lua/lcode.h | 104 - .../s/scriptx-legacy/include/lua/lctype.h | 101 - .../s/scriptx-legacy/include/lua/ldebug.h | 63 - .../s/scriptx-legacy/include/lua/ldo.h | 79 - .../s/scriptx-legacy/include/lua/lfunc.h | 64 - .../s/scriptx-legacy/include/lua/lgc.h | 189 - .../s/scriptx-legacy/include/lua/ljumptab.h | 112 - .../s/scriptx-legacy/include/lua/llex.h | 91 - .../s/scriptx-legacy/include/lua/llimits.h | 353 - .../s/scriptx-legacy/include/lua/lmem.h | 93 - .../s/scriptx-legacy/include/lua/lobject.h | 800 - .../s/scriptx-legacy/include/lua/lopcodes.h | 392 - .../s/scriptx-legacy/include/lua/lopnames.h | 103 - .../s/scriptx-legacy/include/lua/lparser.h | 171 - .../s/scriptx-legacy/include/lua/lprefix.h | 45 - .../s/scriptx-legacy/include/lua/lstate.h | 404 - .../s/scriptx-legacy/include/lua/lstring.h | 57 - .../s/scriptx-legacy/include/lua/ltable.h | 66 - .../s/scriptx-legacy/include/lua/ltm.h | 103 - .../s/scriptx-legacy/include/lua/lua.h | 518 - .../s/scriptx-legacy/include/lua/lua.hpp | 9 - .../s/scriptx-legacy/include/lua/luaconf.h | 790 - .../s/scriptx-legacy/include/lua/lualib.h | 52 - .../s/scriptx-legacy/include/lua/lundump.h | 36 - .../s/scriptx-legacy/include/lua/lvm.h | 136 - .../s/scriptx-legacy/include/lua/lzio.h | 66 - .../scriptx-legacy/include/python310/Python.h | 148 - .../include/python310/abstract.h | 873 -- .../include/python310/bltinmodule.h | 14 - .../include/python310/boolobject.h | 43 - .../include/python310/bytearrayobject.h | 46 - .../include/python310/bytesobject.h | 69 - .../include/python310/cellobject.h | 29 - .../scriptx-legacy/include/python310/ceval.h | 158 - .../include/python310/classobject.h | 57 - .../s/scriptx-legacy/include/python310/code.h | 20 - .../scriptx-legacy/include/python310/codecs.h | 248 - .../include/python310/compile.h | 25 - .../include/python310/complexobject.h | 69 - .../include/python310/context.h | 81 - .../include/python310/cpython/abstract.h | 373 - .../python310/cpython/bytearrayobject.h | 20 - .../include/python310/cpython/bytesobject.h | 118 - .../include/python310/cpython/ceval.h | 30 - .../include/python310/cpython/code.h | 184 - .../include/python310/cpython/compile.h | 54 - .../include/python310/cpython/dictobject.h | 84 - .../include/python310/cpython/fileobject.h | 18 - .../include/python310/cpython/fileutils.h | 172 - .../include/python310/cpython/frameobject.h | 94 - .../include/python310/cpython/import.h | 46 - .../include/python310/cpython/initconfig.h | 249 - .../python310/cpython/interpreteridobject.h | 11 - .../include/python310/cpython/listobject.h | 34 - .../include/python310/cpython/methodobject.h | 35 - .../include/python310/cpython/object.h | 552 - .../include/python310/cpython/objimpl.h | 100 - .../include/python310/cpython/odictobject.h | 43 - .../python310/cpython/picklebufobject.h | 31 - .../include/python310/cpython/pyctype.h | 39 - .../include/python310/cpython/pydebug.h | 38 - .../include/python310/cpython/pyerrors.h | 214 - .../include/python310/cpython/pyfpe.h | 15 - .../include/python310/cpython/pylifecycle.h | 64 - .../include/python310/cpython/pymem.h | 98 - .../include/python310/cpython/pystate.h | 305 - .../include/python310/cpython/pythonrun.h | 121 - .../include/python310/cpython/pytime.h | 247 - .../include/python310/cpython/sysmodule.h | 16 - .../include/python310/cpython/traceback.h | 14 - .../include/python310/cpython/tupleobject.h | 28 - .../include/python310/cpython/unicodeobject.h | 1169 -- .../include/python310/datetime.h | 267 - .../include/python310/descrobject.h | 108 - .../include/python310/dictobject.h | 97 - .../include/python310/dynamic_annotations.h | 499 - .../include/python310/enumobject.h | 17 - .../include/python310/errcode.h | 38 - .../s/scriptx-legacy/include/python310/eval.h | 27 - .../include/python310/exports.h | 30 - .../include/python310/fileobject.h | 49 - .../include/python310/fileutils.h | 26 - .../include/python310/floatobject.h | 118 - .../include/python310/frameobject.h | 20 - .../include/python310/funcobject.h | 110 - .../include/python310/genericaliasobject.h | 14 - .../include/python310/genobject.h | 100 - .../scriptx-legacy/include/python310/import.h | 98 - .../python310/internal/pycore_abstract.h | 22 - .../include/python310/internal/pycore_accu.h | 39 - .../include/python310/internal/pycore_asdl.h | 112 - .../include/python310/internal/pycore_ast.h | 855 -- .../python310/internal/pycore_ast_state.h | 255 - .../python310/internal/pycore_atomic.h | 557 - .../python310/internal/pycore_atomic_funcs.h | 94 - .../python310/internal/pycore_bitutils.h | 176 - .../internal/pycore_blocks_output_buffer.h | 317 - .../python310/internal/pycore_bytes_methods.h | 73 - .../include/python310/internal/pycore_call.h | 39 - .../include/python310/internal/pycore_ceval.h | 114 - .../include/python310/internal/pycore_code.h | 34 - .../python310/internal/pycore_compile.h | 44 - .../python310/internal/pycore_condvar.h | 95 - .../python310/internal/pycore_context.h | 42 - .../include/python310/internal/pycore_dtoa.h | 23 - .../python310/internal/pycore_fileutils.h | 71 - .../python310/internal/pycore_format.h | 27 - .../include/python310/internal/pycore_gc.h | 181 - .../python310/internal/pycore_getopt.h | 22 - .../include/python310/internal/pycore_gil.h | 50 - .../include/python310/internal/pycore_hamt.h | 128 - .../python310/internal/pycore_hashtable.h | 148 - .../python310/internal/pycore_import.h | 17 - .../python310/internal/pycore_initconfig.h | 178 - .../python310/internal/pycore_interp.h | 339 - .../include/python310/internal/pycore_list.h | 20 - .../include/python310/internal/pycore_long.h | 75 - .../python310/internal/pycore_moduleobject.h | 42 - .../python310/internal/pycore_object.h | 186 - .../python310/internal/pycore_parser.h | 31 - .../python310/internal/pycore_pathconfig.h | 73 - .../python310/internal/pycore_pyarena.h | 64 - .../python310/internal/pycore_pyerrors.h | 96 - .../python310/internal/pycore_pyhash.h | 10 - .../python310/internal/pycore_pylifecycle.h | 141 - .../include/python310/internal/pycore_pymem.h | 101 - .../python310/internal/pycore_pystate.h | 153 - .../python310/internal/pycore_runtime.h | 157 - .../python310/internal/pycore_structseq.h | 21 - .../python310/internal/pycore_symtable.h | 133 - .../python310/internal/pycore_sysmodule.h | 24 - .../python310/internal/pycore_traceback.h | 93 - .../include/python310/internal/pycore_tuple.h | 20 - .../python310/internal/pycore_ucnhash.h | 34 - .../python310/internal/pycore_unionobject.h | 22 - .../python310/internal/pycore_warnings.h | 25 - .../include/python310/interpreteridobject.h | 17 - .../include/python310/intrcheck.h | 30 - .../include/python310/iterobject.h | 27 - .../include/python310/listobject.h | 52 - .../include/python310/longintrepr.h | 99 - .../include/python310/longobject.h | 220 - .../include/python310/marshal.h | 28 - .../include/python310/memoryobject.h | 72 - .../include/python310/methodobject.h | 116 - .../include/python310/modsupport.h | 263 - .../include/python310/moduleobject.h | 96 - .../include/python310/namespaceobject.h | 19 - .../scriptx-legacy/include/python310/object.h | 749 - .../include/python310/objimpl.h | 215 - .../scriptx-legacy/include/python310/opcode.h | 172 - .../scriptx-legacy/include/python310/osdefs.h | 51 - .../include/python310/osmodule.h | 17 - .../include/python310/patchlevel.h | 35 - .../include/python310/py_curses.h | 99 - .../include/python310/pycapsule.h | 59 - .../include/python310/pyconfig.h | 690 - .../include/python310/pydtrace.h | 59 - .../include/python310/pyerrors.h | 324 - .../include/python310/pyexpat.h | 55 - .../include/python310/pyframe.h | 22 - .../scriptx-legacy/include/python310/pyhash.h | 144 - .../include/python310/pylifecycle.h | 74 - .../include/python310/pymacconfig.h | 102 - .../include/python310/pymacro.h | 132 - .../scriptx-legacy/include/python310/pymath.h | 230 - .../scriptx-legacy/include/python310/pymem.h | 104 - .../scriptx-legacy/include/python310/pyport.h | 889 -- .../include/python310/pystate.h | 150 - .../include/python310/pystrcmp.h | 23 - .../include/python310/pystrhex.h | 22 - .../include/python310/pystrtod.h | 45 - .../include/python310/pythonrun.h | 44 - .../include/python310/pythread.h | 169 - .../include/python310/rangeobject.h | 27 - .../include/python310/setobject.h | 110 - .../include/python310/sliceobject.h | 65 - .../include/python310/structmember.h | 75 - .../include/python310/structseq.h | 49 - .../include/python310/sysmodule.h | 41 - .../scriptx-legacy/include/python310/token.h | 97 - .../include/python310/traceback.h | 26 - .../include/python310/tracemalloc.h | 38 - .../include/python310/tupleobject.h | 46 - .../include/python310/typeslots.h | 94 - .../include/python310/unicodeobject.h | 1053 -- .../include/python310/warnings.h | 67 - .../include/python310/weakrefobject.h | 86 - .../include/quickjs/quickjs-libc.h | 59 - .../scriptx-legacy/include/quickjs/quickjs.h | 1154 -- .../s/scriptx-legacy/include/scriptx/Engine.h | 285 - .../scriptx-legacy/include/scriptx/Engine.hpp | 87 - .../include/scriptx/Exception.h | 92 - .../scriptx-legacy/include/scriptx/Includes.h | 21 - .../include/scriptx/Inspector.h | 91 - .../s/scriptx-legacy/include/scriptx/Native.h | 550 - .../scriptx-legacy/include/scriptx/Native.hpp | 1060 -- .../include/scriptx/NativeConverter.hpp | 276 - .../include/scriptx/Reference.h | 645 - .../s/scriptx-legacy/include/scriptx/Scope.h | 252 - .../s/scriptx-legacy/include/scriptx/Utils.h | 165 - .../s/scriptx-legacy/include/scriptx/Value.h | 328 - .../include/scriptx/foundation.h | 110 - .../include/scriptx/include/ScriptX/ScriptX.h | 65 - .../s/scriptx-legacy/include/scriptx/types.h | 175 - .../scriptx/utils/GlobalWeakBookkeeping.hpp | 248 - .../include/scriptx/utils/Helper.hpp | 60 - .../include/scriptx/utils/MemoryPool.hpp | 197 - .../include/scriptx/utils/MessageQueue.h | 478 - .../include/scriptx/utils/ThreadLocal.h | 121 - .../include/scriptx/utils/ThreadPool.h | 83 - .../include/scriptx/utils/TypeInformation.h | 72 - .../scriptx-legacy/include/scriptx/version.h | 34 - repo/packages/s/scriptx-legacy/xmake.lua | 12 - repo/packages/t/threadpool/xmake.lua | 11 - .../t/threadpool/include => src}/ThreadPool.h | 0 xmake.lua | 135 +- 529 files changed, 818 insertions(+), 108758 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 COPYING delete mode 100644 LICENSE delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaByteBufferImpl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaNative.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaReference.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/LuaScope.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitException.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitIncludes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitNative.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitReference.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitScope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitUtils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyInternalHelper.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyNative.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyReference.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyRuntimeSettings.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/PyScope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitException.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitIncludes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitNative.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitReference.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitScope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitUtils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsNative.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsReference.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitException.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitIncludes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitNative.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitReference.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitScope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitUtils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Native.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Platform.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Reference.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/thirdparty/utfcpp/utf8-min.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitEngine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitException.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitIncludes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitNative.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitReference.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitScope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitUtils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/aliased_buffer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/aliased_struct-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/aliased_struct.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/async_wrap-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/async_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/base64-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/base64.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/base_object-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/base_object.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/callback_queue-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/callback_queue.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/cares_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/connect_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/connection_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_aes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_bio.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_cipher.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_common.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_context.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dh.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dsa.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_ec.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_groups.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hash.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hkdf.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hmac.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keygen.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keys.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_pbkdf2.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_random.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_rsa.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_scrypt.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_sig.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_spkac.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_timing.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_tls.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_util.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_x509.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/debug_utils-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/debug_utils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/diagnosticfilename-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/env-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/env.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/handle_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/histogram-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/histogram.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector/main_thread_interface.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector/node_string.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector/runtime_agent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector/tracing_agent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_agent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_inspector.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector_agent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector_io.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector_profiler.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector_socket.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/inspector_socket_server.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/js_native_api.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/js_native_api_types.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8_internals.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/js_stream.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/json_utils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/large_pages/node_large_page.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/memory_tracker-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/memory_tracker.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/module_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_api.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_api_internals.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_api_types.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_binding.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_blob.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_bob-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_bob.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_buffer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_constants.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_context_data.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_contextify.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_crypto.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_dir.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_dtrace.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_errors.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_external_reference.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_file-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_file.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_http2.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_http2_state.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_http_common-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_http_common.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_i18n.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_internals.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_main_instance.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_mem-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_mem.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_messaging.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_metadata.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_mutex.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_native_module.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_native_module_env.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_object_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_options-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_options.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_perf.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_perf_common.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_platform.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_process-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_process.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_report.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_revert.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_root_certs.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_snapshotable.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_stat_watcher.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_union_bytes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_url.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_v8.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_v8_platform-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_version.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_wasi.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_watchdog.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/node_worker.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/pipe_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/req_wrap-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/req_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/spawn_sync.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/stream_base-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/stream_base.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/stream_pipe.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/stream_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/string_bytes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/string_decoder-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/string_decoder.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/string_search.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tcp_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/threadpoolwork-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/timer_wrap-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/timer_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tracing/agent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_buffer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_writer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event_common.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tracing/traced_value.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/tty_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/udp_wrap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/util-inl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/util.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/aix.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/android-ifaddrs.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/bsd.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/darwin.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/errno.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/linux.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/os390.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/posix.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/stdint-msvc2008.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/sunos.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/threadpool.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/tree.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/unix.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/version.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/uv/uv/win.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/APIDesign.md delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/DEPS delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/DIR_METADATA delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/OWNERS delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/DEPS delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/OWNERS delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/README.md delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/allocation.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/common.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/cross-thread-persistent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/custom-space.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/default-platform.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/ephemeron-pair.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/explicit-management.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/garbage-collected.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-consistency.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-state.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-statistics.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/api-constants.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/atomic-entry-flag.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/caged-heap-local-data.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/compiler-specific.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/finalizer-trait.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/gc-info.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/logging.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/name-trait.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/persistent-node.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/pointer-policies.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/prefinalizer-handler.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/write-barrier.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/liveness-broker.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/macros.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/member.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/name-provider.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/object-size-trait.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/persistent.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/platform.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/prefinalizer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/process-heap-statistics.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/sentinel-pointer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/source-location.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/testing.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/trace-trait.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/type-traits.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/visitor.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.2.json delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.3.json delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol.pdl delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/DEPS delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform-export.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/v8-tracing.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-cppgc.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-fast-api-calls.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector-protocol.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-internal.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-metrics.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-platform.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-profiler.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-unwinder-state.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-util.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-value-serializer-version.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version-string.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-posix.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-win.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8/v8config.h delete mode 100644 repo/packages/s/scriptx-legacy/include/libnode/v8abbr.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lapi.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lauxlib.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lcode.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lctype.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/ldebug.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/ldo.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lfunc.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lgc.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/ljumptab.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/llex.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/llimits.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lmem.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lopcodes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lopnames.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lparser.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lprefix.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lstate.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lstring.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/ltable.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/ltm.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lua.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lua.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/luaconf.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lualib.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lundump.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lvm.h delete mode 100644 repo/packages/s/scriptx-legacy/include/lua/lzio.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/Python.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/abstract.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/bltinmodule.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/boolobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/bytearrayobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/bytesobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cellobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/ceval.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/classobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/code.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/codecs.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/compile.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/complexobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/context.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/abstract.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/bytearrayobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/bytesobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/ceval.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/code.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/compile.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/dictobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/fileobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/fileutils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/frameobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/import.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/initconfig.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/interpreteridobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/listobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/methodobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/object.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/objimpl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/odictobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/picklebufobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pyctype.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pydebug.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pyerrors.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pyfpe.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pylifecycle.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pymem.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pystate.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pythonrun.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/pytime.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/sysmodule.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/traceback.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/tupleobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/cpython/unicodeobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/datetime.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/descrobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/dictobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/dynamic_annotations.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/enumobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/errcode.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/eval.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/exports.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/fileobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/fileutils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/floatobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/frameobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/funcobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/genericaliasobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/genobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/import.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_abstract.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_accu.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_asdl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_ast.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_ast_state.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_atomic.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_atomic_funcs.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_bitutils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_blocks_output_buffer.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_bytes_methods.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_call.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_ceval.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_code.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_compile.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_condvar.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_context.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_dtoa.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_fileutils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_format.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_gc.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_getopt.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_gil.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_hamt.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_hashtable.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_import.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_initconfig.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_interp.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_list.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_long.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_moduleobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_object.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_parser.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pathconfig.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pyarena.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pyerrors.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pyhash.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pylifecycle.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pymem.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_pystate.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_runtime.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_structseq.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_symtable.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_sysmodule.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_traceback.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_tuple.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_ucnhash.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_unionobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/internal/pycore_warnings.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/interpreteridobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/intrcheck.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/iterobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/listobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/longintrepr.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/longobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/marshal.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/memoryobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/methodobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/modsupport.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/moduleobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/namespaceobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/object.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/objimpl.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/opcode.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/osdefs.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/osmodule.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/patchlevel.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/py_curses.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pycapsule.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pyconfig.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pydtrace.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pyerrors.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pyexpat.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pyframe.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pyhash.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pylifecycle.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pymacconfig.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pymacro.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pymath.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pymem.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pyport.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pystate.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pystrcmp.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pystrhex.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pystrtod.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pythonrun.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/pythread.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/rangeobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/setobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/sliceobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/structmember.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/structseq.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/sysmodule.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/token.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/traceback.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/tracemalloc.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/tupleobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/typeslots.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/unicodeobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/warnings.h delete mode 100644 repo/packages/s/scriptx-legacy/include/python310/weakrefobject.h delete mode 100644 repo/packages/s/scriptx-legacy/include/quickjs/quickjs-libc.h delete mode 100644 repo/packages/s/scriptx-legacy/include/quickjs/quickjs.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Engine.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Engine.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Exception.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Includes.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Inspector.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Native.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Native.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/NativeConverter.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Reference.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Scope.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Utils.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/Value.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/foundation.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/include/ScriptX/ScriptX.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/types.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/GlobalWeakBookkeeping.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/Helper.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/MemoryPool.hpp delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/MessageQueue.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/ThreadLocal.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/ThreadPool.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/utils/TypeInformation.h delete mode 100644 repo/packages/s/scriptx-legacy/include/scriptx/version.h delete mode 100644 repo/packages/s/scriptx-legacy/xmake.lua delete mode 100644 repo/packages/t/threadpool/xmake.lua rename {repo/packages/t/threadpool/include => src}/ThreadPool.h (100%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 2438425e..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: 'Bug: ' -labels: 'bug' -assignees: '' - ---- - -**Describe the bug** - - - -**To Reproduce** - -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** - - - -**Screenshots** - - - -**Platform (please complete the following information):** - -- OS: -- BDS version: -- ScriptEngine version: - -**Additional context** - - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1c3513b4..754d78aa 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -46,8 +46,8 @@ body: - type: input attributes: - label: Version - description: The version of the plugin you are using. (e.g. 1.0.0) + label: LegacyScriptEngine Version + description: The version of LegacyScriptEngine you are using. (e.g. 1.0.0) - type: textarea attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 8142310f..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: 'enhancement' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** - - - -**Describe the solution you'd like** - - - -**Describe alternatives you've considered** - - - -**Additional context** - - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4c90dc59..58da3131 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,7 +12,7 @@ Thank you for your contribution to the repository. Before submitting this PR, please make sure: - [ ] Your code builds clean without any errors or warnings -- [ ] Your code follows [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) +- [ ] Your code follows [LeviLamina C++ Style Guide](https://github.com/LiteLDev/LeviLamina/wiki/CPP-Style-Guide) - [ ] You have tested all functions - [ ] You have not used code without license - [ ] You have added statement for third-party code diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e5908dc..55c7b8be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,32 +5,46 @@ on: jobs: build: + strategy: + matrix: + backend: + - lua + - nodejs + - python310 + - quickjs runs-on: windows-latest steps: - uses: actions/checkout@v4 - - uses: actions/cache@v3 - with: - path: | - ~/AppData/Local/.xmake - .xmake - key: xmake-legacyscriptengine-windows-x64-${{ github.sha }} - restore-keys: | - xmake-legacyscriptengine-windows-x64- - - uses: xmake-io/github-action-setup-xmake@v1 - + - run: | xmake repo -u - run: | - xmake f -a x64 -m release -p windows -v -y + xmake f -a x64 -m release -p windows -v -y --backend=${{ matrix.backend }} - run: | xmake -w -y - uses: actions/upload-artifact@v3 with: - name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} + name: legacy-script-engine-${{ matrix.backend }}-windows-x64-${{ github.sha }} path: | - bin/ + build/windows/x64/release/legacy-script-engine-${{ matrix.backend }}.dll + build/windows/x64/release/legacy-script-engine-${{ matrix.backend }}.pdb + + check-style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - run: | + npm install clang-format@1.8.0 + + - run: | + npx clang-format --dry-run --Werror $(find . -type f -name '*.cpp' -o -name '*.h') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e4fed22..86d86df9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,26 +5,33 @@ on: jobs: build: + strategy: + matrix: + backend: + - lua + - nodejs + - python310 + - quickjs runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: xmake-io/github-action-setup-xmake@v1 - + - run: | xmake repo -u - run: | - xmake f -a x64 -m release -p windows -v -y + xmake f -a x64 -m release -p windows -v -y --backend=${{ matrix.backend }} - run: | xmake -w -y - uses: actions/upload-artifact@v3 with: - name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} + name: legacy-script-engine-${{ matrix.backend }}-windows-x64-${{ github.sha }} path: | - bin/ + build/windows/x64/release/legacy-script-engine-${{ matrix.backend }}.dll upload-to-release: needs: @@ -32,13 +39,23 @@ jobs: permissions: contents: write runs-on: ubuntu-latest + strategy: + matrix: + backend: + - lua + - nodejs + - python310 + - quickjs steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v3 with: - name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} - path: release/ + name: legacy-script-engine-${{ matrix.backend }}-windows-x64-${{ github.sha }} + path: release/legacy-script-engine-${{ matrix.backend }}/ + + - run: | + cp -r assets/${{ matrix.backend }}/* release/legacy-script-engine-${{ matrix.backend }}/ - run: | cp LICENSE README.md release/ @@ -46,20 +63,11 @@ jobs: - name: Archive release run: | cd release - zip -r ../${{ github.event.repository.name }}-windows-x64.zip * + zip -r ../legacy-script-engine-${{ matrix.backend }}-windows-x64.zip * cd .. - - name: Calculate SHA256 - id: calculate-sha256 - run: | - echo release=$(sha256sum ${{ github.event.repository.name }}-windows-x64.zip | awk '{print $1}') >> $GITHUB_OUTPUT - - uses: softprops/action-gh-release@v1 with: append_body: true - body: | - | File | SHA256 | - | ---- | ------ | - | ${{ github.event.repository.name }}-windows-x64.zip | ${{ steps.calculate-sha256.outputs.release }} | files: | - ${{ github.event.repository.name }}-windows-x64.zip + legacy-script-engine-${{ matrix.backend }}-windows-x64.zip diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0a041280..00000000 --- a/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaByteBufferImpl.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaByteBufferImpl.h deleted file mode 100644 index 412b2f0f..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaByteBufferImpl.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "LuaEngine.h" - -namespace script::lua_backend { - -class LuaByteBufferImpl : public LuaByteBufferDelegate { - public: - LuaByteBufferImpl() = default; - - SCRIPTX_DISALLOW_COPY_AND_MOVE(LuaByteBufferImpl); - - ~LuaByteBufferImpl() override = default; - - void init(LuaEngine *engine) override; - - Local newByteBuffer(LuaEngine *engine, std::shared_ptr nativeBuffer, - size_t size) override; - - std::shared_ptr getByteBuffer(LuaEngine *engine, const Local &byteBuffer) override; - - size_t getByteBufferSize(LuaEngine *engine, const Local &byteBuffer) override; - - bool isByteBuffer(LuaEngine *engine, const Local &byteBuffer) override; -}; - -} // namespace script::lua_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.h deleted file mode 100644 index 831a6475..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.h +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX - * available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights - * reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/Engine.h" -#include "../../scriptx/Exception.h" -#include "../../scriptx/Native.h" -#include "../../scriptx/utils/GlobalWeakBookkeeping.hpp" -#include "../../scriptx/utils/MessageQueue.h" -#include "LuaHelper.h" -#include - -namespace script::lua_backend { - -class LuaByteBufferDelegate { -public: - LuaByteBufferDelegate() = default; - virtual ~LuaByteBufferDelegate() = default; - - SCRIPTX_DISALLOW_COPY_AND_MOVE(LuaByteBufferDelegate); - - virtual void init(LuaEngine *engine) = 0; - - /** - * create a new byte buffer object, return it's index on the stack - */ - virtual Local newByteBuffer(LuaEngine *engine, - std::shared_ptr nativeBuffer, - size_t size) = 0; - - /** - * get the underlying shared_ptr - */ - virtual std::shared_ptr - getByteBuffer(LuaEngine *engine, const Local &byteBuffer) = 0; - - virtual size_t getByteBufferSize(LuaEngine *engine, - const Local &byteBuffer) = 0; - - virtual bool isByteBuffer(LuaEngine *engine, - const Local &byteBuffer) = 0; -}; - -class LuaEngine : public ScriptEngine { -private: - // any pointer is fine, just need to be unique - static const void *const kLuaTableNativeThisPtrToken_; - static const void *const kLuaTableNativeClassDefinePtrToken_; - static const void *const kLuaNativeConstructorMarker_; - static const void *const kLuaNativeInternalStorageToken_; - static const void *const kLuaBuiltinDefinedClassMetaDataToken_; - - static const void *const kLuaGlobalRegistryToken_; - static const void *const kLuaWeakRegistryToken_; - - static constexpr auto kIsInstanceBuiltInFunctionName = "isInstance"; - static constexpr auto kMetaTableBuiltInInstanceFunctions = "instanceFunction"; - - std::mutex lock_; - std::shared_ptr<::script::utils::MessageQueue> messageQueue_; - size_t globalIdCounter_ = 1; - std::unordered_map> nativeDefineRegistry_; - ::script::internal::GlobalWeakBookkeeping globalWeakBookkeeping_; - std::unique_ptr byteBufferDelegate_; - - size_t globalRefCount_ = 0; - size_t weakRefCount_ = 0; - bool isDestroying_ = false; - - lua_State *lua_ = nullptr; - -public: - explicit LuaEngine( - std::shared_ptr<::script::utils::MessageQueue> queue = {}, - const std::function &luaStateFactory = {}, - std::unique_ptr byteBufferDelegate = {}); - - SCRIPTX_DISALLOW_COPY_AND_MOVE(LuaEngine); - - void destroy() override; - - bool isDestroying() const override; - - Local get(const Local &key) override; - - void set(const Local &key, const Local &value) override; - using ScriptEngine::set; - - Local eval(const Local &script, - const Local &sourceFile); - Local eval(const Local &script, - const Local &sourceFile) override; - Local eval(const Local &script) override; - using ScriptEngine::eval; - - Local loadFile(const Local &scriptFile) override; - - std::shared_ptr messageQueue() override; - - void gc() override; - - size_t getHeapSize() override; - - void adjustAssociatedMemory(int64_t count) override; - - ScriptLanguage getLanguageType() override; - - std::string getEngineVersion() override; - -protected: - ~LuaEngine() override; - -private: - void initGlobalRegistry(); - - Local get(const char *key); - - void set(const char *key, const Local &value); - - size_t globalIdCounter(); - - size_t putGlobalOrWeakTable(const Local &localReference, - const void *registryToken); - - void removeGlobalOrWeakTable(size_t id, const void *registryToken); - - Local getGlobalOrWeakTable(size_t index, - const void *registryToken) const; - - template - void registerNativeClassImpl(const ClassDefine *classDefine); - - static const ClassDefine &builtInFunctions(); - - void registerStaticDefine(const internal::StaticDefine &staticDefine, - int table, int metaTable); - - void defineStaticFunctions(const internal::StaticDefine &staticDefine, - int tableIndex); - - void defineStaticProperties(const internal::StaticDefine &staticDefine, - int tableIndex, int i); - - // [0, 0, -] - template - void registerInstanceDefine(const ClassDefine &classDefine, int table, - int staticMeta); - - // [0, 0, -] - template - void defineInstanceConstructor(const ClassDefine &classDefine, - int instanceMeta, int staticMeta) const; - - template - void defineInstanceFunctions(const ClassDefine &classDefine, - int instanceFunctionTable) const; - - template - void defineInstanceProperties(const ClassDefine &classDefine, - int instanceMeta, int instanceFunction) const; - - // [0, 0, -] - void setupMetaTableForProperties(int metaIndex, int instanceFunction, - int getterRegistryIndex, - int setterRegistryIndex) const; - - using PushFunctionCallback = Local (*)(lua_State *, void *, - const Arguments &); - /** - * push a lua function, the data will not be collected automatically. - * [0, +1, -] - */ - void pushFunction(const void *data, PushFunctionCallback callable); - - template - Local - newNativeClassImpl(const ClassDefine *classDefine, - const std::initializer_list> &args) { - return newNativeClassImpl(classDefine, args.size(), args.begin()); - } - - template - Local newNativeClassImpl(const ClassDefine *classDefine, - const std::vector> &args) { - return newNativeClassImpl(classDefine, args.size(), args.data()); - } - - template - Local newNativeClassImpl(const ClassDefine *classDefine, - size_t size, const Local *ptr); - - template - bool isInstanceOfImpl(const Local &value, - const ClassDefine *classDefine); - - template - T *getNativeInstanceImpl(const Local &value, - const ClassDefine *classDefine); - - static Local getClassMetaTable(lua_State *lua, int classIndex); - - static bool isInstanceOf(lua_State *lua, int classIndex, int selfIndex); - - static bool isInstanceOf(lua_State *lua, const void *classDefine, - int selfIndex); - - static void *getNativeThis(lua_State *lua, const void *classDefine, - int selfIndex); - - using PushInstanceFunctionCallback = Local (*)(lua_State *, void *, - void *, - const Arguments &); - /** - * [0, +1, -] - */ - void pushInstanceFunction(const void *data, const void *classDefine, - PushInstanceFunctionCallback callable) const; - -public: - template static T make(Args &&...args) { - return T(std::forward(args)...); - } - - template static int localRefIndex(const LocalRef &ref) { - return ref.val_; - } - - static Arguments makeArguments(LuaEngine *engine, int stackBase, - size_t paramCount, bool isInstanceFunc); - -private: - template friend class ::script::Local; - - template friend class ::script::Global; - - template friend class ::script::Weak; - - friend class ::script::Object; - - friend class ::script::Array; - - friend class ::script::Function; - - friend class ::script::ByteBuffer; - - friend class ::script::ScriptEngine; - - friend class ::script::Exception; - - friend class ::script::Arguments; - - friend class ::script::ScriptClass; - - friend class StackFrameScopeImpl; - - friend class EngineScopeImpl; - - friend class ExitEngineScopeImpl; - - friend class LuaByteBufferImpl; - - friend lua_State *currentLua(); - - friend void pushValue(lua_State *lua, const Local &local); - - template - friend void pushValues(lua_State *lua, size_t count, It begin); - - template static auto &refVal(Ref *ref) { return ref->val_; } - - friend struct LuaBookKeepFetcher; - - friend struct ::script::lua_interop; -}; -} // namespace script::lua_backend \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.hpp b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.hpp deleted file mode 100644 index d996e3c5..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaEngine.hpp +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Scope.h" -#include "../../scriptx/Utils.h" -#include "../../scriptx/utils/Helper.hpp" -#include "LuaEngine.h" -#include "LuaHelper.hpp" - -namespace script::lua_backend { - -/** - * - * The created binding class be like: - * - * \code{lua} - * - * Class = {} - * - * local staticMeta = { - * // constructor call - * __call = function() - * local ins = {}; - * setmetatable(inx, instanceMeta); - * return ins - * end - * } - * - * for staticFunc do - * Class[staticFunc.name] = function() ... end - * end - * - * setmetatable(Class, staticMeta) - * - * local instanceMeta = { - * __index = function() - * 1. find from `ClassDefine.instanceProperty` - * 2. find from `ClassDefine.instanceFunction` - * 3. return nil - * end - * - * __newindex = function() - * 1. find from `ClassDefine.instanceProperty` - * 2. raw set to table - * - * __gc = function() - * 1. delete this - * end - * - * instanceFunction = {...} - * - * } - * - * ScriptX.getInstanceMeta(Class) == instanceMeta; - * - * \endcode - * - * @tparam T - * @param classDefine - */ -template -void LuaEngine::registerNativeClassImpl(const ClassDefine* classDefine) { - StackFrameScope stackFrameScope; - - auto ns = ::script::internal::getNamespaceObject(this, classDefine->getNameSpace(), - get(kLuaGlobalEnvName).asObject()) - .asObject(); - - lua_newtable(lua_); - auto table = lua_gettop(lua_); - lua_newtable(lua_); - auto staticMeta = lua_gettop(lua_); - - registerStaticDefine(classDefine->staticDefine, table, staticMeta); - - if (classDefine->instanceDefine.constructor) { - registerInstanceDefine(*classDefine, table, staticMeta); - } - - lua_pushvalue(lua_, staticMeta); - lua_setmetatable(lua_, table); - - auto obj = make>(table); - ns.set(classDefine->className, make>(obj)); - - nativeDefineRegistry_.emplace(classDefine, Global(make>(obj))); -} - -template -void LuaEngine::registerInstanceDefine(const ClassDefine& classDefine, int table, - int staticMeta) { - StackFrameScope stack; - - lua_newtable(lua_); - auto instanceMeta = lua_gettop(lua_); - - lua_newtable(lua_); - auto instanceFunction = lua_gettop(lua_); - - defineInstanceProperties(classDefine, instanceMeta, instanceFunction); - defineInstanceFunctions(classDefine, instanceFunction); - defineInstanceConstructor(classDefine, instanceMeta, staticMeta); - - make>(instanceMeta) - .set(kMetaTableBuiltInInstanceFunctions, make>(instanceFunction)); - - // built in data - lua_pushvalue(lua_, instanceMeta); - lua_rawsetp(lua_, table, kLuaBuiltinDefinedClassMetaDataToken_); - - lua_pushlightuserdata(lua_, const_cast(static_cast(&classDefine))); - lua_rawsetp(lua_, table, kLuaTableNativeClassDefinePtrToken_); -} - -template -void LuaEngine::defineInstanceConstructor(const ClassDefine& classDefine, int instanceMeta, - int staticMeta) const { - luaEnsureStack(lua_, 4); - - { - // key - lua_pushstring(lua_, kLuaMetaMethodCall); - - // value - lua_pushvalue(lua_, instanceMeta); - lua_pushlightuserdata(lua_, const_cast(static_cast(&classDefine))); - lua_pushlightuserdata(lua_, const_cast(this)); - - lua_pushcclosure( - lua_, - [](lua_State* lua) -> int { - // lua __call: staticTable is it's first argument - lua_remove(lua, 1); - - std::optional exception; - try { - auto define = static_cast*>(lua_touserdata(lua, lua_upvalueindex(2))); - lua_newtable(lua); // this table - - // copy instance functions - // luaCopyTable(lua, lua_upvalueindex(3), lua_gettop(lua)); - - // set meta table - lua_pushvalue(lua, lua_upvalueindex(1)); - lua_setmetatable(lua, -2); - - // dup - lua_pushvalue(lua, -1); - lua_rotate(lua, 1, 2); - - // stack state: - // [this table] - // [arg1] - // [arg2] - // [arg ...] - - T* thiz; - auto argsBase = 2; - auto argsCount = lua_gettop(lua) - 1; - - if (argsCount == 3 && lua_islightuserdata(lua, -2) && - lua_touserdata(lua, -2) == kLuaNativeConstructorMarker_) { - // this logic is for - // ScriptClass::ScriptClass(const ClassDefine &define) - thiz = static_cast(lua_touserdata(lua, -1)); - } else { - // this logic is for - // ScriptClass::ScriptClass(const Local& thiz) - - auto engine = static_cast(lua_touserdata(lua, lua_upvalueindex(3))); - thiz = define->instanceDefine.constructor( - makeArguments(engine, argsBase, argsCount, true)); - } - - lua_settop(lua, 1); - // set ptr as this - lua_pushlightuserdata(lua, thiz); - lua_rawsetp(lua, 1, kLuaTableNativeThisPtrToken_); - lua_pushlightuserdata(lua, define); - lua_rawsetp(lua, 1, kLuaTableNativeClassDefinePtrToken_); - return 1; - } catch (const Exception& e) { - exception = e.message(); - } - - luaThrow(lua, exception); - return 0; - }, - 3); - - lua_rawset(lua_, staticMeta); - } - - { - lua_pushstring(lua_, kLuaMetaMethodNewGc); - - lua_pushcfunction(lua_, [](lua_State* lua) { - lua_rawgetp(lua, 1, kLuaTableNativeThisPtrToken_); - ExitEngineScope exit; - delete static_cast(lua_touserdata(lua, -1)); - return 0; - }); - lua_rawset(lua_, instanceMeta); - } -} - -template -void LuaEngine::defineInstanceFunctions(const ClassDefine& classDefine, - int instanceFunctionTable) const { - for (auto& funcDefine : classDefine.instanceDefine.functions) { - { - using FD = typename internal::InstanceDefine::FunctionDefine; - lua_pushstring(lua_, funcDefine.name.c_str()); - pushInstanceFunction( - &funcDefine, &classDefine, - [](lua_State* lua, void* data, void* thiz, const Arguments& args) -> Local { - auto fd = static_cast(data); - auto scriptClass = static_cast(thiz); - Tracer trace(args.engine(), fd->traceName); - return fd->callback(scriptClass, args); - }); - lua_rawset(lua_, instanceFunctionTable); - } - } -} - -template -void LuaEngine::defineInstanceProperties(const ClassDefine& classDefine, int instanceMeta, - int instanceFunction) const { - lua_newtable(lua_); - auto getter = lua_gettop(lua_); - lua_newtable(lua_); - auto setter = lua_gettop(lua_); - - setupMetaTableForProperties(instanceMeta, instanceFunction, getter, setter); - - for (auto& propDef : classDefine.instanceDefine.properties) { - using PD = typename internal::InstanceDefine::PropertyDefine; - - lua_pushstring(lua_, propDef.name.c_str()); - pushInstanceFunction( - &propDef, &classDefine, - [](lua_State* /*lua*/, void* data, void* thiz, const Arguments& args) -> Local { - // __index(table, index) - auto pf = static_cast(data); - auto scriptClass = static_cast(thiz); - if (pf->getter) { - Tracer trace(args.engine(), pf->traceName); - return pf->getter(scriptClass); - } - return {}; - }); - lua_rawset(lua_, getter); - - lua_pushstring(lua_, propDef.name.c_str()); - pushInstanceFunction( - &propDef, &classDefine, - [](lua_State* /*lua*/, void* data, void* thiz, const Arguments& args) -> Local { - // __newindex(table, index, value) - - auto pf = static_cast(data); - auto scriptClass = static_cast(thiz); - if (pf->setter) { - Tracer trace(args.engine(), pf->traceName); - pf->setter(scriptClass, args[1]); - } - return {}; - }); - lua_rawset(lua_, setter); - } -} - -template -Local LuaEngine::newNativeClassImpl(const ClassDefine* classDefine, size_t size, - const Local* ptr) { - auto it = nativeDefineRegistry_.find(static_cast(classDefine)); - if (it == nativeDefineRegistry_.end()) { - registerNativeClassImpl(classDefine); - it = nativeDefineRegistry_.find(static_cast(classDefine)); - } - - return luaNewObject(it->second.getValue(), size, ptr); -} - -template -bool LuaEngine::isInstanceOfImpl(const Local& value, const ClassDefine* classDefine) { - return isInstanceOf(lua_, classDefine, localRefIndex(value)); -} - -template -T* LuaEngine::getNativeInstanceImpl(const Local& value, const ClassDefine* classDefine) { - return static_cast(getNativeThis(lua_, classDefine, localRefIndex(value))); -} - -} // namespace script::lua_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.h deleted file mode 100644 index 04d0dde7..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/types.h" - -SCRIPTX_BEGIN_INCLUDE_LIBRARY -#include "lua/lua.hpp" -SCRIPTX_END_INCLUDE_LIBRARY - -namespace script::lua_backend { - -constexpr const char* kLuaGlobalEnvName = "_G"; -constexpr const char* kLuaMetaMethodMode = "__mode"; -constexpr const char* kLuaMetaMethodIndex = "__index"; -constexpr const char* kLuaMetaMethodNewIndex = "__newindex"; -constexpr const char* kLuaMetaMethodCall = "__call"; -constexpr const char* kLuaMetaMethodNewGc = "__gc"; - -Local callFunction(const Local& func, const Local& thiz, size_t argsCount, - const Local* begin); - -int handleReturnToLua(lua_State* lua, int retIndex); - -// [0, +1, -] -int pushFinalizableUserData(lua_State* lua, void* data, void finalizer(void*)); - -// [+1, 0, -] -void* getUserDataFromFinalizableUserData(lua_State* lua, int finalizableUserDataIndex = -1); - -void luaCopyTable(lua_State* lua, int from, int to); - -Local luaNewObject(const Local& obj, size_t size, const Local* ptr); - -} // namespace script::lua_backend - -namespace script { -struct lua_interop; -} \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.hpp b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.hpp deleted file mode 100644 index b46eece2..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaHelper.hpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include "../../scriptx/Reference.h" -#include "../../scriptx/Scope.h" -#include "LuaEngine.h" -#include "LuaHelper.h" - -namespace script::lua_backend { - -inline LuaEngine* currentEngine() { return &EngineScope::currentEngineCheckedAs(); } - -inline lua_State* currentLua() { return currentEngine()->lua_; } - -/** - * run a balanced stack scope - */ -template -inline void luaStackScope(lua_State* lua, Block&& block) { -#ifndef NDEBUG - auto top = lua_gettop(lua); - block(); - // assert the stack is balanced - assert(top == lua_gettop(lua)); -#else - block(); -#endif -} - -inline void luaEnsureStack(lua_State* lua, int size) { - if (!lua_checkstack(lua, size)) { - throw Exception("stack overflow"); - } -} - -/** - * BE VERY CAREFUL with lua_error, it used longjmp to unwind stack, which WON'T CALL c++ - * DESTRUCTORS. - */ -inline void luaThrow(lua_State* lua, const char* message) { - lua_pushstring(lua, message); - lua_error(lua); -} - -/** - * BE VERY CAREFUL with lua_error, it used longjmp to unwind stack, which WON'T CALL c++ - * DESTRUCTORS. - */ -inline void luaThrow(lua_State* lua, std::optional& message) { - if (message.has_value()) { - lua_pushstring(lua, message->c_str()); - // destruct std::string by hand - message.~optional(); - lua_error(lua); - } -} - -inline void pushValue(lua_State* lua, const Local& local) { - luaEnsureStack(lua, 1); - auto val = LuaEngine::localRefIndex(local); - - if (val == 0) { - lua_pushnil(lua); - } else { - lua_pushvalue(lua, val); - } -} - -template -void pushValues(lua_State* lua, size_t count, It begin) { - luaEnsureStack(lua, static_cast(count)); - for (size_t i = 0; i < count; ++i) { - auto val = LuaEngine::localRefIndex(*begin); - - if (val == 0) { - lua_pushnil(lua); - } else { - lua_pushvalue(lua, val); - } - ++begin; - } -} - -inline void rethrowException(lua_State* lua) { - Exception exp(LuaEngine::make>(lua_gettop(lua))); - lua_pop(lua, 1); - throw exp; // NOLINT -} - -} // namespace script::lua_backend - -namespace script { - -struct lua_interop { - /** - * get lua_State* from LuaEngine - */ - static lua_State* getEngineLua(lua_backend::LuaEngine* engine) { return engine->lua_; } - - static lua_State* currentEngineLua() { return ::script::lua_backend::currentLua(); } - - /** - * convert Local to a lua local reference - * @return the index in stack - */ - template - static int toLua(const Local& ref) { - return lua_backend::LuaEngine::localRefIndex(ref); - } - - /** - * create Local from lua local reference - * @param index the index in stack - */ - template - static Local makeLocal(int index) { - return lua_backend::LuaEngine::make>(index); - } - - static Arguments makeArguments(lua_backend::LuaEngine* engine, int stackBase, size_t paramCount, - bool isInstanceFunc) { - return lua_backend::LuaEngine::makeArguments(engine, stackBase, paramCount, isInstanceFunc); - } - - using ArgumentsData = lua_backend::ArgumentsData; - - static ArgumentsData extractArguments(const Arguments& args) { return args.callbackInfo_; } -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaNative.hpp b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaNative.hpp deleted file mode 100644 index afe65b22..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaNative.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Native.hpp" -#include "LuaEngine.h" -#include "LuaHelper.hpp" - -namespace script { - -template -ScriptClass::ScriptClass(const ScriptClass::ConstructFromCpp) : internalState_() { - auto engine = lua_backend::currentEngine(); - - // Out must be outside of StackFrameScope. - // Because we only has Weak hold to obj - // to prevent obj from GCed, we relay on obj be the local ref. - Local out; - - { - StackFrameScope scope; - auto lua = engine->lua_; - - lua_pushlightuserdata(lua, - const_cast(lua_backend::LuaEngine::kLuaNativeConstructorMarker_)); - auto mark = lua_gettop(lua); - - lua_pushlightuserdata(lua, this); - auto thiz = lua_gettop(lua); - - auto obj = engine->newNativeClass(lua_backend::LuaEngine::make>(mark), - lua_backend::LuaEngine::make>(thiz)); - - out = scope.returnValue(obj); - } - - internalState_.scriptEngine_ = engine; - internalState_.weakRef_ = out.asObject(); -} - -template -T *ScriptClass::getScriptEngineAs() const { - return script::internal::scriptDynamicCast(internalState_.scriptEngine_); -} - -template -T *Arguments::engineAs() const { - return script::internal::scriptDynamicCast(callbackInfo_.engine); -} - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaReference.hpp b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaReference.hpp deleted file mode 100644 index cdb53b58..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaReference.hpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/NativeConverter.hpp" -#include "../../scriptx/Reference.h" -#include "../../scriptx/utils/GlobalWeakBookkeeping.hpp" -#include "LuaHelper.hpp" - -namespace script { - -namespace lua_backend { - -struct LuaBookKeepFetcher { - template - static ::script::internal::GlobalWeakBookkeeping* get(const T* ref) { - if (!ref) return nullptr; - auto& val = LuaEngine::refVal(const_cast(ref)); - if (!val.engine) return nullptr; - return &val.engine->globalWeakBookkeeping_; - } - - template - static ::script::internal::GlobalWeakBookkeeping::HandleType& handle(const T* ref) { - auto& val = LuaEngine::refVal(const_cast(ref)); - return val.handle; - } -}; - -using BookKeep = ::script::internal::GlobalWeakBookkeeping::Helper; - -} // namespace lua_backend - -template -Global::Global() noexcept : val_() {} - -template -Global::Global(const script::Local& localReference) : val_() { - auto engine = lua_backend::currentEngine(); - val_.engine = engine; - val_.index = engine->putGlobalOrWeakTable(localReference, - lua_backend::LuaEngine::kLuaGlobalRegistryToken_); - lua_backend::BookKeep::keep(this); -} - -template -Global::Global(const script::Weak& weak) : val_() { - auto engine = weak.val_.engine; - if (engine) { - auto lua = engine->lua_; - - val_.engine = engine; - - lua_backend::luaStackScope(lua, [lua, &weak, this, engine]() { - auto local = weak.getValue(); - if (local.val_ != 0) { - val_.index = - engine->putGlobalOrWeakTable(local, lua_backend::LuaEngine::kLuaGlobalRegistryToken_); - lua_pop(lua, 1); - } - }); - } - lua_backend::BookKeep::keep(this); -} - -template -Global::Global(const script::Global& copy) : val_() { - auto engine = copy.val_.engine; - if (engine) { - auto lua = engine->lua_; - val_.engine = engine; - - lua_backend::luaStackScope(lua, [lua, ©, this, engine]() { - auto local = copy.getValue(); - assert(local.val_ != 0); - val_.index = - engine->putGlobalOrWeakTable(local, lua_backend::LuaEngine::kLuaGlobalRegistryToken_); - lua_pop(lua, 1); - }); - } - lua_backend::BookKeep::afterCopy(true, this, ©); -} - -template -Global::Global(script::Global&& move) noexcept : val_(std::move(move.val_)) { - lua_backend::BookKeep::afterMove(true, this, &move); -} - -template -Global::~Global() { - if (!isEmpty()) { - EngineScope scope(val_.engine); - reset(); - } -} - -template -Global& Global::operator=(const script::Global& assign) { - Global(assign).swap(*this); - return *this; -} - -template -Global& Global::operator=(script::Global&& move) noexcept { - Global(std::move(move)).swap(*this); - return *this; -} - -template -void Global::swap(Global& rhs) noexcept { - std::swap(val_.engine, rhs.val_.engine); - std::swap(val_.index, rhs.val_.index); - lua_backend::BookKeep::afterSwap(this, &rhs); -} - -template -Global& Global::operator=(const script::Local& assign) { - *this = Global(assign); - return *this; -} - -template -Local Global::get() const { - auto value = getValue(); - if (value.val_ == 0) throw Exception("get on empty Global"); - return Local{value.val_}; -} - -template -Local Global::getValue() const { - if (!val_.engine) return {}; - return val_.engine->getGlobalOrWeakTable(val_.index, - lua_backend::LuaEngine::kLuaGlobalRegistryToken_); -} - -template -bool Global::isEmpty() const { - return val_.index == 0; -} - -template -void Global::reset() { - if (!isEmpty()) { - val_.engine->removeGlobalOrWeakTable(val_.index, - lua_backend::LuaEngine::kLuaGlobalRegistryToken_); - - lua_backend::BookKeep::remove(this); - val_.index = 0; - val_.engine = nullptr; - } -} - -// == Weak == - -template -Weak::Weak() noexcept : val_() {} - -template -Weak::~Weak() { - if (!isEmpty()) { - EngineScope scope(val_.engine); - reset(); - } -} - -template -Weak::Weak(const script::Local& localReference) { - auto engine = lua_backend::currentEngine(); - val_.engine = engine; - val_.index = - engine->putGlobalOrWeakTable(localReference, lua_backend::LuaEngine::kLuaWeakRegistryToken_); - lua_backend::BookKeep::keep(this); -} - -template -Weak::Weak(const script::Global& globalReference) { - auto engine = globalReference.val_.engine; - if (engine) { - auto lua = engine->lua_; - - val_.engine = engine; - - lua_backend::luaStackScope(lua, [lua, &globalReference, this, engine]() { - auto local = globalReference.getValue(); - assert(local.val_ != 0); - val_.index = - engine->putGlobalOrWeakTable(local, lua_backend::LuaEngine::kLuaWeakRegistryToken_); - lua_pop(lua, 1); - }); - } - lua_backend::BookKeep ::keep(this); -} - -template -Weak::Weak(const script::Weak& copy) : val_() { - auto engine = copy.val_.engine; - if (engine) { - auto lua = engine->lua_; - - val_.engine = engine; - - lua_backend::luaStackScope(lua, [lua, ©, this, engine]() { - auto local = copy.getValue(); - if (local.val_ != 0) { - val_.index = - engine->putGlobalOrWeakTable(local, lua_backend::LuaEngine::kLuaWeakRegistryToken_); - lua_pop(lua, 1); - } - }); - } - - lua_backend::BookKeep ::keep(this); -} - -template -Weak::Weak(script::Weak&& move) noexcept : val_(std::move(move.val_)) { - lua_backend::BookKeep ::afterMove(true, this, &move); -} - -template -Weak& Weak::operator=(const script::Weak& assign) { - Weak(assign).swap(*this); - return *this; -} - -template -Weak& Weak::operator=(script::Weak&& move) noexcept { - Weak(std::move(move)).swap(*this); - return *this; -} - -template -void Weak::swap(Weak& rhs) noexcept { - std::swap(val_.engine, rhs.val_.engine); - std::swap(val_.index, rhs.val_.index); - lua_backend::BookKeep ::afterSwap(this, &rhs); -} - -template -Weak& Weak::operator=(const script::Local& assign) { - Weak(assign).swap(*this); - return *this; -} - -template -Local Weak::get() const { - auto value = getValue(); - if (value.isNull()) throw Exception("get on empty Weak"); - return converter::Converter>::toCpp(value); -} - -template -Local Weak::getValue() const { - if (isEmpty()) return {}; - return val_.engine->getGlobalOrWeakTable(val_.index, - lua_backend::LuaEngine::kLuaWeakRegistryToken_); -} - -template -bool Weak::isEmpty() const { - return val_.index == 0; -} - -template -void Weak::reset() noexcept { - if (!isEmpty()) { - lua_backend::currentEngine()->removeGlobalOrWeakTable( - val_.index, lua_backend::LuaEngine::kLuaWeakRegistryToken_); - lua_backend::BookKeep ::remove(this); - val_.index = 0; - val_.engine = nullptr; - } -} - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaScope.hpp b/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaScope.hpp deleted file mode 100644 index 1046e93a..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/LuaScope.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Scope.h" -#include "LuaHelper.hpp" - -namespace script::lua_backend { - -template -Local StackFrameScopeImpl::returnValue(const Local &localRef) { - return LuaEngine::make>(returnRawValue(LuaEngine::localRefIndex(localRef))); -} - -} // namespace script::lua_backend \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitEngine.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitEngine.h deleted file mode 100644 index 3ca670ce..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitEngine.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/types.h" - -namespace script { - -namespace lua_backend { -class LuaEngine; -} - -template <> -struct internal::ImplType { - using type = lua_backend::LuaEngine; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitException.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitException.h deleted file mode 100644 index 89f82283..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitException.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * ScriptX is licensed under the BSD 3-Clause License, except for the third-party components listed - * in the file 'LICENSE' which may be subject to their corresponding license terms. This file is - * subject to the terms and conditions defined in file 'LICENSE', which is part of this source code - * package. - */ -#pragma once - -#include "../../../scriptx/Reference.h" -#include "../../../scriptx/types.h" - -namespace script { - -namespace lua_backend { - -class ExceptionFields { - public: - mutable Global exception_{}; - - mutable std::string message_{}; - mutable bool hasMessage_ = false; - - mutable std::string stacktrace_{}; - mutable bool hasStacktrace_ = false; - - void fillMessage() const noexcept; - void fillStacktrace() const noexcept; -}; - -} // namespace lua_backend - -template <> -struct internal::ImplType { - using type = lua_backend::ExceptionFields; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitIncludes.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitIncludes.h deleted file mode 100644 index eaeca1d2..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitIncludes.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../LuaEngine.h" -#include "../LuaEngine.hpp" -#include "../LuaNative.hpp" -#include "../LuaReference.hpp" -#include "../LuaScope.hpp" - -#define SCRIPTX_BACKEND_LUA -#define SCRIPTX_LANG_LUA \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitNative.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitNative.h deleted file mode 100644 index 32c9fce1..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitNative.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/types.h" - -namespace script { - -namespace lua_backend { -class LuaEngine; - -struct ArgumentsData { - LuaEngine* engine = nullptr; - int stackBase = 0; - size_t size = 0; - bool isInstanceFunc = false; -}; - -struct LuaScriptClassState { - LuaEngine* scriptEngine_ = nullptr; - Weak weakRef_; -}; - -} // namespace lua_backend - -template <> -struct internal::ImplType<::script::Arguments> { - using type = lua_backend::ArgumentsData; -}; - -template <> -struct internal::ImplType<::script::ScriptClass> { - using type = lua_backend::LuaScriptClassState; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitReference.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitReference.h deleted file mode 100644 index f3f5a162..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitReference.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "lua/lua.hpp" -#include "../../../scriptx/types.h" -#include "../../../scriptx/utils/GlobalWeakBookkeeping.hpp" - -namespace script::lua_backend { -class LuaEngine; -} - -namespace script::internal { - -template -struct ImplType> { - using type = int; -}; - -template -struct ImplType> { - struct type { - lua_backend::LuaEngine* engine = nullptr; - lua_Integer index = 0; - GlobalWeakBookkeeping::HandleType handle{}; - - type() = default; - - type(const type& copy) : engine(copy.engine), index(copy.index) {} - type(type&& move) noexcept : engine(move.engine), index(move.index) { - move.index = 0; - move.engine = nullptr; - } - - type& operator=(const type& copy) { - index = copy.index; - engine = copy.engine; - return *this; - } - - type& operator=(type&& copy) noexcept { - index = copy.index; - engine = copy.engine; - - copy.index = 0; - copy.engine = nullptr; - } - }; -}; - -template -struct ImplType> { - using type = typename ImplType>::type; -}; - -} // namespace script::internal \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitScope.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitScope.h deleted file mode 100644 index fd06d70e..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitScope.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../../scriptx/types.h" - -namespace script { - -namespace lua_backend { - -class LuaEngine; - -class StackFrameScopeImpl { - private: - LuaEngine *engine_ = nullptr; - int base_ = 0; - bool hasReturnValue_ = false; - - public: - explicit StackFrameScopeImpl(LuaEngine &); - - ~StackFrameScopeImpl(); - - template - Local returnValue(const Local &localRef); - - int returnRawValue(int index); - - friend class EngineScopeImpl; -}; - -class EngineScopeImpl { - LuaEngine *prevEngine_ = nullptr; - std::lock_guard lockGuard_; - StackFrameScopeImpl stack_; - - public: - explicit EngineScopeImpl(LuaEngine &, LuaEngine *); - - ~EngineScopeImpl(); -}; - -class ExitEngineScopeImpl { - LuaEngine *engine_ = nullptr; - - public: - explicit ExitEngineScopeImpl(LuaEngine &); - - ~ExitEngineScopeImpl(); -}; - -} // namespace lua_backend - -template <> -struct internal::ImplType { - using type = lua_backend::EngineScopeImpl; -}; - -template <> -struct internal::ImplType { - using type = lua_backend::ExitEngineScopeImpl; -}; - -template <> -struct internal::ImplType { - using type = lua_backend::StackFrameScopeImpl; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitUtils.h b/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitUtils.h deleted file mode 100644 index 241ac5da..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Lua/trait/TraitUtils.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/types.h" - -namespace script { -struct lua_interop; - -template <> -struct internal::ImplType { - struct type { - const char* string = nullptr; - size_t len = 0; - }; -}; - -template <> -struct internal::ImplType { - using type = lua_interop; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyEngine.h b/repo/packages/s/scriptx-legacy/include/backend/Python/PyEngine.h deleted file mode 100644 index 86ce3c47..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyEngine.h +++ /dev/null @@ -1,702 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include "../../scriptx/Engine.h" -#include "../../scriptx/Exception.h" -#include "../../scriptx/utils/Helper.hpp" -#include "../../scriptx/utils/MessageQueue.h" -#include "PyHelper.hpp" - -namespace script::py_backend { - -// an PyEngine = a subinterpreter -class PyEngine : public ScriptEngine { -private: - std::shared_ptr<::script::utils::MessageQueue> queue_; - - std::unordered_map registeredTypes_; - std::unordered_map registeredTypesReverse_; - - bool destroying = false; - - // refs keeper - inline static GlobalOrWeakRefKeeper refsKeeper; - friend class GlobalRefState; - friend class WeakRefState; - - // Main interpreter's InterpreterState & ThreadState(in TLS) - inline static PyInterpreterState* mainInterpreterState_; - inline static TssStorage mainThreadStateInTLS_; - // Sub interpreter's InterpreterState & ThreadState(in TLS) - PyInterpreterState* subInterpreterState_; - TssStorage subThreadStateInTLS_; - // Locker used by EngineScope - // -- see more comments of EngineLockerHelper in "PyHelper.h" and "PyScope.cc" - EngineLockerHelper engineLockHelper; - - public: - inline static PyTypeObject* staticPropertyType_ = nullptr; - inline static PyTypeObject* namespaceType_ = nullptr; - inline static PyTypeObject* defaultMetaType_ = nullptr; - inline static PyObject* emptyPyFunction = nullptr; - PyTypeObject* scriptxExceptionTypeObj; - - PyEngine(std::shared_ptr<::script::utils::MessageQueue> queue); - - PyEngine(); - - SCRIPTX_DISALLOW_COPY_AND_MOVE(PyEngine); - - void destroy() noexcept override; - - bool isDestroying() const override; - - Local get(const Local& key) override; - - void set(const Local& key, const Local& value) override; - using ScriptEngine::set; - - Local eval(const Local& script, const Local& sourceFile); - Local eval(const Local& script, const Local& sourceFile) override; - Local eval(const Local& script) override; - using ScriptEngine::eval; - - Local loadFile(const Local& scriptFile) override; - - std::shared_ptr messageQueue() override; - - void gc() override; - - void adjustAssociatedMemory(int64_t count) override; - - ScriptLanguage getLanguageType() override; - - std::string getEngineVersion() override; - - protected: - ~PyEngine() override; - - private: - /* - * namespace will be created as a dict object, which is set in the Global Dict - */ - template - void nameSpaceSet(const ClassDefine* classDefine, const std::string& name, PyObject* type) { - std::string nameSpace = classDefine->getNameSpace(); - PyObject* nameSpaceObj = getGlobalBuiltin(); - - if (nameSpace.empty()) { - setDictItem(nameSpaceObj, name.c_str(), type); - } else { // "nameSpace" can be aaa.bbb.ccc, so we should parse the string to create more dict - std::size_t begin = 0; - while (begin < nameSpace.size()) { - auto index = nameSpace.find('.', begin); - if (index == std::string::npos) { - index = nameSpace.size(); - } - - PyObject* sub = nullptr; - auto key = nameSpace.substr(begin, index - begin); - if (PyDict_CheckExact(nameSpaceObj)) { - sub = getDictItem(nameSpaceObj, key.c_str()); - if (sub == nullptr) { - PyObject* args = PyTuple_New(0); - PyTypeObject* type = reinterpret_cast(namespaceType_); - sub = type->tp_new(type, args, nullptr); - Py_DECREF(args); - setDictItem(nameSpaceObj, key.c_str(), sub); - Py_DECREF(sub); - } - setAttr(sub, name.c_str(), type); - } else /*namespace type*/ { - if (hasAttr(nameSpaceObj, key.c_str())) { - sub = getAttr(nameSpaceObj, key.c_str()); - } else { - PyObject* args = PyTuple_New(0); - PyTypeObject* type = reinterpret_cast(namespaceType_); - sub = type->tp_new(type, args, nullptr); - Py_DECREF(args); - setAttr(nameSpaceObj, key.c_str(), sub); - Py_DECREF(sub); - } - setAttr(sub, name.c_str(), type); - } - nameSpaceObj = sub; - begin = index + 1; - } - } - } - - PyObject* warpGetter(const char* name, GetterCallback callback) { - struct FunctionData { - GetterCallback function; - PyEngine* engine; - std::string name; - }; - - PyMethodDef* method = new PyMethodDef; - method->ml_name = name; - method->ml_flags = METH_VARARGS; - method->ml_doc = nullptr; - - method->ml_meth = [](PyObject* self, PyObject* args) -> PyObject* { - auto data = static_cast(PyCapsule_GetPointer(self, nullptr)); - try { - Tracer tracer(data->engine, data->name); - Local ret = data->function(); - return py_interop::getPy(ret); - } - catch(const Exception &e) { - Local exception = e.exception(); - PyObject* exceptionObj = py_interop::peekPy(exception); - PyErr_SetObject((PyObject*)Py_TYPE(exceptionObj), exceptionObj); - } - catch(const std::exception &e) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, e.what()); - } - catch(...) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, "[No Exception Message]"); - } - return nullptr; - }; - - PyCapsule_Destructor destructor = [](PyObject* cap) { - void* ptr = PyCapsule_GetPointer(cap, nullptr); - delete static_cast(ptr); - }; - PyObject* capsule = - PyCapsule_New(new FunctionData{std::move(callback), this, name}, nullptr, destructor); - checkAndThrowException(); - - PyObject* function = PyCFunction_New(method, capsule); - Py_DECREF(capsule); - checkAndThrowException(); - return function; - } - - template - PyObject* warpInstanceGetter(const char* name, InstanceGetterCallback callback) { - struct FunctionData { - InstanceGetterCallback function; - PyEngine* engine; - std::string name; - }; - - PyMethodDef* method = new PyMethodDef; - method->ml_name = name; - method->ml_flags = METH_VARARGS; - method->ml_doc = nullptr; - method->ml_meth = [](PyObject* self, PyObject* args) -> PyObject* { - auto data = static_cast(PyCapsule_GetPointer(self, nullptr)); - T* cppThiz = GeneralObject::getInstance(PyTuple_GetItem(args, 0)); - try { - Tracer tracer(data->engine, data->name); - Local ret = data->function(cppThiz); - return py_interop::getPy(ret); - } - catch(const Exception &e) { - Local exception = e.exception(); - PyObject* exceptionObj = py_interop::peekPy(exception); - PyErr_SetObject((PyObject*)Py_TYPE(exceptionObj), exceptionObj); - } - catch(const std::exception &e) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, e.what()); - } - catch(...) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, "[No Exception Message]"); - } - return nullptr; - }; - - PyCapsule_Destructor destructor = [](PyObject* cap) { - void* ptr = PyCapsule_GetPointer(cap, nullptr); - delete static_cast(ptr); - }; - PyObject* capsule = - PyCapsule_New(new FunctionData{std::move(callback), this, name}, nullptr, destructor); - checkAndThrowException(); - - PyObject* function = PyCFunction_New(method, capsule); - Py_DECREF(capsule); - checkAndThrowException(); - - return function; - } - - PyObject* warpSetter(const char* name, SetterCallback callback) { - struct FunctionData { - SetterCallback function; - PyEngine* engine; - std::string name; - }; - - PyMethodDef* method = new PyMethodDef; - method->ml_name = name; - method->ml_flags = METH_VARARGS; - method->ml_doc = nullptr; - method->ml_meth = [](PyObject* self, PyObject* args) -> PyObject* { - auto data = static_cast(PyCapsule_GetPointer(self, nullptr)); - try { - Tracer tracer(data->engine, data->name); - data->function(py_interop::toLocal(PyTuple_GetItem(args, 1))); - Py_RETURN_NONE; - } - catch(const Exception &e) { - Local exception = e.exception(); - PyObject* exceptionObj = py_interop::peekPy(exception); - PyErr_SetObject((PyObject*)Py_TYPE(exceptionObj), exceptionObj); - } - catch(const std::exception &e) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, e.what()); - } - catch(...) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, "[No Exception Message]"); - } - return nullptr; - }; - - PyCapsule_Destructor destructor = [](PyObject* cap) { - void* ptr = PyCapsule_GetPointer(cap, nullptr); - delete static_cast(ptr); - }; - PyObject* capsule = - PyCapsule_New(new FunctionData{std::move(callback), this, name}, nullptr, destructor); - checkAndThrowException(); - - PyObject* function = PyCFunction_New(method, capsule); - Py_DECREF(capsule); - checkAndThrowException(); - - return function; - } - - template - PyObject* warpInstanceSetter(const char* name, InstanceSetterCallback callback) { - struct FunctionData { - InstanceSetterCallback function; - PyEngine* engine; - std::string name; - }; - - PyMethodDef* method = new PyMethodDef; - method->ml_name = name; - method->ml_flags = METH_VARARGS; - method->ml_doc = nullptr; - method->ml_meth = [](PyObject* self, PyObject* args) -> PyObject* { - auto data = static_cast(PyCapsule_GetPointer(self, nullptr)); - T* cppThiz = GeneralObject::getInstance(PyTuple_GetItem(args, 0)); - try { - Tracer tracer(data->engine, data->name); - data->function(cppThiz, py_interop::toLocal(PyTuple_GetItem(args, 1))); - Py_RETURN_NONE; - } - catch(const Exception &e) { - Local exception = e.exception(); - PyObject* exceptionObj = py_interop::peekPy(exception); - PyErr_SetObject((PyObject*)Py_TYPE(exceptionObj), exceptionObj); - } - catch(const std::exception &e) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, e.what()); - } - catch(...) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, "[No Exception Message]"); - } - return nullptr; - }; - - PyCapsule_Destructor destructor = [](PyObject* cap) { - void* ptr = PyCapsule_GetPointer(cap, nullptr); - delete static_cast(ptr); - }; - PyObject* capsule = - PyCapsule_New(new FunctionData{std::move(callback), this, name}, nullptr, destructor); - checkAndThrowException(); - - PyObject* function = PyCFunction_New(method, capsule); - Py_DECREF(capsule); - checkAndThrowException(); - - return function; - } - - template - void registerStaticProperty(const ClassDefine* classDefine, PyObject* type) { - for (const auto& property : classDefine->staticDefine.properties) { - PyObject* g = nullptr; - if (property.getter) { - g = warpGetter(property.name.c_str(), property.getter); - } - else g = Py_NewRef(PyEngine::emptyPyFunction); - - PyObject* s = nullptr; - if (property.setter) { - s = warpSetter(property.name.c_str(), property.setter); - } - else s = Py_NewRef(PyEngine::emptyPyFunction); - - PyObject* doc = toStr(""); - PyObject* warpped_property = - PyObject_CallFunctionObjArgs((PyObject*)staticPropertyType_, g, s, Py_None, doc, nullptr); - Py_DECREF(g); - Py_DECREF(s); - Py_DECREF(doc); - setAttr(type, property.name.c_str(), warpped_property); - Py_DECREF(warpped_property); - } - } - - template - void registerInstanceProperty(const ClassDefine* classDefine, PyObject* type) { - for (const auto& property : classDefine->instanceDefine.properties) { - PyObject* g = nullptr; - if (property.getter) { - g = warpInstanceGetter(property.name.c_str(), property.getter); - } - else g = Py_NewRef(PyEngine::emptyPyFunction); - - PyObject* s = nullptr; - if (property.setter) { - s = warpInstanceSetter(property.name.c_str(), property.setter); - } - else s = Py_NewRef(PyEngine::emptyPyFunction); - - PyObject* doc = toStr(""); - PyObject* warpped_property = - PyObject_CallFunctionObjArgs((PyObject*)&PyProperty_Type, g, s, Py_None, doc, nullptr); - Py_DECREF(g); - Py_DECREF(s); - Py_DECREF(doc); - setAttr(type, property.name.c_str(), warpped_property); - Py_DECREF(warpped_property); - } - } - - template - void registerStaticFunction(const ClassDefine* classDefine, PyObject* type) { - for (const auto& f : classDefine->staticDefine.functions) { - struct FunctionData { - FunctionCallback function; - py_backend::PyEngine* engine; - std::string name; - }; - - PyMethodDef* method = new PyMethodDef; - method->ml_name = f.name.c_str(); - method->ml_flags = METH_VARARGS; - method->ml_doc = nullptr; - method->ml_meth = [](PyObject* self, PyObject* args) -> PyObject* { - // - "self" is not real self pointer to object instance, but a capsule for that - // we need it to pass params like impl-function, thiz, engine, ...etc - // into ml_meth here. - auto data = static_cast(PyCapsule_GetPointer(self, nullptr)); - try { - Tracer tracer(data->engine, data->name); - Local ret = data->function(py_interop::makeArguments(data->engine, self, args)); - return py_interop::getPy(ret); - } - catch(const Exception &e) { - Local exception = e.exception(); - PyObject* exceptionObj = py_interop::peekPy(exception); - PyErr_SetObject((PyObject*)Py_TYPE(exceptionObj), exceptionObj); - } - catch(const std::exception &e) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, e.what()); - } - catch(...) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, "[No Exception Message]"); - } - return nullptr; - }; - - PyCapsule_Destructor destructor = [](PyObject* cap) { - void* ptr = PyCapsule_GetPointer(cap, nullptr); - delete static_cast(ptr); - }; - PyObject* capsule = - PyCapsule_New(new FunctionData{std::move(f.callback), this, f.name}, nullptr, destructor); - checkAndThrowException(); - - PyObject* function = PyCFunction_New(method, capsule); - Py_DECREF(capsule); - checkAndThrowException(); - - PyObject* staticMethod = PyStaticMethod_New(function); - Py_DECREF(function); - setAttr(type, f.name.c_str(), staticMethod); - Py_DECREF(staticMethod); - } - } - - template - void registerInstanceFunction(const ClassDefine* classDefine, PyObject* type) { - for (const auto& f : classDefine->instanceDefine.functions) { - struct FunctionData { - InstanceFunctionCallback function; - py_backend::PyEngine* engine; - std::string name; - }; - - PyMethodDef* method = new PyMethodDef; - method->ml_name = f.name.c_str(); - method->ml_flags = METH_VARARGS; - method->ml_doc = nullptr; - method->ml_meth = [](PyObject* self, PyObject* args) -> PyObject* { - // - // - "self" is not real self pointer to object instance, but a capsule for that - // we need it to pass params like impl-function, thiz, engine, ...etc - // into ml_meth here. - // - // - Structure of "args" is: - // , , , ... - // - // - The first is added by CPython when call a class method, which must be - // the owner object instance of this method. Python does not support thiz redirection. - // (Looked into function "method_vectorcall" in CPython source code "Objects/methodobjects.c") - // (Looked into comments in PyLocalReference.cc) - // - auto data = static_cast(PyCapsule_GetPointer(self, nullptr)); - PyObject *thiz = PyTuple_GetItem(args, 0); - T* cppThiz = GeneralObject::getInstance(thiz); - PyObject* real_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); - - try { - Tracer tracer(data->engine, data->name); - Local ret = data->function(cppThiz, py_interop::makeArguments(data->engine, thiz, real_args)); - Py_DECREF(real_args); - return py_interop::getPy(ret); - } - catch(const Exception &e) { - Local exception = e.exception(); - PyObject* exceptionObj = py_interop::peekPy(exception); - PyErr_SetObject((PyObject*)Py_TYPE(exceptionObj), exceptionObj); - } - catch(const std::exception &e) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, e.what()); - } - catch(...) { - PyObject *scriptxType = (PyObject*) - EngineScope::currentEngineAs()->scriptxExceptionTypeObj; - PyErr_SetString(scriptxType, "[No Exception Message]"); - } - Py_DECREF(real_args); - return nullptr; - }; - - PyCapsule_Destructor destructor = [](PyObject* cap) { - void* ptr = PyCapsule_GetPointer(cap, nullptr); - delete static_cast(ptr); - }; - PyObject* capsule = - PyCapsule_New(new FunctionData{std::move(f.callback), this, f.name}, nullptr, destructor); - checkAndThrowException(); - - PyObject* function = PyCFunction_New(method, capsule); - Py_DECREF(capsule); - checkAndThrowException(); - - PyObject* instanceMethod = PyInstanceMethod_New(function); - Py_DECREF(function); - setAttr(type, f.name.c_str(), instanceMethod); - Py_DECREF(instanceMethod); - } - } - - template - void registerNativeClassImpl(const ClassDefine* classDefine) { - auto name_obj = toStr(classDefine->className.c_str()); - - auto* heap_type = (PyHeapTypeObject*)PyType_GenericAlloc(PyEngine::defaultMetaType_, 0); - if (!heap_type) { - Py_FatalError("error allocating type!"); - } - - heap_type->ht_name = Py_NewRef(name_obj); - heap_type->ht_qualname = Py_NewRef(name_obj); - Py_DECREF(name_obj); - - auto* type = &heap_type->ht_type; - type->tp_name = classDefine->className.c_str(); - Py_INCREF(&PyBaseObject_Type); - type->tp_base = &PyBaseObject_Type; - type->tp_basicsize = static_cast(sizeof(GeneralObject)); - type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HEAPTYPE; - - // enable object dict - type->tp_dictoffset = SCRIPTX_OFFSET_OF(GeneralObject, instanceDict); - - /* Support weak references (needed for the keep_alive feature) */ - type->tp_weaklistoffset = SCRIPTX_OFFSET_OF(GeneralObject, weakrefs); - - type->tp_new = [](PyTypeObject* type, PyObject* args, PyObject* kwds) -> PyObject* { - PyObject* self = type->tp_alloc(type, 0); - return self; - }; - type->tp_init = [](PyObject* self, PyObject* args, PyObject* kwds) -> int { - auto engine = currentEngine(); - auto classDefine = - reinterpret_cast*>(engine->registeredTypesReverse_[self->ob_type]); - if (classDefine->instanceDefine.constructor) - { - Tracer tracer(engine, classDefine->getClassName()); - GeneralObject* cppSelf = reinterpret_cast(self); - - if(!PyTuple_Check(args)) - { - throw Exception(std::string("Can't create class ") + Py_TYPE(self)->tp_name); - return -1; - } - - if(PyTuple_Size(args) == 1) - { - PyObject* maybeCapsule = PyTuple_GetItem(args, 0); - if(PyCapsule_CheckExact(maybeCapsule)) - { - // Passed a cpp this in capsule - // Logic for ScriptClass(const ScriptClass::ConstructFromCpp) - cppSelf->instance = (void*)PyCapsule_GetPointer(maybeCapsule, nullptr); - } - } - - if(cppSelf->instance == nullptr) - { - // Python-side constructor - // Logic for ScriptClass::ScriptClass(const Local& thiz) - cppSelf->instance = - classDefine->instanceDefine.constructor(py_interop::makeArguments(engine, self, args)); - if(cppSelf->instance == nullptr) - { - throw Exception(std::string("Can't create class ") + Py_TYPE(self)->tp_name); - return -1; - } - } - } else { - // Will never reach here. If pass nullptr to constructor(), ScriptX will make - // constructor to be a function that always returns nullptr. - return -1; - } - return 0; - }; - type->tp_dealloc = [](PyObject* self) { - auto type = Py_TYPE(self); - delete (T*)(reinterpret_cast(self)->instance); - type->tp_free(self); - Py_DECREF(type); - }; - - if (PyType_Ready(type) < 0) { - throw Exception("PyType_Ready failed in make_object_base_type()"); - } - - setAttr((PyObject*)type, "__module__", toStr("scriptx_builtins")); - - this->registerStaticProperty(classDefine, (PyObject*)type); - this->registerStaticFunction(classDefine, (PyObject*)type); - this->registerInstanceProperty(classDefine, (PyObject*)type); - this->registerInstanceFunction(classDefine, (PyObject*)type); - this->registeredTypes_.emplace(classDefine, type); - this->registeredTypesReverse_.emplace(type, classDefine); - this->nameSpaceSet(classDefine, classDefine->className.c_str(), (PyObject*)type); - } - - template - Local newNativeClassImpl(const ClassDefine* classDefine, size_t size, - const Local* args) { - PyObject* tuple = PyTuple_New(size); - for (size_t i = 0; i < size; ++i) { - Py_INCREF(args[i].val_); // PyTuple_SetItem will steal the ref - PyTuple_SetItem(tuple, i, args[i].val_); - } - - PyTypeObject* type = registeredTypes_[classDefine]; - PyObject* obj = py_backend::newCustomInstance(type, tuple); - Py_DECREF(tuple); - return py_interop::asLocal(obj); - } - - template - bool isInstanceOfImpl(const Local& value, const ClassDefine* classDefine) { - return registeredTypes_[classDefine] == value.val_->ob_type; - } - - template - T* getNativeInstanceImpl(const Local& value, const ClassDefine* classDefine) { - if (!isInstanceOfImpl(value, classDefine)) { - throw Exception("Unmatched type of the value!"); - } - return GeneralObject::getInstance(value.val_); - } - - private: - template - friend class ::script::Local; - - template - friend class ::script::Global; - - template - friend class ::script::Weak; - - friend class ::script::Object; - - friend class ::script::Array; - - friend class ::script::Function; - - friend class ::script::ByteBuffer; - - friend class ::script::ScriptEngine; - - friend class ::script::Exception; - - friend class ::script::Arguments; - - friend class ::script::ScriptClass; - - friend class EngineScopeImpl; - - friend class ExitEngineScopeImpl; - - friend PyTypeObject* makeDefaultMetaclass(); -}; - -} // namespace script::py_backend \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.h b/repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.h deleted file mode 100644 index 41baa92d..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/foundation.h" -#include -#include - -// docs: -// https://docs.python.org/3/c-api/index.html -// https://docs.python.org/3/extending/embedding.html -// https://docs.python.org/3.8/c-api/init.html#thread-state-and-the-global-interpreter-lock - -SCRIPTX_BEGIN_INCLUDE_LIBRARY -#include -#include -#include -SCRIPTX_END_INCLUDE_LIBRARY - -#if PY_VERSION_HEX < 0x030a00f0 -#error "python version must be greater than 3.10.0" -#endif - -namespace script { - -namespace py_backend { - -struct GeneralObject : PyObject { - void* instance; - PyObject* weakrefs; - PyObject* instanceDict; - - template - static T* getInstance(PyObject* self) { - return reinterpret_cast(reinterpret_cast(self)->instance); - } -}; - -// -// - Locker Helper: -// 1. In CPython3.12, it will be changed to per sub-interpreter per GIL, it is great. But in 3.10 -// now GIL is global, and we have to use our own lockers instead as GIL cannot be recursive -// locking. -// 2. This class is used for PyEngine and EngineScope to protect their process. It works like what -// GIL does: Keeping at one time only one thread can get access to engines. But unlike GIL, -// recursive_mutex supports re-entry. -// 3. The locker named "engineLocker" is used to mutually exclude multi-threaded access to the same -// engine, just like what GIL does in the single-interpreter environment. -// 4. "allPyEnginesEnterCount" stores the number of all entered PyEngines to determine whether -// the GIL is needed to lock/unlock. If any engine is entered, GIL must be locked; after all -// engines are exited, GIL is need to be unlocked. -// 5. Read more docs about locker usage in "PyScope.cc" -// - -class PyEngine; -class EngineLockerHelper { -private: - PyEngine* engine; - inline static std::recursive_mutex engineLocker; - inline static int allPyEnginesEnterCount = 0; - -public: - EngineLockerHelper(PyEngine* currentEngine); - ~EngineLockerHelper(); - - // May wait on lock. After this the GIL must be held. - void waitToEnterEngine(); - void finishEngineSwitch(); - - // May wait on lock. - void waitToExitEngine(); - // After this the GIL maybe released. - void finishExitEngine(); - - // May wait on lock - void startDestroyEngine(); - void endDestroyEngine(); -}; - -// key +1 value +1 -void setAttr(PyObject* obj, PyObject* key, PyObject* value); -// value +1 -void setAttr(PyObject* obj, const char* key, PyObject* value); -PyObject* getAttr(PyObject* obj, PyObject* key); -PyObject* getAttr(PyObject* obj, const char* key); -bool hasAttr(PyObject* obj, PyObject* key); -bool hasAttr(PyObject* obj, const char* key); -void delAttr(PyObject* obj, PyObject* key); -void delAttr(PyObject* obj, const char* key); - -// key +1 value +1 -void setDictItem(PyObject* obj, PyObject* key, PyObject* value); -// value +1 -void setDictItem(PyObject* obj, const char* key, PyObject* value); -PyObject* getDictItem(PyObject* obj, PyObject* key); -PyObject* getDictItem(PyObject* obj, const char* key); - -PyObject* toStr(const char* s); -PyObject* toStr(const std::string& s); -std::string fromStr(PyObject* s); - -class PyEngine; - -PyObject* newCustomInstance(PyTypeObject* pType, PyObject* argsTuple, PyObject* kwds = nullptr); -PyObject* newExceptionInstance(PyTypeObject *pType, PyObject* pValue, PyObject* pTraceback); -PyObject* newExceptionInstance(std::string msg); -void checkAndThrowException(); -bool checkAndClearException(); -PyObject* checkAndGetException(); // return new ref -PyEngine* currentEngine(); -PyEngine* currentEngineChecked(); - -// @return borrowed ref -PyObject* getGlobalMain(); - -// @return borrowed ref -PyObject* getGlobalBuiltin(); - -void extendLifeTimeToNextLoop(PyEngine* engine, PyObject* obj); -} // namespace script::py_backend -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.hpp b/repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.hpp deleted file mode 100644 index b85bf91d..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyHelper.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/Native.hpp" -#include "../../scriptx/Reference.h" -#include "PyHelper.h" -#include - -namespace script { - -// pre declare -namespace py_backend { - class PyEngine; -} -class Arguments; - -struct py_interop { - // @return new reference - template - static Local toLocal(PyObject* ref) { - return Local(Py_NewRef(ref)); - } - - // @return borrowed reference - template - static Local asLocal(PyObject* ref) { - return Local(ref); - } - - // @return new reference - template - static PyObject* getPy(const Local& ref) { - return Py_NewRef(ref.val_); - } - - // @return borrowed reference - template - static PyObject* peekPy(const Local& ref) { - return ref.val_; - } - - // @return new reference - template - static Local dupLocal(const Local& ref) { - return toLocal(peekPy(ref)); - } - - static Arguments makeArguments(py_backend::PyEngine* engine, PyObject* self, PyObject* args); - - // Exception APIs - static bool clearLastException(); - static bool hasException(); - static script::Exception getAndClearLastException(); - - // Python runtime config APIs - static void setPythonHomePath(const std::wstring &path); - static std::wstring getPythonHomePath(); - static void setModuleSearchPaths(const std::vector &paths); - static void addModuleSearchPath(const std::wstring &path); - static std::vector getModuleSearchPaths(); - static std::wstring getPlatformPathSeparator(); -}; - -namespace py_backend { - -template -class TssStorage { - private: - Py_tss_t key; // = Py_tss_NEEDS_INIT will cause warning in GCC, change to memset - - public: - TssStorage() { - memset(&key, 0, sizeof(key)); - int result = PyThread_tss_create(&key); // TODO: Output or throw exception if failed - SCRIPTX_UNUSED(result); - } - ~TssStorage() { - if (isValid()) PyThread_tss_delete(&key); - } - int set(T* value) { return isValid() ? PyThread_tss_set(&key, (void*)value) : 1; } - T* get() { return isValid() ? (T*)PyThread_tss_get(&key) : nullptr; } - bool isValid() { return PyThread_tss_is_created(&key) != 0; } -}; - -// @return new reference -PyTypeObject* makeStaticPropertyType(); -// @return new reference -PyTypeObject* makeNamespaceType(); -// @return new reference -PyTypeObject* makeDefaultMetaclass(); -// @return new reference -PyObject *makeEmptyPyFunction(); - -class GlobalOrWeakRefKeeper -{ -private: - // PyEngine* recorded below is just a sign, used for engines to reset all existing Global<> and Weak<> when destroying - std::unordered_map globalRefs; - std::unordered_map weakRefs; - -public: - inline void update(GlobalRefState* globalRef, PyEngine* engine) { - globalRefs[globalRef] = engine; - } - - inline void update(WeakRefState* weakRef, PyEngine* engine) { - weakRefs[weakRef] = engine; - } - - inline bool remove(GlobalRefState* globalRef) { - return globalRefs.erase(globalRef) > 0; - } - - inline bool remove(WeakRefState* weakRef) { - return weakRefs.erase(weakRef) > 0; - } - - void dtor(PyEngine* dtorEngine) - { - for(auto &refData : globalRefs) - if(refData.second == dtorEngine) - refData.first->dtor(false); - std::erase_if(globalRefs, - [dtorEngine](auto &refData) { return refData.second == dtorEngine; } - ); - - for(auto &refData : weakRefs) - if(refData.second == dtorEngine) - refData.first->dtor(false); - std::erase_if(weakRefs, - [dtorEngine](auto &refData) { return refData.second == dtorEngine; } - ); - } -}; - -} // namespace py_backend - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyInternalHelper.h b/repo/packages/s/scriptx-legacy/include/backend/Python/PyInternalHelper.h deleted file mode 100644 index 7aba8c96..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyInternalHelper.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/foundation.h" - -SCRIPTX_BEGIN_INCLUDE_LIBRARY -#include -SCRIPTX_END_INCLUDE_LIBRARY - -// ========================================= -// - Attention! Functions and definitions below is copied from CPython source code so they -// may need to be re-adapted as the CPython backend's version is updated. -// - These function and definitions are not exported. We can only copy the implementation. - -extern "C" void _PyThreadState_DeleteExcept(/*_PyRuntimeState *runtime, */ PyThreadState *tstate); - -// ========================================= - -extern "C" void SetPyInterpreterStateFinalizing(PyInterpreterState *is); \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyNative.hpp b/repo/packages/s/scriptx-legacy/include/backend/Python/PyNative.hpp deleted file mode 100644 index ef1a7635..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyNative.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Native.h" -#include "PyEngine.h" - -namespace script { - -template -ScriptClass::ScriptClass(const ScriptClass::ConstructFromCpp) : internalState_() { - auto engine = py_backend::currentEngineChecked(); - internalState_.scriptEngine_ = engine; - - // pass "this" through into tp_init by wrapped in a capsule - PyCapsule_Destructor destructor = [](PyObject* cap) {}; - PyObject* capsule = - PyCapsule_New(this, nullptr, destructor); - - auto ref = engine->newNativeClass({py_interop::asLocal(capsule)}); - internalState_.weakRef_ = ref; - - py_backend::extendLifeTimeToNextLoop(engine, py_interop::getPy(ref.asValue())); -} - -template -T* Arguments::engineAs() const { - return static_cast(engine()); -} - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyReference.hpp b/repo/packages/s/scriptx-legacy/include/backend/Python/PyReference.hpp deleted file mode 100644 index c499539a..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyReference.hpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include "PyHelper.hpp" -#include "PyEngine.h" -#include - -namespace script { - -// =============== Global =============== - -template -Global::Global() noexcept : val_() {} - -template -Global::Global(const script::Local& localReference) :val_(py_interop::peekPy(localReference)) {} - -template -Global::Global(const script::Weak& weak) : val_(weak.val_.peek()) {} - -template -Global::Global(const script::Global& copy) : val_(copy.val_) {} - -template -Global::Global(script::Global&& move) noexcept : val_(std::move(move.val_)) {} - -template -Global::~Global() { - val_.dtor(); -} - -template -Global& Global::operator=(const script::Global& assign) { - val_ = assign.val_; - return *this; -} - -template -Global& Global::operator=(script::Global&& move) noexcept { - val_ = std::move(move.val_); - return *this; -} - -template -Global& Global::operator=(const script::Local& assign) { - auto state{py_backend::GlobalRefState(py_interop::peekPy(assign))}; - val_ = std::move(state); - state.dtor(); - return *this; -} - - -template -void Global::swap(Global& rhs) noexcept { - val_.swap(rhs.val_); -} - -template -Local Global::get() const { - return py_interop::asLocal(val_.get()); -} - -template -Local Global::getValue() const { - return py_interop::asLocal(val_.get()); -} - -template -bool Global::isEmpty() const { - return val_.isEmpty(); -} - -template -void Global::reset() { - val_.reset(); -} - -// =============== Weak =============== - -template -Weak::Weak() noexcept {}; - -template -Weak::~Weak() { - val_.dtor(); -} - -template -Weak::Weak(const script::Local& localReference) : val_(py_interop::peekPy(localReference)) {} - -template -Weak::Weak(const script::Global& globalReference) : val_(globalReference.val_.peek()) {} - -template -Weak::Weak(const script::Weak& copy) : val_(copy.val_) {} - -template -Weak::Weak(script::Weak&& move) noexcept : val_(std::move(move.val_)) {} - -template -Weak& Weak::operator=(const script::Weak& assign) { - val_ = assign.val_; - return *this; -} - -template -Weak& Weak::operator=(script::Weak&& move) noexcept { - val_ = std::move(move.val_); - return *this; -} - -template -Weak& Weak::operator=(const script::Local& assign) { - auto state{py_backend::WeakRefState(py_interop::peekPy(assign))}; - val_ = std::move(state); - state.dtor(); - return *this; -} - -template -void Weak::swap(Weak& rhs) noexcept { - val_.swap(rhs.val_); -} - -template -Local Weak::get() const { - if (isEmpty()) throw Exception("get on empty Weak"); - return py_interop::asLocal(val_.get()); -} - -template -Local Weak::getValue() const { - if (isEmpty()) return Local(); - return py_interop::asLocal(val_.get()); -} - -template -bool Weak::isEmpty() const { - return val_.isEmpty(); -} - -template -void Weak::reset() noexcept { - val_.reset(); -} - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyRuntimeSettings.h b/repo/packages/s/scriptx-legacy/include/backend/Python/PyRuntimeSettings.h deleted file mode 100644 index da76e059..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyRuntimeSettings.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -# pragma once - -#include -#include - -namespace script::py_backend { -namespace py_runtime_settings { - -void initDefaultPythonRuntimeSettings(); - -void setPythonHomePath(const std::wstring &path); -std::wstring getPythonHomePath(); - -void setModuleSearchPaths(const std::vector &paths); -void addModuleSearchPath(const std::wstring &path); -std::vector getModuleSearchPaths(); - -std::wstring getPlatformPathSeparator(); - -} -} \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/PyScope.h b/repo/packages/s/scriptx-legacy/include/backend/Python/PyScope.h deleted file mode 100644 index dada6d1a..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/PyScope.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/Reference.h" - -namespace script::py_backend { - -class PyEngine; - -class EngineScopeImpl { - // Previous thread state - PyThreadState* prevThreadState; - - public: - explicit EngineScopeImpl(PyEngine &, PyEngine *); - - ~EngineScopeImpl(); -}; - -class ExitEngineScopeImpl { - // Entered thread state - PyThreadState* enteredThreadState; - // Entered engine - PyEngine* enteredEngine; - - public: - explicit ExitEngineScopeImpl(PyEngine &); - - ~ExitEngineScopeImpl(); -}; - -class StackFrameScopeImpl { - public: - explicit StackFrameScopeImpl(PyEngine &) {} - - template - Local returnValue(const Local &localRef) { - // create a new ref for localRef - return Local(localRef); - } -}; -} // namespace script::py_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitEngine.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitEngine.h deleted file mode 100644 index 4ea37b4e..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitEngine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../../scriptx/types.h" - -#define TEMPLATE_NOT_IMPLEMENTED() throw Exception(std::string(__func__) + " not implemented"); - -namespace script { - -namespace py_backend { -class PyEngine; -} - -template <> -struct internal::ImplType { - using type = py_backend::PyEngine; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitException.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitException.h deleted file mode 100644 index e3173c54..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitException.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include "../../../scriptx/types.h" - -namespace script { - -namespace py_backend { - -// Two exception sources: -// 1. PyErr_Fetch get from Python -// 2. Construct from std::string -// -// Four exception usage way: -// 1. exception() need return "Exception Object" -// 2. message() need return "Message String" -// 3. traceback() need return "Stacktrace String" -// 4. throw exception back to Python in ml_meth callback function - -class ExceptionFields { - public: - mutable Global exceptionObj_{}; - - mutable std::string message_{}; - mutable bool hasMessage_ = false; - - mutable std::string stacktrace_{}; - mutable bool hasStacktrace_ = false; - - std::string getMessage() const noexcept; - std::string getStacktrace() const noexcept; -}; - -} // namespace py_backend - -template <> -struct internal::ImplType { - using type = py_backend::ExceptionFields; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitIncludes.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitIncludes.h deleted file mode 100644 index 6f22d372..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitIncludes.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../PyEngine.h" -#include "../PyNative.hpp" -#include "../PyReference.hpp" - -// global marco -#define SCRIPTX_BACKEND_PYTHON -#define SCRIPTX_LANG_PYTHON \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitNative.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitNative.h deleted file mode 100644 index bf8a4c73..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitNative.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../../scriptx/types.h" -#include "../PyHelper.h" - -namespace script { - -namespace py_backend { - -struct ArgumentsData { - PyEngine* engine; - PyObject* self; - PyObject* args; -}; - -struct PyScriptClassState { - PyEngine* scriptEngine_ = nullptr; - Weak weakRef_; -}; - -} // namespace py_backend - -template <> -struct internal::ImplType<::script::Arguments> { - using type = py_backend::ArgumentsData; -}; - -template <> -struct internal::ImplType<::script::ScriptClass> { - using type = py_backend::PyScriptClassState; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitReference.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitReference.h deleted file mode 100644 index e1ec145d..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitReference.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../../scriptx/types.h" -#include "../PyHelper.h" - -namespace script { - -namespace py_backend { - -struct GlobalRefState { - PyObject* _ref; - PyEngine *_engine; - - GlobalRefState(); - GlobalRefState(PyObject* obj); - GlobalRefState(const GlobalRefState& assign); - GlobalRefState(GlobalRefState&& move) noexcept; - - GlobalRefState& operator=(const GlobalRefState& assign); - GlobalRefState& operator=(GlobalRefState&& move) noexcept; - void swap(GlobalRefState& other); - - bool isEmpty() const; - PyObject *get() const; // ref count + 1 - PyObject *peek() const; // ref count no change - void reset(); - void dtor(bool eraseFromList = true); -}; - -struct WeakRefState { - PyObject* _ref; - bool _isRealWeakRef = false; - PyEngine* _engine; - // if true, _ref is a real weak ref, or _ref will be a global ref instead - // (some builtin types like cannot have native weak ref) - - WeakRefState(); - WeakRefState(PyObject* obj); - WeakRefState(const WeakRefState& assign); - WeakRefState(WeakRefState&& move) noexcept; - - WeakRefState& operator=(const WeakRefState& assign); - WeakRefState& operator=(WeakRefState&& move) noexcept; - void swap(WeakRefState& other); - - bool isEmpty() const; - bool isRealWeakRef() const; - - PyObject *get() const; // ref count + 1 - PyObject *peek() const; // ref count no change - void reset(); - void dtor(bool eraseFromList = true); -}; - -} // namespace script::py_backend - -namespace internal { - -template -struct ImplType> { - using type = PyObject*; -}; - -template -struct ImplType> { - using type = py_backend::GlobalRefState; -}; - -template -struct ImplType> { - using type = py_backend::WeakRefState; -}; - -} // namespace script::internal - -}// namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitScope.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitScope.h deleted file mode 100644 index d3cd8996..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitScope.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../PyScope.h" -#include "TraitEngine.h" - -namespace script { - -template <> -struct internal::ImplType { - using type = py_backend::EngineScopeImpl; -}; - -template <> -struct internal::ImplType { - using type = py_backend::ExitEngineScopeImpl; -}; - -template <> -struct internal::ImplType { - using type = py_backend::StackFrameScopeImpl; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitUtils.h b/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitUtils.h deleted file mode 100644 index 1f0bc116..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/Python/trait/TraitUtils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../src/types.h" -#include "../PyHelper.h" - -namespace script { - -struct py_interop; - -template <> -struct internal::ImplType { - using type = PyObject*; -}; - -template <> -struct internal::ImplType { - using type = py_interop; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.h deleted file mode 100644 index e189b7ed..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -#include "../../scriptx/Engine.h" -#include "../../scriptx/Exception.h" -#include "../../scriptx/utils/GlobalWeakBookkeeping.hpp" -#include "../../scriptx/utils/MessageQueue.h" -#include "QjsHelper.h" - -namespace script::qjs_backend { - -using RawFunctionCallback = Local (*)(const Arguments& args, void* data1, void* data2, - bool isConstructorCall); - -class QjsEngine : public ScriptEngine { - private: - static JSClassID kPointerClassId; - /** - * for Function::newFunction - * - */ - static JSClassID kFunctionDataClassId; - static JSClassID kInstanceClassId; - - std::shared_ptr<::script::utils::MessageQueue> queue_; - JSRuntime* runtime_ = nullptr; - JSContext* context_ = nullptr; - - std::recursive_mutex runtimeLock_{}; - - // state - int pauseGcCount_ = 0; - bool isDestroying_ = false; - std::atomic_bool tickScheduled_ = false; - - /** - * key: ClassDefine - * value: prototype, constructor - */ - std::unordered_map> nativeInstanceRegistry_; - - internal::GlobalWeakBookkeeping globalWeakBookkeeping_{}; - - JSAtom lengthAtom_ = {}; - // QuickJs C API is not enough, we have to use some js helper code. - JSValue helperFunctionStrictEqual_ = {}; - JSValue helperFunctionIsByteBuffer_ = {}; - JSValue helperFunctionGetByteBufferInfo_ = {}; - JSAtom helperSymbolInternalStore_ = JS_ATOM_NULL; - - public: - using QjsFactory = std::function()>; - - public: - explicit QjsEngine(std::shared_ptr<::script::utils::MessageQueue> queue = nullptr, - const QjsFactory& factory = nullptr); - - SCRIPTX_DISALLOW_COPY_AND_MOVE(QjsEngine); - - void destroy() noexcept override; - - bool isDestroying() const override; - - Local get(const Local& key) override; - - void set(const Local& key, const Local& value) override; - using ScriptEngine::set; - - Local getGlobal() const; - - Local eval(const Local& script, const Local& sourceFile); - Local eval(const Local& script, const Local& sourceFile) override; - Local eval(const Local& script) override; - using ScriptEngine::eval; - - Local loadFile(const Local& scriptFile) override; - - std::shared_ptr messageQueue() override; - - void gc() override; - - size_t getHeapSize() override; - - void adjustAssociatedMemory(int64_t count) override; - - ScriptLanguage getLanguageType() override; - - std::string getEngineVersion() override; - - protected: - ~QjsEngine() override; - - private: - struct BookKeepFetcher; - friend struct QjsBookKeepFetcher; - - template - void registerNativeClassImpl(const ClassDefine* classDefine); - - void registerNativeStatic(const Local& module, const internal::StaticDefine& data1); - - template - Local newConstructor(const ClassDefine& define); - - template - Local newPrototype(const ClassDefine& define); - - template - Local newNativeClassImpl(const ClassDefine* classDefine, size_t size, - const Local* args); - - template - bool isInstanceOfImpl(const Local& value, const ClassDefine* classDefine); - - template - T* getNativeInstanceImpl(const Local& value, const ClassDefine* classDefine); - - void initEngineResource(); - - /** - * similar to js_std_loop - */ - void scheduleTick(); - - void extendLifeTimeToNextLoop(JSValue value); - - template - static T make(Args&&... args) { - return T(std::forward(args)...); - } - - private: - template - friend class ::script::Local; - - template - friend class ::script::Global; - - template - friend class ::script::Weak; - - friend class ::script::Object; - - friend class ::script::Array; - - friend class ::script::Function; - - friend class ::script::ByteBuffer; - - friend class ::script::ScriptEngine; - - friend class ::script::Exception; - - friend class ::script::Arguments; - - friend class ::script::ScriptClass; - - friend struct ByteBufferState; - - friend class PauseGc; - - friend class EngineScopeImpl; - friend class ExitEngineScopeImpl; - friend struct GlobalRefState; - template - friend struct MakeLocalInternal; - - friend struct ::script::qjs_interop; - - friend JSContext* currentContext(); - friend JSRuntime* currentRuntime(); - friend JSValue throwException(const Exception&, QjsEngine*); - friend Local newRawFunction(QjsEngine* engine, void* data1, void* data2, - RawFunctionCallback); -}; - -} // namespace script::qjs_backend \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.hpp b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.hpp deleted file mode 100644 index ab24f533..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsEngine.hpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/Native.hpp" -#include "../../scriptx/utils/Helper.hpp" -#include "QjsEngine.h" -#include "QjsHelper.hpp" - -namespace script::qjs_backend { - -struct InstanceClassOpaque { - void* scriptClassPolymorphicPointer; - ScriptClass* scriptClassPointer; - const void* classDefine; -}; - -class PauseGc { - SCRIPTX_DISALLOW_COPY_AND_MOVE(PauseGc); - QjsEngine* engine_; - - public: - explicit PauseGc(QjsEngine* engine) : engine_(engine) { engine_->pauseGcCount_++; } - ~PauseGc() { engine_->pauseGcCount_--; } -}; - -template -void QjsEngine::registerNativeClassImpl(const ClassDefine* classDefine) { - auto ns = internal::getNamespaceObject(this, classDefine->getNameSpace(), getGlobal()).asObject(); - - auto hasInstance = classDefine->instanceDefine.constructor; - - // static only - auto module = hasInstance ? newConstructor(*classDefine) : Object::newObject(); - registerNativeStatic(module, classDefine->staticDefine); - - if (hasInstance) { - auto proto = newPrototype(*classDefine); - nativeInstanceRegistry_.emplace( - classDefine, - std::pair{qjs_interop::getLocal(proto, context_), qjs_interop::getLocal(module, context_)}); - module.set("prototype", proto); - } - ns.set(classDefine->className, module); -} - -template -Local QjsEngine::newConstructor(const ClassDefine& classDefine) { - auto ret = newRawFunction( - this, const_cast*>(&classDefine), nullptr, - [](const Arguments& args, void* data, void*, bool isConstructorCall) { - auto classDefine = static_cast*>(data); - auto engine = args.template engineAs(); - - Tracer trace(engine, classDefine->getClassName()); - - // For Constructor the this_val is new.target, which must be the constructor. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target - if (!JS_IsConstructor(engine->context_, args.callbackInfo_.thiz_)) { - throw Exception(u8"constructor can't be called as function"); - } - - auto registry = engine->nativeInstanceRegistry_.find(classDefine); - assert(registry != engine->nativeInstanceRegistry_.end()); - - auto obj = JS_NewObjectClass(engine->context_, kInstanceClassId); - auto ret = JS_SetPrototype(engine->context_, obj, registry->second.first); - checkException(ret); - - T* instance = nullptr; - if (args.size() == 1) { - auto ptr = JS_GetOpaque(qjs_interop::peekLocal(args[0]), kPointerClassId); - if (ptr != nullptr) { - // this logic is for - // ScriptClass::ScriptClass(ConstructFromCpp) - instance = static_cast(ptr); - } - } - - if (instance == nullptr) { - // this logic is for - // ScriptClass::ScriptClass(const Local& thiz) - auto callbackInfo = args.callbackInfo_; - callbackInfo.thiz_ = obj; - - instance = classDefine->instanceDefine.constructor(Arguments(callbackInfo)); - if (instance == nullptr) { - throw Exception("can't create class " + classDefine->className); - } - } - - auto opaque = new InstanceClassOpaque(); - opaque->scriptClassPolymorphicPointer = instance; - opaque->scriptClassPointer = static_cast(instance); - opaque->classDefine = classDefine; - JS_SetOpaque(obj, opaque); - - return qjs_interop::makeLocal(obj); - }); - - auto obj = qjs_interop::getLocal(ret); - qjs_backend::checkException(JS_SetConstructorBit(context_, obj, true)); - return qjs_interop::makeLocal(obj); -} - -template -Local QjsEngine::newPrototype(const ClassDefine& define) { - auto proto = Object::newObject(); - using IDT = internal::InstanceDefine; - - auto definePtr = const_cast*>(&define); - - auto& def = define.instanceDefine; - for (auto&& f : def.functions) { - using FuncDef = typename IDT::FunctionDefine; - - auto fun = newRawFunction( - this, const_cast(&f), definePtr, - [](const Arguments& args, void* data1, void* data2, bool) { - auto ptr = static_cast( - JS_GetOpaque(qjs_interop::peekLocal(args.thiz()), kInstanceClassId)); - if (ptr == nullptr || ptr->classDefine != data2) { - throw Exception(u8"call function on wrong receiver"); - } - auto f = static_cast(data1); - Tracer tracer(args.engine(), f->traceName); - return (f->callback)(static_cast(ptr->scriptClassPolymorphicPointer), args); - }); - proto.set(f.name, fun); - } - - for (auto&& prop : def.properties) { - using PropDef = typename IDT::PropertyDefine; - - Local getterFun; - Local setterFun; - - if (prop.getter) { - getterFun = - newRawFunction(this, const_cast(&prop), definePtr, - [](const Arguments& args, void* data1, void* data2, bool) { - auto ptr = static_cast( - JS_GetOpaque(qjs_interop::peekLocal(args.thiz()), kInstanceClassId)); - if (ptr == nullptr || ptr->classDefine != data2) { - throw Exception(u8"call function on wrong receiver"); - } - auto p = static_cast(data1); - Tracer tracer(args.engine(), p->traceName); - return (p->getter)(static_cast(ptr->scriptClassPolymorphicPointer)); - }) - .asValue(); - } - - if (prop.setter) { - setterFun = newRawFunction( - this, const_cast(&prop), definePtr, - [](const Arguments& args, void* data1, void* data2, bool) { - auto ptr = static_cast( - JS_GetOpaque(qjs_interop::peekLocal(args.thiz()), kInstanceClassId)); - if (ptr == nullptr || ptr->classDefine != data2) { - throw Exception(u8"call function on wrong receiver"); - } - auto p = static_cast(data1); - Tracer tracer(args.engine(), p->traceName); - - (p->setter)(static_cast(ptr->scriptClassPolymorphicPointer), args[0]); - return Local(); - }) - .asValue(); - } - - auto atom = JS_NewAtomLen(context_, prop.name.c_str(), prop.name.length()); - - auto ret = JS_DefinePropertyGetSet(context_, qjs_interop::peekLocal(proto), atom, - qjs_interop::getLocal(getterFun), - qjs_interop::getLocal(setterFun), JS_PROP_C_W_E); - JS_FreeAtom(context_, atom); - qjs_backend::checkException(ret); - } - return proto; -} - -template -Local QjsEngine::newNativeClassImpl(const ClassDefine* classDefine, size_t size, - const Local* args) { - auto it = nativeInstanceRegistry_.find(classDefine); - if (it != nativeInstanceRegistry_.end()) { - auto ctor = it->second.second; - auto constructor = qjs_interop::makeLocal(qjs_backend::dupValue(ctor, context_)); - return Object::newObjectImpl(constructor, size, args); - } - - throw Exception("class define[" + classDefine->className + "] is not registered"); -} - -template -bool QjsEngine::isInstanceOfImpl(const Local& value, const ClassDefine* classDefine) { - if (!value.isObject()) return false; - - auto it = nativeInstanceRegistry_.find(classDefine); - if (it != nativeInstanceRegistry_.end()) { - return value.asObject().instanceOf( - qjs_interop::makeLocal(qjs_backend::dupValue(it->second.second, context_))); - } - - return false; -} - -template -T* QjsEngine::getNativeInstanceImpl(const Local& value, const ClassDefine* classDefine) { - if (!isInstanceOfImpl(value, classDefine)) { - return nullptr; - } - - return static_cast(static_cast( - JS_GetOpaque(qjs_interop::peekLocal(value), kInstanceClassId)) - ->scriptClassPolymorphicPointer); -} - -} // namespace script::qjs_backend \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.h deleted file mode 100644 index bea7c619..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/foundation.h" -#include "../../scriptx/types.h" - -SCRIPTX_BEGIN_INCLUDE_LIBRARY -#include -#include -SCRIPTX_END_INCLUDE_LIBRARY - -namespace script::qjs_backend { -class QjsEngine; - -JSContext* currentContext(); - -JSRuntime* currentRuntime(); - -QjsEngine& currentEngine(); - -/** - * @param value owned - */ -void checkException(JSValueConst value); - -/** - * throw if ret < 0 - * @param ret - */ -void checkException(int ret, const char* message = "Unknown Error"); - -JSValue throwException(const Exception& e, QjsEngine* engine = nullptr); - -JSValue dupValue(JSValueConst val, JSContext* context = nullptr); - -void freeValue(JSValueConst val, JSContext* context = nullptr); - -} // namespace script::qjs_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.hpp b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.hpp deleted file mode 100644 index d17aa2a0..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsHelper.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../scriptx/Native.h" -#include "QjsHelper.h" - -namespace script { - -namespace qjs_backend { - -template -struct MakeLocalInternal { - static Local make(JSValue value) { return QjsEngine::make>(value); } -}; - -template <> -struct MakeLocalInternal { - static Local make(JSValue value) { - return QjsEngine::make>(qjs_backend::ByteBufferState(value)); - } -}; - -} // namespace qjs_backend - -struct qjs_interop { - public: - static qjs_backend::QjsEngine& currentEngine() { return qjs_backend::currentEngine(); } - static JSContext* currentContext() { return qjs_backend::currentContext(); } - static JSRuntime* currentRuntime() { return qjs_backend::currentRuntime(); } - - static JSContext* getContext(qjs_backend::QjsEngine* engine) { return engine->context_; } - static JSRuntime* getRuntime(qjs_backend::QjsEngine* engine) { return engine->runtime_; } - - /** - * @tparam T - * @param value owned(passing ownership) - * @return - */ - template - static Local makeLocal(JSValue value) { - return ::script::qjs_backend::MakeLocalInternal::make(value); - } - - /** - * - * @tparam T - * @param ref - * @return not owned - */ - template - static JSValueConst peekLocal(const Local& ref) { - auto val = ref.val_; - if (JS_IsNull(val)) { - return JS_UNDEFINED; - } - return val; - } - - /** - * - * @tparam T - * @param ref - * @return owned - */ - template - static JSValue getLocal(const Local& ref, JSContext* context = nullptr) { - return qjs_backend::dupValue(peekLocal(ref), context); - } - - /** - * @param engine - * @param thiz not own - * @param argc - * @param argv not own - * @return - */ - static script::Arguments makeArguments(qjs_backend::QjsEngine* engine, JSValueConst thiz, - size_t argc, JSValueConst* argv) { - return script::Arguments(qjs_backend::ArgumentsData{engine, thiz, argc, argv}); - } -}; - -namespace qjs_backend { - -Local newRawFunction(QjsEngine* engine, void* data1, void* data2, RawFunctionCallback); - -} // namespace qjs_backend - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsNative.hpp b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsNative.hpp deleted file mode 100644 index ccd60886..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsNative.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Native.h" -#include "QjsEngine.h" - -namespace script { - -template -ScriptClass::ScriptClass(const ScriptClass::ConstructFromCpp) : internalState_() { - auto& engine = qjs_backend::currentEngine(); - internalState_.engine = &engine; - - auto pointer = JS_NewObjectClass(engine.context_, qjs_backend::QjsEngine::kPointerClassId); - qjs_backend::checkException(pointer); - JS_SetOpaque(pointer, this); - - auto ret = engine.template newNativeClass({qjs_interop::makeLocal(pointer)}); - auto ref = qjs_interop::getLocal(ret); - - internalState_.weakRef_ = ref; - - // schedule -> JS_Free(ref) - engine.extendLifeTimeToNextLoop(ref); -} - -template -T* Arguments::engineAs() const { - return script::internal::scriptDynamicCast(callbackInfo_.engine_); -} - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsReference.hpp b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsReference.hpp deleted file mode 100644 index 8b6eae78..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/QjsReference.hpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include -#include "QjsHelper.hpp" - -namespace script { - -namespace qjs_backend { - -struct QjsEngine::BookKeepFetcher { - template - static ::script::internal::GlobalWeakBookkeeping* get(const T* ref) { - if (!ref) return nullptr; - auto& val = ref->val_; - if (!val.engine_) return nullptr; - return &val.engine_->globalWeakBookkeeping_; - } - - template - static ::script::internal::GlobalWeakBookkeeping::HandleType& handle(const T* ref) { - auto& val = const_cast(ref)->val_; - return val.handle_; - } -}; - -struct QjsBookKeepFetcher : QjsEngine::BookKeepFetcher {}; - -using BookKeep = ::script::internal::GlobalWeakBookkeeping::Helper; - -inline GlobalRefState& GlobalRefState::operator=(const GlobalRefState& assign) { - assert(this != &assign); - bool wasEmpty = isEmpty(); - if (!wasEmpty) { - qjs_backend::freeValue(ref_, engine_->context_); - } - - ref_ = assign.ref_; - engine_ = assign.engine_; - if (engine_) qjs_backend::dupValue(ref_, engine_->context_); - - return *this; -} -inline GlobalRefState& GlobalRefState::operator=(GlobalRefState&& move) noexcept { - assert(this != &move); - bool wasEmpty = isEmpty(); - if (!wasEmpty) { - qjs_backend::freeValue(ref_, engine_->context_); - } - - ref_ = move.ref_; - engine_ = move.engine_; - move.ref_ = JS_UNDEFINED; - move.engine_ = nullptr; - - return *this; -} -inline bool GlobalRefState::isEmpty() const { return engine_ == nullptr; } - -template -void GlobalRefState::reset(GlobalOrWeak* thiz) { - if (!isEmpty()) { - qjs_backend::freeValue(ref_, engine_->context_); - qjs_backend::BookKeep::remove(thiz); - ref_ = JS_UNDEFINED; - engine_ = nullptr; - } -} -inline void GlobalRefState::swap(GlobalRefState& other) { - std::swap(ref_, other.ref_); - std::swap(engine_, other.engine_); -} - -template -void GlobalRefState::dtor(GlobalOrWeak* thiz) { - if (!isEmpty()) { - EngineScope scope(engine_); - reset(thiz); - } -} - -} // namespace qjs_backend - -template -Global::Global() noexcept : val_() {} - -template -Global::Global(const script::Local& localReference) : val_() { - val_.ref_ = localReference.val_; - val_.engine_ = &qjs_backend::currentEngine(); - qjs_backend::dupValue(val_.ref_, val_.engine_->context_); - - qjs_backend::BookKeep::keep(this); -} - -template -Global::Global(const script::Weak& weak) - : Global(::script::converter::Converter>::toCpp(weak.getValue())) {} - -template -Global::Global(const script::Global& copy) : val_() { - *this = copy; -} - -template -Global::Global(script::Global&& move) noexcept : val_() { - *this = std::move(move); -} - -template -Global::~Global() { - val_.dtor(this); -} - -template -Global& Global::operator=(const script::Global& assign) { - if (this != &assign) { - bool wasEmpty = isEmpty(); - val_ = assign.val_; - qjs_backend::BookKeep::afterCopy(wasEmpty, this, &assign); - } - return *this; -} - -template -Global& Global::operator=(script::Global&& move) noexcept { - if (this != &move) { - bool wasEmpty = isEmpty(); - val_ = std::move(move.val_); - qjs_backend::BookKeep::afterMove(wasEmpty, this, &move); - } - return *this; -} - -template -void Global::swap(Global& rhs) noexcept { - val_.swap(rhs.val_); - qjs_backend::BookKeep::afterSwap(this, &rhs); -} - -template -Global& Global::operator=(const script::Local& assign) { - *this = Global(assign); - return *this; -} - -template -Local Global::get() const { - if (isEmpty()) throw Exception("get on empty Global"); - return qjs_interop::makeLocal(qjs_backend::dupValue(val_.ref_, val_.engine_->context_)); -} - -template -Local Global::getValue() const { - if (isEmpty()) return {}; - return qjs_interop::makeLocal(qjs_backend::dupValue(val_.ref_, val_.engine_->context_)); -} - -template -bool Global::isEmpty() const { - return val_.isEmpty(); -} - -template -void Global::reset() { - val_.reset(this); -} - -// == Weak == - -template -Weak::Weak() noexcept : val_() {} - -template -Weak::~Weak() { - val_.dtor(this); -} - -template -Weak::Weak(const script::Local& localReference) : val_() { - auto ref = qjs_interop::peekLocal(localReference); - val_.engine_ = &qjs_backend::currentEngine(); - - // if has our patch, use the real WeakRef impl. -#ifdef QUICK_JS_HAS_SCRIPTX_PATCH - if (JS_IsObject(ref)) { - val_.ref_ = JS_NewWeakRef(val_.engine_->context_, ref); - qjs_backend::checkException(val_.ref_); - qjs_backend::BookKeep::keep(this); - return; - } -#endif - - val_.ref_ = qjs_backend::dupValue(ref, val_.engine_->context_); - qjs_backend::BookKeep::keep(this); -} - -template -Weak::Weak(const script::Global& globalReference) - : Weak(::script::converter::Converter>::toCpp(globalReference.getValue())) {} - -template -Weak::Weak(const script::Weak& copy) : val_() { - *this = copy; -} - -template -Weak::Weak(script::Weak&& move) noexcept : val_() { - *this = std::move(move); -} - -template -Weak& Weak::operator=(const script::Weak& assign) { - if (this != &assign) { - bool wasEmpty = isEmpty(); - val_ = assign.val_; - qjs_backend::BookKeep::afterCopy(wasEmpty, this, &assign); - } - return *this; -} - -template -Weak& Weak::operator=(script::Weak&& move) noexcept { - if (this != &move) { - bool wasEmpty = isEmpty(); - val_ = std::move(move.val_); - qjs_backend::BookKeep::afterMove(wasEmpty, this, &move); - } - return *this; -} - -template -void Weak::swap(Weak& rhs) noexcept { - val_.swap(rhs.val_); - qjs_backend::BookKeep::afterSwap(this, &rhs); -} - -template -Weak& Weak::operator=(const script::Local& assign) { - *this = Weak(assign); - return *this; -} - -template -Local Weak::get() const { - auto value = getValue(); - if (value.isNull()) throw Exception("get on empty Weak"); - return converter::Converter>::toCpp(value); -} - -template -Local Weak::getValue() const { - if (isEmpty()) return {}; -#ifdef QUICK_JS_HAS_SCRIPTX_PATCH - if (JS_IsObject(val_.ref_)) { - auto ref = JS_GetWeakRef(val_.engine_->context_, val_.ref_); - qjs_backend::checkException(ref); - return qjs_interop::makeLocal(ref); - } -#endif - return qjs_interop::makeLocal(qjs_backend::dupValue(val_.ref_, val_.engine_->context_)); -} - -template -bool Weak::isEmpty() const { - return val_.isEmpty(); -} - -template -void Weak::reset() noexcept { - val_.reset(this); -} - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitEngine.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitEngine.h deleted file mode 100644 index 936a777a..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitEngine.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../src/types.h" - -namespace script { - -namespace qjs_backend { -class QjsEngine; -} - -template <> -struct internal::ImplType { - using type = qjs_backend::QjsEngine; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitException.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitException.h deleted file mode 100644 index abe36b30..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitException.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../../src/Reference.h" -#include "../../../src/foundation.h" -#include "../../../src/types.h" - -namespace script { - -namespace qjs_backend { - -class ExceptionFields { - public: - mutable Global exception_{}; - mutable std::string message_{}; - mutable bool hasMessage_ = false; - - void fillMessage() const; -}; - -} // namespace qjs_backend - -template <> -struct internal::ImplType { - using type = qjs_backend::ExceptionFields; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitIncludes.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitIncludes.h deleted file mode 100644 index 73f1db03..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitIncludes.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../QjsEngine.hpp" -#include "../QjsHelper.hpp" -#include "../QjsNative.hpp" -#include "../QjsReference.hpp" - -// global marco -#define SCRIPTX_BACKEND_QUICKJS -#define SCRIPTX_LANG_JAVASCRIPT \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitNative.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitNative.h deleted file mode 100644 index eee02d50..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitNative.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../QjsHelper.h" - -namespace script { - -namespace qjs_backend { - -struct ArgumentsData { - QjsEngine* engine_; - JSValueConst thiz_; - size_t argc_; - JSValueConst* argv_; -}; - -struct QjsScriptClassState { - QjsEngine* engine = nullptr; - JSValueConst weakRef_ = JS_UNDEFINED; -}; - -} // namespace qjs_backend - -template <> -struct internal::ImplType<::script::Arguments> { - using type = qjs_backend::ArgumentsData; -}; - -template <> -struct internal::ImplType<::script::ScriptClass> { - using type = qjs_backend::QjsScriptClassState; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitReference.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitReference.h deleted file mode 100644 index 864b620a..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitReference.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include "../../src/types.h" -#include "../../src/utils/GlobalWeakBookkeeping.hpp" -#include "../QjsHelper.h" - -namespace script { - -namespace qjs_backend { - -// this class acts like a plain JSValue -struct ByteBufferState { - static constexpr size_t kNoSize = static_cast(-1); - mutable JSValue val_ = JS_UNDEFINED; - mutable size_t size_ = kNoSize; - mutable ByteBuffer::Type type_ = ByteBuffer::Type::kUnspecified; - mutable uint8_t* pointer_ = nullptr; - - /** - * constructor to create ByteBuffer wrapping ArrayBuffer of SharedByteBuffer - * @param val - */ - explicit ByteBufferState(JSValue val); // NOLINT - - ByteBufferState(ByteBufferState&& move) noexcept; - - ByteBufferState(const ByteBufferState&); - - ByteBufferState* operator=(ByteBufferState&) = delete; - ByteBufferState* operator=(ByteBufferState&&) = delete; - - ByteBufferState& operator=(JSValue); - - operator JSValue() const; // NOLINT - - void reset() const; - - void fillTypeAndSize() const; - - friend void swap(ByteBufferState& lhs, ByteBufferState& rhs); -}; - -void swap(ByteBufferState& lhs, ByteBufferState& rhs); - -struct GlobalRefState { - JSValue ref_ = JS_UNDEFINED; - QjsEngine* engine_ = nullptr; - internal::GlobalWeakBookkeeping::HandleType handle_{}; - - GlobalRefState() = default; - GlobalRefState(const GlobalRefState& cp) = delete; - GlobalRefState(GlobalRefState&& mv) noexcept = delete; - - GlobalRefState& operator=(const GlobalRefState& assign); - GlobalRefState& operator=(GlobalRefState&& move) noexcept; - bool isEmpty() const; - void swap(GlobalRefState& other); - - template - void reset(GlobalOrWeak* thiz); - - template - void dtor(GlobalOrWeak* thiz); -}; - -} // namespace qjs_backend - -namespace internal { - -template -struct ImplType> { - using type = JSValue; -}; - -template <> -struct ImplType> { - using type = qjs_backend::ByteBufferState; -}; - -template -struct ImplType> { - using type = qjs_backend::GlobalRefState; -}; - -template -struct ImplType> { - using type = qjs_backend::GlobalRefState; -}; - -} // namespace internal -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitScope.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitScope.h deleted file mode 100644 index 86c213b2..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitScope.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "TraitEngine.h" - -namespace script { - -namespace qjs_backend { - -class EngineScopeImpl { - QjsEngine *previous_; - QjsEngine *current_; - - public: - explicit EngineScopeImpl(QjsEngine &, QjsEngine *); - - ~EngineScopeImpl(); -}; - -class ExitEngineScopeImpl { - QjsEngine *current_; - - public: - explicit ExitEngineScopeImpl(QjsEngine &); - - ~ExitEngineScopeImpl(); -}; - -class StackFrameScopeImpl { - public: - // enter stack; - explicit StackFrameScopeImpl(QjsEngine &){}; - - // exit stack; - ~StackFrameScopeImpl() = default; - - template - Local returnValue(const Local &localRef) { - return localRef; - } -}; -} // namespace qjs_backend - -template <> -struct internal::ImplType { - using type = qjs_backend::EngineScopeImpl; -}; - -template <> -struct internal::ImplType { - using type = qjs_backend::ExitEngineScopeImpl; -}; - -template <> -struct internal::ImplType { - using type = qjs_backend::StackFrameScopeImpl; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitUtils.h b/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitUtils.h deleted file mode 100644 index 5215f446..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/QuickJs/trait/TraitUtils.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../QjsHelper.h" - -namespace script { - -struct qjs_interop; - -namespace qjs_backend { - -struct StringHolderImpl { - JSContext* context_; - const char* string_; - size_t length_; -}; - -} // namespace qjs_backend - -template <> -struct internal::ImplType { - using type = qjs_backend::StringHolderImpl; -}; - -template <> -struct internal::ImplType { - using type = qjs_interop; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.h b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.h deleted file mode 100644 index 7fdb49e3..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../scriptx/Engine.h" -#include "../../scriptx/Native.h" -#include "../../scriptx/Reference.h" -#include "../../scriptx/Scope.h" -#include "../../scriptx/Value.h" -#include "../../scriptx/utils/GlobalWeakBookkeeping.hpp" -#include "V8Helper.h" -#include "V8Platform.h" - -namespace script::v8_backend { - -class InspectorClient; - -class V8Engine : public ::script::ScriptEngine { - struct ManagedObject { - V8Engine* engine; - void* data; - std::function cleanupFunc; - }; - - struct ThreadGlobalScope { - EngineScope scope_; - explicit ThreadGlobalScope(V8Engine* engine) - : scope_(EngineScope::InternalEnterEngine{}, engine, false) {} - }; - - private: - bool isOwnIsolate_ = true; - // used only for node addon - std::unique_ptr threadGlobalScope_ = nullptr; - std::unordered_map> nativeRegistry_; - std::shared_ptr v8Platform_; - std::unique_ptr allocator_; - - std::shared_ptr<::script::utils::MessageQueue> messageQueue_; - - // V8 don't do gc on Isolate::Dispose, - // so we must got a way to manage native object. - // key: native pointer - // value: v8 weak - std::unordered_map> managedObject_; - - std::unordered_map> keptObject_; - size_t keptObjectId_ = 0; - bool isDestroying_ = false; - - internal::GlobalWeakBookkeeping globalWeakBookkeeping_; - - // create a slave engine - explicit V8Engine(V8Engine* masterEngine); - - protected: - v8::Isolate* isolate_; - - v8::Global context_; - - v8::Global internalStoreSymbol_; - - v8::Global constructorMarkSymbol_; - - explicit V8Engine(std::shared_ptr messageQueue, - const std::function& isolateFactory); - - ~V8Engine() override; - - public: - explicit V8Engine(std::shared_ptr messageQueue = {}); - - /** - * Create a ScriptEngine instance wrapping existing v8 instance, especially for NODE JS addons. - * After creating such instance, there will be a global EngineScope for CURRENT THREAD, until you - * destroy the engine (controlled by the param addGlobalEngineScope, which is true by default). - * Note: when destroying such ScriptEngine instance, the v8 isolate/context - * are not destroyed, only ScriptEngine related resources. - * - * Note: V8 has it's on event-loop, especially for node.js, so you may ignore messageQueue. - * Note: BUT, if you post message to ScriptEngine::messageQueue(), you still need to schedule - * MessageQueue::loop from time to time. - */ - explicit V8Engine(std::shared_ptr messageQueue, v8::Isolate* isolate, - v8::Local context, bool addGlobalEngineScope = true); - - void destroy() noexcept override; - - bool isDestroying() const override; - - Local get(const Local& key) override; - - Local getGlobal(); - - void set(const Local& key, const Local& value) override; - using ScriptEngine::set; - - Local eval(const Local& script, const Local& sourceFile) override; - Local eval(const Local& script) override; - using ScriptEngine::eval; - - Local loadFile(const Local& scriptFile) override; - - /** - * Create a new V8 Engine that share the same isolate, but with different context. - * Caller own the returned pointer, and the returned instance - * should be deleted BEFORE this instance. - * - * and the message queue from a slave engine is the same as its master. - */ - UniqueEnginePtr newSlaveEngine(); - - std::shared_ptr<::script::utils::MessageQueue> messageQueue() override; - - void gc() override; - - size_t getHeapSize() override; - - void adjustAssociatedMemory(int64_t count) override; - - ScriptLanguage getLanguageType() override; - - std::string getEngineVersion() override; - - private: - void initContext(); - - Local eval(const Local& script, const Local& sourceFile); - - template - void registerNativeClassImpl(const ClassDefine* classDefine); - - template - Local newNativeClassImpl(const ClassDefine* classDefine, size_t argc, - const Local* args); - - template - bool isInstanceOfImpl(const Local& value, const ClassDefine* classDefine); - - template - T* getNativeInstanceImpl(const Local& value, const ClassDefine* classDefine); - - template - v8::Local newConstructor(const ClassDefine* classDefine); - - void registerNativeClassStatic(v8::Local funcT, - const internal::StaticDefine* staticDefine); - - template - void registerNativeClassInstance(v8::Local funcT, - const ClassDefine* classDefine); - - // the following function are public only for you to interact with raw v8 APIs. - template - static T make(Args&&... args) { - return T(std::forward(args)...); - } - - template - static inline typename Local::InternalLocalRef toV8(v8::Isolate* /*isolate*/, - const Local& ref) { - return ref.val_; - } - - static typename Local::InternalLocalRef toV8(v8::Isolate* isolate, - const Local& ref) { - if (ref.val_.IsEmpty()) { - return v8::Undefined(isolate).As>(); - } - return ref.val_; - } - - static inline Arguments extractV8Arguments(V8Engine* engine, - const v8::FunctionCallbackInfo& args) { - return Arguments(std::make_pair(engine, args)); - } - - private: - void addManagedObject(void* nativeObj, v8::Local obj, - std::function&& proc); - - size_t keepReference(const Local& ref); - - /** - * can be called withoud EngineScope - */ - void removeKeptReference(size_t id); - - private: - // WHO is your friend!!! - friend class V8EngineScope; - - friend class V8HandleScope; - - friend class V8ExitEngineScope; - - template - friend class ::script::Local; - - template - friend class ::script::Global; - - template - friend class ::script::Weak; - - friend class ::script::Object; - - friend class ::script::ScriptEngine; - - // in V8Helper.h - friend class v8_backend::V8HandleScope; - - friend v8::Isolate* currentEngineIsolateChecked(); - - friend v8::Local currentEngineContextChecked(); - - friend std::tuple> currentEngineIsolateAndContextChecked(); - - friend void checkException(v8::TryCatch& tryCatch); - - friend void rethrowException(const Exception& exception); - - // in V8Helper.hpp - template - friend Ret toV8ValueArray(v8::Isolate* isolate, size_t argc, const Local* args, Closure c); - - friend class ::script::Exception; - - friend class ::script::Function; - - friend class ::script::ByteBuffer; - - friend class ::script::Arguments; - - friend class ::script::ScriptClass; - - friend class ::script::StringHolder; - - friend class ::script::ScriptClass; - - friend class ExceptionFields; - - friend class InspectorClient; - - template - friend class GlobalRefState; - friend struct V8BookKeepFetcher; - friend struct ::script::v8_interop; - - template - static auto& refVal(Ref* ref) { - return ref->val_; - } -}; - -} // namespace script::v8_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.hpp b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.hpp deleted file mode 100644 index ac60076f..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Engine.hpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Utils.h" -#include "../../scriptx/utils/Helper.hpp" -#include "V8Engine.h" -#include "V8Helper.hpp" - -namespace script::v8_backend { - -template -void V8Engine::registerNativeClassImpl(const ClassDefine* classDefine) { - StackFrameScope stack; - v8::TryCatch tryCatch(isolate_); - - Local nameSpaceObj = - ::script::internal::getNamespaceObject(this, classDefine->getNameSpace(), getGlobal()) - .asObject(); - - v8::Local funcT; - - if (classDefine->instanceDefine.constructor) { - if constexpr (!std::is_same_v) { - funcT = newConstructor(classDefine); - } else { - // validateClassDefine will make sure this won't happen - std::terminate(); - } - } else { - funcT = - v8::FunctionTemplate::New(isolate_, nullptr, {}, {}, 0, v8::ConstructorBehavior::kThrow); - funcT->RemovePrototype(); - } - - auto className = String::newString(classDefine->className); - funcT->SetClassName(v8_backend::V8Engine::toV8(isolate_, className)); - - registerNativeClassStatic(funcT, &classDefine->staticDefine); - registerNativeClassInstance(funcT, classDefine); - - auto function = funcT->GetFunction(v8_backend::currentEngineContextChecked()); - v8_backend::checkException(tryCatch); - - auto global = v8::Global(isolate_, funcT); - nativeRegistry_.emplace(classDefine, std::move(global)); - - nameSpaceObj.set(className, make>(function.ToLocalChecked())); -} - -template -v8::Local V8Engine::newConstructor(const ClassDefine* classDefine) { - v8::TryCatch tryCatch(isolate_); - - v8::Local data = v8::Object::New(isolate_); - checkException(tryCatch); - auto ret = data->Set(currentEngineContextChecked(), 0, - v8::External::New(isolate_, const_cast*>(classDefine))); - (void)ret; - checkException(tryCatch); - ret = data->Set(currentEngineContextChecked(), 1, v8::External::New(isolate_, currentEngine())); - (void)ret; - checkException(tryCatch); - - auto funcT = v8::FunctionTemplate::New( - isolate_, - [](const v8::FunctionCallbackInfo& args) { - auto context = args.GetIsolate()->GetCurrentContext(); - v8::Local data = args.Data().As(); - auto classDefine = reinterpret_cast*>( - data->Get(context, 0).ToLocalChecked().As()->Value()); - auto engine = reinterpret_cast( - data->Get(context, 1).ToLocalChecked().As()->Value()); - auto& constructor = classDefine->instanceDefine.constructor; - - Tracer trace(engine, classDefine->className.c_str()); - try { - StackFrameScope stack; - if (!args.IsConstructCall()) { - throw Exception(u8"constructor can't be called as function"); - } - T* ret; - if (args.Length() == 2 && args[0]->IsSymbol() && - args[0]->StrictEquals(engine->constructorMarkSymbol_.Get(args.GetIsolate())) && - args[1]->IsExternal()) { - // this logic is for - // ScriptClass::ScriptClass(ConstructFromCpp) - ret = static_cast(args[1].As()->Value()); - } else { - // this logic is for - // ScriptClass::ScriptClass(const Local& thiz) - ret = constructor(extractV8Arguments(engine, args)); - } - - if (ret != nullptr) { - ret->internalState_.classDefine_ = static_cast(classDefine); - - args.This()->SetAlignedPointerInInternalField(0, ret); - engine->adjustAssociatedMemory(classDefine->instanceDefine.instanceSize); - - engine->addManagedObject(ret, args.This(), [](void* ptr) { - auto scriptClass = static_cast(ptr); - auto engine = scriptClass->internalState_.scriptEngine_; - engine->adjustAssociatedMemory(-static_cast( - static_cast*>(scriptClass->internalState_.classDefine_) - ->instanceDefine.instanceSize)); - delete scriptClass; - }); - - } else { - throw Exception("can't create class " + classDefine->className); - } - } catch (Exception& e) { - v8_backend::rethrowException(e); - } - }, - data); - funcT->InstanceTemplate()->SetInternalFieldCount(1); - return funcT; -} - -template -void V8Engine::registerNativeClassInstance(v8::Local funcT, - const ClassDefine* classDefine) { - if (!classDefine->instanceDefine.constructor) return; - - // instance - auto instanceT = funcT->PrototypeTemplate(); - auto accessSignature = v8::AccessorSignature::New(isolate_, funcT); - auto signature = v8::Signature::New(isolate_, funcT); - for (auto& prop : classDefine->instanceDefine.properties) { - StackFrameScope stack; - auto name = String::newString(prop.name); - - v8::AccessorGetterCallback getter = nullptr; - v8::AccessorSetterCallback setter = nullptr; - - if (prop.getter) { - getter = [](v8::Local property, const v8::PropertyCallbackInfo& info) { - auto ptr = static_cast(info.Data().As()->Value()); - auto thiz = static_cast(info.This()->GetAlignedPointerFromInternalField(0)); - auto& getter = ptr->getter; - - Tracer trace(static_cast(thiz)->getScriptEngine(), ptr->traceName); - - Local ret = (getter)(thiz); - try { - info.GetReturnValue().Set(toV8(info.GetIsolate(), ret)); - } catch (const Exception& e) { - v8_backend::rethrowException(e); - } - }; - } - - if (prop.setter) { - setter = [](v8::Local property, v8::Local value, - const v8::PropertyCallbackInfo& info) { - auto ptr = static_cast(info.Data().As()->Value()); - auto thiz = static_cast(info.This()->GetAlignedPointerFromInternalField(0)); - auto& setter = ptr->setter; - - Tracer trace(static_cast(thiz)->getScriptEngine(), ptr->traceName); - - try { - (setter)(thiz, make>(value)); - } catch (const Exception& e) { - v8_backend::rethrowException(e); - } - }; - } - - instanceT->SetAccessor( - toV8(isolate_, name), getter, setter, - v8::External::New(isolate_, - const_cast::PropertyDefine*>(&prop)), - v8::AccessControl::DEFAULT, v8::PropertyAttribute::DontDelete, accessSignature); - } - - for (auto& func : classDefine->instanceDefine.functions) { - StackFrameScope stack; - auto name = String::newString(func.name); - using FuncDefPtr = typename internal::InstanceDefine::FunctionDefine*; - auto fn = v8::FunctionTemplate::New( - isolate_, - [](const v8::FunctionCallbackInfo& info) { - auto ptr = static_cast(info.Data().As()->Value()); - auto thiz = static_cast(info.This()->GetAlignedPointerFromInternalField(0)); - auto engine = static_cast(thiz)->getScriptEngineAs(); - - Tracer trace(engine, ptr->traceName); - try { - auto returnVal = (ptr->callback)(thiz, extractV8Arguments(engine, info)); - info.GetReturnValue().Set(v8_backend::V8Engine::toV8(info.GetIsolate(), returnVal)); - } catch (Exception& e) { - v8_backend::rethrowException(e); - } - }, - v8::External::New(isolate_, const_cast(&func)), signature); - if (!fn.IsEmpty()) { - funcT->PrototypeTemplate()->Set(toV8(isolate_, name), fn, v8::PropertyAttribute::DontDelete); - } else { - throw Exception("can't create function for instance"); - } - } -} - -template -Local V8Engine::newNativeClassImpl(const ClassDefine* classDefine, size_t size, - const Local* args) { - auto begin = args; - auto it = nativeRegistry_.find(classDefine); - if (it == nativeRegistry_.end()) { - // register on needed - registerNativeClassImpl(classDefine); - // try again - it = nativeRegistry_.find(classDefine); - if (it == nativeRegistry_.end()) { - throw Exception("can't create native class"); - } - } - - auto context = context_.Get(isolate_); - v8::TryCatch tryCatch(isolate_); - auto funcT = it->second.Get(isolate_); - auto function = funcT->GetFunction(context); - v8_backend::checkException(tryCatch); - - auto ret = toV8ValueArray>( - isolate_, size, begin, [size, &function, &context](auto* args) { - return function.ToLocalChecked()->NewInstance(context, static_cast(size), args); - }); - v8_backend::checkException(tryCatch); - return Local(ret.ToLocalChecked()); -} - -template -bool V8Engine::isInstanceOfImpl(const Local& value, const ClassDefine* classDefine) { - auto it = nativeRegistry_.find(classDefine); - if (it != nativeRegistry_.end()) { - auto funcT = it->second.Get(isolate_); - return funcT->HasInstance(toV8(isolate_, value)); - } - return false; -} - -template -T* V8Engine::getNativeInstanceImpl(const Local& value, const ClassDefine* classDefine) { - if (isInstanceOfImpl(value, classDefine)) { - auto obj = toV8(isolate_, value).As(); - return static_cast(obj->GetAlignedPointerFromInternalField(0)); - } - return nullptr; -} - -} // namespace script::v8_backend \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.h b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.h deleted file mode 100644 index f8e32fa2..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/types.h" - -SCRIPTX_BEGIN_INCLUDE_LIBRARY -#include -SCRIPTX_END_INCLUDE_LIBRARY - -namespace script::v8_backend { - -class V8Engine; - -// forward declare to solve recursive include issue -// implemented in V8Engine.h -V8Engine* currentEngine(); - -V8Engine& currentEngineChecked(); - -v8::Isolate* currentEngineIsolateChecked(); - -v8::Local currentEngineContextChecked(); - -std::tuple> currentEngineIsolateAndContextChecked(); - -void checkException(v8::TryCatch& tryCatch); - -void rethrowException(const Exception& exception); - -} // namespace script::v8_backend - -namespace script { -struct v8_interop; -} \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.hpp b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.hpp deleted file mode 100644 index b0541f49..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Helper.hpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../scriptx/utils/Helper.hpp" -#include "V8Engine.h" -#include "V8Reference.hpp" - -namespace script::v8_backend { - -template -Ret toV8ValueArray(v8::Isolate* isolate, size_t argc, const Local* args, Closure c) { - std::optional ret{std::nullopt}; - - script::internal::withNArray>( - argc, [&ret, isolate, argc, args, &c](v8::Local* arr) { - for (size_t i = 0; i < argc; i++) { - arr[i] = ::script::v8_backend::V8Engine::toV8(isolate, args[i]); - } - ret.emplace(c(arr)); - }); - - return *ret; -} - -} // namespace script::v8_backend - -namespace script { - -struct v8_interop { - /** - * get v8::Isolate* from V8Engine - */ - static v8::Isolate* getEngineIsolate(v8_backend::V8Engine* engine) { return engine->isolate_; } - - /** - * get v8::Local from V8Engine, must be called under EngineScope - */ - static v8::Local getEngineContext(v8_backend::V8Engine* engine) { - return engine->context_.Get(engine->isolate_); - } - - static v8::Isolate* currentEngineIsolateChecked() { - return ::script::v8_backend::currentEngineIsolateChecked(); - } - - static v8::Local currentEngineContextChecked() { - return ::script::v8_backend::currentEngineContextChecked(); - } - - /** - * convert Local to a v8::Local reference - */ - template - static typename internal::ImplType>::type toV8(v8::Isolate* isolate, - const Local& ref) { - return v8_backend::V8Engine::toV8(isolate, ref); - } - - /** - * create Local from jsc local reference - */ - template - static Local makeLocal(Args args) { - return v8_backend::V8Engine::make>(std::forward(args)); - } - - static Arguments newArguments(v8_backend::V8Engine* engine, - const v8::FunctionCallbackInfo& args) { - return v8_backend::V8Engine::extractV8Arguments(engine, args); - } - - struct ArgumentsData { - v8_backend::V8Engine* engine; - v8::FunctionCallbackInfo args; - }; - - /** - * Note: don't use v8::FunctionCallbackInfo::GetReturnValue to return value, it won't work. - */ - static ArgumentsData extractArguments(const Arguments& args) { - return ArgumentsData{args.callbackInfo_.first, args.callbackInfo_.second}; - } -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Native.hpp b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Native.hpp deleted file mode 100644 index 91989226..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Native.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../src/Native.h" -#include "V8Engine.hpp" - -namespace script { - -template -ScriptClass::ScriptClass(const ScriptClass::ConstructFromCpp) : internalState_() { - auto v8Engine = v8_backend::currentEngine(); - auto symbol = v8Engine->constructorMarkSymbol_.Get(v8Engine->isolate_); - auto pointer = v8::External::New(v8Engine->isolate_, this); - - auto obj = v8Engine->newNativeClass(v8_backend::V8Engine::make>(symbol), - v8_backend::V8Engine::make>(pointer)); - internalState_.scriptEngine_ = v8Engine; - internalState_.weakRef_.Reset(v8Engine->isolate_, - v8_backend::V8Engine::toV8(v8Engine->isolate_, obj)); - internalState_.weakRef_.SetWeak(); -} - -template -T *ScriptClass::getScriptEngineAs() const { - return script::internal::scriptDynamicCast(internalState_.scriptEngine_); -} - -template -T *Arguments::engineAs() const { - return script::internal::scriptDynamicCast(callbackInfo_.first); -} - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Platform.h b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Platform.h deleted file mode 100644 index ce41f956..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Platform.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "../../scriptx/foundation.h" - -SCRIPTX_BEGIN_INCLUDE_LIBRARY -#include "libnode/v8/v8-platform.h" -SCRIPTX_END_INCLUDE_LIBRARY - -#include "V8Helper.h" - -namespace script::v8_backend { - -class V8Engine; - -class MessageQueueTaskRunner; - -class V8Platform : public v8::Platform { - private: - std::unique_ptr defaultPlatform_; - - V8Platform(); - - SCRIPTX_DISALLOW_COPY_AND_MOVE(V8Platform); - - public: - // this method is used in v8 internally, we should handle it properly, since V8 7.1.1 - std::shared_ptr GetForegroundTaskRunner(v8::Isolate* isolate) override; - - // call in V8Engine - bool pumpMessageQueue(v8::Isolate* isolate); - - void OnCriticalMemoryPressure() override; - - bool OnCriticalMemoryPressure(size_t length) override; - - public: - // directly delegate to default platform - int NumberOfWorkerThreads() override { return defaultPlatform_->NumberOfWorkerThreads(); } - - void CallOnWorkerThread(std::unique_ptr task) override { - return defaultPlatform_->CallOnWorkerThread(std::move(task)); - } - - void CallDelayedOnWorkerThread(std::unique_ptr task, double delay_in_seconds) override { - return defaultPlatform_->CallDelayedOnWorkerThread(std::move(task), delay_in_seconds); - } - - double MonotonicallyIncreasingTime() override { - return defaultPlatform_->MonotonicallyIncreasingTime(); - } - - double CurrentClockTimeMillis() override { return defaultPlatform_->CurrentClockTimeMillis(); } - - v8::TracingController* GetTracingController() override { - return defaultPlatform_->GetTracingController(); - } - - v8::PageAllocator* GetPageAllocator() override { - // V8 has a bug around this, we always return null to use the default one - // return defaultPlatform_->GetPageAllocator(); - return nullptr; - } - -#define V8_VERSION_AT_LEAST(major, minor) \ - (V8_MAJOR_VERSION > (major) || (V8_MAJOR_VERSION == (major) && V8_MINOR_VERSION >= (minor))) - - // v8::Platform::PostJob, introduced since 8.4 - // https://chromium.googlesource.com/v8/v8/+/05b6268126c1435d1c964ef81799728088b72c76 - // NOTE: not available in node 14.x (node.js modified v8 code...) - // https://nodejs.org/en/download/releases/ - // and node 15.x uses v8 8.6+ -#if defined(BUILDING_NODE_EXTENSION) ? V8_VERSION_AT_LEAST(8, 6) : V8_VERSION_AT_LEAST(8, 4) - virtual std::unique_ptr PostJob(v8::TaskPriority priority, - std::unique_ptr job_task) override { - return defaultPlatform_->PostJob(priority, std::move(job_task)); - } -#endif - -#if !V8_VERSION_AT_LEAST(8, 0) - // v8 8.0 added default impl - // v8 8.1 removed those function - // so we won't override them since v8 8.0 - // https://github.com/v8/v8/commit/95aba36b52eecdec56752956a7960b916f986a39 - - void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override { - return GetForegroundTaskRunner(isolate)->PostTask(std::unique_ptr(task)); - } - - void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task, - double delay_in_seconds) override { - return GetForegroundTaskRunner(isolate)->PostDelayedTask(std::unique_ptr(task), - delay_in_seconds); - } -#endif - -#undef V8_VERSION_AT_LEAST - - public: - ~V8Platform() override; - - private: - static std::mutex lock_; - static std::weak_ptr weakInstance_; - - struct EngineData { - // auto created in the default ctor - std::shared_ptr messageQueueRunner; - EngineData(); - }; - - std::unordered_map engineMap_; - - public: - static std::shared_ptr getPlatform(); - - void addEngineInstance(v8::Isolate* isolate, V8Engine* engine); - - void removeEngineInstance(v8::Isolate* isolate); -}; - -} // namespace script::v8_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Reference.hpp b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Reference.hpp deleted file mode 100644 index 2ffc5106..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Reference.hpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include "../../src/NativeConverter.hpp" -#include "../../src/Reference.h" -#include "../../src/Value.h" -#include "../../src/types.h" -#include "../../src/utils/GlobalWeakBookkeeping.hpp" -#include "V8Engine.h" -#include "V8Helper.h" - -namespace script { - -namespace v8_backend { - -template -GlobalRefState::GlobalRefState(V8Engine* scriptEngine, const GlobalRefState::V8Global& v8Global) - : engine_(scriptEngine), ref_(v8Global) {} - -template -GlobalRefState::GlobalRefState(V8Engine* scriptEngine, const Local& localReference) - : engine_(scriptEngine), - ref_{engine_->isolate_, v8_backend::V8Engine::toV8(engine_->isolate_, localReference)} {} - -struct V8BookKeepFetcher { - template - static ::script::internal::GlobalWeakBookkeeping* get(const T* ref) { - if (!ref) return nullptr; - auto& val = V8Engine::refVal(const_cast(ref)); - if (!val.engine_) return nullptr; - return &val.engine_->globalWeakBookkeeping_; - } - - template - static ::script::internal::GlobalWeakBookkeeping::HandleType& handle(const T* ref) { - auto& val = V8Engine::refVal(const_cast(ref)); - return val.handle_; - } -}; - -using V8BookKeep = internal::GlobalWeakBookkeeping::Helper; - -} // namespace v8_backend - -// == Global == -template -Global::Global() noexcept : val_() {} - -template -Global::Global(const script::Local& localReference) - : val_(v8_backend::currentEngine(), localReference) { - v8_backend::V8BookKeep::keep(this); -} - -template -Global::Global(const script::Weak& weakReference) - : val_(v8_backend::currentEngine(), weakReference.val_.ref_) { - v8_backend::V8BookKeep::keep(this); -} - -template -Global::Global(const script::Global& copy) : val_(copy.val_) { - v8_backend::V8BookKeep::afterCopy(true, this, ©); -} - -template -Global::Global(script::Global&& move) noexcept : val_(std::move(move.val_)) { - v8_backend::V8BookKeep::afterMove(true, this, &move); -} - -template -Global::~Global() { - if (!isEmpty()) { - EngineScope scope(val_.engine_); - reset(); - } -} - -template -Global& Global::operator=(const script::Global& assign) { - bool wasEmpty = isEmpty(); - val_ = assign.val_; - v8_backend::V8BookKeep::afterCopy(wasEmpty, this, &assign); - return *this; -} - -template -Global& Global::operator=(Global&& move) noexcept { - if (&move != this) { - bool wasEmpty = isEmpty(); - val_ = std::move(move.val_); - v8_backend::V8BookKeep::afterMove(wasEmpty, this, &move); - } - return *this; -} - -template -void Global::swap(Global& rhs) noexcept { - if (&rhs != this) { - val_.swap(rhs.val_); - v8_backend::V8BookKeep::afterSwap(this, &rhs); - } -} - -template -Global& Global::operator=(const script::Local& assign) { - *this = Global(assign); - return *this; -} - -template -Local Global::get() const { - if (isEmpty()) throw Exception("get on empty Global"); - return Local(val_.ref_.Get(v8_backend::currentEngineIsolateChecked())); -} - -template -Local Global::getValue() const { - return Local(val_.ref_.Get(v8_backend::currentEngineIsolateChecked())); -} - -template -bool Global::isEmpty() const { - return val_.ref_.IsEmpty(); -} - -template -void Global::reset() { - if (!isEmpty()) { - val_.ref_.Reset(); - v8_backend::V8BookKeep::remove(this); - } -} - -// == Weak == - -template -Weak::Weak() noexcept : val_() {} - -template -Weak::~Weak() { - if (!isEmpty()) { - EngineScope scope(val_.engine_); - reset(); - } -} - -template -Weak::Weak(const script::Local& localReference) - : val_(v8_backend::currentEngine(), localReference) { - val_.makeWeak(); - v8_backend::V8BookKeep::keep(this); -} - -template -Weak::Weak(const script::Global& globalReference) - : val_(globalReference.val_.engine_, globalReference.val_.ref_) { - val_.makeWeak(); - v8_backend::V8BookKeep::keep(this); -} - -template -Weak::Weak(const script::Weak& copy) : val_(copy.val_) { - val_.makeWeak(); - v8_backend::V8BookKeep::afterCopy(true, this, ©); -} - -template -Weak::Weak(script::Weak&& move) noexcept : val_(std::move(move.val_)) { - val_.makeWeak(); - v8_backend::V8BookKeep::afterMove(true, this, &move); -} - -template -Weak& Weak::operator=(const script::Weak& assign) { - if (&assign != this) { - bool wasEmpty = isEmpty(); - val_ = assign.val_; - val_.makeWeak(); - v8_backend::V8BookKeep::afterCopy(wasEmpty, this, &assign); - } - return *this; -} - -template -Weak& Weak::operator=(script::Weak&& move) noexcept { - if (&move != this) { - bool wasEmpty = isEmpty(); - val_ = std::move(move.val_); - val_.makeWeak(); - v8_backend::V8BookKeep::afterMove(wasEmpty, this, &move); - } - return *this; -} - -template -void Weak::swap(Weak& rhs) noexcept { - if (&rhs != this) { - val_.swap(rhs.val_); - val_.makeWeak(); - rhs.val_.makeWeak(); - v8_backend::V8BookKeep::afterSwap(this, &rhs); - } -} - -template -Weak& Weak::operator=(const script::Local& assign) { - *this = Weak(assign); - return *this; -} - -template -Local Weak::get() const { - auto value = getValue(); - if (value.isNull()) throw Exception("get on null Weak"); - return converter::Converter>::toCpp(value); -} - -template -Local Weak::getValue() const { - if (isEmpty()) return {}; - return Local(val_.ref_.Get(val_.engine_->isolate_)); -} - -template -bool Weak::isEmpty() const { - // V8 PersistentBase::IsEmpty will be true after gc - // differs with our semantics, so we use then engine_ field to check this. - return val_.engine_ == nullptr; -} - -template -void Weak::reset() noexcept { - if (!isEmpty()) { - val_.ref_.Reset(); - v8_backend::V8BookKeep::remove(this); - val_.engine_ = nullptr; - } -} - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.h b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.h deleted file mode 100644 index 54995bba..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../scriptx/Reference.h" -#include "../../scriptx/types.h" -#include "V8Helper.h" - -namespace script::v8_backend { - -class V8EngineScope { - v8::Locker locker_; - v8::Isolate::Scope isolateScope_; - v8::HandleScope handleScope_; - v8::Context::Scope contextScope_; - - public: - explicit V8EngineScope(V8Engine& engine, V8Engine* previous); - - ~V8EngineScope() = default; -}; - -class V8ExitEngineScope { - v8::Unlocker unlocker_; - - public: - explicit V8ExitEngineScope(V8Engine& engine); - ~V8ExitEngineScope() = default; -}; - -class V8HandleScope { - v8::EscapableHandleScope handleScope_; - - public: - explicit V8HandleScope(V8Engine& engine); - - ~V8HandleScope() = default; - - template - Local returnValue(const Local& localRef); -}; - -} // namespace script::v8_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.hpp b/repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.hpp deleted file mode 100644 index d56fc2b7..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/V8Scope.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "V8Engine.h" -#include "V8Scope.h" - -namespace script::v8_backend { - -template -Local V8HandleScope::returnValue(const Local& localRef) { - return v8_backend::V8Engine::make>( - handleScope_.Escape(v8_backend::V8Engine::toV8(handleScope_.GetIsolate(), localRef))); -} - -} // namespace script::v8_backend diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/thirdparty/utfcpp/utf8-min.h b/repo/packages/s/scriptx-legacy/include/backend/V8/thirdparty/utfcpp/utf8-min.h deleted file mode 100644 index bed6f3c0..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/thirdparty/utfcpp/utf8-min.h +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2006-2016 Nemanja Trifunovic -// Copyright 2019 taylorcyang@tencent.com - -// this file is adapted from https://github.com/nemtrif/utfcpp -// keep only logic related with `utf8::utf16to8` - -/* -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - -#pragma once - -#include -#include -#include - -namespace utf8 { - -// Helper code - not intended to be directly called by the library users. May be changed at any time -namespace internal { - -// Unicode constants -// Leading (high) surrogates: 0xd800 - 0xdbff -// Trailing (low) surrogates: 0xdc00 - 0xdfff -const uint16_t LEAD_SURROGATE_MIN = 0xd800u; -const uint16_t LEAD_SURROGATE_MAX = 0xdbffu; -const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u; -const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu; -const uint32_t SURROGATE_OFFSET = - 0xfca02400u; // 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN - -// Maximum valid value for a Unicode code point -const uint32_t CODE_POINT_MAX = 0x0010ffffu; - -template -inline uint16_t mask16(u16_type oc) { - return static_cast(0xffff & oc); -} - -template -inline bool is_lead_surrogate(u16 cp) { - return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX); -} - -template -inline bool is_trail_surrogate(u16 cp) { - return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); -} - -template -inline bool is_surrogate(u16 cp) { - return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); -} - -template -inline bool is_code_point_valid(u32 cp) { - return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp)); -} - -} // namespace internal - -/// The library API - functions intended to be called by the users - -template -octet_iterator append(uint32_t cp, octet_iterator result) { - if (!utf8::internal::is_code_point_valid(cp)) throw std::exception(); - - if (cp < 0x80) // one octet - *(result++) = static_cast(cp); - else if (cp < 0x800) { // two octets - *(result++) = static_cast((cp >> 6) | 0xc0); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } else if (cp < 0x10000) { // three octets - *(result++) = static_cast((cp >> 12) | 0xe0); - *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } else { // four octets - *(result++) = static_cast((cp >> 18) | 0xf0); - *(result++) = static_cast(((cp >> 12) & 0x3f) | 0x80); - *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast((cp & 0x3f) | 0x80); - } - return result; -} - -template -octet_iterator utf16to8(u16bit_iterator start, u16bit_iterator end, octet_iterator result) { - while (start != end) { - uint32_t cp = utf8::internal::mask16(*start++); - // Take care of surrogate pairs first - if (utf8::internal::is_lead_surrogate(cp)) { - if (start != end) { - uint32_t trail_surrogate = utf8::internal::mask16(*start++); - if (utf8::internal::is_trail_surrogate(trail_surrogate)) { - cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; - } else { - throw std::exception(); - } - } else { - throw std::exception(); - } - } - // Lone trail surrogate - else if (utf8::internal::is_trail_surrogate(cp)) { - throw std::exception(); - } - - result = utf8::append(cp, result); - } - return result; -} - -} // namespace utf8 diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitEngine.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitEngine.h deleted file mode 100644 index b4c7c054..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitEngine.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/foundation.h" -#include "../../../scriptx/types.h" - -namespace script { -namespace v8_backend { -class V8Engine; -} - -template <> -struct internal::ImplType { - using type = v8_backend::V8Engine; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitException.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitException.h deleted file mode 100644 index ce35ee91..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitException.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/foundation.h" -#include "../../../scriptx/types.h" -#include "../V8Helper.h" - -namespace script { - -namespace v8_backend { - -class ExceptionFields { - public: - mutable Global exception_{}; - mutable std::string message_{}; - mutable bool hasMessage_ = false; - - void fillMessage() const noexcept; -}; - -} // namespace v8_backend - -template <> -struct internal::ImplType { - using type = v8_backend::ExceptionFields; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitIncludes.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitIncludes.h deleted file mode 100644 index d04ead45..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitIncludes.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../V8Engine.h" -#include "../V8Engine.hpp" -#include "../V8Native.hpp" -#include "../V8Reference.hpp" -#include "../V8Scope.h" -#include "../V8Scope.hpp" - -// global marco -#define SCRIPTX_BACKEND_V8 -#define SCRIPTX_LANG_JAVASCRIPT diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitNative.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitNative.h deleted file mode 100644 index 88a07ee7..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitNative.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/foundation.h" -#include "../../../scriptx/types.h" -#include "../V8Helper.h" - -namespace script { - -namespace v8_backend { -class V8Engine; -} - -template <> -struct internal::ImplType<::script::Arguments> { - using type = std::pair>; -}; - -namespace v8_backend { - -struct V8ScriptClassState { - V8Engine* scriptEngine_ = nullptr; - v8::Global weakRef_; - void* classDefine_ = nullptr; -}; - -} // namespace v8_backend - -template <> -struct internal::ImplType<::script::ScriptClass> { - using type = v8_backend::V8ScriptClassState; -}; - -} // namespace script \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitReference.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitReference.h deleted file mode 100644 index 55c9599f..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitReference.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "../../../scriptx/foundation.h" -#include "../../../scriptx/types.h" -#include "../../../scriptx/utils/GlobalWeakBookkeeping.hpp" -#include "../V8Helper.h" - -namespace script { - -namespace v8_backend { - -// T is script type -// type is mapped v8 type -template -struct _V8ValueType {}; - -template -using V8ValueType = typename _V8ValueType::type; - -#define TypeMap(scriptType, v8Type) \ - template <> \ - struct _V8ValueType { \ - using type = v8Type; \ - } - -TypeMap(::script::Value, v8::Value); -TypeMap(::script::Object, v8::Object); -TypeMap(::script::String, v8::String); -TypeMap(::script::Number, v8::Number); -TypeMap(::script::Boolean, v8::Boolean); -TypeMap(::script::Function, v8::Function); -TypeMap(::script::Array, v8::Array); -TypeMap(::script::ByteBuffer, v8::Value); -TypeMap(::script::Unsupported, v8::Value); - -#undef TypeMap - -template -class GlobalRefState { - private: - using V8Global = - typename ::v8::CopyablePersistentTraits>::CopyablePersistent; - - public: - V8Engine* engine_ = nullptr; - V8Global ref_{}; - ::script::internal::GlobalWeakBookkeeping::HandleType handle_{}; - - GlobalRefState() = default; - - GlobalRefState(V8Engine* scriptEngine, const Local& localReference); - - GlobalRefState(V8Engine* scriptEngine, const V8Global& v8Global); - - GlobalRefState(const GlobalRefState& copy) : engine_(copy.engine_), ref_(copy.ref_) {} - - GlobalRefState(GlobalRefState&& move) noexcept - : engine_(move.engine_), ref_(std::move(move.ref_)) { - // v8 Ref don't have a move assign - // this is still a copy - move.ref_.Reset(); - move.engine_ = nullptr; - } - - GlobalRefState& operator=(const GlobalRefState& assign) { - if (this != &assign) { - engine_ = assign.engine_; - ref_ = assign.ref_; - } - return *this; - } - - GlobalRefState& operator=(GlobalRefState&& assign) noexcept { - if (this != &assign) { - engine_ = assign.engine_; - // v8 Ref don't have a move assign - // this is still a copy - ref_ = std::move(assign.ref_); - assign.ref_.Reset(); - assign.engine_ = nullptr; - } - return *this; - } - - void swap(GlobalRefState& other) { - std::swap(ref_, other.ref_); - std::swap(engine_, other.engine_); - } - - void makeWeak() { - if (!ref_.IsEmpty()) ref_.SetWeak(); - } -}; - -} // namespace v8_backend - -template -struct internal::ImplType> { - using type = typename v8::Local>; -}; - -template -struct internal::ImplType> { - using type = typename v8_backend::GlobalRefState; -}; - -template -struct internal::ImplType> { - using type = typename v8_backend::GlobalRefState; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitScope.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitScope.h deleted file mode 100644 index ac194ff8..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitScope.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "../../../scriptx/foundation.h" -#include "../../../scriptx/types.h" -#include "../V8Helper.h" -#include "../V8Scope.h" - -namespace script { - -template <> -struct internal::ImplType { - using type = v8_backend::V8EngineScope; -}; - -template <> -struct internal::ImplType { - using type = v8_backend::V8ExitEngineScope; -}; - -template <> -struct internal::ImplType { - using type = v8_backend::V8HandleScope; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitUtils.h b/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitUtils.h deleted file mode 100644 index 2b4d4a3c..00000000 --- a/repo/packages/s/scriptx-legacy/include/backend/V8/trait/TraitUtils.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making ScriptX available. - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include "../../../src/foundation.h" -#include "../../../scriptx/types.h" -#include "../V8Helper.h" - -namespace script { - -template <> -struct internal::ImplType { - using type = v8::String::Utf8Value; -}; - -template <> -struct internal::ImplType { - using type = v8_interop; -}; - -} // namespace script diff --git a/repo/packages/s/scriptx-legacy/include/libnode/aliased_buffer.h b/repo/packages/s/scriptx-legacy/include/libnode/aliased_buffer.h deleted file mode 100644 index 2cbc70aa..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/aliased_buffer.h +++ /dev/null @@ -1,315 +0,0 @@ -#ifndef SRC_ALIASED_BUFFER_H_ -#define SRC_ALIASED_BUFFER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include "util-inl.h" -#include "v8.h" - -namespace node { - -typedef size_t AliasedBufferIndex; - -/** - * Do not use this class directly when creating instances of it - use the - * Aliased*Array defined at the end of this file instead. - * - * This class encapsulates the technique of having a native buffer mapped to - * a JS object. Writes to the native buffer can happen efficiently without - * going through JS, and the data is then available to user's via the exposed - * JS object. - * - * While this technique is computationally efficient, it is effectively a - * write to JS program state w/out going through the standard - * (monitored) API. Thus any VM capabilities to detect the modification are - * circumvented. - * - * The encapsulation herein provides a placeholder where such writes can be - * observed. Any notification APIs will be left as a future exercise. - */ -template ::value>> -class AliasedBufferBase { - public: - AliasedBufferBase(v8::Isolate* isolate, - const size_t count, - const AliasedBufferIndex* index = nullptr) - : isolate_(isolate), count_(count), byte_offset_(0), index_(index) { - CHECK_GT(count, 0); - if (index != nullptr) { - // Will be deserialized later. - return; - } - const v8::HandleScope handle_scope(isolate_); - const size_t size_in_bytes = - MultiplyWithOverflowCheck(sizeof(NativeT), count); - - // allocate v8 ArrayBuffer - v8::Local ab = v8::ArrayBuffer::New( - isolate_, size_in_bytes); - buffer_ = static_cast(ab->GetBackingStore()->Data()); - - // allocate v8 TypedArray - v8::Local js_array = V8T::New(ab, byte_offset_, count); - js_array_ = v8::Global(isolate, js_array); - } - - /** - * Create an AliasedBufferBase over a sub-region of another aliased buffer. - * The two will share a v8::ArrayBuffer instance & - * a native buffer, but will each read/write to different sections of the - * native buffer. - * - * Note that byte_offset must by aligned by sizeof(NativeT). - */ - // TODO(refack): refactor into a non-owning `AliasedBufferBaseView` - AliasedBufferBase( - v8::Isolate* isolate, - const size_t byte_offset, - const size_t count, - const AliasedBufferBase& backing_buffer, - const AliasedBufferIndex* index = nullptr) - : isolate_(isolate), - count_(count), - byte_offset_(byte_offset), - index_(index) { - if (index != nullptr) { - // Will be deserialized later. - return; - } - const v8::HandleScope handle_scope(isolate_); - v8::Local ab = backing_buffer.GetArrayBuffer(); - - // validate that the byte_offset is aligned with sizeof(NativeT) - CHECK_EQ(byte_offset & (sizeof(NativeT) - 1), 0); - // validate this fits inside the backing buffer - CHECK_LE(MultiplyWithOverflowCheck(sizeof(NativeT), count), - ab->ByteLength() - byte_offset); - - buffer_ = reinterpret_cast( - const_cast(backing_buffer.GetNativeBuffer() + byte_offset)); - - v8::Local js_array = V8T::New(ab, byte_offset, count); - js_array_ = v8::Global(isolate, js_array); - } - - AliasedBufferBase(const AliasedBufferBase& that) - : isolate_(that.isolate_), - count_(that.count_), - byte_offset_(that.byte_offset_), - buffer_(that.buffer_) { - DCHECK_NULL(index_); - js_array_ = v8::Global(that.isolate_, that.GetJSArray()); - } - - AliasedBufferIndex Serialize(v8::Local context, - v8::SnapshotCreator* creator) { - DCHECK_NULL(index_); - return creator->AddData(context, GetJSArray()); - } - - inline void Deserialize(v8::Local context) { - DCHECK_NOT_NULL(index_); - v8::Local arr = - context->GetDataFromSnapshotOnce(*index_).ToLocalChecked(); - // These may not hold true for AliasedBuffers that have grown, so should - // be removed when we expand the snapshot support. - DCHECK_EQ(count_, arr->Length()); - DCHECK_EQ(byte_offset_, arr->ByteOffset()); - uint8_t* raw = - static_cast(arr->Buffer()->GetBackingStore()->Data()); - buffer_ = reinterpret_cast(raw + byte_offset_); - js_array_.Reset(isolate_, arr); - index_ = nullptr; - } - - AliasedBufferBase& operator=(AliasedBufferBase&& that) noexcept { - DCHECK_NULL(index_); - this->~AliasedBufferBase(); - isolate_ = that.isolate_; - count_ = that.count_; - byte_offset_ = that.byte_offset_; - buffer_ = that.buffer_; - - js_array_.Reset(isolate_, that.js_array_.Get(isolate_)); - - that.buffer_ = nullptr; - that.js_array_.Reset(); - return *this; - } - - /** - * Helper class that is returned from operator[] to support assignment into - * a specified location. - */ - class Reference { - public: - Reference(AliasedBufferBase* aliased_buffer, size_t index) - : aliased_buffer_(aliased_buffer), index_(index) {} - - Reference(const Reference& that) - : aliased_buffer_(that.aliased_buffer_), - index_(that.index_) { - } - - inline Reference& operator=(const NativeT& val) { - aliased_buffer_->SetValue(index_, val); - return *this; - } - - inline Reference& operator=(const Reference& val) { - return *this = static_cast(val); - } - - operator NativeT() const { - return aliased_buffer_->GetValue(index_); - } - - inline Reference& operator+=(const NativeT& val) { - const NativeT current = aliased_buffer_->GetValue(index_); - aliased_buffer_->SetValue(index_, current + val); - return *this; - } - - inline Reference& operator+=(const Reference& val) { - return this->operator+=(static_cast(val)); - } - - inline Reference& operator-=(const NativeT& val) { - const NativeT current = aliased_buffer_->GetValue(index_); - aliased_buffer_->SetValue(index_, current - val); - return *this; - } - - private: - AliasedBufferBase* aliased_buffer_; - size_t index_; - }; - - /** - * Get the underlying v8 TypedArray overlayed on top of the native buffer - */ - v8::Local GetJSArray() const { - DCHECK_NULL(index_); - return js_array_.Get(isolate_); - } - - void Release() { - DCHECK_NULL(index_); - js_array_.Reset(); - } - - /** - * Get the underlying v8::ArrayBuffer underlying the TypedArray and - * overlaying the native buffer - */ - v8::Local GetArrayBuffer() const { - return GetJSArray()->Buffer(); - } - - /** - * Get the underlying native buffer. Note that all reads/writes should occur - * through the GetValue/SetValue/operator[] methods - */ - inline const NativeT* GetNativeBuffer() const { - DCHECK_NULL(index_); - return buffer_; - } - - /** - * Synonym for GetBuffer() - */ - inline const NativeT* operator * () const { - return GetNativeBuffer(); - } - - /** - * Set position index to given value. - */ - inline void SetValue(const size_t index, NativeT value) { - DCHECK_LT(index, count_); - DCHECK_NULL(index_); - buffer_[index] = value; - } - - /** - * Get value at position index - */ - inline const NativeT GetValue(const size_t index) const { - DCHECK_NULL(index_); - DCHECK_LT(index, count_); - return buffer_[index]; - } - - /** - * Effectively, a synonym for GetValue/SetValue - */ - Reference operator[](size_t index) { - DCHECK_NULL(index_); - return Reference(this, index); - } - - NativeT operator[](size_t index) const { - return GetValue(index); - } - - size_t Length() const { - return count_; - } - - // Should only be used to extend the array. - // Should only be used on an owning array, not one created as a sub array of - // an owning `AliasedBufferBase`. - void reserve(size_t new_capacity) { - DCHECK_NULL(index_); - DCHECK_GE(new_capacity, count_); - DCHECK_EQ(byte_offset_, 0); - const v8::HandleScope handle_scope(isolate_); - - const size_t old_size_in_bytes = sizeof(NativeT) * count_; - const size_t new_size_in_bytes = MultiplyWithOverflowCheck(sizeof(NativeT), - new_capacity); - - // allocate v8 new ArrayBuffer - v8::Local ab = v8::ArrayBuffer::New( - isolate_, new_size_in_bytes); - - // allocate new native buffer - NativeT* new_buffer = static_cast(ab->GetBackingStore()->Data()); - // copy old content - memcpy(new_buffer, buffer_, old_size_in_bytes); - - // allocate v8 TypedArray - v8::Local js_array = V8T::New(ab, byte_offset_, new_capacity); - - // move over old v8 TypedArray - js_array_ = std::move(v8::Global(isolate_, js_array)); - - buffer_ = new_buffer; - count_ = new_capacity; - } - - private: - v8::Isolate* isolate_ = nullptr; - size_t count_ = 0; - size_t byte_offset_ = 0; - NativeT* buffer_ = nullptr; - v8::Global js_array_; - - // Deserialize data - const AliasedBufferIndex* index_ = nullptr; -}; - -typedef AliasedBufferBase AliasedInt32Array; -typedef AliasedBufferBase AliasedUint8Array; -typedef AliasedBufferBase AliasedUint32Array; -typedef AliasedBufferBase AliasedFloat64Array; -typedef AliasedBufferBase AliasedBigUint64Array; -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ALIASED_BUFFER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/aliased_struct-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/aliased_struct-inl.h deleted file mode 100644 index 17d5ff58..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/aliased_struct-inl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef SRC_ALIASED_STRUCT_INL_H_ -#define SRC_ALIASED_STRUCT_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_struct.h" -#include "v8.h" -#include - -namespace node { - -template -template -AliasedStruct::AliasedStruct(v8::Isolate* isolate, Args&&... args) - : isolate_(isolate) { - const v8::HandleScope handle_scope(isolate); - - store_ = v8::ArrayBuffer::NewBackingStore(isolate, sizeof(T)); - ptr_ = new (store_->Data()) T(std::forward(args)...); - DCHECK_NOT_NULL(ptr_); - - v8::Local buffer = v8::ArrayBuffer::New(isolate, store_); - buffer_ = v8::Global(isolate, buffer); -} - -template -AliasedStruct::AliasedStruct(const AliasedStruct& that) - : AliasedStruct(that.isolate_, *that) {} - -template -AliasedStruct& AliasedStruct::operator=( - AliasedStruct&& that) noexcept { - this->~AliasedStruct(); - isolate_ = that.isolate_; - store_ = that.store_; - ptr_ = that.ptr_; - - buffer_ = std::move(that.buffer_); - - that.ptr_ = nullptr; - that.store_.reset(); - return *this; -} - -template -AliasedStruct::~AliasedStruct() { - if (ptr_ != nullptr) ptr_->~T(); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ALIASED_STRUCT_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/aliased_struct.h b/repo/packages/s/scriptx-legacy/include/libnode/aliased_struct.h deleted file mode 100644 index e4df393f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/aliased_struct.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef SRC_ALIASED_STRUCT_H_ -#define SRC_ALIASED_STRUCT_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_internals.h" -#include "v8.h" -#include - -namespace node { - -// AliasedStruct is a utility that allows uses a V8 Backing Store -// to be exposed to the C++/C side as a struct and to the -// JavaScript side as an ArrayBuffer to efficiently share -// data without marshalling. It is similar in nature to -// AliasedBuffer. -// -// struct Foo { int x; } -// -// AliasedStruct foo; -// foo->x = 1; -// -// Local ab = foo.GetArrayBuffer(); -template -class AliasedStruct final { - public: - template - explicit AliasedStruct(v8::Isolate* isolate, Args&&... args); - - inline AliasedStruct(const AliasedStruct& that); - - inline ~AliasedStruct(); - - inline AliasedStruct& operator=(AliasedStruct&& that) noexcept; - - v8::Local GetArrayBuffer() const { - return buffer_.Get(isolate_); - } - - const T* Data() const { return ptr_; } - - T* Data() { return ptr_; } - - const T& operator*() const { return *ptr_; } - - T& operator*() { return *ptr_; } - - const T* operator->() const { return ptr_; } - - T* operator->() { return ptr_; } - - private: - v8::Isolate* isolate_; - std::shared_ptr store_; - T* ptr_; - v8::Global buffer_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ALIASED_STRUCT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer-inl.h deleted file mode 100644 index 2dee6f09..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer-inl.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef SRC_ALLOCATED_BUFFER_INL_H_ -#define SRC_ALLOCATED_BUFFER_INL_H_ - -#include "allocated_buffer.h" -#include "base_object-inl.h" -#include "node_buffer.h" -#include "env-inl.h" -#include "uv.h" -#include "v8.h" -#include "util-inl.h" -#include "node_internals.h" - -namespace node { - -// It's a bit awkward to define this Buffer::New() overload here, but it -// avoids a circular dependency with node_internals.h. -namespace Buffer { -v8::MaybeLocal New(Environment* env, - v8::Local ab, - size_t byte_offset, - size_t length); -} - -NoArrayBufferZeroFillScope::NoArrayBufferZeroFillScope( - IsolateData* isolate_data) - : node_allocator_(isolate_data->node_allocator()) { - if (node_allocator_ != nullptr) node_allocator_->zero_fill_field()[0] = 0; -} - -NoArrayBufferZeroFillScope::~NoArrayBufferZeroFillScope() { - if (node_allocator_ != nullptr) node_allocator_->zero_fill_field()[0] = 1; -} - -AllocatedBuffer AllocatedBuffer::AllocateManaged( - Environment* env, - size_t size) { - NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); - std::unique_ptr bs = - v8::ArrayBuffer::NewBackingStore(env->isolate(), size); - return AllocatedBuffer(env, std::move(bs)); -} - -AllocatedBuffer::AllocatedBuffer( - Environment* env, std::unique_ptr bs) - : env_(env), backing_store_(std::move(bs)) {} - -AllocatedBuffer::AllocatedBuffer( - Environment* env, uv_buf_t buffer) - : env_(env) { - if (buffer.base == nullptr) return; - auto map = env->released_allocated_buffers(); - auto it = map->find(buffer.base); - CHECK_NE(it, map->end()); - backing_store_ = std::move(it->second); - map->erase(it); -} - -void AllocatedBuffer::Resize(size_t len) { - if (len == 0) { - backing_store_ = v8::ArrayBuffer::NewBackingStore(env_->isolate(), 0); - return; - } - NoArrayBufferZeroFillScope no_zero_fill_scope(env_->isolate_data()); - backing_store_ = v8::BackingStore::Reallocate( - env_->isolate(), std::move(backing_store_), len); -} - -uv_buf_t AllocatedBuffer::release() { - if (data() == nullptr) return uv_buf_init(nullptr, 0); - - CHECK_NOT_NULL(env_); - uv_buf_t ret = uv_buf_init(data(), size()); - env_->released_allocated_buffers()->emplace( - ret.base, std::move(backing_store_)); - return ret; -} - -char* AllocatedBuffer::data() { - if (!backing_store_) return nullptr; - return static_cast(backing_store_->Data()); -} - -const char* AllocatedBuffer::data() const { - if (!backing_store_) return nullptr; - return static_cast(backing_store_->Data()); -} - - -size_t AllocatedBuffer::size() const { - if (!backing_store_) return 0; - return backing_store_->ByteLength(); -} - -void AllocatedBuffer::clear() { - backing_store_.reset(); -} - -v8::MaybeLocal AllocatedBuffer::ToBuffer() { - v8::Local ab = ToArrayBuffer(); - return Buffer::New(env_, ab, 0, ab->ByteLength()) - .FromMaybe(v8::Local()); -} - -v8::Local AllocatedBuffer::ToArrayBuffer() { - return v8::ArrayBuffer::New(env_->isolate(), std::move(backing_store_)); -} - -} // namespace node - -#endif // SRC_ALLOCATED_BUFFER_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer.h b/repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer.h deleted file mode 100644 index 9cf41bff..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/allocated_buffer.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef SRC_ALLOCATED_BUFFER_H_ -#define SRC_ALLOCATED_BUFFER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object.h" -#include "uv.h" -#include "v8.h" -#include "env.h" - -namespace node { - -class Environment; - -// Disables zero-filling for ArrayBuffer allocations in this scope. This is -// similar to how we implement Buffer.allocUnsafe() in JS land. -class NoArrayBufferZeroFillScope{ - public: - inline explicit NoArrayBufferZeroFillScope(IsolateData* isolate_data); - inline ~NoArrayBufferZeroFillScope(); - - private: - NodeArrayBufferAllocator* node_allocator_; - - friend class Environment; -}; - -// A unique-pointer-ish object that is compatible with the JS engine's -// ArrayBuffer::Allocator. -// TODO(addaleax): We may want to start phasing this out as it's only a -// thin wrapper around v8::BackingStore at this point -struct AllocatedBuffer { - public: - // Utilities that allocate memory using the Isolate's ArrayBuffer::Allocator. - // In particular, using AllocateManaged() will provide a RAII-style object - // with easy conversion to `Buffer` and `ArrayBuffer` objects. - inline static AllocatedBuffer AllocateManaged(Environment* env, size_t size); - - AllocatedBuffer() = default; - inline AllocatedBuffer( - Environment* env, std::unique_ptr bs); - // For this constructor variant, `buffer` *must* come from an earlier call - // to .release - inline AllocatedBuffer(Environment* env, uv_buf_t buffer); - - inline void Resize(size_t len); - - inline uv_buf_t release(); - inline char* data(); - inline const char* data() const; - inline size_t size() const; - inline void clear(); - - inline v8::MaybeLocal ToBuffer(); - inline v8::Local ToArrayBuffer(); - - AllocatedBuffer(AllocatedBuffer&& other) = default; - AllocatedBuffer& operator=(AllocatedBuffer&& other) = default; - AllocatedBuffer(const AllocatedBuffer& other) = delete; - AllocatedBuffer& operator=(const AllocatedBuffer& other) = delete; - - private: - Environment* env_ = nullptr; - std::unique_ptr backing_store_; - - friend class Environment; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ALLOCATED_BUFFER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/async_wrap-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/async_wrap-inl.h deleted file mode 100644 index 03745081..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/async_wrap-inl.h +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_ASYNC_WRAP_INL_H_ -#define SRC_ASYNC_WRAP_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "base_object-inl.h" -#include "node_internals.h" - -namespace node { - -inline AsyncWrap::ProviderType AsyncWrap::provider_type() const { - return provider_type_; -} - -inline AsyncWrap::ProviderType AsyncWrap::set_provider_type( - AsyncWrap::ProviderType provider) { - provider_type_ = provider; - return provider_type_; -} - -inline double AsyncWrap::get_async_id() const { - return async_id_; -} - - -inline double AsyncWrap::get_trigger_async_id() const { - return trigger_async_id_; -} - - -inline v8::MaybeLocal AsyncWrap::MakeCallback( - const v8::Local symbol, - int argc, - v8::Local* argv) { - return MakeCallback(symbol.As(), argc, argv); -} - - -inline v8::MaybeLocal AsyncWrap::MakeCallback( - const v8::Local symbol, - int argc, - v8::Local* argv) { - return MakeCallback(symbol.As(), argc, argv); -} - - -inline v8::MaybeLocal AsyncWrap::MakeCallback( - const v8::Local symbol, - int argc, - v8::Local* argv) { - v8::Local cb_v; - if (!object()->Get(env()->context(), symbol).ToLocal(&cb_v)) - return v8::MaybeLocal(); - if (!cb_v->IsFunction()) { - v8::Isolate* isolate = env()->isolate(); - return Undefined(isolate); - } - return MakeCallback(cb_v.As(), argc, argv); -} - - -// Defined here to avoid a circular dependency with env-inl.h. -inline AsyncHooks::DefaultTriggerAsyncIdScope ::DefaultTriggerAsyncIdScope( - AsyncWrap* async_wrap) - : DefaultTriggerAsyncIdScope(async_wrap->env(), - async_wrap->get_async_id()) {} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ASYNC_WRAP_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/async_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/async_wrap.h deleted file mode 100644 index f7ed25f9..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/async_wrap.h +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_ASYNC_WRAP_H_ -#define SRC_ASYNC_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object.h" -#include "v8.h" - -#include - -namespace node { - -#define NODE_ASYNC_NON_CRYPTO_PROVIDER_TYPES(V) \ - V(NONE) \ - V(DIRHANDLE) \ - V(DNSCHANNEL) \ - V(ELDHISTOGRAM) \ - V(FILEHANDLE) \ - V(FILEHANDLECLOSEREQ) \ - V(FIXEDSIZEBLOBCOPY) \ - V(FSEVENTWRAP) \ - V(FSREQCALLBACK) \ - V(FSREQPROMISE) \ - V(GETADDRINFOREQWRAP) \ - V(GETNAMEINFOREQWRAP) \ - V(HEAPSNAPSHOT) \ - V(HTTP2SESSION) \ - V(HTTP2STREAM) \ - V(HTTP2PING) \ - V(HTTP2SETTINGS) \ - V(HTTPINCOMINGMESSAGE) \ - V(HTTPCLIENTREQUEST) \ - V(JSSTREAM) \ - V(JSUDPWRAP) \ - V(MESSAGEPORT) \ - V(PIPECONNECTWRAP) \ - V(PIPESERVERWRAP) \ - V(PIPEWRAP) \ - V(PROCESSWRAP) \ - V(PROMISE) \ - V(QUERYWRAP) \ - V(SHUTDOWNWRAP) \ - V(SIGNALWRAP) \ - V(STATWATCHER) \ - V(STREAMPIPE) \ - V(TCPCONNECTWRAP) \ - V(TCPSERVERWRAP) \ - V(TCPWRAP) \ - V(TTYWRAP) \ - V(UDPSENDWRAP) \ - V(UDPWRAP) \ - V(SIGINTWATCHDOG) \ - V(WORKER) \ - V(WORKERHEAPSNAPSHOT) \ - V(WRITEWRAP) \ - V(ZLIB) - -#if HAVE_OPENSSL -#define NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) \ - V(CHECKPRIMEREQUEST) \ - V(PBKDF2REQUEST) \ - V(KEYPAIRGENREQUEST) \ - V(KEYGENREQUEST) \ - V(KEYEXPORTREQUEST) \ - V(CIPHERREQUEST) \ - V(DERIVEBITSREQUEST) \ - V(HASHREQUEST) \ - V(RANDOMBYTESREQUEST) \ - V(RANDOMPRIMEREQUEST) \ - V(SCRYPTREQUEST) \ - V(SIGNREQUEST) \ - V(TLSWRAP) \ - V(VERIFYREQUEST) -#else -#define NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) -#endif // HAVE_OPENSSL - -#if HAVE_INSPECTOR -#define NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) \ - V(INSPECTORJSBINDING) -#else -#define NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) -#endif // HAVE_INSPECTOR - -#define NODE_ASYNC_PROVIDER_TYPES(V) \ - NODE_ASYNC_NON_CRYPTO_PROVIDER_TYPES(V) \ - NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) \ - NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) - -class Environment; -class DestroyParam; -class ExternalReferenceRegistry; - -class AsyncWrap : public BaseObject { - public: - enum ProviderType { -#define V(PROVIDER) \ - PROVIDER_ ## PROVIDER, - NODE_ASYNC_PROVIDER_TYPES(V) -#undef V - PROVIDERS_LENGTH, - }; - - AsyncWrap(Environment* env, - v8::Local object, - ProviderType provider, - double execution_async_id = kInvalidAsyncId); - - // This constructor creates a reusable instance where user is responsible - // to call set_provider_type() and AsyncReset() before use. - AsyncWrap(Environment* env, v8::Local object); - - ~AsyncWrap() override; - - AsyncWrap() = delete; - - static constexpr double kInvalidAsyncId = -1; - - static v8::Local GetConstructorTemplate( - Environment* env); - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - - static void GetAsyncId(const v8::FunctionCallbackInfo& args); - static void PushAsyncContext(const v8::FunctionCallbackInfo& args); - static void PopAsyncContext(const v8::FunctionCallbackInfo& args); - static void ExecutionAsyncResource( - const v8::FunctionCallbackInfo& args); - static void ClearAsyncIdStack( - const v8::FunctionCallbackInfo& args); - static void AsyncReset(const v8::FunctionCallbackInfo& args); - static void GetProviderType(const v8::FunctionCallbackInfo& args); - static void QueueDestroyAsyncId( - const v8::FunctionCallbackInfo& args); - static void SetCallbackTrampoline( - const v8::FunctionCallbackInfo& args); - - static void EmitAsyncInit(Environment* env, - v8::Local object, - v8::Local type, - double async_id, - double trigger_async_id); - - static void EmitDestroy(Environment* env, double async_id); - static void EmitBefore(Environment* env, double async_id); - static void EmitAfter(Environment* env, double async_id); - static void EmitPromiseResolve(Environment* env, double async_id); - - void EmitDestroy(bool from_gc = false); - - void EmitTraceEventBefore(); - static void EmitTraceEventAfter(ProviderType type, double async_id); - void EmitTraceEventDestroy(); - - static void DestroyAsyncIdsCallback(Environment* env); - - inline ProviderType provider_type() const; - inline ProviderType set_provider_type(ProviderType provider); - - inline double get_async_id() const; - inline double get_trigger_async_id() const; - - void AsyncReset(v8::Local resource, - double execution_async_id = kInvalidAsyncId, - bool silent = false); - - // Only call these within a valid HandleScope. - v8::MaybeLocal MakeCallback(const v8::Local cb, - int argc, - v8::Local* argv); - inline v8::MaybeLocal MakeCallback( - const v8::Local symbol, - int argc, - v8::Local* argv); - inline v8::MaybeLocal MakeCallback( - const v8::Local symbol, - int argc, - v8::Local* argv); - inline v8::MaybeLocal MakeCallback( - const v8::Local symbol, - int argc, - v8::Local* argv); - - virtual std::string diagnostic_name() const; - std::string MemoryInfoName() const override; - - static void WeakCallback(const v8::WeakCallbackInfo &info); - - // Returns the object that 'owns' an async wrap. For example, for a - // TCP connection handle, this is the corresponding net.Socket. - v8::Local GetOwner(); - static v8::Local GetOwner(Environment* env, - v8::Local obj); - - bool IsDoneInitializing() const override; - - private: - friend class PromiseWrap; - - AsyncWrap(Environment* env, - v8::Local promise, - ProviderType provider, - double execution_async_id, - bool silent); - AsyncWrap(Environment* env, - v8::Local promise, - ProviderType provider, - double execution_async_id, - double trigger_async_id); - ProviderType provider_type_ = PROVIDER_NONE; - bool init_hook_ran_ = false; - // Because the values may be Reset(), cannot be made const. - double async_id_ = kInvalidAsyncId; - double trigger_async_id_ = kInvalidAsyncId; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ASYNC_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/base64-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/base64-inl.h deleted file mode 100644 index 1b6cdd93..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/base64-inl.h +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef SRC_BASE64_INL_H_ -#define SRC_BASE64_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base64.h" -#include "util.h" - -namespace node { - -extern const int8_t unbase64_table[256]; - - -inline static int8_t unbase64(uint8_t x) { - return unbase64_table[x]; -} - - -inline uint32_t ReadUint32BE(const unsigned char* p) { - return static_cast(p[0] << 24U) | - static_cast(p[1] << 16U) | - static_cast(p[2] << 8U) | - static_cast(p[3]); -} - -#ifdef _MSC_VER -#pragma warning(push) -// MSVC C4003: not enough actual parameters for macro 'identifier' -#pragma warning(disable : 4003) -#endif - -template -bool base64_decode_group_slow(char* const dst, const size_t dstlen, - const TypeName* const src, const size_t srclen, - size_t* const i, size_t* const k) { - uint8_t hi; - uint8_t lo; -#define V(expr) \ - for (;;) { \ - const uint8_t c = static_cast(src[*i]); \ - lo = unbase64(c); \ - *i += 1; \ - if (lo < 64) break; /* Legal character. */ \ - if (c == '=' || *i >= srclen) return false; /* Stop decoding. */ \ - } \ - expr; \ - if (*i >= srclen) return false; \ - if (*k >= dstlen) return false; \ - hi = lo; - V(/* Nothing. */); - V(dst[(*k)++] = ((hi & 0x3F) << 2) | ((lo & 0x30) >> 4)); - V(dst[(*k)++] = ((hi & 0x0F) << 4) | ((lo & 0x3C) >> 2)); - V(dst[(*k)++] = ((hi & 0x03) << 6) | ((lo & 0x3F) >> 0)); -#undef V - return true; // Continue decoding. -} - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -template -size_t base64_decode_fast(char* const dst, const size_t dstlen, - const TypeName* const src, const size_t srclen, - const size_t decoded_size) { - const size_t available = dstlen < decoded_size ? dstlen : decoded_size; - const size_t max_k = available / 3 * 3; - size_t max_i = srclen / 4 * 4; - size_t i = 0; - size_t k = 0; - while (i < max_i && k < max_k) { - const unsigned char txt[] = { - static_cast(unbase64(static_cast(src[i + 0]))), - static_cast(unbase64(static_cast(src[i + 1]))), - static_cast(unbase64(static_cast(src[i + 2]))), - static_cast(unbase64(static_cast(src[i + 3]))), - }; - - const uint32_t v = ReadUint32BE(txt); - // If MSB is set, input contains whitespace or is not valid base64. - if (v & 0x80808080) { - if (!base64_decode_group_slow(dst, dstlen, src, srclen, &i, &k)) - return k; - max_i = i + (srclen - i) / 4 * 4; // Align max_i again. - } else { - dst[k + 0] = ((v >> 22) & 0xFC) | ((v >> 20) & 0x03); - dst[k + 1] = ((v >> 12) & 0xF0) | ((v >> 10) & 0x0F); - dst[k + 2] = ((v >> 2) & 0xC0) | ((v >> 0) & 0x3F); - i += 4; - k += 3; - } - } - if (i < srclen && k < dstlen) { - base64_decode_group_slow(dst, dstlen, src, srclen, &i, &k); - } - return k; -} - - -template -size_t base64_decoded_size(const TypeName* src, size_t size) { - // 1-byte input cannot be decoded - if (size < 2) - return 0; - - if (src[size - 1] == '=') { - size--; - if (src[size - 1] == '=') - size--; - } - return base64_decoded_size_fast(size); -} - - -template -size_t base64_decode(char* const dst, const size_t dstlen, - const TypeName* const src, const size_t srclen) { - const size_t decoded_size = base64_decoded_size(src, srclen); - return base64_decode_fast(dst, dstlen, src, srclen, decoded_size); -} - - -inline size_t base64_encode(const char* src, - size_t slen, - char* dst, - size_t dlen, - Base64Mode mode) { - // We know how much we'll write, just make sure that there's space. - CHECK(dlen >= base64_encoded_size(slen, mode) && - "not enough space provided for base64 encode"); - - dlen = base64_encoded_size(slen, mode); - - unsigned a; - unsigned b; - unsigned c; - unsigned i; - unsigned k; - unsigned n; - - const char* table = base64_select_table(mode); - - i = 0; - k = 0; - n = slen / 3 * 3; - - while (i < n) { - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - c = src[i + 2] & 0xff; - - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; - dst[k + 3] = table[c & 0x3f]; - - i += 3; - k += 4; - } - - switch (slen - n) { - case 1: - a = src[i + 0] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[(a & 3) << 4]; - if (mode == Base64Mode::NORMAL) { - dst[k + 2] = '='; - dst[k + 3] = '='; - } - break; - case 2: - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[(b & 0x0f) << 2]; - if (mode == Base64Mode::NORMAL) - dst[k + 3] = '='; - break; - } - - return dlen; -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_BASE64_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/base64.h b/repo/packages/s/scriptx-legacy/include/libnode/base64.h deleted file mode 100644 index 0db09681..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/base64.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef SRC_BASE64_H_ -#define SRC_BASE64_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "util.h" - -#include -#include -#include - -namespace node { -//// Base 64 //// - -enum class Base64Mode { - NORMAL, - URL -}; - -static constexpr char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - -static constexpr char base64_table_url[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789-_"; - -static inline const char* base64_select_table(Base64Mode mode) { - switch (mode) { - case Base64Mode::NORMAL: return base64_table; - case Base64Mode::URL: return base64_table_url; - default: UNREACHABLE(); - } -} - -static inline constexpr size_t base64_encoded_size( - size_t size, - Base64Mode mode = Base64Mode::NORMAL) { - return mode == Base64Mode::NORMAL ? ((size + 2) / 3 * 4) - : static_cast(std::ceil( - static_cast(size * 4) / 3)); -} - -// Doesn't check for padding at the end. Can be 1-2 bytes over. -static inline constexpr size_t base64_decoded_size_fast(size_t size) { - // 1-byte input cannot be decoded - return size > 1 ? (size / 4) * 3 + (size % 4 + 1) / 2 : 0; -} - -inline uint32_t ReadUint32BE(const unsigned char* p); - -template -size_t base64_decoded_size(const TypeName* src, size_t size); - -template -size_t base64_decode(char* const dst, const size_t dstlen, - const TypeName* const src, const size_t srclen); - -inline size_t base64_encode(const char* src, - size_t slen, - char* dst, - size_t dlen, - Base64Mode mode = Base64Mode::NORMAL); -} // namespace node - - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_BASE64_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/base_object-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/base_object-inl.h deleted file mode 100644 index bb1e8d4b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/base_object-inl.h +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_BASE_OBJECT_INL_H_ -#define SRC_BASE_OBJECT_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object.h" -#include "env-inl.h" -#include "util.h" - -#include "v8.h" - -namespace node { - -BaseObject::BaseObject(Environment* env, v8::Local object) - : persistent_handle_(env->isolate(), object), env_(env) { - CHECK_EQ(false, object.IsEmpty()); - CHECK_GT(object->InternalFieldCount(), 0); - object->SetAlignedPointerInInternalField( - BaseObject::kSlot, - static_cast(this)); - env->AddCleanupHook(DeleteMe, static_cast(this)); - env->modify_base_object_count(1); -} - -BaseObject::~BaseObject() { - env()->modify_base_object_count(-1); - env()->RemoveCleanupHook(DeleteMe, static_cast(this)); - - if (UNLIKELY(has_pointer_data())) { - PointerData* metadata = pointer_data(); - CHECK_EQ(metadata->strong_ptr_count, 0); - metadata->self = nullptr; - if (metadata->weak_ptr_count == 0) - delete metadata; - } - - if (persistent_handle_.IsEmpty()) { - // This most likely happened because the weak callback below cleared it. - return; - } - - { - v8::HandleScope handle_scope(env()->isolate()); - object()->SetAlignedPointerInInternalField(BaseObject::kSlot, nullptr); - } -} - -void BaseObject::Detach() { - CHECK_GT(pointer_data()->strong_ptr_count, 0); - pointer_data()->is_detached = true; -} - -v8::Global& BaseObject::persistent() { - return persistent_handle_; -} - - -v8::Local BaseObject::object() const { - return PersistentToLocal::Default(env()->isolate(), persistent_handle_); -} - -v8::Local BaseObject::object(v8::Isolate* isolate) const { - v8::Local handle = object(); - - DCHECK_EQ(handle->GetCreationContext().ToLocalChecked()->GetIsolate(), - isolate); - DCHECK_EQ(env()->isolate(), isolate); - - return handle; -} - -Environment* BaseObject::env() const { - return env_; -} - -BaseObject* BaseObject::FromJSObject(v8::Local value) { - v8::Local obj = value.As(); - DCHECK_GE(obj->InternalFieldCount(), BaseObject::kSlot); - return static_cast( - obj->GetAlignedPointerFromInternalField(BaseObject::kSlot)); -} - - -template -T* BaseObject::FromJSObject(v8::Local object) { - return static_cast(FromJSObject(object)); -} - - -void BaseObject::MakeWeak() { - if (has_pointer_data()) { - pointer_data()->wants_weak_jsobj = true; - if (pointer_data()->strong_ptr_count > 0) return; - } - - persistent_handle_.SetWeak( - this, - [](const v8::WeakCallbackInfo& data) { - BaseObject* obj = data.GetParameter(); - // Clear the persistent handle so that ~BaseObject() doesn't attempt - // to mess with internal fields, since the JS object may have - // transitioned into an invalid state. - // Refs: https://github.com/nodejs/node/issues/18897 - obj->persistent_handle_.Reset(); - CHECK_IMPLIES(obj->has_pointer_data(), - obj->pointer_data()->strong_ptr_count == 0); - obj->OnGCCollect(); - }, v8::WeakCallbackType::kParameter); -} - -void BaseObject::OnGCCollect() { - delete this; -} - -void BaseObject::ClearWeak() { - if (has_pointer_data()) - pointer_data()->wants_weak_jsobj = false; - - persistent_handle_.ClearWeak(); -} - -bool BaseObject::IsWeakOrDetached() const { - if (persistent_handle_.IsWeak()) return true; - - if (!has_pointer_data()) return false; - const PointerData* pd = const_cast(this)->pointer_data(); - return pd->wants_weak_jsobj || pd->is_detached; -} - -void BaseObject::LazilyInitializedJSTemplateConstructor( - const v8::FunctionCallbackInfo& args) { - DCHECK(args.IsConstructCall()); - DCHECK_GT(args.This()->InternalFieldCount(), 0); - args.This()->SetAlignedPointerInInternalField(BaseObject::kSlot, nullptr); -} - -v8::Local -BaseObject::MakeLazilyInitializedJSTemplate(Environment* env) { - v8::Local t = - env->NewFunctionTemplate(LazilyInitializedJSTemplateConstructor); - t->Inherit(BaseObject::GetConstructorTemplate(env)); - t->InstanceTemplate()->SetInternalFieldCount( - BaseObject::kInternalFieldCount); - return t; -} - -template -void BaseObject::InternalFieldGet( - v8::Local property, - const v8::PropertyCallbackInfo& info) { - info.GetReturnValue().Set(info.This()->GetInternalField(Field)); -} - -template -void BaseObject::InternalFieldSet(v8::Local property, - v8::Local value, - const v8::PropertyCallbackInfo& info) { - // This could be e.g. value->IsFunction(). - CHECK(((*value)->*typecheck)()); - info.This()->SetInternalField(Field, value); -} - -bool BaseObject::has_pointer_data() const { - return pointer_data_ != nullptr; -} - -BaseObject::PointerData* BaseObject::pointer_data() { - if (!has_pointer_data()) { - PointerData* metadata = new PointerData(); - metadata->wants_weak_jsobj = persistent_handle_.IsWeak(); - metadata->self = this; - pointer_data_ = metadata; - } - CHECK(has_pointer_data()); - return pointer_data_; -} - -void BaseObject::decrease_refcount() { - CHECK(has_pointer_data()); - PointerData* metadata = pointer_data(); - CHECK_GT(metadata->strong_ptr_count, 0); - unsigned int new_refcount = --metadata->strong_ptr_count; - if (new_refcount == 0) { - if (metadata->is_detached) { - OnGCCollect(); - } else if (metadata->wants_weak_jsobj && !persistent_handle_.IsEmpty()) { - MakeWeak(); - } - } -} - -void BaseObject::increase_refcount() { - unsigned int prev_refcount = pointer_data()->strong_ptr_count++; - if (prev_refcount == 0 && !persistent_handle_.IsEmpty()) - persistent_handle_.ClearWeak(); -} - -template -BaseObject::PointerData* -BaseObjectPtrImpl::pointer_data() const { - if (kIsWeak) { - return data_.pointer_data; - } - if (get_base_object() == nullptr) { - return nullptr; - } - return get_base_object()->pointer_data(); -} - -template -BaseObject* BaseObjectPtrImpl::get_base_object() const { - if (kIsWeak) { - if (pointer_data() == nullptr) { - return nullptr; - } - return pointer_data()->self; - } - return data_.target; -} - -template -BaseObjectPtrImpl::~BaseObjectPtrImpl() { - if (kIsWeak) { - if (pointer_data() != nullptr && - --pointer_data()->weak_ptr_count == 0 && - pointer_data()->self == nullptr) { - delete pointer_data(); - } - } else if (get() != nullptr) { - get()->decrease_refcount(); - } -} - -template -BaseObjectPtrImpl::BaseObjectPtrImpl() { - data_.target = nullptr; -} - -template -BaseObjectPtrImpl::BaseObjectPtrImpl(T* target) - : BaseObjectPtrImpl() { - if (target == nullptr) return; - if (kIsWeak) { - data_.pointer_data = target->pointer_data(); - CHECK_NOT_NULL(pointer_data()); - pointer_data()->weak_ptr_count++; - } else { - data_.target = target; - CHECK_NOT_NULL(pointer_data()); - get()->increase_refcount(); - } -} - -template -template -BaseObjectPtrImpl::BaseObjectPtrImpl( - const BaseObjectPtrImpl& other) - : BaseObjectPtrImpl(other.get()) {} - -template -BaseObjectPtrImpl::BaseObjectPtrImpl(const BaseObjectPtrImpl& other) - : BaseObjectPtrImpl(other.get()) {} - -template -template -BaseObjectPtrImpl& BaseObjectPtrImpl::operator=( - const BaseObjectPtrImpl& other) { - if (other.get() == get()) return *this; - this->~BaseObjectPtrImpl(); - return *new (this) BaseObjectPtrImpl(other); -} - -template -BaseObjectPtrImpl& BaseObjectPtrImpl::operator=( - const BaseObjectPtrImpl& other) { - if (other.get() == get()) return *this; - this->~BaseObjectPtrImpl(); - return *new (this) BaseObjectPtrImpl(other); -} - -template -BaseObjectPtrImpl::BaseObjectPtrImpl(BaseObjectPtrImpl&& other) - : data_(other.data_) { - if (kIsWeak) - other.data_.target = nullptr; - else - other.data_.pointer_data = nullptr; -} - -template -BaseObjectPtrImpl& BaseObjectPtrImpl::operator=( - BaseObjectPtrImpl&& other) { - if (&other == this) return *this; - this->~BaseObjectPtrImpl(); - return *new (this) BaseObjectPtrImpl(std::move(other)); -} - -template -void BaseObjectPtrImpl::reset(T* ptr) { - *this = BaseObjectPtrImpl(ptr); -} - -template -T* BaseObjectPtrImpl::get() const { - return static_cast(get_base_object()); -} - -template -T& BaseObjectPtrImpl::operator*() const { - return *get(); -} - -template -T* BaseObjectPtrImpl::operator->() const { - return get(); -} - -template -BaseObjectPtrImpl::operator bool() const { - return get() != nullptr; -} - -template -template -bool BaseObjectPtrImpl::operator ==( - const BaseObjectPtrImpl& other) const { - return get() == other.get(); -} - -template -template -bool BaseObjectPtrImpl::operator !=( - const BaseObjectPtrImpl& other) const { - return get() != other.get(); -} - -template -BaseObjectPtr MakeBaseObject(Args&&... args) { - return BaseObjectPtr(new T(std::forward(args)...)); -} - -template -BaseObjectPtr MakeDetachedBaseObject(Args&&... args) { - BaseObjectPtr target = MakeBaseObject(std::forward(args)...); - target->Detach(); - return target; -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_BASE_OBJECT_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/base_object.h b/repo/packages/s/scriptx-legacy/include/libnode/base_object.h deleted file mode 100644 index 1c63da92..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/base_object.h +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_BASE_OBJECT_H_ -#define SRC_BASE_OBJECT_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include // std::remove_reference -#include "memory_tracker.h" -#include "v8.h" - -namespace node { - -class Environment; -template -class BaseObjectPtrImpl; - -namespace worker { -class TransferData; -} - -class BaseObject : public MemoryRetainer { - public: - enum InternalFields { kSlot, kInternalFieldCount }; - - // Associates this object with `object`. It uses the 0th internal field for - // that, and in particular aborts if there is no such field. - inline BaseObject(Environment* env, v8::Local object); - inline ~BaseObject() override; - - BaseObject() = delete; - - // Returns the wrapped object. Returns an empty handle when - // persistent.IsEmpty() is true. - inline v8::Local object() const; - - // Same as the above, except it additionally verifies that this object - // is associated with the passed Isolate in debug mode. - inline v8::Local object(v8::Isolate* isolate) const; - - inline v8::Global& persistent(); - - inline Environment* env() const; - - // Get a BaseObject* pointer, or subclass pointer, for the JS object that - // was also passed to the `BaseObject()` constructor initially. - // This may return `nullptr` if the C++ object has not been constructed yet, - // e.g. when the JS object used `MakeLazilyInitializedJSTemplate`. - static inline void LazilyInitializedJSTemplateConstructor( - const v8::FunctionCallbackInfo& args); - static inline BaseObject* FromJSObject(v8::Local object); - template - static inline T* FromJSObject(v8::Local object); - - // Make the `v8::Global` a weak reference and, `delete` this object once - // the JS object has been garbage collected and there are no (strong) - // BaseObjectPtr references to it. - inline void MakeWeak(); - - // Undo `MakeWeak()`, i.e. turn this into a strong reference that is a GC - // root and will not be touched by the garbage collector. - inline void ClearWeak(); - - // Reports whether this BaseObject is using a weak reference or detached, - // i.e. whether is can be deleted by GC once no strong BaseObjectPtrs refer - // to it anymore. - inline bool IsWeakOrDetached() const; - - // Utility to create a FunctionTemplate with one internal field (used for - // the `BaseObject*` pointer) and a constructor that initializes that field - // to `nullptr`. - static inline v8::Local MakeLazilyInitializedJSTemplate( - Environment* env); - - // Setter/Getter pair for internal fields that can be passed to SetAccessor. - template - static void InternalFieldGet(v8::Local property, - const v8::PropertyCallbackInfo& info); - template - static void InternalFieldSet(v8::Local property, - v8::Local value, - const v8::PropertyCallbackInfo& info); - - // This is a bit of a hack. See the override in async_wrap.cc for details. - virtual bool IsDoneInitializing() const; - - // Can be used to avoid this object keeping itself alive as a GC root - // indefinitely, for example when this object is owned and deleted by another - // BaseObject once that is torn down. This can only be called when there is - // a BaseObjectPtr to this object. - inline void Detach(); - - static v8::Local GetConstructorTemplate( - Environment* env); - - // Interface for transferring BaseObject instances using the .postMessage() - // method of MessagePorts (and, by extension, Workers). - // GetTransferMode() returns a transfer mode that indicates how to deal with - // the current object: - // - kUntransferable: - // No transfer is possible, either because this type of BaseObject does - // not know how to be transferred, or because it is not in a state in - // which it is possible to do so (e.g. because it has already been - // transferred). - // - kTransferable: - // This object can be transferred in a destructive fashion, i.e. will be - // rendered unusable on the sending side of the channel in the process - // of being transferred. (In C++ this would be referred to as movable but - // not copyable.) Objects of this type need to be listed in the - // `transferList` argument of the relevant postMessage() call in order to - // make sure that they are not accidentally destroyed on the sending side. - // TransferForMessaging() will be called to get a representation of the - // object that is used for subsequent deserialization. - // The NestedTransferables() method can be used to transfer other objects - // along with this one, if a situation requires it. - // - kCloneable: - // This object can be cloned without being modified. - // CloneForMessaging() will be called to get a representation of the - // object that is used for subsequent deserialization, unless the - // object is listed in transferList, in which case TransferForMessaging() - // is attempted first. - // After a successful clone, FinalizeTransferRead() is called on the receiving - // end, and can read deserialize JS data possibly serialized by a previous - // FinalizeTransferWrite() call. - enum class TransferMode { - kUntransferable, - kTransferable, - kCloneable - }; - virtual TransferMode GetTransferMode() const; - virtual std::unique_ptr TransferForMessaging(); - virtual std::unique_ptr CloneForMessaging() const; - virtual v8::Maybe>> - NestedTransferables() const; - virtual v8::Maybe FinalizeTransferRead( - v8::Local context, v8::ValueDeserializer* deserializer); - - // Indicates whether this object is expected to use a strong reference during - // a clean process exit (due to an empty event loop). - virtual bool IsNotIndicativeOfMemoryLeakAtExit() const; - - virtual inline void OnGCCollect(); - - virtual inline bool is_snapshotable() const { return false; } - - private: - v8::Local WrappedObject() const override; - bool IsRootNode() const override; - static void DeleteMe(void* data); - - // persistent_handle_ needs to be at a fixed offset from the start of the - // class because it is used by src/node_postmortem_metadata.cc to calculate - // offsets and generate debug symbols for BaseObject, which assumes that the - // position of members in memory are predictable. For more information please - // refer to `doc/contributing/node-postmortem-support.md` - friend int GenDebugSymbols(); - friend class CleanupHookCallback; - template - friend class BaseObjectPtrImpl; - - v8::Global persistent_handle_; - - // Metadata that is associated with this BaseObject if there are BaseObjectPtr - // or BaseObjectWeakPtr references to it. - // This object is deleted when the BaseObject itself is destroyed, and there - // are no weak references to it. - struct PointerData { - // Number of BaseObjectPtr instances that refer to this object. If this - // is non-zero, the BaseObject is always a GC root and will not be destroyed - // during cleanup until the count drops to zero again. - unsigned int strong_ptr_count = 0; - // Number of BaseObjectWeakPtr instances that refer to this object. - unsigned int weak_ptr_count = 0; - // Indicates whether MakeWeak() has been called. - bool wants_weak_jsobj = false; - // Indicates whether Detach() has been called. If that is the case, this - // object will be destroyed once the strong pointer count drops to zero. - bool is_detached = false; - // Reference to the original BaseObject. This is used by weak pointers. - BaseObject* self = nullptr; - }; - - inline bool has_pointer_data() const; - // This creates a PointerData struct if none was associated with this - // BaseObject before. - inline PointerData* pointer_data(); - - // Functions that adjust the strong pointer count. - inline void decrease_refcount(); - inline void increase_refcount(); - - Environment* env_; - PointerData* pointer_data_ = nullptr; -}; - -// Global alias for FromJSObject() to avoid churn. -template -inline T* Unwrap(v8::Local obj) { - return BaseObject::FromJSObject(obj); -} - -#define ASSIGN_OR_RETURN_UNWRAP(ptr, obj, ...) \ - do { \ - *ptr = static_cast::type>( \ - BaseObject::FromJSObject(obj)); \ - if (*ptr == nullptr) return __VA_ARGS__; \ - } while (0) - -// Implementation of a generic strong or weak pointer to a BaseObject. -// If strong, this will keep the target BaseObject alive regardless of other -// circumstances such as the GC or Environment cleanup. -// If weak, destruction behaviour is not affected, but the pointer will be -// reset to nullptr once the BaseObject is destroyed. -// The API matches std::shared_ptr closely. -template -class BaseObjectPtrImpl final { - public: - inline BaseObjectPtrImpl(); - inline ~BaseObjectPtrImpl(); - inline explicit BaseObjectPtrImpl(T* target); - - // Copy and move constructors. Note that the templated version is not a copy - // or move constructor in the C++ sense of the word, so an identical - // untemplated version is provided. - template - inline BaseObjectPtrImpl(const BaseObjectPtrImpl& other); - inline BaseObjectPtrImpl(const BaseObjectPtrImpl& other); - template - inline BaseObjectPtrImpl& operator=(const BaseObjectPtrImpl& other); - inline BaseObjectPtrImpl& operator=(const BaseObjectPtrImpl& other); - inline BaseObjectPtrImpl(BaseObjectPtrImpl&& other); - inline BaseObjectPtrImpl& operator=(BaseObjectPtrImpl&& other); - - inline void reset(T* ptr = nullptr); - inline T* get() const; - inline T& operator*() const; - inline T* operator->() const; - inline operator bool() const; - - template - inline bool operator ==(const BaseObjectPtrImpl& other) const; - template - inline bool operator !=(const BaseObjectPtrImpl& other) const; - - private: - union { - BaseObject* target; // Used for strong pointers. - BaseObject::PointerData* pointer_data; // Used for weak pointers. - } data_; - - inline BaseObject* get_base_object() const; - inline BaseObject::PointerData* pointer_data() const; -}; - -template -using BaseObjectPtr = BaseObjectPtrImpl; -template -using BaseObjectWeakPtr = BaseObjectPtrImpl; - -// Create a BaseObject instance and return a pointer to it. -// This variant leaves the object as a GC root by default. -template -inline BaseObjectPtr MakeBaseObject(Args&&... args); -// Create a BaseObject instance and return a pointer to it. -// This variant detaches the object by default, meaning that the caller fully -// owns it, and once the last BaseObjectPtr to it is destroyed, the object -// itself is also destroyed. -template -inline BaseObjectPtr MakeDetachedBaseObject(Args&&... args); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_BASE_OBJECT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/callback_queue-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/callback_queue-inl.h deleted file mode 100644 index 9e46ae48..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/callback_queue-inl.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef SRC_CALLBACK_QUEUE_INL_H_ -#define SRC_CALLBACK_QUEUE_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "callback_queue.h" - -namespace node { - -template -template -std::unique_ptr::Callback> -CallbackQueue::CreateCallback(Fn&& fn, CallbackFlags::Flags flags) { - return std::make_unique>(std::move(fn), flags); -} - -template -std::unique_ptr::Callback> -CallbackQueue::Shift() { - std::unique_ptr ret = std::move(head_); - if (ret) { - head_ = ret->get_next(); - if (!head_) - tail_ = nullptr; // The queue is now empty. - size_--; - } - return ret; -} - -template -void CallbackQueue::Push(std::unique_ptr cb) { - Callback* prev_tail = tail_; - - size_++; - tail_ = cb.get(); - if (prev_tail != nullptr) - prev_tail->set_next(std::move(cb)); - else - head_ = std::move(cb); -} - -template -void CallbackQueue::ConcatMove(CallbackQueue&& other) { - size_ += other.size_; - if (tail_ != nullptr) - tail_->set_next(std::move(other.head_)); - else - head_ = std::move(other.head_); - tail_ = other.tail_; - other.tail_ = nullptr; - other.size_ = 0; -} - -template -size_t CallbackQueue::size() const { - return size_.load(); -} - -template -CallbackQueue::Callback::Callback(CallbackFlags::Flags flags) - : flags_(flags) {} - -template -CallbackFlags::Flags CallbackQueue::Callback::flags() const { - return flags_; -} - -template -std::unique_ptr::Callback> -CallbackQueue::Callback::get_next() { - return std::move(next_); -} - -template -void CallbackQueue::Callback::set_next( - std::unique_ptr next) { - next_ = std::move(next); -} - -template -template -CallbackQueue::CallbackImpl::CallbackImpl( - Fn&& callback, CallbackFlags::Flags flags) - : Callback(flags), - callback_(std::move(callback)) {} - -template -template -R CallbackQueue::CallbackImpl::Call(Args... args) { - return callback_(std::forward(args)...); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CALLBACK_QUEUE_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/callback_queue.h b/repo/packages/s/scriptx-legacy/include/libnode/callback_queue.h deleted file mode 100644 index e5694d5e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/callback_queue.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef SRC_CALLBACK_QUEUE_H_ -#define SRC_CALLBACK_QUEUE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include - -namespace node { - -namespace CallbackFlags { -enum Flags { - kUnrefed = 0, - kRefed = 1, -}; -} - -// A queue of C++ functions that take Args... as arguments and return R -// (this is similar to the signature of std::function). -// New entries are added using `CreateCallback()`/`Push()`, and removed using -// `Shift()`. -// The `refed` flag is left for easier use in situations in which some of these -// should be run even if nothing else is keeping the event loop alive. -template -class CallbackQueue { - public: - class Callback { - public: - explicit inline Callback(CallbackFlags::Flags flags); - - virtual ~Callback() = default; - virtual R Call(Args... args) = 0; - - inline CallbackFlags::Flags flags() const; - - private: - inline std::unique_ptr get_next(); - inline void set_next(std::unique_ptr next); - - CallbackFlags::Flags flags_; - std::unique_ptr next_; - - friend class CallbackQueue; - }; - - template - inline std::unique_ptr CreateCallback( - Fn&& fn, CallbackFlags::Flags); - - inline std::unique_ptr Shift(); - inline void Push(std::unique_ptr cb); - // ConcatMove adds elements from 'other' to the end of this list, and clears - // 'other' afterwards. - inline void ConcatMove(CallbackQueue&& other); - - // size() is atomic and may be called from any thread. - inline size_t size() const; - - private: - template - class CallbackImpl final : public Callback { - public: - CallbackImpl(Fn&& callback, CallbackFlags::Flags flags); - R Call(Args... args) override; - - private: - Fn callback_; - }; - - std::atomic size_ {0}; - std::unique_ptr head_; - Callback* tail_ = nullptr; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CALLBACK_QUEUE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/cares_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/cares_wrap.h deleted file mode 100644 index 60f99e65..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/cares_wrap.h +++ /dev/null @@ -1,523 +0,0 @@ -#ifndef SRC_CARES_WRAP_H_ -#define SRC_CARES_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#define CARES_STATICLIB - -#include "async_wrap.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "util.h" -#include "node.h" - -#include "ares.h" -#include "v8.h" -#include "uv.h" - -#include - -#ifdef __POSIX__ -# include -#endif // __POSIX__ - -# include - -namespace node { -namespace cares_wrap { - -constexpr int ns_t_cname_or_a = -1; -constexpr int DNS_ESETSRVPENDING = -1000; - -class ChannelWrap; - -inline void safe_free_hostent(struct hostent* host); - -using HostEntPointer = DeleteFnPtr; -using SafeHostEntPointer = DeleteFnPtr; - -inline const char* ToErrorCodeString(int status) { - switch (status) { -#define V(code) case ARES_##code: return #code; - V(EADDRGETNETWORKPARAMS) - V(EBADFAMILY) - V(EBADFLAGS) - V(EBADHINTS) - V(EBADNAME) - V(EBADQUERY) - V(EBADRESP) - V(EBADSTR) - V(ECANCELLED) - V(ECONNREFUSED) - V(EDESTRUCTION) - V(EFILE) - V(EFORMERR) - V(ELOADIPHLPAPI) - V(ENODATA) - V(ENOMEM) - V(ENONAME) - V(ENOTFOUND) - V(ENOTIMP) - V(ENOTINITIALIZED) - V(EOF) - V(EREFUSED) - V(ESERVFAIL) - V(ETIMEOUT) -#undef V - } - - return "UNKNOWN_ARES_ERROR"; -} - -inline void cares_wrap_hostent_cpy( - struct hostent* dest, - const struct hostent* src) { - dest->h_addr_list = nullptr; - dest->h_addrtype = 0; - dest->h_aliases = nullptr; - dest->h_length = 0; - dest->h_name = nullptr; - - /* copy `h_name` */ - size_t name_size = strlen(src->h_name) + 1; - dest->h_name = node::Malloc(name_size); - memcpy(dest->h_name, src->h_name, name_size); - - /* copy `h_aliases` */ - size_t alias_count; - for (alias_count = 0; - src->h_aliases[alias_count] != nullptr; - alias_count++) { - } - - dest->h_aliases = node::Malloc(alias_count + 1); - for (size_t i = 0; i < alias_count; i++) { - const size_t cur_alias_size = strlen(src->h_aliases[i]) + 1; - dest->h_aliases[i] = node::Malloc(cur_alias_size); - memcpy(dest->h_aliases[i], src->h_aliases[i], cur_alias_size); - } - dest->h_aliases[alias_count] = nullptr; - - /* copy `h_addr_list` */ - size_t list_count; - for (list_count = 0; - src->h_addr_list[list_count] != nullptr; - list_count++) { - } - - dest->h_addr_list = node::Malloc(list_count + 1); - for (size_t i = 0; i < list_count; i++) { - dest->h_addr_list[i] = node::Malloc(src->h_length); - memcpy(dest->h_addr_list[i], src->h_addr_list[i], src->h_length); - } - dest->h_addr_list[list_count] = nullptr; - - /* work after work */ - dest->h_length = src->h_length; - dest->h_addrtype = src->h_addrtype; -} - - -struct NodeAresTask final : public MemoryRetainer { - ChannelWrap* channel; - ares_socket_t sock; - uv_poll_t poll_watcher; - - inline void MemoryInfo(MemoryTracker* trakcer) const override; - SET_MEMORY_INFO_NAME(NodeAresTask) - SET_SELF_SIZE(NodeAresTask) - - struct Hash { - inline size_t operator()(NodeAresTask* a) const { - return std::hash()(a->sock); - } - }; - - struct Equal { - inline bool operator()(NodeAresTask* a, NodeAresTask* b) const { - return a->sock == b->sock; - } - }; - - static NodeAresTask* Create(ChannelWrap* channel, ares_socket_t sock); - - using List = std::unordered_set; -}; - -class ChannelWrap final : public AsyncWrap { - public: - ChannelWrap( - Environment* env, - v8::Local object, - int timeout, - int tries); - ~ChannelWrap() override; - - static void New(const v8::FunctionCallbackInfo& args); - - void Setup(); - void EnsureServers(); - void StartTimer(); - void CloseTimer(); - - void ModifyActivityQueryCount(int count); - - inline uv_timer_t* timer_handle() { return timer_handle_; } - inline ares_channel cares_channel() { return channel_; } - inline void set_query_last_ok(bool ok) { query_last_ok_ = ok; } - inline void set_is_servers_default(bool is_default) { - is_servers_default_ = is_default; - } - inline int active_query_count() { return active_query_count_; } - inline NodeAresTask::List* task_list() { return &task_list_; } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(ChannelWrap) - SET_SELF_SIZE(ChannelWrap) - - static void AresTimeout(uv_timer_t* handle); - - private: - uv_timer_t* timer_handle_ = nullptr; - ares_channel channel_ = nullptr; - bool query_last_ok_ = true; - bool is_servers_default_ = true; - bool library_inited_ = false; - int timeout_; - int tries_; - int active_query_count_ = 0; - NodeAresTask::List task_list_; -}; - -class GetAddrInfoReqWrap final : public ReqWrap { - public: - GetAddrInfoReqWrap(Environment* env, - v8::Local req_wrap_obj, - bool verbatim); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(GetAddrInfoReqWrap) - SET_SELF_SIZE(GetAddrInfoReqWrap) - - bool verbatim() const { return verbatim_; } - - private: - const bool verbatim_; -}; - -class GetNameInfoReqWrap final : public ReqWrap { - public: - GetNameInfoReqWrap(Environment* env, v8::Local req_wrap_obj); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(GetNameInfoReqWrap) - SET_SELF_SIZE(GetNameInfoReqWrap) -}; - -struct ResponseData final { - int status; - bool is_host; - SafeHostEntPointer host; - MallocedBuffer buf; -}; - -template -class QueryWrap final : public AsyncWrap { - public: - QueryWrap(ChannelWrap* channel, v8::Local req_wrap_obj) - : AsyncWrap(channel->env(), req_wrap_obj, AsyncWrap::PROVIDER_QUERYWRAP), - channel_(channel), - trace_name_(Traits::name) {} - - ~QueryWrap() { - CHECK_EQ(false, persistent().IsEmpty()); - - // Let Callback() know that this object no longer exists. - if (callback_ptr_ != nullptr) - *callback_ptr_ = nullptr; - } - - int Send(const char* name) { - return Traits::Send(this, name); - } - - void AresQuery(const char* name, int dnsclass, int type) { - channel_->EnsureServers(); - TRACE_EVENT_NESTABLE_ASYNC_BEGIN1( - TRACING_CATEGORY_NODE2(dns, native), trace_name_, this, - "name", TRACE_STR_COPY(name)); - ares_query( - channel_->cares_channel(), - name, - dnsclass, - type, - Callback, - MakeCallbackPointer()); - } - - void ParseError(int status) { - CHECK_NE(status, ARES_SUCCESS); - v8::HandleScope handle_scope(env()->isolate()); - v8::Context::Scope context_scope(env()->context()); - const char* code = ToErrorCodeString(status); - v8::Local arg = OneByteString(env()->isolate(), code); - TRACE_EVENT_NESTABLE_ASYNC_END1( - TRACING_CATEGORY_NODE2(dns, native), trace_name_, this, - "error", status); - MakeCallback(env()->oncomplete_string(), 1, &arg); - } - - const BaseObjectPtr& channel() const { return channel_; } - - void AfterResponse() { - CHECK(response_data_); - - int status = response_data_->status; - - if (status != ARES_SUCCESS) - return ParseError(status); - - status = Traits::Parse(this, response_data_); - - if (status != ARES_SUCCESS) - ParseError(status); - } - - void* MakeCallbackPointer() { - CHECK_NULL(callback_ptr_); - callback_ptr_ = new QueryWrap*(this); - return callback_ptr_; - } - - static QueryWrap* FromCallbackPointer(void* arg) { - std::unique_ptr*> wrap_ptr { - static_cast**>(arg) - }; - QueryWrap* wrap = *wrap_ptr.get(); - if (wrap == nullptr) return nullptr; - wrap->callback_ptr_ = nullptr; - return wrap; - } - - static void Callback( - void* arg, - int status, - int timeouts, - unsigned char* answer_buf, - int answer_len) { - QueryWrap* wrap = FromCallbackPointer(arg); - if (wrap == nullptr) return; - - unsigned char* buf_copy = nullptr; - if (status == ARES_SUCCESS) { - buf_copy = node::Malloc(answer_len); - memcpy(buf_copy, answer_buf, answer_len); - } - - wrap->response_data_ = std::make_unique(); - ResponseData* data = wrap->response_data_.get(); - data->status = status; - data->is_host = false; - data->buf = MallocedBuffer(buf_copy, answer_len); - - wrap->QueueResponseCallback(status); - } - - static void Callback( - void* arg, - int status, - int timeouts, - struct hostent* host) { - QueryWrap* wrap = FromCallbackPointer(arg); - if (wrap == nullptr) return; - - struct hostent* host_copy = nullptr; - if (status == ARES_SUCCESS) { - host_copy = node::Malloc(1); - cares_wrap_hostent_cpy(host_copy, host); - } - - wrap->response_data_ = std::make_unique(); - ResponseData* data = wrap->response_data_.get(); - data->status = status; - data->host.reset(host_copy); - data->is_host = true; - - wrap->QueueResponseCallback(status); - } - - void QueueResponseCallback(int status) { - BaseObjectPtr> strong_ref{this}; - env()->SetImmediate([this, strong_ref](Environment*) { - AfterResponse(); - - // Delete once strong_ref goes out of scope. - Detach(); - }); - - channel_->set_query_last_ok(status != ARES_ECONNREFUSED); - channel_->ModifyActivityQueryCount(-1); - } - - void CallOnComplete( - v8::Local answer, - v8::Local extra = v8::Local()) { - v8::HandleScope handle_scope(env()->isolate()); - v8::Context::Scope context_scope(env()->context()); - v8::Local argv[] = { - v8::Integer::New(env()->isolate(), 0), - answer, - extra - }; - const int argc = arraysize(argv) - extra.IsEmpty(); - TRACE_EVENT_NESTABLE_ASYNC_END0( - TRACING_CATEGORY_NODE2(dns, native), trace_name_, this); - - MakeCallback(env()->oncomplete_string(), argc, argv); - } - - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackField("channel", channel_); - if (response_data_) { - tracker->TrackFieldWithSize("response", response_data_->buf.size); - } - } - - SET_MEMORY_INFO_NAME(QueryWrap) - SET_SELF_SIZE(QueryWrap) - - private: - BaseObjectPtr channel_; - - std::unique_ptr response_data_; - const char* trace_name_; - // Pointer to pointer to 'this' that can be reset from the destructor, - // in order to let Callback() know that 'this' no longer exists. - QueryWrap** callback_ptr_ = nullptr; -}; - -struct AnyTraits final { - static constexpr const char* name = "resolveAny"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct ATraits final { - static constexpr const char* name = "resolve4"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct AaaaTraits final { - static constexpr const char* name = "resolve6"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct CaaTraits final { - static constexpr const char* name = "resolveCaa"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct CnameTraits final { - static constexpr const char* name = "resolveCname"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct MxTraits final { - static constexpr const char* name = "resolveMx"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct NsTraits final { - static constexpr const char* name = "resolveNs"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct TxtTraits final { - static constexpr const char* name = "resolveTxt"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct SrvTraits final { - static constexpr const char* name = "resolveSrv"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct PtrTraits final { - static constexpr const char* name = "resolvePtr"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct NaptrTraits final { - static constexpr const char* name = "resolveNaptr"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct SoaTraits final { - static constexpr const char* name = "resolveSoa"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -struct ReverseTraits final { - static constexpr const char* name = "reverse"; - static int Send(QueryWrap* wrap, const char* name); - static int Parse( - QueryWrap* wrap, - const std::unique_ptr& response); -}; - -using QueryAnyWrap = QueryWrap; -using QueryAWrap = QueryWrap; -using QueryAaaaWrap = QueryWrap; -using QueryCaaWrap = QueryWrap; -using QueryCnameWrap = QueryWrap; -using QueryMxWrap = QueryWrap; -using QueryNsWrap = QueryWrap; -using QueryTxtWrap = QueryWrap; -using QuerySrvWrap = QueryWrap; -using QueryPtrWrap = QueryWrap; -using QueryNaptrWrap = QueryWrap; -using QuerySoaWrap = QueryWrap; -using GetHostByAddrWrap = QueryWrap; - -} // namespace cares_wrap -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CARES_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/connect_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/connect_wrap.h deleted file mode 100644 index eaa53302..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/connect_wrap.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SRC_CONNECT_WRAP_H_ -#define SRC_CONNECT_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "req_wrap-inl.h" -#include "async_wrap.h" - -namespace node { - -class ConnectWrap : public ReqWrap { - public: - ConnectWrap(Environment* env, - v8::Local req_wrap_obj, - AsyncWrap::ProviderType provider); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(ConnectWrap) - SET_SELF_SIZE(ConnectWrap) -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CONNECT_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/connection_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/connection_wrap.h deleted file mode 100644 index e91b2ab3..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/connection_wrap.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef SRC_CONNECTION_WRAP_H_ -#define SRC_CONNECTION_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "stream_wrap.h" - -namespace node { - -class Environment; - -template -class ConnectionWrap : public LibuvStreamWrap { - public: - static void OnConnection(uv_stream_t* handle, int status); - static void AfterConnect(uv_connect_t* req, int status); - - protected: - ConnectionWrap(Environment* env, - v8::Local object, - ProviderType provider); - - UVType handle_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CONNECTION_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_aes.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_aes.h deleted file mode 100644 index 3ffe0476..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_aes.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_AES_H_ -#define SRC_CRYPTO_CRYPTO_AES_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_cipher.h" -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "env.h" -#include "v8.h" - -namespace node { -namespace crypto { -constexpr size_t kAesBlockSize = 16; -constexpr unsigned kNoAuthTagLength = static_cast(-1); -constexpr const char* kDefaultWrapIV = "\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6"; - -#define VARIANTS(V) \ - V(CTR_128, AES_CTR_Cipher) \ - V(CTR_192, AES_CTR_Cipher) \ - V(CTR_256, AES_CTR_Cipher) \ - V(CBC_128, AES_Cipher) \ - V(CBC_192, AES_Cipher) \ - V(CBC_256, AES_Cipher) \ - V(GCM_128, AES_Cipher) \ - V(GCM_192, AES_Cipher) \ - V(GCM_256, AES_Cipher) \ - V(KW_128, AES_Cipher) \ - V(KW_192, AES_Cipher) \ - V(KW_256, AES_Cipher) - -enum AESKeyVariant { -#define V(name, _) kKeyVariantAES_ ## name, - VARIANTS(V) -#undef V -}; - -struct AESCipherConfig final : public MemoryRetainer { - CryptoJobMode mode; - AESKeyVariant variant; - const EVP_CIPHER* cipher; - size_t length; - ByteSource iv; // Used for both iv or counter - ByteSource additional_data; - ByteSource tag; // Used only for authenticated modes (GCM) - - AESCipherConfig() = default; - - AESCipherConfig(AESCipherConfig&& other) noexcept; - - AESCipherConfig& operator=(AESCipherConfig&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(AESCipherConfig) - SET_SELF_SIZE(AESCipherConfig) -}; - -struct AESCipherTraits final { - static constexpr const char* JobName = "AESCipherJob"; - - using AdditionalParameters = AESCipherConfig; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - WebCryptoCipherMode cipher_mode, - AESCipherConfig* config); - - static WebCryptoCipherStatus DoCipher( - Environment* env, - std::shared_ptr key_data, - WebCryptoCipherMode cipher_mode, - const AESCipherConfig& params, - const ByteSource& in, - ByteSource* out); -}; - -using AESCryptoJob = CipherJob; - -namespace AES { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace AES -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_AES_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_bio.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_bio.h deleted file mode 100644 index b25980ad..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_bio.h +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_CRYPTO_CRYPTO_BIO_H_ -#define SRC_CRYPTO_CRYPTO_BIO_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_crypto.h" -#include "openssl/bio.h" -#include "util.h" -#include "v8.h" - -namespace node { - -class Environment; - -namespace crypto { -// This class represents buffers for OpenSSL I/O, implemented as a singly-linked -// list of chunks. It can be used either for writing data from Node to OpenSSL, -// or for reading data back, but not both. -// The structure is only accessed, and owned by, the OpenSSL BIOPointer -// (a.k.a. std::unique_ptr). -class NodeBIO : public MemoryRetainer { - public: - ~NodeBIO() override; - - static BIOPointer New(Environment* env = nullptr); - - // NewFixed takes a copy of `len` bytes from `data` and returns a BIO that, - // when read from, returns those bytes followed by EOF. - static BIOPointer NewFixed(const char* data, size_t len, - Environment* env = nullptr); - - // Move read head to next buffer if needed - void TryMoveReadHead(); - - // Allocate new buffer for write if needed - void TryAllocateForWrite(size_t hint); - - // Read `len` bytes maximum into `out`, return actual number of read bytes - size_t Read(char* out, size_t size); - - // Memory optimization: - // Deallocate children of write head's child if they're empty - void FreeEmpty(); - - // Return pointer to internal data and amount of - // contiguous data available to read - char* Peek(size_t* size); - - // Return pointers and sizes of multiple internal data chunks available for - // reading - size_t PeekMultiple(char** out, size_t* size, size_t* count); - - // Find first appearance of `delim` in buffer or `limit` if `delim` - // wasn't found. - size_t IndexOf(char delim, size_t limit); - - // Discard all available data - void Reset(); - - // Put `len` bytes from `data` into buffer - void Write(const char* data, size_t size); - - // Return pointer to contiguous block of reserved data and the size available - // for future writes. Call Commit() once the write is complete. - char* PeekWritable(size_t* size); - - // Specify how much data was written into the block returned by - // PeekWritable(). - void Commit(size_t size); - - - // Return size of buffer in bytes - inline size_t Length() const { - return length_; - } - - // Provide a hint about the size of the next pending set of writes. TLS - // writes records of a maximum length of 16k of data plus a 5-byte header, - // a MAC (up to 20 bytes for SSLv3, TLS 1.0, TLS 1.1, and up to 32 bytes - // for TLS 1.2), and padding if a block cipher is used. If there is a - // large write this will result in potentially many buffers being - // allocated and gc'ed which can cause long pauses. By providing a - // guess about the amount of buffer space that will be needed in the - // next allocation this overhead is removed. - inline void set_allocate_tls_hint(size_t size) { - constexpr size_t kThreshold = 16 * 1024; - if (size >= kThreshold) { - allocate_hint_ = (size / kThreshold + 1) * (kThreshold + 5 + 32); - } - } - - inline void set_eof_return(int num) { - eof_return_ = num; - } - - inline int eof_return() { - return eof_return_; - } - - inline void set_initial(size_t initial) { - initial_ = initial; - } - - static NodeBIO* FromBIO(BIO* bio); - - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackFieldWithSize("buffer", length_, "NodeBIO::Buffer"); - } - - SET_MEMORY_INFO_NAME(NodeBIO) - SET_SELF_SIZE(NodeBIO) - - private: - static int New(BIO* bio); - static int Free(BIO* bio); - static int Read(BIO* bio, char* out, int len); - static int Write(BIO* bio, const char* data, int len); - static int Puts(BIO* bio, const char* str); - static int Gets(BIO* bio, char* out, int size); - static long Ctrl(BIO* bio, int cmd, long num, // NOLINT(runtime/int) - void* ptr); - - static const BIO_METHOD* GetMethod(); - - // Enough to handle the most of the client hellos - static const size_t kInitialBufferLength = 1024; - static const size_t kThroughputBufferLength = 16384; - - class Buffer { - public: - Buffer(Environment* env, size_t len) : env_(env), - read_pos_(0), - write_pos_(0), - len_(len), - next_(nullptr) { - data_ = new char[len]; - if (env_ != nullptr) - env_->isolate()->AdjustAmountOfExternalAllocatedMemory(len); - } - - ~Buffer() { - delete[] data_; - if (env_ != nullptr) { - const int64_t len = static_cast(len_); - env_->isolate()->AdjustAmountOfExternalAllocatedMemory(-len); - } - } - - Environment* env_; - size_t read_pos_; - size_t write_pos_; - size_t len_; - Buffer* next_; - char* data_; - }; - - Environment* env_ = nullptr; - size_t initial_ = kInitialBufferLength; - size_t length_ = 0; - size_t allocate_hint_ = 0; - int eof_return_ = -1; - Buffer* read_head_ = nullptr; - Buffer* write_head_ = nullptr; - - friend void node::crypto::InitCryptoOnce(); -}; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_BIO_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_cipher.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_cipher.h deleted file mode 100644 index e725a2f3..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_cipher.h +++ /dev/null @@ -1,291 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_CIPHER_H_ -#define SRC_CRYPTO_CRYPTO_CIPHER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -#include - -namespace node { -namespace crypto { -class CipherBase : public BaseObject { - public: - static void GetSSLCiphers(const v8::FunctionCallbackInfo& args); - static void GetCiphers(const v8::FunctionCallbackInfo& args); - - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(CipherBase) - SET_SELF_SIZE(CipherBase) - - protected: - enum CipherKind { - kCipher, - kDecipher - }; - enum UpdateResult { - kSuccess, - kErrorMessageSize, - kErrorState - }; - enum AuthTagState { - kAuthTagUnknown, - kAuthTagKnown, - kAuthTagPassedToOpenSSL - }; - static const unsigned kNoAuthTagLength = static_cast(-1); - - void CommonInit(const char* cipher_type, - const EVP_CIPHER* cipher, - const unsigned char* key, - int key_len, - const unsigned char* iv, - int iv_len, - unsigned int auth_tag_len); - void Init(const char* cipher_type, - const ArrayBufferOrViewContents& key_buf, - unsigned int auth_tag_len); - void InitIv(const char* cipher_type, - const ByteSource& key_buf, - const ArrayBufferOrViewContents& iv_buf, - unsigned int auth_tag_len); - bool InitAuthenticated(const char* cipher_type, int iv_len, - unsigned int auth_tag_len); - bool CheckCCMMessageLength(int message_len); - UpdateResult Update(const char* data, size_t len, - std::unique_ptr* out); - bool Final(std::unique_ptr* out); - bool SetAutoPadding(bool auto_padding); - - bool IsAuthenticatedMode() const; - bool SetAAD( - const ArrayBufferOrViewContents& data, - int plaintext_len); - bool MaybePassAuthTagToOpenSSL(); - - static void New(const v8::FunctionCallbackInfo& args); - static void Init(const v8::FunctionCallbackInfo& args); - static void InitIv(const v8::FunctionCallbackInfo& args); - static void Update(const v8::FunctionCallbackInfo& args); - static void Final(const v8::FunctionCallbackInfo& args); - static void SetAutoPadding(const v8::FunctionCallbackInfo& args); - - static void GetAuthTag(const v8::FunctionCallbackInfo& args); - static void SetAuthTag(const v8::FunctionCallbackInfo& args); - static void SetAAD(const v8::FunctionCallbackInfo& args); - - CipherBase(Environment* env, v8::Local wrap, CipherKind kind); - - private: - DeleteFnPtr ctx_; - const CipherKind kind_; - AuthTagState auth_tag_state_; - unsigned int auth_tag_len_; - char auth_tag_[EVP_GCM_TLS_TAG_LEN]; - bool pending_auth_failed_; - int max_message_size_; -}; - -class PublicKeyCipher { - public: - typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX* ctx); - typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX* ctx, - unsigned char* out, size_t* outlen, - const unsigned char* in, size_t inlen); - - enum Operation { - kPublic, - kPrivate - }; - - template - static bool Cipher(Environment* env, - const ManagedEVPPKey& pkey, - int padding, - const EVP_MD* digest, - const ArrayBufferOrViewContents& oaep_label, - const ArrayBufferOrViewContents& data, - std::unique_ptr* out); - - template - static void Cipher(const v8::FunctionCallbackInfo& args); -}; - -enum WebCryptoCipherMode { - kWebCryptoCipherEncrypt, - kWebCryptoCipherDecrypt -}; - -enum class WebCryptoCipherStatus { - OK, - INVALID_KEY_TYPE, - FAILED -}; - -// CipherJob is a base implementation class for implementations of -// one-shot sync and async ciphers. It has been added primarily to -// support the AES and RSA ciphers underlying the WebCrypt API. -// -// See the crypto_aes and crypto_rsa headers for examples of how to -// use CipherJob. -template -class CipherJob final : public CryptoJob { - public: - using AdditionalParams = typename CipherTraits::AdditionalParameters; - - static void New(const v8::FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - CHECK(args.IsConstructCall()); - - CryptoJobMode mode = GetCryptoJobMode(args[0]); - - CHECK(args[1]->IsUint32()); // Cipher Mode - - uint32_t cmode = args[1].As()->Value(); - CHECK_LE(cmode, WebCryptoCipherMode::kWebCryptoCipherDecrypt); - WebCryptoCipherMode cipher_mode = static_cast(cmode); - - CHECK(args[2]->IsObject()); // KeyObject - KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args[2]); - CHECK_NOT_NULL(key); - - ArrayBufferOrViewContents data(args[3]); // data to operate on - if (!data.CheckSizeInt32()) - return THROW_ERR_OUT_OF_RANGE(env, "data is too large"); - - AdditionalParams params; - if (CipherTraits::AdditionalConfig(mode, args, 4, cipher_mode, ¶ms) - .IsNothing()) { - // The CipherTraits::AdditionalConfig is responsible for - // calling an appropriate THROW_CRYPTO_* variant reporting - // whatever error caused initialization to fail. - return; - } - - new CipherJob( - env, - args.This(), - mode, - key, - cipher_mode, - data, - std::move(params)); - } - - static void Initialize( - Environment* env, - v8::Local target) { - CryptoJob::Initialize(New, env, target); - } - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry) { - CryptoJob::RegisterExternalReferences(New, registry); - } - - CipherJob( - Environment* env, - v8::Local object, - CryptoJobMode mode, - KeyObjectHandle* key, - WebCryptoCipherMode cipher_mode, - const ArrayBufferOrViewContents& data, - AdditionalParams&& params) - : CryptoJob( - env, - object, - AsyncWrap::PROVIDER_CIPHERREQUEST, - mode, - std::move(params)), - key_(key->Data()), - cipher_mode_(cipher_mode), - in_(mode == kCryptoJobAsync - ? data.ToCopy() - : data.ToByteSource()) {} - - std::shared_ptr key() const { return key_; } - - WebCryptoCipherMode cipher_mode() const { return cipher_mode_; } - - void DoThreadPoolWork() override { - const WebCryptoCipherStatus status = - CipherTraits::DoCipher( - AsyncWrap::env(), - key(), - cipher_mode_, - *CryptoJob::params(), - in_, - &out_); - if (status == WebCryptoCipherStatus::OK) { - // Success! - return; - } - CryptoErrorStore* errors = CryptoJob::errors(); - errors->Capture(); - if (errors->Empty()) { - switch (status) { - case WebCryptoCipherStatus::OK: - UNREACHABLE(); - break; - case WebCryptoCipherStatus::INVALID_KEY_TYPE: - errors->Insert(NodeCryptoError::INVALID_KEY_TYPE); - break; - case WebCryptoCipherStatus::FAILED: - errors->Insert(NodeCryptoError::CIPHER_JOB_FAILED); - break; - } - } - } - - v8::Maybe ToResult( - v8::Local* err, - v8::Local* result) override { - Environment* env = AsyncWrap::env(); - CryptoErrorStore* errors = CryptoJob::errors(); - - if (errors->Empty()) - errors->Capture(); - - if (out_.size() > 0 || errors->Empty()) { - CHECK(errors->Empty()); - *err = v8::Undefined(env->isolate()); - *result = out_.ToArrayBuffer(env); - return v8::Just(!result->IsEmpty()); - } - - *result = v8::Undefined(env->isolate()); - return v8::Just(errors->ToException(env).ToLocal(err)); - } - - SET_SELF_SIZE(CipherJob) - void MemoryInfo(MemoryTracker* tracker) const override { - if (CryptoJob::mode() == kCryptoJobAsync) - tracker->TrackFieldWithSize("in", in_.size()); - tracker->TrackFieldWithSize("out", out_.size()); - CryptoJob::MemoryInfo(tracker); - } - - private: - std::shared_ptr key_; - WebCryptoCipherMode cipher_mode_; - ByteSource in_; - ByteSource out_; -}; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_CIPHER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello-inl.h deleted file mode 100644 index 4f133e83..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello-inl.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_CRYPTO_CRYPTO_CLIENTHELLO_INL_H_ -#define SRC_CRYPTO_CRYPTO_CLIENTHELLO_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_clienthello.h" -#include "util.h" - -namespace node { -namespace crypto { -inline ClientHelloParser::ClientHelloParser() - : state_(kEnded), - onhello_cb_(nullptr), - onend_cb_(nullptr), - cb_arg_(nullptr) { - Reset(); -} - -inline void ClientHelloParser::Reset() { - frame_len_ = 0; - body_offset_ = 0; - extension_offset_ = 0; - session_size_ = 0; - session_id_ = nullptr; - tls_ticket_size_ = -1; - tls_ticket_ = nullptr; - servername_size_ = 0; - servername_ = nullptr; -} - -inline void ClientHelloParser::Start(ClientHelloParser::OnHelloCb onhello_cb, - ClientHelloParser::OnEndCb onend_cb, - void* onend_arg) { - if (!IsEnded()) - return; - Reset(); - - CHECK_NOT_NULL(onhello_cb); - - state_ = kWaiting; - onhello_cb_ = onhello_cb; - onend_cb_ = onend_cb; - cb_arg_ = onend_arg; -} - -inline void ClientHelloParser::End() { - if (state_ == kEnded) - return; - state_ = kEnded; - if (onend_cb_ != nullptr) { - onend_cb_(cb_arg_); - onend_cb_ = nullptr; - } -} - -inline bool ClientHelloParser::IsEnded() const { - return state_ == kEnded; -} - -inline bool ClientHelloParser::IsPaused() const { - return state_ == kPaused; -} - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_CLIENTHELLO_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello.h deleted file mode 100644 index 0d3bf60f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_clienthello.h +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_CRYPTO_CRYPTO_CLIENTHELLO_H_ -#define SRC_CRYPTO_CRYPTO_CLIENTHELLO_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include // size_t -#include - -namespace node { -namespace crypto { -// Parse the client hello so we can do async session resumption. OpenSSL's -// session resumption uses synchronous callbacks, see SSL_CTX_sess_set_get_cb -// and get_session_cb. -// -// TLS1.3 handshakes masquerade as TLS1.2 session resumption, and to do this, -// they always include a session_id in the ClientHello, making up a bogus value -// if necessary. The parser can't know if its a bogus id, and will cause a -// 'newSession' event to be emitted. This should do no harm, the id won't be -// found, and the handshake will continue. -class ClientHelloParser { - public: - inline ClientHelloParser(); - - class ClientHello { - public: - inline uint8_t session_size() const { return session_size_; } - inline const uint8_t* session_id() const { return session_id_; } - inline bool has_ticket() const { return has_ticket_; } - inline uint8_t servername_size() const { return servername_size_; } - inline const uint8_t* servername() const { return servername_; } - - private: - uint8_t session_size_; - const uint8_t* session_id_; - bool has_ticket_; - uint8_t servername_size_; - const uint8_t* servername_; - - friend class ClientHelloParser; - }; - - typedef void (*OnHelloCb)(void* arg, const ClientHello& hello); - typedef void (*OnEndCb)(void* arg); - - void Parse(const uint8_t* data, size_t avail); - - inline void Reset(); - inline void Start(OnHelloCb onhello_cb, OnEndCb onend_cb, void* onend_arg); - inline void End(); - inline bool IsPaused() const; - inline bool IsEnded() const; - - private: - static const size_t kMaxTLSFrameLen = 16 * 1024 + 5; - static const size_t kMaxSSLExFrameLen = 32 * 1024; - static const uint8_t kServernameHostname = 0; - static const size_t kMinStatusRequestSize = 5; - - enum ParseState { - kWaiting, - kTLSHeader, - kPaused, - kEnded - }; - - enum FrameType { - kChangeCipherSpec = 20, - kAlert = 21, - kHandshake = 22, - kApplicationData = 23, - kOther = 255 - }; - - enum HandshakeType { - kClientHello = 1 - }; - - enum ExtensionType { - kServerName = 0, - kTLSSessionTicket = 35 - }; - - bool ParseRecordHeader(const uint8_t* data, size_t avail); - void ParseHeader(const uint8_t* data, size_t avail); - void ParseExtension(const uint16_t type, - const uint8_t* data, - size_t len); - bool ParseTLSClientHello(const uint8_t* data, size_t avail); - - ParseState state_; - OnHelloCb onhello_cb_; - OnEndCb onend_cb_; - void* cb_arg_; - size_t frame_len_ = 0; - size_t body_offset_ = 0; - size_t extension_offset_ = 0; - uint8_t session_size_ = 0; - const uint8_t* session_id_ = nullptr; - uint16_t servername_size_ = 0; - const uint8_t* servername_ = nullptr; - uint16_t tls_ticket_size_ = -1; - const uint8_t* tls_ticket_ = nullptr; -}; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_CLIENTHELLO_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_common.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_common.h deleted file mode 100644 index e0956395..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_common.h +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_COMMON_H_ -#define SRC_CRYPTO_CRYPTO_COMMON_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_crypto.h" -#include "v8.h" -#include -#include - -#include - -namespace node { -namespace crypto { - -struct StackOfX509Deleter { - void operator()(STACK_OF(X509)* p) const { sk_X509_pop_free(p, X509_free); } -}; -using StackOfX509 = std::unique_ptr; - -struct StackOfXASN1Deleter { - void operator()(STACK_OF(ASN1_OBJECT)* p) const { - sk_ASN1_OBJECT_pop_free(p, ASN1_OBJECT_free); - } -}; -using StackOfASN1 = std::unique_ptr; - -bool SSL_CTX_get_issuer(SSL_CTX* ctx, X509* cert, X509** issuer); - -void LogSecret( - const SSLPointer& ssl, - const char* name, - const unsigned char* secret, - size_t secretlen); - -bool SetALPN(const SSLPointer& ssl, const std::string& alpn); - -bool SetALPN(const SSLPointer& ssl, v8::Local alpn); - -v8::MaybeLocal GetSSLOCSPResponse( - Environment* env, - SSL* ssl, - v8::Local default_value); - -bool SetTLSSession( - const SSLPointer& ssl, - const SSLSessionPointer& session); - -SSLSessionPointer GetTLSSession(const unsigned char* buf, size_t length); - -long VerifyPeerCertificate( // NOLINT(runtime/int) - const SSLPointer& ssl, - long def = X509_V_ERR_UNSPECIFIED); // NOLINT(runtime/int) - -bool UseSNIContext(const SSLPointer& ssl, BaseObjectPtr context); - -const char* GetClientHelloALPN(const SSLPointer& ssl); - -const char* GetClientHelloServerName(const SSLPointer& ssl); - -const char* GetServerName(SSL* ssl); - -v8::MaybeLocal GetClientHelloCiphers( - Environment* env, - const SSLPointer& ssl); - -bool SetGroups(SecureContext* sc, const char* groups); - -const char* X509ErrorCode(long err); // NOLINT(runtime/int) - -v8::MaybeLocal GetValidationErrorReason(Environment* env, int err); - -v8::MaybeLocal GetValidationErrorCode(Environment* env, int err); - -v8::MaybeLocal GetCert(Environment* env, const SSLPointer& ssl); - -v8::MaybeLocal GetCipherName( - Environment* env, - const SSLPointer& ssl); - -v8::MaybeLocal GetCipherStandardName( - Environment* env, - const SSLPointer& ssl); - -v8::MaybeLocal GetCipherVersion( - Environment* env, - const SSLPointer& ssl); - -v8::MaybeLocal GetCipherInfo( - Environment* env, - const SSLPointer& ssl); - -v8::MaybeLocal GetEphemeralKey( - Environment* env, - const SSLPointer& ssl); - -v8::MaybeLocal GetPeerCert( - Environment* env, - const SSLPointer& ssl, - bool abbreviated = false, - bool is_server = false); - -v8::MaybeLocal ECPointToBuffer( - Environment* env, - const EC_GROUP* group, - const EC_POINT* point, - point_conversion_form_t form, - const char** error); - -v8::MaybeLocal X509ToObject( - Environment* env, - X509* cert, - bool names_as_string = false); - -v8::MaybeLocal GetValidTo( - Environment* env, - X509* cert, - const BIOPointer& bio); - -v8::MaybeLocal GetValidFrom( - Environment* env, - X509* cert, - const BIOPointer& bio); - -v8::MaybeLocal GetFingerprintDigest( - Environment* env, - const EVP_MD* method, - X509* cert); - -v8::MaybeLocal GetKeyUsage(Environment* env, X509* cert); - -v8::MaybeLocal GetSerialNumber(Environment* env, X509* cert); - -v8::MaybeLocal GetRawDERCertificate(Environment* env, X509* cert); - -v8::Local ToV8Value(Environment* env, const BIOPointer& bio); -bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext); - -v8::MaybeLocal GetSubject( - Environment* env, - const BIOPointer& bio, - X509* cert); - -v8::MaybeLocal GetIssuerString( - Environment* env, - const BIOPointer& bio, - X509* cert); - -v8::MaybeLocal GetSubjectAltNameString( - Environment* env, - const BIOPointer& bio, - X509* cert); - -v8::MaybeLocal GetInfoAccessString( - Environment* env, - const BIOPointer& bio, - X509* cert); - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_COMMON_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_context.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_context.h deleted file mode 100644 index d9b33a47..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_context.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_CONTEXT_H_ -#define SRC_CRYPTO_CRYPTO_CONTEXT_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_util.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -// A maxVersion of 0 means "any", but OpenSSL may support TLS versions that -// Node.js doesn't, so pin the max to what we do support. -constexpr int kMaxSupportedVersion = TLS1_3_VERSION; - -void GetRootCertificates( - const v8::FunctionCallbackInfo& args); - -void IsExtraRootCertsFileLoaded( - const v8::FunctionCallbackInfo& args); - -X509_STORE* NewRootCertStore(); - -BIOPointer LoadBIO(Environment* env, v8::Local v); - -class SecureContext final : public BaseObject { - public: - using GetSessionCb = SSL_SESSION* (*)(SSL*, const unsigned char*, int, int*); - using KeylogCb = void (*)(const SSL*, const char*); - using NewSessionCb = int (*)(SSL*, SSL_SESSION*); - using SelectSNIContextCb = int (*)(SSL*, int*, void*); - - ~SecureContext() override; - - static bool HasInstance(Environment* env, const v8::Local& value); - static v8::Local GetConstructorTemplate( - Environment* env); - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - static SecureContext* Create(Environment* env); - - SSL_CTX* operator*() const { return ctx_.get(); } - - SSL_CTX* ssl_ctx() const { return ctx_.get(); } - - SSLPointer CreateSSL(); - - void SetGetSessionCallback(GetSessionCb cb); - void SetKeylogCallback(KeylogCb cb); - void SetNewSessionCallback(NewSessionCb cb); - void SetSelectSNIContextCallback(SelectSNIContextCb cb); - - // TODO(joyeecheung): track the memory used by OpenSSL types - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(SecureContext) - SET_SELF_SIZE(SecureContext) - - SSLCtxPointer ctx_; - X509Pointer cert_; - X509Pointer issuer_; -#ifndef OPENSSL_NO_ENGINE - bool client_cert_engine_provided_ = false; - EnginePointer private_key_engine_; -#endif // !OPENSSL_NO_ENGINE - - static const int kMaxSessionSize = 10 * 1024; - - // See TicketKeyCallback - static const int kTicketKeyReturnIndex = 0; - static const int kTicketKeyHMACIndex = 1; - static const int kTicketKeyAESIndex = 2; - static const int kTicketKeyNameIndex = 3; - static const int kTicketKeyIVIndex = 4; - - unsigned char ticket_key_name_[16]; - unsigned char ticket_key_aes_[16]; - unsigned char ticket_key_hmac_[16]; - - protected: - // OpenSSL structures are opaque. This is sizeof(SSL_CTX) for OpenSSL 1.1.1b: - static const int64_t kExternalSize = 1024; - - static void New(const v8::FunctionCallbackInfo& args); - static void Init(const v8::FunctionCallbackInfo& args); - static void SetKey(const v8::FunctionCallbackInfo& args); -#ifndef OPENSSL_NO_ENGINE - static void SetEngineKey(const v8::FunctionCallbackInfo& args); -#endif // !OPENSSL_NO_ENGINE - static void SetCert(const v8::FunctionCallbackInfo& args); - static void AddCACert(const v8::FunctionCallbackInfo& args); - static void AddCRL(const v8::FunctionCallbackInfo& args); - static void AddRootCerts(const v8::FunctionCallbackInfo& args); - static void SetCipherSuites(const v8::FunctionCallbackInfo& args); - static void SetCiphers(const v8::FunctionCallbackInfo& args); - static void SetSigalgs(const v8::FunctionCallbackInfo& args); - static void SetECDHCurve(const v8::FunctionCallbackInfo& args); - static void SetDHParam(const v8::FunctionCallbackInfo& args); - static void SetOptions(const v8::FunctionCallbackInfo& args); - static void SetSessionIdContext( - const v8::FunctionCallbackInfo& args); - static void SetSessionTimeout( - const v8::FunctionCallbackInfo& args); - static void SetMinProto(const v8::FunctionCallbackInfo& args); - static void SetMaxProto(const v8::FunctionCallbackInfo& args); - static void GetMinProto(const v8::FunctionCallbackInfo& args); - static void GetMaxProto(const v8::FunctionCallbackInfo& args); - static void Close(const v8::FunctionCallbackInfo& args); - static void LoadPKCS12(const v8::FunctionCallbackInfo& args); -#ifndef OPENSSL_NO_ENGINE - static void SetClientCertEngine( - const v8::FunctionCallbackInfo& args); -#endif // !OPENSSL_NO_ENGINE - static void GetTicketKeys(const v8::FunctionCallbackInfo& args); - static void SetTicketKeys(const v8::FunctionCallbackInfo& args); - static void SetFreeListLength( - const v8::FunctionCallbackInfo& args); - static void EnableTicketKeyCallback( - const v8::FunctionCallbackInfo& args); - static void CtxGetter(const v8::FunctionCallbackInfo& info); - - template - static void GetCertificate(const v8::FunctionCallbackInfo& args); - - static int TicketKeyCallback(SSL* ssl, - unsigned char* name, - unsigned char* iv, - EVP_CIPHER_CTX* ectx, - HMAC_CTX* hctx, - int enc); - - static int TicketCompatibilityCallback(SSL* ssl, - unsigned char* name, - unsigned char* iv, - EVP_CIPHER_CTX* ectx, - HMAC_CTX* hctx, - int enc); - - SecureContext(Environment* env, v8::Local wrap); - void Reset(); -}; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_CONTEXT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dh.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dh.h deleted file mode 100644 index cb3664fb..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dh.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_DH_H_ -#define SRC_CRYPTO_CRYPTO_DH_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_keygen.h" -#include "crypto/crypto_util.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -#include - -namespace node { -namespace crypto { -class DiffieHellman : public BaseObject { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - bool Init(int primeLength, int g); - bool Init(const char* p, int p_len, int g); - bool Init(const char* p, int p_len, const char* g, int g_len); - - static void Stateless(const v8::FunctionCallbackInfo& args); - - protected: - static void DiffieHellmanGroup( - const v8::FunctionCallbackInfo& args); - static void New(const v8::FunctionCallbackInfo& args); - static void GenerateKeys(const v8::FunctionCallbackInfo& args); - static void GetPrime(const v8::FunctionCallbackInfo& args); - static void GetGenerator(const v8::FunctionCallbackInfo& args); - static void GetPublicKey(const v8::FunctionCallbackInfo& args); - static void GetPrivateKey(const v8::FunctionCallbackInfo& args); - static void ComputeSecret(const v8::FunctionCallbackInfo& args); - static void SetPublicKey(const v8::FunctionCallbackInfo& args); - static void SetPrivateKey(const v8::FunctionCallbackInfo& args); - static void VerifyErrorGetter( - const v8::FunctionCallbackInfo& args); - - DiffieHellman(Environment* env, v8::Local wrap); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(DiffieHellman) - SET_SELF_SIZE(DiffieHellman) - - private: - static void GetField(const v8::FunctionCallbackInfo& args, - const BIGNUM* (*get_field)(const DH*), - const char* err_if_null); - static void SetKey(const v8::FunctionCallbackInfo& args, - int (*set_field)(DH*, BIGNUM*), const char* what); - bool VerifyContext(); - - int verifyError_; - DHPointer dh_; -}; - -struct DhKeyPairParams final : public MemoryRetainer { - // TODO(tniessen): Use std::variant instead. - // Diffie-Hellman can either generate keys using a fixed prime, or by first - // generating a random prime of a given size (in bits). Only one of both - // options may be specified. - BignumPointer prime_fixed_value; - unsigned int prime_size; - unsigned int generator; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(DhKeyPairParams) - SET_SELF_SIZE(DhKeyPairParams) -}; - -using DhKeyPairGenConfig = KeyPairGenConfig; - -struct DhKeyGenTraits final { - using AdditionalParameters = DhKeyPairGenConfig; - static constexpr const char* JobName = "DhKeyPairGenJob"; - - static EVPKeyCtxPointer Setup(DhKeyPairGenConfig* params); - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - DhKeyPairGenConfig* params); -}; - -using DHKeyPairGenJob = KeyGenJob>; - -struct DHKeyExportConfig final : public MemoryRetainer { - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(DHKeyExportConfig) - SET_SELF_SIZE(DHKeyExportConfig) -}; - -struct DHKeyExportTraits final { - static constexpr const char* JobName = "DHKeyExportJob"; - using AdditionalParameters = DHKeyExportConfig; - - static v8::Maybe AdditionalConfig( - const v8::FunctionCallbackInfo& args, - unsigned int offset, - DHKeyExportConfig* config); - - static WebCryptoKeyExportStatus DoExport( - std::shared_ptr key_data, - WebCryptoKeyFormat format, - const DHKeyExportConfig& params, - ByteSource* out); -}; - -using DHKeyExportJob = KeyExportJob; - -struct DHBitsConfig final : public MemoryRetainer { - std::shared_ptr private_key; - std::shared_ptr public_key; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(DHBitsConfig) - SET_SELF_SIZE(DHBitsConfig) -}; - -struct DHBitsTraits final { - using AdditionalParameters = DHBitsConfig; - static constexpr const char* JobName = "DHBitsJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_DERIVEBITSREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - DHBitsConfig* params); - - static bool DeriveBits( - Environment* env, - const DHBitsConfig& params, - ByteSource* out_); - - static v8::Maybe EncodeOutput( - Environment* env, - const DHBitsConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using DHBitsJob = DeriveBitsJob; - -v8::Maybe GetDhKeyDetail( - Environment* env, - std::shared_ptr key, - v8::Local target); - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_DH_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dsa.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dsa.h deleted file mode 100644 index e93cb807..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_dsa.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_DSA_H_ -#define SRC_CRYPTO_CRYPTO_DSA_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_keygen.h" -#include "crypto/crypto_util.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -struct DsaKeyPairParams final : public MemoryRetainer { - unsigned int modulus_bits; - int divisor_bits; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(DsaKeyPairParams) - SET_SELF_SIZE(DsaKeyPairParams) -}; - -using DsaKeyPairGenConfig = KeyPairGenConfig; - -struct DsaKeyGenTraits final { - using AdditionalParameters = DsaKeyPairGenConfig; - static constexpr const char* JobName = "DsaKeyPairGenJob"; - - static EVPKeyCtxPointer Setup(DsaKeyPairGenConfig* params); - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - DsaKeyPairGenConfig* params); -}; - -using DsaKeyPairGenJob = KeyGenJob>; - -struct DSAKeyExportConfig final : public MemoryRetainer { - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(DSAKeyExportConfig) - SET_SELF_SIZE(DSAKeyExportConfig) -}; - -struct DSAKeyExportTraits final { - static constexpr const char* JobName = "DSAKeyExportJob"; - using AdditionalParameters = DSAKeyExportConfig; - - static v8::Maybe AdditionalConfig( - const v8::FunctionCallbackInfo& args, - unsigned int offset, - DSAKeyExportConfig* config); - - static WebCryptoKeyExportStatus DoExport( - std::shared_ptr key_data, - WebCryptoKeyFormat format, - const DSAKeyExportConfig& params, - ByteSource* out); -}; - -using DSAKeyExportJob = KeyExportJob; - -v8::Maybe GetDsaKeyDetail( - Environment* env, - std::shared_ptr key, - v8::Local target); - -namespace DSAAlg { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace DSAAlg -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_DSA_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_ec.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_ec.h deleted file mode 100644 index bc4160fc..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_ec.h +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_EC_H_ -#define SRC_CRYPTO_CRYPTO_EC_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_keygen.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "async_wrap.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "node_internals.h" -#include "v8.h" - -namespace node { -namespace crypto { -int GetCurveFromName(const char* name); -int GetOKPCurveFromName(const char* name); - -class ECDH final : public BaseObject { - public: - ~ECDH() override; - - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - static ECPointPointer BufferToPoint(Environment* env, - const EC_GROUP* group, - v8::Local buf); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(ECDH) - SET_SELF_SIZE(ECDH) - - static void ConvertKey(const v8::FunctionCallbackInfo& args); - - static void GetCurves(const v8::FunctionCallbackInfo& args); - - protected: - ECDH(Environment* env, v8::Local wrap, ECKeyPointer&& key); - - static void New(const v8::FunctionCallbackInfo& args); - static void GenerateKeys(const v8::FunctionCallbackInfo& args); - static void ComputeSecret(const v8::FunctionCallbackInfo& args); - static void GetPrivateKey(const v8::FunctionCallbackInfo& args); - static void SetPrivateKey(const v8::FunctionCallbackInfo& args); - static void GetPublicKey(const v8::FunctionCallbackInfo& args); - static void SetPublicKey(const v8::FunctionCallbackInfo& args); - - bool IsKeyPairValid(); - bool IsKeyValidForCurve(const BignumPointer& private_key); - - ECKeyPointer key_; - const EC_GROUP* group_; -}; - -struct ECDHBitsConfig final : public MemoryRetainer { - int id_; - std::shared_ptr private_; - std::shared_ptr public_; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(ECDHBitsConfig) - SET_SELF_SIZE(ECDHBitsConfig) -}; - -struct ECDHBitsTraits final { - using AdditionalParameters = ECDHBitsConfig; - static constexpr const char* JobName = "ECDHBitsJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_DERIVEBITSREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - ECDHBitsConfig* params); - - static bool DeriveBits( - Environment* env, - const ECDHBitsConfig& params, - ByteSource* out_); - - static v8::Maybe EncodeOutput( - Environment* env, - const ECDHBitsConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using ECDHBitsJob = DeriveBitsJob; - -struct EcKeyPairParams final : public MemoryRetainer { - int curve_nid; - int param_encoding; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(EcKeyPairParams) - SET_SELF_SIZE(EcKeyPairParams) -}; - -using EcKeyPairGenConfig = KeyPairGenConfig; - -struct EcKeyGenTraits final { - using AdditionalParameters = EcKeyPairGenConfig; - static constexpr const char* JobName = "EcKeyPairGenJob"; - - static EVPKeyCtxPointer Setup(EcKeyPairGenConfig* params); - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - EcKeyPairGenConfig* params); -}; - -using ECKeyPairGenJob = KeyGenJob>; - -// There is currently no additional information that the -// ECKeyExport needs to collect, but we need to provide -// the base struct anyway. -struct ECKeyExportConfig final : public MemoryRetainer { - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(ECKeyExportConfig) - SET_SELF_SIZE(ECKeyExportConfig) -}; - -struct ECKeyExportTraits final { - static constexpr const char* JobName = "ECKeyExportJob"; - using AdditionalParameters = ECKeyExportConfig; - - static v8::Maybe AdditionalConfig( - const v8::FunctionCallbackInfo& args, - unsigned int offset, - ECKeyExportConfig* config); - - static WebCryptoKeyExportStatus DoExport( - std::shared_ptr key_data, - WebCryptoKeyFormat format, - const ECKeyExportConfig& params, - ByteSource* out); -}; - -using ECKeyExportJob = KeyExportJob; - -v8::Maybe ExportJWKEcKey( - Environment* env, - std::shared_ptr key, - v8::Local target); - -v8::Maybe ExportJWKEdKey( - Environment* env, - std::shared_ptr key, - v8::Local target); - -std::shared_ptr ImportJWKEcKey( - Environment* env, - v8::Local jwk, - const v8::FunctionCallbackInfo& args, - unsigned int offset); - -v8::Maybe GetEcKeyDetail( - Environment* env, - std::shared_ptr key, - v8::Local target); -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_EC_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_groups.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_groups.h deleted file mode 100644 index c49b4356..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_groups.h +++ /dev/null @@ -1,415 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_CRYPTO_CRYPTO_GROUPS_H_ -#define SRC_CRYPTO_CRYPTO_GROUPS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -/* - These modular groups were literally taken from: - * RFC 2412 (groups 1 and 2) - * RFC 3526 (groups 5, 14, 15, 16, 17 and 18) - They all use 2 as a generator. -*/ - - -static const unsigned int two_generator = 2; - -static const unsigned char group_modp1[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x3a, 0x36, 0x20, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static const unsigned char group_modp2[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe6, 0x53, 0x81, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static const unsigned char group_modp5[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, - 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, - 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, - 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, - 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, - 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, - 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, - 0xca, 0x23, 0x73, 0x27, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff }; - -static const unsigned char group_modp14[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, - 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, - 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, - 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, - 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, - 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, - 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, - 0xca, 0x18, 0x21, 0x7c, 0x32, 0x90, 0x5e, 0x46, 0x2e, 0x36, - 0xce, 0x3b, 0xe3, 0x9e, 0x77, 0x2c, 0x18, 0x0e, 0x86, 0x03, - 0x9b, 0x27, 0x83, 0xa2, 0xec, 0x07, 0xa2, 0x8f, 0xb5, 0xc5, - 0x5d, 0xf0, 0x6f, 0x4c, 0x52, 0xc9, 0xde, 0x2b, 0xcb, 0xf6, - 0x95, 0x58, 0x17, 0x18, 0x39, 0x95, 0x49, 0x7c, 0xea, 0x95, - 0x6a, 0xe5, 0x15, 0xd2, 0x26, 0x18, 0x98, 0xfa, 0x05, 0x10, - 0x15, 0x72, 0x8e, 0x5a, 0x8a, 0xac, 0xaa, 0x68, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static const unsigned char group_modp15[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, - 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, - 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, - 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, - 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, - 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, - 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, - 0xca, 0x18, 0x21, 0x7c, 0x32, 0x90, 0x5e, 0x46, 0x2e, 0x36, - 0xce, 0x3b, 0xe3, 0x9e, 0x77, 0x2c, 0x18, 0x0e, 0x86, 0x03, - 0x9b, 0x27, 0x83, 0xa2, 0xec, 0x07, 0xa2, 0x8f, 0xb5, 0xc5, - 0x5d, 0xf0, 0x6f, 0x4c, 0x52, 0xc9, 0xde, 0x2b, 0xcb, 0xf6, - 0x95, 0x58, 0x17, 0x18, 0x39, 0x95, 0x49, 0x7c, 0xea, 0x95, - 0x6a, 0xe5, 0x15, 0xd2, 0x26, 0x18, 0x98, 0xfa, 0x05, 0x10, - 0x15, 0x72, 0x8e, 0x5a, 0x8a, 0xaa, 0xc4, 0x2d, 0xad, 0x33, - 0x17, 0x0d, 0x04, 0x50, 0x7a, 0x33, 0xa8, 0x55, 0x21, 0xab, - 0xdf, 0x1c, 0xba, 0x64, 0xec, 0xfb, 0x85, 0x04, 0x58, 0xdb, - 0xef, 0x0a, 0x8a, 0xea, 0x71, 0x57, 0x5d, 0x06, 0x0c, 0x7d, - 0xb3, 0x97, 0x0f, 0x85, 0xa6, 0xe1, 0xe4, 0xc7, 0xab, 0xf5, - 0xae, 0x8c, 0xdb, 0x09, 0x33, 0xd7, 0x1e, 0x8c, 0x94, 0xe0, - 0x4a, 0x25, 0x61, 0x9d, 0xce, 0xe3, 0xd2, 0x26, 0x1a, 0xd2, - 0xee, 0x6b, 0xf1, 0x2f, 0xfa, 0x06, 0xd9, 0x8a, 0x08, 0x64, - 0xd8, 0x76, 0x02, 0x73, 0x3e, 0xc8, 0x6a, 0x64, 0x52, 0x1f, - 0x2b, 0x18, 0x17, 0x7b, 0x20, 0x0c, 0xbb, 0xe1, 0x17, 0x57, - 0x7a, 0x61, 0x5d, 0x6c, 0x77, 0x09, 0x88, 0xc0, 0xba, 0xd9, - 0x46, 0xe2, 0x08, 0xe2, 0x4f, 0xa0, 0x74, 0xe5, 0xab, 0x31, - 0x43, 0xdb, 0x5b, 0xfc, 0xe0, 0xfd, 0x10, 0x8e, 0x4b, 0x82, - 0xd1, 0x20, 0xa9, 0x3a, 0xd2, 0xca, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff }; - -static const unsigned char group_modp16[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, - 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, - 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, - 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, - 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, - 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, - 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, - 0xca, 0x18, 0x21, 0x7c, 0x32, 0x90, 0x5e, 0x46, 0x2e, 0x36, - 0xce, 0x3b, 0xe3, 0x9e, 0x77, 0x2c, 0x18, 0x0e, 0x86, 0x03, - 0x9b, 0x27, 0x83, 0xa2, 0xec, 0x07, 0xa2, 0x8f, 0xb5, 0xc5, - 0x5d, 0xf0, 0x6f, 0x4c, 0x52, 0xc9, 0xde, 0x2b, 0xcb, 0xf6, - 0x95, 0x58, 0x17, 0x18, 0x39, 0x95, 0x49, 0x7c, 0xea, 0x95, - 0x6a, 0xe5, 0x15, 0xd2, 0x26, 0x18, 0x98, 0xfa, 0x05, 0x10, - 0x15, 0x72, 0x8e, 0x5a, 0x8a, 0xaa, 0xc4, 0x2d, 0xad, 0x33, - 0x17, 0x0d, 0x04, 0x50, 0x7a, 0x33, 0xa8, 0x55, 0x21, 0xab, - 0xdf, 0x1c, 0xba, 0x64, 0xec, 0xfb, 0x85, 0x04, 0x58, 0xdb, - 0xef, 0x0a, 0x8a, 0xea, 0x71, 0x57, 0x5d, 0x06, 0x0c, 0x7d, - 0xb3, 0x97, 0x0f, 0x85, 0xa6, 0xe1, 0xe4, 0xc7, 0xab, 0xf5, - 0xae, 0x8c, 0xdb, 0x09, 0x33, 0xd7, 0x1e, 0x8c, 0x94, 0xe0, - 0x4a, 0x25, 0x61, 0x9d, 0xce, 0xe3, 0xd2, 0x26, 0x1a, 0xd2, - 0xee, 0x6b, 0xf1, 0x2f, 0xfa, 0x06, 0xd9, 0x8a, 0x08, 0x64, - 0xd8, 0x76, 0x02, 0x73, 0x3e, 0xc8, 0x6a, 0x64, 0x52, 0x1f, - 0x2b, 0x18, 0x17, 0x7b, 0x20, 0x0c, 0xbb, 0xe1, 0x17, 0x57, - 0x7a, 0x61, 0x5d, 0x6c, 0x77, 0x09, 0x88, 0xc0, 0xba, 0xd9, - 0x46, 0xe2, 0x08, 0xe2, 0x4f, 0xa0, 0x74, 0xe5, 0xab, 0x31, - 0x43, 0xdb, 0x5b, 0xfc, 0xe0, 0xfd, 0x10, 0x8e, 0x4b, 0x82, - 0xd1, 0x20, 0xa9, 0x21, 0x08, 0x01, 0x1a, 0x72, 0x3c, 0x12, - 0xa7, 0x87, 0xe6, 0xd7, 0x88, 0x71, 0x9a, 0x10, 0xbd, 0xba, - 0x5b, 0x26, 0x99, 0xc3, 0x27, 0x18, 0x6a, 0xf4, 0xe2, 0x3c, - 0x1a, 0x94, 0x68, 0x34, 0xb6, 0x15, 0x0b, 0xda, 0x25, 0x83, - 0xe9, 0xca, 0x2a, 0xd4, 0x4c, 0xe8, 0xdb, 0xbb, 0xc2, 0xdb, - 0x04, 0xde, 0x8e, 0xf9, 0x2e, 0x8e, 0xfc, 0x14, 0x1f, 0xbe, - 0xca, 0xa6, 0x28, 0x7c, 0x59, 0x47, 0x4e, 0x6b, 0xc0, 0x5d, - 0x99, 0xb2, 0x96, 0x4f, 0xa0, 0x90, 0xc3, 0xa2, 0x23, 0x3b, - 0xa1, 0x86, 0x51, 0x5b, 0xe7, 0xed, 0x1f, 0x61, 0x29, 0x70, - 0xce, 0xe2, 0xd7, 0xaf, 0xb8, 0x1b, 0xdd, 0x76, 0x21, 0x70, - 0x48, 0x1c, 0xd0, 0x06, 0x91, 0x27, 0xd5, 0xb0, 0x5a, 0xa9, - 0x93, 0xb4, 0xea, 0x98, 0x8d, 0x8f, 0xdd, 0xc1, 0x86, 0xff, - 0xb7, 0xdc, 0x90, 0xa6, 0xc0, 0x8f, 0x4d, 0xf4, 0x35, 0xc9, - 0x34, 0x06, 0x31, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff }; - -static const unsigned char group_modp17[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, - 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, - 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, - 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, - 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, - 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, - 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, - 0xca, 0x18, 0x21, 0x7c, 0x32, 0x90, 0x5e, 0x46, 0x2e, 0x36, - 0xce, 0x3b, 0xe3, 0x9e, 0x77, 0x2c, 0x18, 0x0e, 0x86, 0x03, - 0x9b, 0x27, 0x83, 0xa2, 0xec, 0x07, 0xa2, 0x8f, 0xb5, 0xc5, - 0x5d, 0xf0, 0x6f, 0x4c, 0x52, 0xc9, 0xde, 0x2b, 0xcb, 0xf6, - 0x95, 0x58, 0x17, 0x18, 0x39, 0x95, 0x49, 0x7c, 0xea, 0x95, - 0x6a, 0xe5, 0x15, 0xd2, 0x26, 0x18, 0x98, 0xfa, 0x05, 0x10, - 0x15, 0x72, 0x8e, 0x5a, 0x8a, 0xaa, 0xc4, 0x2d, 0xad, 0x33, - 0x17, 0x0d, 0x04, 0x50, 0x7a, 0x33, 0xa8, 0x55, 0x21, 0xab, - 0xdf, 0x1c, 0xba, 0x64, 0xec, 0xfb, 0x85, 0x04, 0x58, 0xdb, - 0xef, 0x0a, 0x8a, 0xea, 0x71, 0x57, 0x5d, 0x06, 0x0c, 0x7d, - 0xb3, 0x97, 0x0f, 0x85, 0xa6, 0xe1, 0xe4, 0xc7, 0xab, 0xf5, - 0xae, 0x8c, 0xdb, 0x09, 0x33, 0xd7, 0x1e, 0x8c, 0x94, 0xe0, - 0x4a, 0x25, 0x61, 0x9d, 0xce, 0xe3, 0xd2, 0x26, 0x1a, 0xd2, - 0xee, 0x6b, 0xf1, 0x2f, 0xfa, 0x06, 0xd9, 0x8a, 0x08, 0x64, - 0xd8, 0x76, 0x02, 0x73, 0x3e, 0xc8, 0x6a, 0x64, 0x52, 0x1f, - 0x2b, 0x18, 0x17, 0x7b, 0x20, 0x0c, 0xbb, 0xe1, 0x17, 0x57, - 0x7a, 0x61, 0x5d, 0x6c, 0x77, 0x09, 0x88, 0xc0, 0xba, 0xd9, - 0x46, 0xe2, 0x08, 0xe2, 0x4f, 0xa0, 0x74, 0xe5, 0xab, 0x31, - 0x43, 0xdb, 0x5b, 0xfc, 0xe0, 0xfd, 0x10, 0x8e, 0x4b, 0x82, - 0xd1, 0x20, 0xa9, 0x21, 0x08, 0x01, 0x1a, 0x72, 0x3c, 0x12, - 0xa7, 0x87, 0xe6, 0xd7, 0x88, 0x71, 0x9a, 0x10, 0xbd, 0xba, - 0x5b, 0x26, 0x99, 0xc3, 0x27, 0x18, 0x6a, 0xf4, 0xe2, 0x3c, - 0x1a, 0x94, 0x68, 0x34, 0xb6, 0x15, 0x0b, 0xda, 0x25, 0x83, - 0xe9, 0xca, 0x2a, 0xd4, 0x4c, 0xe8, 0xdb, 0xbb, 0xc2, 0xdb, - 0x04, 0xde, 0x8e, 0xf9, 0x2e, 0x8e, 0xfc, 0x14, 0x1f, 0xbe, - 0xca, 0xa6, 0x28, 0x7c, 0x59, 0x47, 0x4e, 0x6b, 0xc0, 0x5d, - 0x99, 0xb2, 0x96, 0x4f, 0xa0, 0x90, 0xc3, 0xa2, 0x23, 0x3b, - 0xa1, 0x86, 0x51, 0x5b, 0xe7, 0xed, 0x1f, 0x61, 0x29, 0x70, - 0xce, 0xe2, 0xd7, 0xaf, 0xb8, 0x1b, 0xdd, 0x76, 0x21, 0x70, - 0x48, 0x1c, 0xd0, 0x06, 0x91, 0x27, 0xd5, 0xb0, 0x5a, 0xa9, - 0x93, 0xb4, 0xea, 0x98, 0x8d, 0x8f, 0xdd, 0xc1, 0x86, 0xff, - 0xb7, 0xdc, 0x90, 0xa6, 0xc0, 0x8f, 0x4d, 0xf4, 0x35, 0xc9, - 0x34, 0x02, 0x84, 0x92, 0x36, 0xc3, 0xfa, 0xb4, 0xd2, 0x7c, - 0x70, 0x26, 0xc1, 0xd4, 0xdc, 0xb2, 0x60, 0x26, 0x46, 0xde, - 0xc9, 0x75, 0x1e, 0x76, 0x3d, 0xba, 0x37, 0xbd, 0xf8, 0xff, - 0x94, 0x06, 0xad, 0x9e, 0x53, 0x0e, 0xe5, 0xdb, 0x38, 0x2f, - 0x41, 0x30, 0x01, 0xae, 0xb0, 0x6a, 0x53, 0xed, 0x90, 0x27, - 0xd8, 0x31, 0x17, 0x97, 0x27, 0xb0, 0x86, 0x5a, 0x89, 0x18, - 0xda, 0x3e, 0xdb, 0xeb, 0xcf, 0x9b, 0x14, 0xed, 0x44, 0xce, - 0x6c, 0xba, 0xce, 0xd4, 0xbb, 0x1b, 0xdb, 0x7f, 0x14, 0x47, - 0xe6, 0xcc, 0x25, 0x4b, 0x33, 0x20, 0x51, 0x51, 0x2b, 0xd7, - 0xaf, 0x42, 0x6f, 0xb8, 0xf4, 0x01, 0x37, 0x8c, 0xd2, 0xbf, - 0x59, 0x83, 0xca, 0x01, 0xc6, 0x4b, 0x92, 0xec, 0xf0, 0x32, - 0xea, 0x15, 0xd1, 0x72, 0x1d, 0x03, 0xf4, 0x82, 0xd7, 0xce, - 0x6e, 0x74, 0xfe, 0xf6, 0xd5, 0x5e, 0x70, 0x2f, 0x46, 0x98, - 0x0c, 0x82, 0xb5, 0xa8, 0x40, 0x31, 0x90, 0x0b, 0x1c, 0x9e, - 0x59, 0xe7, 0xc9, 0x7f, 0xbe, 0xc7, 0xe8, 0xf3, 0x23, 0xa9, - 0x7a, 0x7e, 0x36, 0xcc, 0x88, 0xbe, 0x0f, 0x1d, 0x45, 0xb7, - 0xff, 0x58, 0x5a, 0xc5, 0x4b, 0xd4, 0x07, 0xb2, 0x2b, 0x41, - 0x54, 0xaa, 0xcc, 0x8f, 0x6d, 0x7e, 0xbf, 0x48, 0xe1, 0xd8, - 0x14, 0xcc, 0x5e, 0xd2, 0x0f, 0x80, 0x37, 0xe0, 0xa7, 0x97, - 0x15, 0xee, 0xf2, 0x9b, 0xe3, 0x28, 0x06, 0xa1, 0xd5, 0x8b, - 0xb7, 0xc5, 0xda, 0x76, 0xf5, 0x50, 0xaa, 0x3d, 0x8a, 0x1f, - 0xbf, 0xf0, 0xeb, 0x19, 0xcc, 0xb1, 0xa3, 0x13, 0xd5, 0x5c, - 0xda, 0x56, 0xc9, 0xec, 0x2e, 0xf2, 0x96, 0x32, 0x38, 0x7f, - 0xe8, 0xd7, 0x6e, 0x3c, 0x04, 0x68, 0x04, 0x3e, 0x8f, 0x66, - 0x3f, 0x48, 0x60, 0xee, 0x12, 0xbf, 0x2d, 0x5b, 0x0b, 0x74, - 0x74, 0xd6, 0xe6, 0x94, 0xf9, 0x1e, 0x6d, 0xcc, 0x40, 0x24, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static const unsigned char group_modp18[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, - 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, - 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, - 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, - 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0xef, 0x95, - 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, - 0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, - 0xc2, 0x45, 0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, - 0xf4, 0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff, - 0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b, 0xfb, - 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11, 0x7c, 0x4b, - 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe4, 0x5b, 0x3d, - 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63, 0xbf, 0x05, 0x98, 0xda, - 0x48, 0x36, 0x1c, 0x55, 0xd3, 0x9a, 0x69, 0x16, 0x3f, 0xa8, - 0xfd, 0x24, 0xcf, 0x5f, 0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, - 0xad, 0x96, 0x1c, 0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, - 0x9e, 0xd5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, - 0x35, 0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08, - 0xca, 0x18, 0x21, 0x7c, 0x32, 0x90, 0x5e, 0x46, 0x2e, 0x36, - 0xce, 0x3b, 0xe3, 0x9e, 0x77, 0x2c, 0x18, 0x0e, 0x86, 0x03, - 0x9b, 0x27, 0x83, 0xa2, 0xec, 0x07, 0xa2, 0x8f, 0xb5, 0xc5, - 0x5d, 0xf0, 0x6f, 0x4c, 0x52, 0xc9, 0xde, 0x2b, 0xcb, 0xf6, - 0x95, 0x58, 0x17, 0x18, 0x39, 0x95, 0x49, 0x7c, 0xea, 0x95, - 0x6a, 0xe5, 0x15, 0xd2, 0x26, 0x18, 0x98, 0xfa, 0x05, 0x10, - 0x15, 0x72, 0x8e, 0x5a, 0x8a, 0xaa, 0xc4, 0x2d, 0xad, 0x33, - 0x17, 0x0d, 0x04, 0x50, 0x7a, 0x33, 0xa8, 0x55, 0x21, 0xab, - 0xdf, 0x1c, 0xba, 0x64, 0xec, 0xfb, 0x85, 0x04, 0x58, 0xdb, - 0xef, 0x0a, 0x8a, 0xea, 0x71, 0x57, 0x5d, 0x06, 0x0c, 0x7d, - 0xb3, 0x97, 0x0f, 0x85, 0xa6, 0xe1, 0xe4, 0xc7, 0xab, 0xf5, - 0xae, 0x8c, 0xdb, 0x09, 0x33, 0xd7, 0x1e, 0x8c, 0x94, 0xe0, - 0x4a, 0x25, 0x61, 0x9d, 0xce, 0xe3, 0xd2, 0x26, 0x1a, 0xd2, - 0xee, 0x6b, 0xf1, 0x2f, 0xfa, 0x06, 0xd9, 0x8a, 0x08, 0x64, - 0xd8, 0x76, 0x02, 0x73, 0x3e, 0xc8, 0x6a, 0x64, 0x52, 0x1f, - 0x2b, 0x18, 0x17, 0x7b, 0x20, 0x0c, 0xbb, 0xe1, 0x17, 0x57, - 0x7a, 0x61, 0x5d, 0x6c, 0x77, 0x09, 0x88, 0xc0, 0xba, 0xd9, - 0x46, 0xe2, 0x08, 0xe2, 0x4f, 0xa0, 0x74, 0xe5, 0xab, 0x31, - 0x43, 0xdb, 0x5b, 0xfc, 0xe0, 0xfd, 0x10, 0x8e, 0x4b, 0x82, - 0xd1, 0x20, 0xa9, 0x21, 0x08, 0x01, 0x1a, 0x72, 0x3c, 0x12, - 0xa7, 0x87, 0xe6, 0xd7, 0x88, 0x71, 0x9a, 0x10, 0xbd, 0xba, - 0x5b, 0x26, 0x99, 0xc3, 0x27, 0x18, 0x6a, 0xf4, 0xe2, 0x3c, - 0x1a, 0x94, 0x68, 0x34, 0xb6, 0x15, 0x0b, 0xda, 0x25, 0x83, - 0xe9, 0xca, 0x2a, 0xd4, 0x4c, 0xe8, 0xdb, 0xbb, 0xc2, 0xdb, - 0x04, 0xde, 0x8e, 0xf9, 0x2e, 0x8e, 0xfc, 0x14, 0x1f, 0xbe, - 0xca, 0xa6, 0x28, 0x7c, 0x59, 0x47, 0x4e, 0x6b, 0xc0, 0x5d, - 0x99, 0xb2, 0x96, 0x4f, 0xa0, 0x90, 0xc3, 0xa2, 0x23, 0x3b, - 0xa1, 0x86, 0x51, 0x5b, 0xe7, 0xed, 0x1f, 0x61, 0x29, 0x70, - 0xce, 0xe2, 0xd7, 0xaf, 0xb8, 0x1b, 0xdd, 0x76, 0x21, 0x70, - 0x48, 0x1c, 0xd0, 0x06, 0x91, 0x27, 0xd5, 0xb0, 0x5a, 0xa9, - 0x93, 0xb4, 0xea, 0x98, 0x8d, 0x8f, 0xdd, 0xc1, 0x86, 0xff, - 0xb7, 0xdc, 0x90, 0xa6, 0xc0, 0x8f, 0x4d, 0xf4, 0x35, 0xc9, - 0x34, 0x02, 0x84, 0x92, 0x36, 0xc3, 0xfa, 0xb4, 0xd2, 0x7c, - 0x70, 0x26, 0xc1, 0xd4, 0xdc, 0xb2, 0x60, 0x26, 0x46, 0xde, - 0xc9, 0x75, 0x1e, 0x76, 0x3d, 0xba, 0x37, 0xbd, 0xf8, 0xff, - 0x94, 0x06, 0xad, 0x9e, 0x53, 0x0e, 0xe5, 0xdb, 0x38, 0x2f, - 0x41, 0x30, 0x01, 0xae, 0xb0, 0x6a, 0x53, 0xed, 0x90, 0x27, - 0xd8, 0x31, 0x17, 0x97, 0x27,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8, 0x99, 0xa0, 0x25, 0x5d, 0xc1, - 0x64, 0xf3, 0x1c, 0xc5, 0x08, 0x46, 0x85, 0x1d, 0xf9, 0xab, - 0x48, 0x19, 0x5d, 0xed, 0x7e, 0xa1, 0xb1, 0xd5, 0x10, 0xbd, - 0x7e, 0xe7, 0x4d, 0x73, 0xfa, 0xf3, 0x6b, 0xc3, 0x1e, 0xcf, - 0xa2, 0x68, 0x35, 0x90, 0x46, 0xf4, 0xeb, 0x87, 0x9f, 0x92, - 0x40, 0x09, 0x43, 0x8b, 0x48, 0x1c, 0x6c, 0xd7, 0x88, 0x9a, - 0x00, 0x2e, 0xd5, 0xee, 0x38, 0x2b, 0xc9, 0x19, 0x0d, 0xa6, - 0xfc, 0x02, 0x6e, 0x47, 0x95, 0x58, 0xe4, 0x47, 0x56, 0x77, - 0xe9, 0xaa, 0x9e, 0x30, 0x50, 0xe2, 0x76, 0x56, 0x94, 0xdf, - 0xc8, 0x1f, 0x56, 0xe8, 0x80, 0xb9, 0x6e, 0x71, 0x60, 0xc9, - 0x80, 0xdd, 0x98, 0xed, 0xd3, 0xdf, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff }; - -typedef struct { - const char* name; - const char* prime; - unsigned int prime_size; - unsigned int gen; -} modp_group; - -static const modp_group modp_groups[] = { -#define V(var) reinterpret_cast(var) - { "modp1", V(group_modp1), sizeof(group_modp1), two_generator }, - { "modp2", V(group_modp2), sizeof(group_modp2), two_generator }, - { "modp5", V(group_modp5), sizeof(group_modp5), two_generator }, - { "modp14", V(group_modp14), sizeof(group_modp14), two_generator }, - { "modp15", V(group_modp15), sizeof(group_modp15), two_generator }, - { "modp16", V(group_modp16), sizeof(group_modp16), two_generator }, - { "modp17", V(group_modp17), sizeof(group_modp17), two_generator }, - { "modp18", V(group_modp18), sizeof(group_modp18), two_generator } -#undef V -}; - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_GROUPS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hash.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hash.h deleted file mode 100644 index cfc09334..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hash.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_HASH_H_ -#define SRC_CRYPTO_CRYPTO_HASH_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -class Hash final : public BaseObject { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Hash) - SET_SELF_SIZE(Hash) - - bool HashInit(const EVP_MD* md, v8::Maybe xof_md_len); - bool HashUpdate(const char* data, size_t len); - - static void GetHashes(const v8::FunctionCallbackInfo& args); - - protected: - static void New(const v8::FunctionCallbackInfo& args); - static void HashUpdate(const v8::FunctionCallbackInfo& args); - static void HashDigest(const v8::FunctionCallbackInfo& args); - - Hash(Environment* env, v8::Local wrap); - - private: - EVPMDPointer mdctx_ {}; - unsigned int md_len_ = 0; - ByteSource digest_; -}; - -struct HashConfig final : public MemoryRetainer { - CryptoJobMode mode; - ByteSource in; - const EVP_MD* digest; - unsigned int length; - - HashConfig() = default; - - explicit HashConfig(HashConfig&& other) noexcept; - - HashConfig& operator=(HashConfig&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(HashConfig) - SET_SELF_SIZE(HashConfig) -}; - -struct HashTraits final { - using AdditionalParameters = HashConfig; - static constexpr const char* JobName = "HashJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_HASHREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - HashConfig* params); - - static bool DeriveBits( - Environment* env, - const HashConfig& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const HashConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using HashJob = DeriveBitsJob; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_HASH_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hkdf.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hkdf.h deleted file mode 100644 index 666aad65..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hkdf.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_HKDF_H_ -#define SRC_CRYPTO_CRYPTO_HKDF_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "async_wrap.h" -#include "base_object.h" -#include "v8.h" - -namespace node { -namespace crypto { -static constexpr size_t kMaxDigestMultiplier = 255; - -struct HKDFConfig final : public MemoryRetainer { - CryptoJobMode mode; - size_t length; - const EVP_MD* digest; - std::shared_ptr key; - ByteSource salt; - ByteSource info; - - HKDFConfig() = default; - - explicit HKDFConfig(HKDFConfig&& other) noexcept; - - HKDFConfig& operator=(HKDFConfig&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(HKDFConfig) - SET_SELF_SIZE(HKDFConfig) -}; - -struct HKDFTraits final { - using AdditionalParameters = HKDFConfig; - static constexpr const char* JobName = "HKDFJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_DERIVEBITSREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - HKDFConfig* params); - - static bool DeriveBits( - Environment* env, - const HKDFConfig& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const HKDFConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using HKDFJob = DeriveBitsJob; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_HKDF_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hmac.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hmac.h deleted file mode 100644 index c37fc4a8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_hmac.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_HMAC_H_ -#define SRC_CRYPTO_CRYPTO_HMAC_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_sig.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -class Hmac : public BaseObject { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Hmac) - SET_SELF_SIZE(Hmac) - - protected: - void HmacInit(const char* hash_type, const char* key, int key_len); - bool HmacUpdate(const char* data, size_t len); - - static void New(const v8::FunctionCallbackInfo& args); - static void HmacInit(const v8::FunctionCallbackInfo& args); - static void HmacUpdate(const v8::FunctionCallbackInfo& args); - static void HmacDigest(const v8::FunctionCallbackInfo& args); - - Hmac(Environment* env, v8::Local wrap); - - static void Sign(const v8::FunctionCallbackInfo& args); - - private: - HMACCtxPointer ctx_; -}; - -struct HmacConfig final : public MemoryRetainer { - CryptoJobMode job_mode; - SignConfiguration::Mode mode; - std::shared_ptr key; - ByteSource data; - ByteSource signature; - const EVP_MD* digest; - - HmacConfig() = default; - - explicit HmacConfig(HmacConfig&& other) noexcept; - - HmacConfig& operator=(HmacConfig&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(HmacConfig) - SET_SELF_SIZE(HmacConfig) -}; - -struct HmacTraits final { - using AdditionalParameters = HmacConfig; - static constexpr const char* JobName = "HmacJob"; - -// TODO(@jasnell): Sign request vs. Verify request - - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_SIGNREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - HmacConfig* params); - - static bool DeriveBits( - Environment* env, - const HmacConfig& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const HmacConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using HmacJob = DeriveBitsJob; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_HMAC_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keygen.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keygen.h deleted file mode 100644 index f8d863a2..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keygen.h +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_KEYGEN_H_ -#define SRC_CRYPTO_CRYPTO_KEYGEN_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "async_wrap.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -namespace Keygen { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace Keygen - -enum class KeyGenJobStatus { - OK, - FAILED -}; - -// A Base CryptoJob for generating secret keys or key pairs. -// The KeyGenTraits is largely responsible for the details of -// the implementation, while KeyGenJob handles the common -// mechanisms. -template -class KeyGenJob final : public CryptoJob { - public: - using AdditionalParams = typename KeyGenTraits::AdditionalParameters; - - static void New(const v8::FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - CHECK(args.IsConstructCall()); - - CryptoJobMode mode = GetCryptoJobMode(args[0]); - - unsigned int offset = 1; - - AdditionalParams params; - if (KeyGenTraits::AdditionalConfig(mode, args, &offset, ¶ms) - .IsNothing()) { - // The KeyGenTraits::AdditionalConfig is responsible for - // calling an appropriate THROW_CRYPTO_* variant reporting - // whatever error caused initialization to fail. - return; - } - - new KeyGenJob(env, args.This(), mode, std::move(params)); - } - - static void Initialize( - Environment* env, - v8::Local target) { - CryptoJob::Initialize(New, env, target); - } - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry) { - CryptoJob::RegisterExternalReferences(New, registry); - } - - KeyGenJob( - Environment* env, - v8::Local object, - CryptoJobMode mode, - AdditionalParams&& params) - : CryptoJob( - env, - object, - KeyGenTraits::Provider, - mode, - std::move(params)) {} - - void DoThreadPoolWork() override { - // Make sure the CSPRNG is properly seeded so the results are secure. - CheckEntropy(); - - AdditionalParams* params = CryptoJob::params(); - - switch (KeyGenTraits::DoKeyGen(AsyncWrap::env(), params)) { - case KeyGenJobStatus::OK: - status_ = KeyGenJobStatus::OK; - // Success! - break; - case KeyGenJobStatus::FAILED: { - CryptoErrorStore* errors = CryptoJob::errors(); - errors->Capture(); - if (errors->Empty()) - errors->Insert(NodeCryptoError::KEY_GENERATION_JOB_FAILED); - } - } - } - - v8::Maybe ToResult( - v8::Local* err, - v8::Local* result) override { - Environment* env = AsyncWrap::env(); - CryptoErrorStore* errors = CryptoJob::errors(); - AdditionalParams* params = CryptoJob::params(); - - if (status_ == KeyGenJobStatus::OK) { - v8::Maybe ret = KeyGenTraits::EncodeKey(env, params, result); - if (ret.IsJust() && ret.FromJust()) { - *err = Undefined(env->isolate()); - } - return ret; - } - - if (errors->Empty()) - errors->Capture(); - CHECK(!errors->Empty()); - *result = Undefined(env->isolate()); - return v8::Just(errors->ToException(env).ToLocal(err)); - } - - SET_SELF_SIZE(KeyGenJob) - - private: - KeyGenJobStatus status_ = KeyGenJobStatus::FAILED; -}; - -// A Base KeyGenTraits for Key Pair generation algorithms. -template -struct KeyPairGenTraits final { - using AdditionalParameters = - typename KeyPairAlgorithmTraits::AdditionalParameters; - - static const AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_KEYPAIRGENREQUEST; - static constexpr const char* JobName = KeyPairAlgorithmTraits::JobName; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - AdditionalParameters* params) { - // Notice that offset is a pointer. Each of the AdditionalConfig, - // GetPublicKeyEncodingFromJs, and GetPrivateKeyEncodingFromJs - // functions will update the value of the offset as they successfully - // process input parameters. This allows each job to have a variable - // number of input parameters specific to each job type. - if (KeyPairAlgorithmTraits::AdditionalConfig(mode, args, offset, params) - .IsNothing()) { - return v8::Just(false); - } - - params->public_key_encoding = ManagedEVPPKey::GetPublicKeyEncodingFromJs( - args, - offset, - kKeyContextGenerate); - - auto private_key_encoding = - ManagedEVPPKey::GetPrivateKeyEncodingFromJs( - args, - offset, - kKeyContextGenerate); - - if (!private_key_encoding.IsEmpty()) - params->private_key_encoding = private_key_encoding.Release(); - - return v8::Just(true); - } - - static KeyGenJobStatus DoKeyGen( - Environment* env, - AdditionalParameters* params) { - EVPKeyCtxPointer ctx = KeyPairAlgorithmTraits::Setup(params); - - if (!ctx) - return KeyGenJobStatus::FAILED; - - // Generate the key - EVP_PKEY* pkey = nullptr; - if (!EVP_PKEY_keygen(ctx.get(), &pkey)) - return KeyGenJobStatus::FAILED; - - params->key = ManagedEVPPKey(EVPKeyPointer(pkey)); - return KeyGenJobStatus::OK; - } - - static v8::Maybe EncodeKey( - Environment* env, - AdditionalParameters* params, - v8::Local* result) { - v8::Local keys[2]; - if (ManagedEVPPKey::ToEncodedPublicKey( - env, - std::move(params->key), - params->public_key_encoding, - &keys[0]).IsNothing() || - ManagedEVPPKey::ToEncodedPrivateKey( - env, - std::move(params->key), - params->private_key_encoding, - &keys[1]).IsNothing()) { - return v8::Nothing(); - } - *result = v8::Array::New(env->isolate(), keys, arraysize(keys)); - return v8::Just(true); - } -}; - -struct SecretKeyGenConfig final : public MemoryRetainer { - size_t length; // Expressed a a number of bits - char* out = nullptr; // Placeholder for the generated key bytes - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SecretKeyGenConfig) - SET_SELF_SIZE(SecretKeyGenConfig) -}; - -struct SecretKeyGenTraits final { - using AdditionalParameters = SecretKeyGenConfig; - static const AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_KEYGENREQUEST; - static constexpr const char* JobName = "SecretKeyGenJob"; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - SecretKeyGenConfig* params); - - static KeyGenJobStatus DoKeyGen( - Environment* env, - SecretKeyGenConfig* params); - - static v8::Maybe EncodeKey( - Environment* env, - SecretKeyGenConfig* params, - v8::Local* result); -}; - -template -struct KeyPairGenConfig final : public MemoryRetainer { - PublicKeyEncodingConfig public_key_encoding; - PrivateKeyEncodingConfig private_key_encoding; - ManagedEVPPKey key; - AlgorithmParams params; - - KeyPairGenConfig() = default; - ~KeyPairGenConfig() { - Mutex::ScopedLock priv_lock(*key.mutex()); - } - - explicit KeyPairGenConfig(KeyPairGenConfig&& other) noexcept - : public_key_encoding(other.public_key_encoding), - private_key_encoding( - std::forward( - other.private_key_encoding)), - key(std::move(other.key)), - params(std::move(other.params)) {} - - KeyPairGenConfig& operator=(KeyPairGenConfig&& other) noexcept { - if (&other == this) return *this; - this->~KeyPairGenConfig(); - return *new (this) KeyPairGenConfig(std::move(other)); - } - - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackField("key", key); - if (!private_key_encoding.passphrase_.IsEmpty()) { - tracker->TrackFieldWithSize("private_key_encoding.passphrase", - private_key_encoding.passphrase_->size()); - } - tracker->TrackField("params", params); - } - - SET_MEMORY_INFO_NAME(KeyPairGenConfig) - SET_SELF_SIZE(KeyPairGenConfig) -}; - -struct NidKeyPairParams final : public MemoryRetainer { - int id; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(NidKeyPairParams) - SET_SELF_SIZE(NidKeyPairParams) -}; - -using NidKeyPairGenConfig = KeyPairGenConfig; - -struct NidKeyPairGenTraits final { - using AdditionalParameters = NidKeyPairGenConfig; - static constexpr const char* JobName = "NidKeyPairGenJob"; - - static EVPKeyCtxPointer Setup(NidKeyPairGenConfig* params); - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - NidKeyPairGenConfig* params); -}; - -using NidKeyPairGenJob = KeyGenJob>; -using SecretKeyGenJob = KeyGenJob; -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_KEYGEN_H_ - diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keys.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keys.h deleted file mode 100644 index d06565d8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_keys.h +++ /dev/null @@ -1,420 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_KEYS_H_ -#define SRC_CRYPTO_CRYPTO_KEYS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_util.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "node_buffer.h" -#include "node_worker.h" -#include "v8.h" - -#include - -#include -#include - -namespace node { -namespace crypto { -enum PKEncodingType { - // RSAPublicKey / RSAPrivateKey according to PKCS#1. - kKeyEncodingPKCS1, - // PrivateKeyInfo or EncryptedPrivateKeyInfo according to PKCS#8. - kKeyEncodingPKCS8, - // SubjectPublicKeyInfo according to X.509. - kKeyEncodingSPKI, - // ECPrivateKey according to SEC1. - kKeyEncodingSEC1 -}; - -enum PKFormatType { - kKeyFormatDER, - kKeyFormatPEM, - kKeyFormatJWK -}; - -enum KeyType { - kKeyTypeSecret, - kKeyTypePublic, - kKeyTypePrivate -}; - -enum KeyEncodingContext { - kKeyContextInput, - kKeyContextExport, - kKeyContextGenerate -}; - -enum class ParseKeyResult { - kParseKeyOk, - kParseKeyNotRecognized, - kParseKeyNeedPassphrase, - kParseKeyFailed -}; - -struct AsymmetricKeyEncodingConfig { - bool output_key_object_ = false; - PKFormatType format_ = kKeyFormatDER; - v8::Maybe type_ = v8::Nothing(); -}; - -using PublicKeyEncodingConfig = AsymmetricKeyEncodingConfig; - -struct PrivateKeyEncodingConfig : public AsymmetricKeyEncodingConfig { - const EVP_CIPHER* cipher_; - // The ByteSource alone is not enough to distinguish between "no passphrase" - // and a zero-length passphrase (which can be a null pointer), therefore, we - // use a NonCopyableMaybe. - NonCopyableMaybe passphrase_; -}; - -// This uses the built-in reference counter of OpenSSL to manage an EVP_PKEY -// which is slightly more efficient than using a shared pointer and easier to -// use. -class ManagedEVPPKey : public MemoryRetainer { - public: - ManagedEVPPKey() : mutex_(std::make_shared()) {} - explicit ManagedEVPPKey(EVPKeyPointer&& pkey); - ManagedEVPPKey(const ManagedEVPPKey& that); - ManagedEVPPKey& operator=(const ManagedEVPPKey& that); - - operator bool() const; - EVP_PKEY* get() const; - Mutex* mutex() const; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(ManagedEVPPKey) - SET_SELF_SIZE(ManagedEVPPKey) - - static PublicKeyEncodingConfig GetPublicKeyEncodingFromJs( - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - KeyEncodingContext context); - - static NonCopyableMaybe GetPrivateKeyEncodingFromJs( - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - KeyEncodingContext context); - - static ManagedEVPPKey GetParsedKey(Environment* env, - EVPKeyPointer&& pkey, - ParseKeyResult ret, - const char* default_msg); - - static ManagedEVPPKey GetPublicOrPrivateKeyFromJs( - const v8::FunctionCallbackInfo& args, - unsigned int* offset); - - static ManagedEVPPKey GetPrivateKeyFromJs( - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - bool allow_key_object); - - static v8::Maybe ToEncodedPublicKey( - Environment* env, - ManagedEVPPKey key, - const PublicKeyEncodingConfig& config, - v8::Local* out); - - static v8::Maybe ToEncodedPrivateKey( - Environment* env, - ManagedEVPPKey key, - const PrivateKeyEncodingConfig& config, - v8::Local* out); - - private: - size_t size_of_private_key() const; - size_t size_of_public_key() const; - - EVPKeyPointer pkey_; - std::shared_ptr mutex_; -}; - -// Objects of this class can safely be shared among threads. -class KeyObjectData : public MemoryRetainer { - public: - static std::shared_ptr CreateSecret(ByteSource key); - - static std::shared_ptr CreateAsymmetric( - KeyType type, - const ManagedEVPPKey& pkey); - - KeyType GetKeyType() const; - - // These functions allow unprotected access to the raw key material and should - // only be used to implement cryptographic operations requiring the key. - ManagedEVPPKey GetAsymmetricKey() const; - const char* GetSymmetricKey() const; - size_t GetSymmetricKeySize() const; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(KeyObjectData) - SET_SELF_SIZE(KeyObjectData) - - private: - explicit KeyObjectData(ByteSource symmetric_key); - - KeyObjectData( - KeyType type, - const ManagedEVPPKey& pkey); - - const KeyType key_type_; - const ByteSource symmetric_key_; - const unsigned int symmetric_key_len_; - const ManagedEVPPKey asymmetric_key_; -}; - -class KeyObjectHandle : public BaseObject { - public: - static v8::Local Initialize(Environment* env); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - static v8::MaybeLocal Create(Environment* env, - std::shared_ptr data); - - // TODO(tniessen): track the memory used by OpenSSL types - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(KeyObjectHandle) - SET_SELF_SIZE(KeyObjectHandle) - - const std::shared_ptr& Data(); - - protected: - static void New(const v8::FunctionCallbackInfo& args); - - static void Init(const v8::FunctionCallbackInfo& args); - static void InitECRaw(const v8::FunctionCallbackInfo& args); - static void InitEDRaw(const v8::FunctionCallbackInfo& args); - static void InitJWK(const v8::FunctionCallbackInfo& args); - static void GetKeyDetail(const v8::FunctionCallbackInfo& args); - static void Equals(const v8::FunctionCallbackInfo& args); - - static void ExportJWK(const v8::FunctionCallbackInfo& args); - - static void GetAsymmetricKeyType( - const v8::FunctionCallbackInfo& args); - v8::Local GetAsymmetricKeyType() const; - - static void GetSymmetricKeySize( - const v8::FunctionCallbackInfo& args); - - static void Export(const v8::FunctionCallbackInfo& args); - - v8::MaybeLocal ExportSecretKey() const; - v8::MaybeLocal ExportPublicKey( - const PublicKeyEncodingConfig& config) const; - v8::MaybeLocal ExportPrivateKey( - const PrivateKeyEncodingConfig& config) const; - - KeyObjectHandle(Environment* env, - v8::Local wrap); - - private: - std::shared_ptr data_; -}; - -class NativeKeyObject : public BaseObject { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - static void New(const v8::FunctionCallbackInfo& args); - static void CreateNativeKeyObjectClass( - const v8::FunctionCallbackInfo& args); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(NativeKeyObject) - SET_SELF_SIZE(NativeKeyObject) - - class KeyObjectTransferData : public worker::TransferData { - public: - explicit KeyObjectTransferData(const std::shared_ptr& data) - : data_(data) {} - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - SET_MEMORY_INFO_NAME(KeyObjectTransferData) - SET_SELF_SIZE(KeyObjectTransferData) - SET_NO_MEMORY_INFO() - - private: - std::shared_ptr data_; - }; - - BaseObject::TransferMode GetTransferMode() const override; - std::unique_ptr CloneForMessaging() const override; - - private: - NativeKeyObject(Environment* env, - v8::Local wrap, - const std::shared_ptr& handle_data) - : BaseObject(env, wrap), - handle_data_(handle_data) { - MakeWeak(); - } - - std::shared_ptr handle_data_; -}; - -enum WebCryptoKeyFormat { - kWebCryptoKeyFormatRaw, - kWebCryptoKeyFormatPKCS8, - kWebCryptoKeyFormatSPKI, - kWebCryptoKeyFormatJWK -}; - -enum class WebCryptoKeyExportStatus { - OK, - INVALID_KEY_TYPE, - FAILED -}; - -template -class KeyExportJob final : public CryptoJob { - public: - using AdditionalParams = typename KeyExportTraits::AdditionalParameters; - - static void New(const v8::FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - CHECK(args.IsConstructCall()); - - CryptoJobMode mode = GetCryptoJobMode(args[0]); - - CHECK(args[1]->IsUint32()); // Export Type - CHECK(args[2]->IsObject()); // KeyObject - - WebCryptoKeyFormat format = - static_cast(args[1].As()->Value()); - - KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args[2]); - - CHECK_NOT_NULL(key); - - AdditionalParams params; - if (KeyExportTraits::AdditionalConfig(args, 3, ¶ms).IsNothing()) { - // The KeyExportTraits::AdditionalConfig is responsible for - // calling an appropriate THROW_CRYPTO_* variant reporting - // whatever error caused initialization to fail. - return; - } - - new KeyExportJob( - env, - args.This(), - mode, - key->Data(), - format, - std::move(params)); - } - - static void Initialize( - Environment* env, - v8::Local target) { - CryptoJob::Initialize(New, env, target); - } - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry) { - CryptoJob::RegisterExternalReferences(New, registry); - } - - KeyExportJob( - Environment* env, - v8::Local object, - CryptoJobMode mode, - std::shared_ptr key, - WebCryptoKeyFormat format, - AdditionalParams&& params) - : CryptoJob( - env, - object, - AsyncWrap::PROVIDER_KEYEXPORTREQUEST, - mode, - std::move(params)), - key_(key), - format_(format) {} - - WebCryptoKeyFormat format() const { return format_; } - - void DoThreadPoolWork() override { - const WebCryptoKeyExportStatus status = - KeyExportTraits::DoExport( - key_, - format_, - *CryptoJob::params(), - &out_); - if (status == WebCryptoKeyExportStatus::OK) { - // Success! - return; - } - CryptoErrorStore* errors = CryptoJob::errors(); - errors->Capture(); - if (errors->Empty()) { - switch (status) { - case WebCryptoKeyExportStatus::OK: - UNREACHABLE(); - break; - case WebCryptoKeyExportStatus::INVALID_KEY_TYPE: - errors->Insert(NodeCryptoError::INVALID_KEY_TYPE); - break; - case WebCryptoKeyExportStatus::FAILED: - errors->Insert(NodeCryptoError::CIPHER_JOB_FAILED); - break; - } - } - } - - v8::Maybe ToResult( - v8::Local* err, - v8::Local* result) override { - Environment* env = AsyncWrap::env(); - CryptoErrorStore* errors = CryptoJob::errors(); - if (out_.size() > 0) { - CHECK(errors->Empty()); - *err = v8::Undefined(env->isolate()); - *result = out_.ToArrayBuffer(env); - return v8::Just(!result->IsEmpty()); - } - - if (errors->Empty()) - errors->Capture(); - CHECK(!errors->Empty()); - *result = v8::Undefined(env->isolate()); - return v8::Just(errors->ToException(env).ToLocal(err)); - } - - SET_SELF_SIZE(KeyExportJob) - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackFieldWithSize("out", out_.size()); - CryptoJob::MemoryInfo(tracker); - } - - private: - std::shared_ptr key_; - WebCryptoKeyFormat format_; - ByteSource out_; -}; - -WebCryptoKeyExportStatus PKEY_SPKI_Export( - KeyObjectData* key_data, - ByteSource* out); - -WebCryptoKeyExportStatus PKEY_PKCS8_Export( - KeyObjectData* key_data, - ByteSource* out); - -namespace Keys { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace Keys - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_KEYS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_pbkdf2.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_pbkdf2.h deleted file mode 100644 index 6fda7cd3..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_pbkdf2.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_PBKDF2_H_ -#define SRC_CRYPTO_CRYPTO_PBKDF2_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_util.h" -#include "async_wrap.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -// PBKDF2 is a pseudo-random key derivation scheme defined -// in https://tools.ietf.org/html/rfc8018 -// -// The algorithm takes as input a password and salt -// (both of which may, but should not be zero-length), -// a number of iterations, a hash digest algorithm, and -// an output length. -// -// The salt should be as unique as possible, and should -// be at least 16 bytes in length. -// -// The iteration count should be as high as possible. - -struct PBKDF2Config final : public MemoryRetainer { - CryptoJobMode mode; - ByteSource pass; - ByteSource salt; - int32_t iterations; - int32_t length; - const EVP_MD* digest = nullptr; - - PBKDF2Config() = default; - - explicit PBKDF2Config(PBKDF2Config&& other) noexcept; - - PBKDF2Config& operator=(PBKDF2Config&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(PBKDF2Config) - SET_SELF_SIZE(PBKDF2Config) -}; - -struct PBKDF2Traits final { - using AdditionalParameters = PBKDF2Config; - static constexpr const char* JobName = "PBKDF2Job"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_PBKDF2REQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - PBKDF2Config* params); - - static bool DeriveBits( - Environment* env, - const PBKDF2Config& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const PBKDF2Config& params, - ByteSource* out, - v8::Local* result); -}; - -using PBKDF2Job = DeriveBitsJob; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_PBKDF2_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_random.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_random.h deleted file mode 100644 index 970306c3..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_random.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_RANDOM_H_ -#define SRC_CRYPTO_CRYPTO_RANDOM_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_util.h" -#include "base_object.h" -#include "allocated_buffer.h" -#include "env.h" -#include "memory_tracker.h" -#include "node_internals.h" -#include "v8.h" - -namespace node { -namespace crypto { -struct RandomBytesConfig final : public MemoryRetainer { - unsigned char* buffer; - size_t size; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(RandomBytesConfig) - SET_SELF_SIZE(RandomBytesConfig) -}; - -struct RandomBytesTraits final { - using AdditionalParameters = RandomBytesConfig; - static constexpr const char* JobName = "RandomBytesJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_RANDOMBYTESREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - RandomBytesConfig* params); - - static bool DeriveBits( - Environment* env, - const RandomBytesConfig& params, - ByteSource* out_); - - static v8::Maybe EncodeOutput( - Environment* env, - const RandomBytesConfig& params, - ByteSource* unused, - v8::Local* result); -}; - -using RandomBytesJob = DeriveBitsJob; - -struct RandomPrimeConfig final : public MemoryRetainer { - BignumPointer prime; - BignumPointer rem; - BignumPointer add; - int bits; - bool safe; - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(RandomPrimeConfig) - SET_SELF_SIZE(RandomPrimeConfig) -}; - -struct RandomPrimeTraits final { - using AdditionalParameters = RandomPrimeConfig; - static constexpr const char* JobName = "RandomPrimeJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_RANDOMPRIMEREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - RandomPrimeConfig* params); - - static bool DeriveBits( - Environment* env, - const RandomPrimeConfig& params, - ByteSource* out_); - - static v8::Maybe EncodeOutput( - Environment* env, - const RandomPrimeConfig& params, - ByteSource* unused, - v8::Local* result); -}; - -using RandomPrimeJob = DeriveBitsJob; - -struct CheckPrimeConfig final : public MemoryRetainer { - BignumPointer candidate; - int checks = 1; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(CheckPrimeConfig) - SET_SELF_SIZE(CheckPrimeConfig) -}; - -struct CheckPrimeTraits final { - using AdditionalParameters = CheckPrimeConfig; - static constexpr const char* JobName = "CheckPrimeJob"; - - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_CHECKPRIMEREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - CheckPrimeConfig* params); - - static bool DeriveBits( - Environment* env, - const CheckPrimeConfig& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const CheckPrimeConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using CheckPrimeJob = DeriveBitsJob; - -namespace Random { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace Random -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_RANDOM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_rsa.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_rsa.h deleted file mode 100644 index 4f6fbad4..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_rsa.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_RSA_H_ -#define SRC_CRYPTO_CRYPTO_RSA_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_cipher.h" -#include "crypto/crypto_keygen.h" -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -enum RSAKeyVariant { - kKeyVariantRSA_SSA_PKCS1_v1_5, - kKeyVariantRSA_PSS, - kKeyVariantRSA_OAEP -}; - -struct RsaKeyPairParams final : public MemoryRetainer { - RSAKeyVariant variant; - unsigned int modulus_bits; - unsigned int exponent; - - // The following options are used for RSA-PSS. If any of them are set, a - // RSASSA-PSS-params sequence will be added to the key. - const EVP_MD* md = nullptr; - const EVP_MD* mgf1_md = nullptr; - int saltlen = -1; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(RsaKeyPairParams) - SET_SELF_SIZE(RsaKeyPairParams) -}; - -using RsaKeyPairGenConfig = KeyPairGenConfig; - -struct RsaKeyGenTraits final { - using AdditionalParameters = RsaKeyPairGenConfig; - static constexpr const char* JobName = "RsaKeyPairGenJob"; - - static EVPKeyCtxPointer Setup(RsaKeyPairGenConfig* params); - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int* offset, - RsaKeyPairGenConfig* params); -}; - -using RSAKeyPairGenJob = KeyGenJob>; - -struct RSAKeyExportConfig final : public MemoryRetainer { - RSAKeyVariant variant = kKeyVariantRSA_SSA_PKCS1_v1_5; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(RSAKeyExportConfig) - SET_SELF_SIZE(RSAKeyExportConfig) -}; - -struct RSAKeyExportTraits final { - static constexpr const char* JobName = "RSAKeyExportJob"; - using AdditionalParameters = RSAKeyExportConfig; - - static v8::Maybe AdditionalConfig( - const v8::FunctionCallbackInfo& args, - unsigned int offset, - RSAKeyExportConfig* config); - - static WebCryptoKeyExportStatus DoExport( - std::shared_ptr key_data, - WebCryptoKeyFormat format, - const RSAKeyExportConfig& params, - ByteSource* out); -}; - -using RSAKeyExportJob = KeyExportJob; - -struct RSACipherConfig final : public MemoryRetainer { - CryptoJobMode mode; - ByteSource label; - int padding = 0; - const EVP_MD* digest = nullptr; - - RSACipherConfig() = default; - - RSACipherConfig(RSACipherConfig&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(RSACipherConfig) - SET_SELF_SIZE(RSACipherConfig) -}; - -struct RSACipherTraits final { - static constexpr const char* JobName = "RSACipherJob"; - using AdditionalParameters = RSACipherConfig; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - WebCryptoCipherMode cipher_mode, - RSACipherConfig* config); - - static WebCryptoCipherStatus DoCipher( - Environment* env, - std::shared_ptr key_data, - WebCryptoCipherMode cipher_mode, - const RSACipherConfig& params, - const ByteSource& in, - ByteSource* out); -}; - -using RSACipherJob = CipherJob; - -v8::Maybe ExportJWKRsaKey( - Environment* env, - std::shared_ptr key, - v8::Local target); - -std::shared_ptr ImportJWKRsaKey( - Environment* env, - v8::Local jwk, - const v8::FunctionCallbackInfo& args, - unsigned int offset); - -v8::Maybe GetRsaKeyDetail( - Environment* env, - std::shared_ptr key, - v8::Local target); - -namespace RSAAlg { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace RSAAlg -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_RSA_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_scrypt.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_scrypt.h deleted file mode 100644 index 3d185637..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_scrypt.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_SCRYPT_H_ -#define SRC_CRYPTO_CRYPTO_SCRYPT_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_util.h" -#include "env.h" -#include "memory_tracker.h" -#include "v8.h" - -namespace node { -namespace crypto { -#ifndef OPENSSL_NO_SCRYPT - -// Scrypt is a password-based key derivation algorithm -// defined in https://tools.ietf.org/html/rfc7914 - -// It takes as input a password, a salt value, and a -// handful of additional parameters that control the -// cost of the operation. In this case, the higher -// the cost, the better the result. The length parameter -// defines the number of bytes that are generated. - -// The salt must be as random as possible and should be -// at least 16 bytes in length. - -struct ScryptConfig final : public MemoryRetainer { - CryptoJobMode mode; - ByteSource pass; - ByteSource salt; - uint32_t N; - uint32_t r; - uint32_t p; - uint64_t maxmem; - int32_t length; - - ScryptConfig() = default; - - explicit ScryptConfig(ScryptConfig&& other) noexcept; - - ScryptConfig& operator=(ScryptConfig&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(ScryptConfig) - SET_SELF_SIZE(ScryptConfig) -}; - -struct ScryptTraits final { - using AdditionalParameters = ScryptConfig; - static constexpr const char* JobName = "ScryptJob"; - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_SCRYPTREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - ScryptConfig* params); - - static bool DeriveBits( - Environment* env, - const ScryptConfig& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const ScryptConfig& params, - ByteSource* out, - v8::Local* result); -}; - -using ScryptJob = DeriveBitsJob; - -#else -// If there is no Scrypt support, ScryptJob becomes a non-op -struct ScryptJob { - static void Initialize( - Environment* env, - v8::Local target) {} -}; -#endif // !OPENSSL_NO_SCRYPT - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_SCRYPT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_sig.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_sig.h deleted file mode 100644 index eba18be7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_sig.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_SIG_H_ -#define SRC_CRYPTO_CRYPTO_SIG_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_keys.h" -#include "crypto/crypto_util.h" -#include "allocated_buffer.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" - -namespace node { -namespace crypto { -static const unsigned int kNoDsaSignature = static_cast(-1); - -enum DSASigEnc { - kSigEncDER, - kSigEncP1363 -}; - -class SignBase : public BaseObject { - public: - typedef enum { - kSignOk, - kSignUnknownDigest, - kSignInit, - kSignNotInitialised, - kSignUpdate, - kSignPrivateKey, - kSignPublicKey, - kSignMalformedSignature - } Error; - - SignBase(Environment* env, v8::Local wrap); - - Error Init(const char* sign_type); - Error Update(const char* data, size_t len); - - // TODO(joyeecheung): track the memory used by OpenSSL types - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SignBase) - SET_SELF_SIZE(SignBase) - - protected: - EVPMDPointer mdctx_; -}; - -class Sign : public SignBase { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - struct SignResult { - Error error; - std::unique_ptr signature; - - explicit SignResult( - Error err, - std::unique_ptr&& sig = nullptr) - : error(err), signature(std::move(sig)) {} - }; - - SignResult SignFinal( - const ManagedEVPPKey& pkey, - int padding, - const v8::Maybe& saltlen, - DSASigEnc dsa_sig_enc); - - static void SignSync(const v8::FunctionCallbackInfo& args); - - protected: - static void New(const v8::FunctionCallbackInfo& args); - static void SignInit(const v8::FunctionCallbackInfo& args); - static void SignUpdate(const v8::FunctionCallbackInfo& args); - static void SignFinal(const v8::FunctionCallbackInfo& args); - - Sign(Environment* env, v8::Local wrap); -}; - -class Verify : public SignBase { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - Error VerifyFinal(const ManagedEVPPKey& key, - const ByteSource& sig, - int padding, - const v8::Maybe& saltlen, - bool* verify_result); - - static void VerifySync(const v8::FunctionCallbackInfo& args); - - protected: - static void New(const v8::FunctionCallbackInfo& args); - static void VerifyInit(const v8::FunctionCallbackInfo& args); - static void VerifyUpdate(const v8::FunctionCallbackInfo& args); - static void VerifyFinal(const v8::FunctionCallbackInfo& args); - - Verify(Environment* env, v8::Local wrap); -}; - -struct SignConfiguration final : public MemoryRetainer { - enum Mode { - kSign, - kVerify - }; - enum Flags { - kHasNone = 0, - kHasSaltLength = 1, - kHasPadding = 2 - }; - - CryptoJobMode job_mode; - Mode mode; - ManagedEVPPKey key; - ByteSource data; - ByteSource signature; - const EVP_MD* digest = nullptr; - int flags = SignConfiguration::kHasNone; - int padding = 0; - int salt_length = 0; - DSASigEnc dsa_encoding = kSigEncDER; - - SignConfiguration() = default; - - explicit SignConfiguration(SignConfiguration&& other) noexcept; - - SignConfiguration& operator=(SignConfiguration&& other) noexcept; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SignConfiguration) - SET_SELF_SIZE(SignConfiguration) -}; - -struct SignTraits final { - using AdditionalParameters = SignConfiguration; - static constexpr const char* JobName = "SignJob"; - -// TODO(@jasnell): Sign request vs. Verify request - - static constexpr AsyncWrap::ProviderType Provider = - AsyncWrap::PROVIDER_SIGNREQUEST; - - static v8::Maybe AdditionalConfig( - CryptoJobMode mode, - const v8::FunctionCallbackInfo& args, - unsigned int offset, - SignConfiguration* params); - - static bool DeriveBits( - Environment* env, - const SignConfiguration& params, - ByteSource* out); - - static v8::Maybe EncodeOutput( - Environment* env, - const SignConfiguration& params, - ByteSource* out, - v8::Local* result); -}; - -using SignJob = DeriveBitsJob; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_SIG_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_spkac.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_spkac.h deleted file mode 100644 index bdd9f6b3..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_spkac.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_SPKAC_H_ -#define SRC_CRYPTO_CRYPTO_SPKAC_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "v8.h" - -#include - -namespace node { -namespace crypto { -namespace SPKAC { -void Initialize(Environment* env, v8::Local); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace SPKAC -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_SPKAC_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_timing.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_timing.h deleted file mode 100644 index 3e0594ce..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_timing.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_TIMING_H_ -#define SRC_CRYPTO_CRYPTO_TIMING_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "v8.h" - -namespace node { -namespace crypto { -namespace Timing { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace Timing -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_TIMING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_tls.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_tls.h deleted file mode 100644 index 765c6c47..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_tls.h +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_CRYPTO_CRYPTO_TLS_H_ -#define SRC_CRYPTO_CRYPTO_TLS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "crypto/crypto_context.h" -#include "crypto/crypto_clienthello.h" - -#include "async_wrap.h" -#include "stream_wrap.h" -#include "v8.h" - -#include - -#include - -namespace node { -namespace crypto { - -class TLSWrap : public AsyncWrap, - public StreamBase, - public StreamListener { - public: - enum class Kind { - kClient, - kServer - }; - - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - ~TLSWrap() override; - - bool is_cert_cb_running() const { return cert_cb_running_; } - bool is_waiting_cert_cb() const { return cert_cb_ != nullptr; } - bool has_session_callbacks() const { return session_callbacks_; } - void set_cert_cb_running(bool on = true) { cert_cb_running_ = on; } - void set_awaiting_new_session(bool on = true) { awaiting_new_session_ = on; } - void enable_session_callbacks() { session_callbacks_ = true; } - bool is_server() const { return kind_ == Kind::kServer; } - bool is_client() const { return kind_ == Kind::kClient; } - bool is_awaiting_new_session() const { return awaiting_new_session_; } - - // Implement StreamBase: - bool IsAlive() override; - bool IsClosing() override; - bool IsIPCPipe() override; - int GetFD() override; - ShutdownWrap* CreateShutdownWrap( - v8::Local req_wrap_object) override; - AsyncWrap* GetAsyncWrap() override; - - - // Implement StreamResource: - int ReadStart() override; // Exposed to JS - int ReadStop() override; // Exposed to JS - int DoShutdown(ShutdownWrap* req_wrap) override; - int DoWrite(WriteWrap* w, - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle) override; - // Return error_ string or nullptr if it's empty. - const char* Error() const override; - // Reset error_ string to empty. Not related to "clear text". - void ClearError() override; - - v8::MaybeLocal ocsp_response() const; - void ClearOcspResponse(); - SSL_SESSION* ReleaseSession(); - - // Called by the done() callback of the 'newSession' event. - void NewSessionDoneCb(); - - // Implement MemoryRetainer: - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(TLSWrap) - SET_SELF_SIZE(TLSWrap) - - std::string diagnostic_name() const override; - - private: - // OpenSSL structures are opaque. Estimate SSL memory size for OpenSSL 1.1.1b: - // SSL: 6224 - // SSL->SSL3_STATE: 1040 - // ...some buffers: 42 * 1024 - // NOTE: Actually it is much more than this - static constexpr int64_t kExternalSize = 6224 + 1040 + 42 * 1024; - - static constexpr int kClearOutChunkSize = 16384; - - // Maximum number of bytes for hello parser - static constexpr int kMaxHelloLength = 16384; - - // Usual ServerHello + Certificate size - static constexpr int kInitialClientBufferLength = 4096; - - // Maximum number of buffers passed to uv_write() - static constexpr int kSimultaneousBufferCount = 10; - - typedef void (*CertCb)(void* arg); - - // Alternative to StreamListener::stream(), that returns a StreamBase instead - // of a StreamResource. - StreamBase* underlying_stream() const { - return static_cast(stream()); - } - - void WaitForCertCb(CertCb cb, void* arg); - - TLSWrap(Environment* env, - v8::Local obj, - Kind kind, - StreamBase* stream, - SecureContext* sc); - - static void SSLInfoCallback(const SSL* ssl_, int where, int ret); - void InitSSL(); - // SSL has a "clear" text (unencrypted) side (to/from the node API) and - // encrypted ("enc") text side (to/from the underlying socket/stream). - // On each side data flows "in" or "out" of SSL context. - // - // EncIn() doesn't exist. Encrypted data is pushed from underlying stream into - // enc_in_ via the stream listener's OnStreamAlloc()/OnStreamRead() interface. - void EncOut(); // Write encrypted data from enc_out_ to underlying stream. - void ClearIn(); // SSL_write() clear data "in" to SSL. - void ClearOut(); // SSL_read() clear text "out" from SSL. - void Destroy(); - - // Call Done() on outstanding WriteWrap request. - void InvokeQueued(int status, const char* error_str = nullptr); - - // Drive the SSL state machine by attempting to SSL_read() and SSL_write() to - // it. Transparent handshakes mean SSL_read() might trigger I/O on the - // underlying stream even if there is no clear text to read or write. - void Cycle(); - - // Implement StreamListener: - // Returns buf that points into enc_in_. - uv_buf_t OnStreamAlloc(size_t size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; - void OnStreamAfterWrite(WriteWrap* w, int status) override; - - int SetCACerts(SecureContext* sc); - - int GetSSLError(int status) const; - - static int SelectSNIContextCallback(SSL* s, int* ad, void* arg); - - static void CertCbDone(const v8::FunctionCallbackInfo& args); - static void DestroySSL(const v8::FunctionCallbackInfo& args); - static void EnableCertCb(const v8::FunctionCallbackInfo& args); - static void EnableKeylogCallback( - const v8::FunctionCallbackInfo& args); - static void EnableSessionCallbacks( - const v8::FunctionCallbackInfo& args); - static void EnableTrace(const v8::FunctionCallbackInfo& args); - static void EndParser(const v8::FunctionCallbackInfo& args); - static void ExportKeyingMaterial( - const v8::FunctionCallbackInfo& args); - static void GetALPNNegotiatedProto( - const v8::FunctionCallbackInfo& args); - static void GetCertificate(const v8::FunctionCallbackInfo& args); - static void GetX509Certificate( - const v8::FunctionCallbackInfo& args); - static void GetCipher(const v8::FunctionCallbackInfo& args); - static void GetEphemeralKeyInfo( - const v8::FunctionCallbackInfo& args); - static void GetFinished(const v8::FunctionCallbackInfo& args); - static void GetPeerCertificate( - const v8::FunctionCallbackInfo& args); - static void GetPeerX509Certificate( - const v8::FunctionCallbackInfo& args); - static void GetPeerFinished(const v8::FunctionCallbackInfo& args); - static void GetProtocol(const v8::FunctionCallbackInfo& args); - static void GetServername(const v8::FunctionCallbackInfo& args); - static void GetSession(const v8::FunctionCallbackInfo& args); - static void GetSharedSigalgs(const v8::FunctionCallbackInfo& args); - static void GetTLSTicket(const v8::FunctionCallbackInfo& args); - static void GetWriteQueueSize( - const v8::FunctionCallbackInfo& info); - static void IsSessionReused(const v8::FunctionCallbackInfo& args); - static void LoadSession(const v8::FunctionCallbackInfo& args); - static void NewSessionDone(const v8::FunctionCallbackInfo& args); - static void OnClientHelloParseEnd(void* arg); - static void Receive(const v8::FunctionCallbackInfo& args); - static void Renegotiate(const v8::FunctionCallbackInfo& args); - static void RequestOCSP(const v8::FunctionCallbackInfo& args); - static void SetALPNProtocols(const v8::FunctionCallbackInfo& args); - static void SetOCSPResponse(const v8::FunctionCallbackInfo& args); - static void SetServername(const v8::FunctionCallbackInfo& args); - static void SetSession(const v8::FunctionCallbackInfo& args); - static void SetVerifyMode(const v8::FunctionCallbackInfo& args); - static void Start(const v8::FunctionCallbackInfo& args); - static void VerifyError(const v8::FunctionCallbackInfo& args); - static void Wrap(const v8::FunctionCallbackInfo& args); - -#ifdef SSL_set_max_send_fragment - static void SetMaxSendFragment( - const v8::FunctionCallbackInfo& args); -#endif // SSL_set_max_send_fragment - -#ifndef OPENSSL_NO_PSK - static void EnablePskCallback( - const v8::FunctionCallbackInfo& args); - static void SetPskIdentityHint( - const v8::FunctionCallbackInfo& args); - static unsigned int PskServerCallback(SSL* s, - const char* identity, - unsigned char* psk, - unsigned int max_psk_len); - static unsigned int PskClientCallback(SSL* s, - const char* hint, - char* identity, - unsigned int max_identity_len, - unsigned char* psk, - unsigned int max_psk_len); -#endif - - Environment* const env_; - Kind kind_; - SSLSessionPointer next_sess_; - SSLPointer ssl_; - ClientHelloParser hello_parser_; - v8::Global ocsp_response_; - BaseObjectPtr sni_context_; - BaseObjectPtr sc_; - - // BIO buffers hold encrypted data. - BIO* enc_in_ = nullptr; // StreamListener fills this for SSL_read(). - BIO* enc_out_ = nullptr; // SSL_write()/handshake fills this for EncOut(). - // Waiting for ClearIn() to pass to SSL_write(). - std::unique_ptr pending_cleartext_input_; - size_t write_size_ = 0; - BaseObjectPtr current_write_; - BaseObjectPtr current_empty_write_; - std::string error_; - - bool session_callbacks_ = false; - bool awaiting_new_session_ = false; - bool in_dowrite_ = false; - bool started_ = false; - bool shutdown_ = false; - bool cert_cb_running_ = false; - bool eof_ = false; - - // TODO(@jasnell): These state flags should be revisited. - // The established_ flag indicates that the handshake is - // completed. The write_callback_scheduled_ flag is less - // clear -- once it is set to true, it is never set to - // false and it is only set to true after established_ - // is set to true, so it's likely redundant. - bool established_ = false; - bool write_callback_scheduled_ = false; - - int cycle_depth_ = 0; - - // SSL_set_cert_cb - CertCb cert_cb_ = nullptr; - void* cert_cb_arg_ = nullptr; - - BIOPointer bio_trace_; -}; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_CRYPTO_CRYPTO_TLS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_util.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_util.h deleted file mode 100644 index c431159e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_util.h +++ /dev/null @@ -1,792 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_UTIL_H_ -#define SRC_CRYPTO_CRYPTO_UTIL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "async_wrap.h" -#include "allocated_buffer.h" -#include "node_errors.h" -#include "node_external_reference.h" -#include "node_internals.h" -#include "util.h" -#include "v8.h" -#include "string_bytes.h" - -#include -#include -#include -#include -#include -#include -#include -#ifndef OPENSSL_NO_ENGINE -# include -#endif // !OPENSSL_NO_ENGINE -// The FIPS-related functions are only available -// when the OpenSSL itself was compiled with FIPS support. -#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_MAJOR < 3 -# include -#endif // OPENSSL_FIPS - -#include -#include -#include -#include -#include -#include - -namespace node { -namespace crypto { -// Currently known sizes of commonly used OpenSSL struct sizes. -// OpenSSL considers it's various structs to be opaque and the -// sizes may change from one version of OpenSSL to another, so -// these values should not be trusted to remain static. These -// are provided to allow for some close to reasonable memory -// tracking. -constexpr size_t kSizeOf_DH = 144; -constexpr size_t kSizeOf_EC_KEY = 80; -constexpr size_t kSizeOf_EVP_CIPHER_CTX = 168; -constexpr size_t kSizeOf_EVP_MD_CTX = 48; -constexpr size_t kSizeOf_EVP_PKEY = 72; -constexpr size_t kSizeOf_EVP_PKEY_CTX = 80; -constexpr size_t kSizeOf_HMAC_CTX = 32; - -// Define smart pointers for the most commonly used OpenSSL types: -using X509Pointer = DeleteFnPtr; -using BIOPointer = DeleteFnPtr; -using SSLCtxPointer = DeleteFnPtr; -using SSLSessionPointer = DeleteFnPtr; -using SSLPointer = DeleteFnPtr; -using PKCS8Pointer = DeleteFnPtr; -using EVPKeyPointer = DeleteFnPtr; -using EVPKeyCtxPointer = DeleteFnPtr; -using EVPMDPointer = DeleteFnPtr; -using RSAPointer = DeleteFnPtr; -using ECPointer = DeleteFnPtr; -using BignumPointer = DeleteFnPtr; -using BignumCtxPointer = DeleteFnPtr; -using NetscapeSPKIPointer = DeleteFnPtr; -using ECGroupPointer = DeleteFnPtr; -using ECPointPointer = DeleteFnPtr; -using ECKeyPointer = DeleteFnPtr; -using DHPointer = DeleteFnPtr; -using ECDSASigPointer = DeleteFnPtr; -using HMACCtxPointer = DeleteFnPtr; -using CipherCtxPointer = DeleteFnPtr; -using RsaPointer = DeleteFnPtr; -using DsaPointer = DeleteFnPtr; -using DsaSigPointer = DeleteFnPtr; - -// Our custom implementation of the certificate verify callback -// used when establishing a TLS handshake. Because we cannot perform -// I/O quickly enough with X509_STORE_CTX_ APIs in this callback, -// we ignore preverify_ok errors here and let the handshake continue. -// In other words, this VerifyCallback is a non-op. It is imperative -// that the user user Connection::VerifyError after the `secure` -// callback has been made. -extern int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx); - -bool ProcessFipsOptions(); - -bool InitCryptoOnce(v8::Isolate* isolate); -void InitCryptoOnce(); - -void InitCrypto(v8::Local target); - -extern void UseExtraCaCerts(const std::string& file); - -// Forcibly clear OpenSSL's error stack on return. This stops stale errors -// from popping up later in the lifecycle of crypto operations where they -// would cause spurious failures. It's a rather blunt method, though. -// ERR_clear_error() isn't necessarily cheap either. -struct ClearErrorOnReturn { - ~ClearErrorOnReturn() { ERR_clear_error(); } -}; - -// Pop errors from OpenSSL's error stack that were added -// between when this was constructed and destructed. -struct MarkPopErrorOnReturn { - MarkPopErrorOnReturn() { ERR_set_mark(); } - ~MarkPopErrorOnReturn() { ERR_pop_to_mark(); } -}; - -// Ensure that OpenSSL has enough entropy (at least 256 bits) for its PRNG. -// The entropy pool starts out empty and needs to fill up before the PRNG -// can be used securely. Once the pool is filled, it never dries up again; -// its contents is stirred and reused when necessary. -// -// OpenSSL normally fills the pool automatically but not when someone starts -// generating random numbers before the pool is full: in that case OpenSSL -// keeps lowering the entropy estimate to thwart attackers trying to guess -// the initial state of the PRNG. -// -// When that happens, we will have to wait until enough entropy is available. -// That should normally never take longer than a few milliseconds. -// -// OpenSSL draws from /dev/random and /dev/urandom. While /dev/random may -// block pending "true" randomness, /dev/urandom is a CSPRNG that doesn't -// block under normal circumstances. -// -// The only time when /dev/urandom may conceivably block is right after boot, -// when the whole system is still low on entropy. That's not something we can -// do anything about. -void CheckEntropy(); - -// Generate length bytes of random data. If this returns false, the data -// may not be truly random but it's still generally good enough. -bool EntropySource(unsigned char* buffer, size_t length); - -int PasswordCallback(char* buf, int size, int rwflag, void* u); - -int NoPasswordCallback(char* buf, int size, int rwflag, void* u); - -// Decode is used by the various stream-based crypto utilities to decode -// string input. -template -void Decode(const v8::FunctionCallbackInfo& args, - void (*callback)(T*, const v8::FunctionCallbackInfo&, - const char*, size_t)) { - T* ctx; - ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder()); - - if (args[0]->IsString()) { - StringBytes::InlineDecoder decoder; - Environment* env = Environment::GetCurrent(args); - enum encoding enc = ParseEncoding(env->isolate(), args[1], UTF8); - if (decoder.Decode(env, args[0].As(), enc).IsNothing()) - return; - callback(ctx, args, decoder.out(), decoder.size()); - } else { - ArrayBufferViewContents buf(args[0]); - callback(ctx, args, buf.data(), buf.length()); - } -} - -#define NODE_CRYPTO_ERROR_CODES_MAP(V) \ - V(CIPHER_JOB_FAILED, "Cipher job failed") \ - V(DERIVING_BITS_FAILED, "Deriving bits failed") \ - V(ENGINE_NOT_FOUND, "Engine \"%s\" was not found") \ - V(INVALID_KEY_TYPE, "Invalid key type") \ - V(KEY_GENERATION_JOB_FAILED, "Key generation job failed") \ - V(OK, "Ok") \ - -enum class NodeCryptoError { -#define V(CODE, DESCRIPTION) CODE, - NODE_CRYPTO_ERROR_CODES_MAP(V) -#undef V -}; - -// Utility struct used to harvest error information from openssl's error stack -struct CryptoErrorStore final : public MemoryRetainer { - public: - void Capture(); - - bool Empty() const; - - template - void Insert(const NodeCryptoError error, Args&&... args); - - v8::MaybeLocal ToException( - Environment* env, - v8::Local exception_string = v8::Local()) const; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(CryptoErrorStore) - SET_SELF_SIZE(CryptoErrorStore) - - private: - std::vector errors_; -}; - -template -void CryptoErrorStore::Insert(const NodeCryptoError error, Args&&... args) { - const char* error_string = nullptr; - switch (error) { -#define V(CODE, DESCRIPTION) \ - case NodeCryptoError::CODE: error_string = DESCRIPTION; break; - NODE_CRYPTO_ERROR_CODES_MAP(V) -#undef V - } - errors_.emplace_back(SPrintF(error_string, - std::forward(args)...)); -} - -template -T* MallocOpenSSL(size_t count) { - void* mem = OPENSSL_malloc(MultiplyWithOverflowCheck(count, sizeof(T))); - CHECK_IMPLIES(mem == nullptr, count == 0); - return static_cast(mem); -} - -template -T* ReallocOpenSSL(T* buf, size_t count) { - void* mem = OPENSSL_realloc(buf, MultiplyWithOverflowCheck(count, sizeof(T))); - CHECK_IMPLIES(mem == nullptr, count == 0); - return static_cast(mem); -} - -// A helper class representing a read-only byte array. When deallocated, its -// contents are zeroed. -class ByteSource { - public: - ByteSource() = default; - ByteSource(ByteSource&& other) noexcept; - ~ByteSource(); - - ByteSource& operator=(ByteSource&& other) noexcept; - - const char* get() const; - - template - const T* data() const { return reinterpret_cast(get()); } - - size_t size() const; - - operator bool() const { return data_ != nullptr; } - - BignumPointer ToBN() const { - return BignumPointer(BN_bin2bn( - reinterpret_cast(get()), - size(), - nullptr)); - } - - // Creates a v8::BackingStore that takes over responsibility for - // any allocated data. The ByteSource will be reset with size = 0 - // after being called. - std::unique_ptr ReleaseToBackingStore(); - - v8::Local ToArrayBuffer(Environment* env); - - v8::MaybeLocal ToBuffer(Environment* env); - - void reset(); - - // Allows an Allocated ByteSource to be truncated. - void Resize(size_t newsize) { - CHECK_LE(newsize, size_); - CHECK_NOT_NULL(allocated_data_); - char* new_data_ = ReallocOpenSSL(allocated_data_, newsize); - data_ = allocated_data_ = new_data_; - size_ = newsize; - } - - static ByteSource Allocated(char* data, size_t size); - static ByteSource Foreign(const char* data, size_t size); - - static ByteSource FromEncodedString(Environment* env, - v8::Local value, - enum encoding enc = BASE64); - - static ByteSource FromStringOrBuffer(Environment* env, - v8::Local value); - - static ByteSource FromString(Environment* env, - v8::Local str, - bool ntc = false); - - static ByteSource FromBuffer(v8::Local buffer, - bool ntc = false); - - static ByteSource FromBIO(const BIOPointer& bio); - - static ByteSource NullTerminatedCopy(Environment* env, - v8::Local value); - - static ByteSource FromSymmetricKeyObjectHandle(v8::Local handle); - - ByteSource(const ByteSource&) = delete; - ByteSource& operator=(const ByteSource&) = delete; - - static ByteSource FromSecretKeyBytes( - Environment* env, v8::Local value); - - private: - const char* data_ = nullptr; - char* allocated_data_ = nullptr; - size_t size_ = 0; - - ByteSource(const char* data, char* allocated_data, size_t size); -}; - -enum CryptoJobMode { - kCryptoJobAsync, - kCryptoJobSync -}; - -CryptoJobMode GetCryptoJobMode(v8::Local args); - -template -class CryptoJob : public AsyncWrap, public ThreadPoolWork { - public: - using AdditionalParams = typename CryptoJobTraits::AdditionalParameters; - - explicit CryptoJob( - Environment* env, - v8::Local object, - AsyncWrap::ProviderType type, - CryptoJobMode mode, - AdditionalParams&& params) - : AsyncWrap(env, object, type), - ThreadPoolWork(env), - mode_(mode), - params_(std::move(params)) { - // If the CryptoJob is async, then the instance will be - // cleaned up when AfterThreadPoolWork is called. - if (mode == kCryptoJobSync) MakeWeak(); - } - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { - // CryptoJobs run a work in the libuv thread pool and may still - // exist when the event loop empties and starts to exit. - return true; - } - - void AfterThreadPoolWork(int status) override { - Environment* env = AsyncWrap::env(); - CHECK_EQ(mode_, kCryptoJobAsync); - CHECK(status == 0 || status == UV_ECANCELED); - std::unique_ptr ptr(this); - // If the job was canceled do not execute the callback. - // TODO(@jasnell): We should likely revisit skipping the - // callback on cancel as that could leave the JS in a pending - // state (e.g. unresolved promises...) - if (status == UV_ECANCELED) return; - v8::HandleScope handle_scope(env->isolate()); - v8::Context::Scope context_scope(env->context()); - - // TODO(tniessen): Remove the exception handling logic here as soon as we - // can verify that no code path in ToResult will ever throw an exception. - v8::Local exception; - v8::Local args[2]; - { - node::errors::TryCatchScope try_catch(env); - v8::Maybe ret = ptr->ToResult(&args[0], &args[1]); - if (!ret.IsJust()) { - CHECK(try_catch.HasCaught()); - exception = try_catch.Exception(); - } else if (!ret.FromJust()) { - return; - } - } - - if (exception.IsEmpty()) { - ptr->MakeCallback(env->ondone_string(), arraysize(args), args); - } else { - ptr->MakeCallback(env->ondone_string(), 1, &exception); - } - } - - virtual v8::Maybe ToResult( - v8::Local* err, - v8::Local* result) = 0; - - CryptoJobMode mode() const { return mode_; } - - CryptoErrorStore* errors() { return &errors_; } - - AdditionalParams* params() { return ¶ms_; } - - std::string MemoryInfoName() const override { - return CryptoJobTraits::JobName; - } - - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackField("params", params_); - tracker->TrackField("errors", errors_); - } - - static void Run(const v8::FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - - CryptoJob* job; - ASSIGN_OR_RETURN_UNWRAP(&job, args.Holder()); - if (job->mode() == kCryptoJobAsync) - return job->ScheduleWork(); - - v8::Local ret[2]; - env->PrintSyncTrace(); - job->DoThreadPoolWork(); - v8::Maybe result = job->ToResult(&ret[0], &ret[1]); - if (result.IsJust() && result.FromJust()) { - args.GetReturnValue().Set( - v8::Array::New(env->isolate(), ret, arraysize(ret))); - } - } - - static void Initialize( - v8::FunctionCallback new_fn, - Environment* env, - v8::Local target) { - v8::Local job = env->NewFunctionTemplate(new_fn); - job->Inherit(AsyncWrap::GetConstructorTemplate(env)); - job->InstanceTemplate()->SetInternalFieldCount( - AsyncWrap::kInternalFieldCount); - env->SetProtoMethod(job, "run", Run); - env->SetConstructorFunction(target, CryptoJobTraits::JobName, job); - } - - static void RegisterExternalReferences(v8::FunctionCallback new_fn, - ExternalReferenceRegistry* registry) { - registry->Register(new_fn); - registry->Register(Run); - } - - private: - const CryptoJobMode mode_; - CryptoErrorStore errors_; - AdditionalParams params_; -}; - -template -class DeriveBitsJob final : public CryptoJob { - public: - using AdditionalParams = typename DeriveBitsTraits::AdditionalParameters; - - static void New(const v8::FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - - CryptoJobMode mode = GetCryptoJobMode(args[0]); - - AdditionalParams params; - if (DeriveBitsTraits::AdditionalConfig(mode, args, 1, ¶ms) - .IsNothing()) { - // The DeriveBitsTraits::AdditionalConfig is responsible for - // calling an appropriate THROW_CRYPTO_* variant reporting - // whatever error caused initialization to fail. - return; - } - - new DeriveBitsJob(env, args.This(), mode, std::move(params)); - } - - static void Initialize( - Environment* env, - v8::Local target) { - CryptoJob::Initialize(New, env, target); - } - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry) { - CryptoJob::RegisterExternalReferences(New, registry); - } - - DeriveBitsJob( - Environment* env, - v8::Local object, - CryptoJobMode mode, - AdditionalParams&& params) - : CryptoJob( - env, - object, - DeriveBitsTraits::Provider, - mode, - std::move(params)) {} - - void DoThreadPoolWork() override { - if (!DeriveBitsTraits::DeriveBits( - AsyncWrap::env(), - *CryptoJob::params(), &out_)) { - CryptoErrorStore* errors = CryptoJob::errors(); - errors->Capture(); - if (errors->Empty()) - errors->Insert(NodeCryptoError::DERIVING_BITS_FAILED); - return; - } - success_ = true; - } - - v8::Maybe ToResult( - v8::Local* err, - v8::Local* result) override { - Environment* env = AsyncWrap::env(); - CryptoErrorStore* errors = CryptoJob::errors(); - if (success_) { - CHECK(errors->Empty()); - *err = v8::Undefined(env->isolate()); - return DeriveBitsTraits::EncodeOutput( - env, - *CryptoJob::params(), - &out_, - result); - } - - if (errors->Empty()) - errors->Capture(); - CHECK(!errors->Empty()); - *result = v8::Undefined(env->isolate()); - return v8::Just(errors->ToException(env).ToLocal(err)); - } - - SET_SELF_SIZE(DeriveBitsJob) - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackFieldWithSize("out", out_.size()); - CryptoJob::MemoryInfo(tracker); - } - - private: - ByteSource out_; - bool success_ = false; -}; - -void ThrowCryptoError(Environment* env, - unsigned long err, // NOLINT(runtime/int) - const char* message = nullptr); - -#ifndef OPENSSL_NO_ENGINE -struct EnginePointer { - ENGINE* engine = nullptr; - bool finish_on_exit = false; - - inline EnginePointer() = default; - - inline explicit EnginePointer(ENGINE* engine_, bool finish_on_exit_ = false) - : engine(engine_), - finish_on_exit(finish_on_exit_) {} - - inline EnginePointer(EnginePointer&& other) noexcept - : engine(other.engine), - finish_on_exit(other.finish_on_exit) { - other.release(); - } - - inline ~EnginePointer() { reset(); } - - inline EnginePointer& operator=(EnginePointer&& other) noexcept { - if (this == &other) return *this; - this->~EnginePointer(); - return *new (this) EnginePointer(std::move(other)); - } - - inline operator bool() const { return engine != nullptr; } - - inline ENGINE* get() { return engine; } - - inline void reset(ENGINE* engine_ = nullptr, bool finish_on_exit_ = false) { - if (engine != nullptr) { - if (finish_on_exit) { - // This also does the equivalent of ENGINE_free. - CHECK_EQ(ENGINE_finish(engine), 1); - } else { - CHECK_EQ(ENGINE_free(engine), 1); - } - } - engine = engine_; - finish_on_exit = finish_on_exit_; - } - - inline ENGINE* release() { - ENGINE* ret = engine; - engine = nullptr; - finish_on_exit = false; - return ret; - } -}; - -EnginePointer LoadEngineById(const char* id, CryptoErrorStore* errors); - -bool SetEngine( - const char* id, - uint32_t flags, - CryptoErrorStore* errors = nullptr); - -void SetEngine(const v8::FunctionCallbackInfo& args); -#endif // !OPENSSL_NO_ENGINE - -void GetFipsCrypto(const v8::FunctionCallbackInfo& args); - -void SetFipsCrypto(const v8::FunctionCallbackInfo& args); - -void TestFipsCrypto(const v8::FunctionCallbackInfo& args); - -class CipherPushContext { - public: - inline explicit CipherPushContext(Environment* env) : env_(env) {} - - inline void push_back(const char* str) { - list_.emplace_back(OneByteString(env_->isolate(), str)); - } - - inline v8::Local ToJSArray() { - return v8::Array::New(env_->isolate(), list_.data(), list_.size()); - } - - private: - std::vector> list_; - Environment* env_; -}; - -#if OPENSSL_VERSION_MAJOR >= 3 -template -void array_push_back(const TypeName* evp_ref, - const char* from, - const char* to, - void* arg) { - if (!from) - return; - - const TypeName* real_instance = getbyname(from); - if (!real_instance) - return; - - const char* real_name = getname(real_instance); - if (!real_name) - return; - - // EVP_*_fetch() does not support alias names, so we need to pass it the - // real/original algorithm name. - // We use EVP_*_fetch() as a filter here because it will only return an - // instance if the algorithm is supported by the public OpenSSL APIs (some - // algorithms are used internally by OpenSSL and are also passed to this - // callback). - TypeName* fetched = fetch_type(nullptr, real_name, nullptr); - if (!fetched) - return; - - free_type(fetched); - static_cast(arg)->push_back(from); -} -#else -template -void array_push_back(const TypeName* evp_ref, - const char* from, - const char* to, - void* arg) { - if (!from) - return; - static_cast(arg)->push_back(from); -} -#endif - -inline bool IsAnyByteSource(v8::Local arg) { - return arg->IsArrayBufferView() || - arg->IsArrayBuffer() || - arg->IsSharedArrayBuffer(); -} - -template -class ArrayBufferOrViewContents { - public: - ArrayBufferOrViewContents() = default; - - inline explicit ArrayBufferOrViewContents(v8::Local buf) { - CHECK(IsAnyByteSource(buf)); - if (buf->IsArrayBufferView()) { - auto view = buf.As(); - offset_ = view->ByteOffset(); - length_ = view->ByteLength(); - store_ = view->Buffer()->GetBackingStore(); - } else if (buf->IsArrayBuffer()) { - auto ab = buf.As(); - offset_ = 0; - length_ = ab->ByteLength(); - store_ = ab->GetBackingStore(); - } else { - auto sab = buf.As(); - offset_ = 0; - length_ = sab->ByteLength(); - store_ = sab->GetBackingStore(); - } - } - - inline const T* data() const { - // Ideally, these would return nullptr if IsEmpty() or length_ is zero, - // but some of the openssl API react badly if given a nullptr even when - // length is zero, so we have to return something. - if (size() == 0) - return &buf; - return reinterpret_cast(store_->Data()) + offset_; - } - - inline T* data() { - // Ideally, these would return nullptr if IsEmpty() or length_ is zero, - // but some of the openssl API react badly if given a nullptr even when - // length is zero, so we have to return something. - if (size() == 0) - return &buf; - return reinterpret_cast(store_->Data()) + offset_; - } - - inline size_t size() const { return length_; } - - // In most cases, input buffer sizes passed in to openssl need to - // be limited to <= INT_MAX. This utility method helps us check. - inline bool CheckSizeInt32() { return size() <= INT_MAX; } - - inline ByteSource ToByteSource() const { - return ByteSource::Foreign(data(), size()); - } - - inline ByteSource ToCopy() const { - if (size() == 0) return ByteSource(); - char* buf = MallocOpenSSL(size()); - CHECK_NOT_NULL(buf); - memcpy(buf, data(), size()); - return ByteSource::Allocated(buf, size()); - } - - inline ByteSource ToNullTerminatedCopy() const { - if (size() == 0) return ByteSource(); - char* buf = MallocOpenSSL(size() + 1); - CHECK_NOT_NULL(buf); - buf[size()] = 0; - memcpy(buf, data(), size()); - return ByteSource::Allocated(buf, size()); - } - - template - void CopyTo(M* dest, size_t len) const { - static_assert(sizeof(M) == 1, "sizeof(M) must equal 1"); - len = std::min(len, size()); - if (len > 0 && data() != nullptr) - memcpy(dest, data(), len); - } - - private: - T buf = 0; - size_t offset_ = 0; - size_t length_ = 0; - std::shared_ptr store_; -}; - -template -std::vector CopyBuffer(const ArrayBufferOrViewContents& buf) { - std::vector vec; - vec->resize(buf.size()); - if (vec->size() > 0 && buf.data() != nullptr) - memcpy(vec->data(), buf.data(), vec->size()); - return vec; -} - -template -std::vector CopyBuffer(v8::Local buf) { - return CopyBuffer(ArrayBufferOrViewContents(buf)); -} - -v8::MaybeLocal EncodeBignum( - Environment* env, - const BIGNUM* bn, - int size, - v8::Local* error); - -v8::Maybe SetEncodedValue( - Environment* env, - v8::Local target, - v8::Local name, - const BIGNUM* bn, - int size = 0); - -namespace Util { -void Initialize(Environment* env, v8::Local target); -void RegisterExternalReferences(ExternalReferenceRegistry* registry); -} // namespace Util - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_UTIL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_x509.h b/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_x509.h deleted file mode 100644 index 751e6e8c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/crypto/crypto_x509.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef SRC_CRYPTO_CRYPTO_X509_H_ -#define SRC_CRYPTO_CRYPTO_X509_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object.h" -#include "crypto/crypto_util.h" -#include "env.h" -#include "memory_tracker.h" -#include "node_worker.h" -#include "v8.h" - -namespace node { -namespace crypto { - -// The ManagedX509 class is essentially a smart pointer for -// X509 objects that allows an X509Certificate instance to -// be cloned at the JS level while pointing at the same -// underlying X509 instance. -class ManagedX509 : public MemoryRetainer { - public: - ManagedX509() = default; - explicit ManagedX509(X509Pointer&& cert); - ManagedX509(const ManagedX509& that); - ManagedX509& operator=(const ManagedX509& that); - - operator bool() const { return !!cert_; } - X509* get() const { return cert_.get(); } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(ManagedX509) - SET_SELF_SIZE(ManagedX509) - - private: - X509Pointer cert_; -}; - -class X509Certificate : public BaseObject { - public: - enum class GetPeerCertificateFlag { - NONE, - SERVER - }; - - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - static v8::Local GetConstructorTemplate( - Environment* env); - static bool HasInstance(Environment* env, v8::Local object); - - static v8::MaybeLocal New( - Environment* env, - X509Pointer cert, - STACK_OF(X509)* issuer_chain = nullptr); - - static v8::MaybeLocal New( - Environment* env, - std::shared_ptr cert, - STACK_OF(X509)* issuer_chain = nullptr); - - static v8::MaybeLocal GetCert( - Environment* env, - const SSLPointer& ssl); - - static v8::MaybeLocal GetPeerCert( - Environment* env, - const SSLPointer& ssl, - GetPeerCertificateFlag flag); - - static v8::Local Wrap( - Environment* env, - v8::Local object, - X509Pointer cert); - - static void Parse(const v8::FunctionCallbackInfo& args); - static void Subject(const v8::FunctionCallbackInfo& args); - static void SubjectAltName(const v8::FunctionCallbackInfo& args); - static void Issuer(const v8::FunctionCallbackInfo& args); - static void InfoAccess(const v8::FunctionCallbackInfo& args); - static void ValidFrom(const v8::FunctionCallbackInfo& args); - static void ValidTo(const v8::FunctionCallbackInfo& args); - static void Fingerprint(const v8::FunctionCallbackInfo& args); - static void Fingerprint256(const v8::FunctionCallbackInfo& args); - static void Fingerprint512(const v8::FunctionCallbackInfo& args); - static void KeyUsage(const v8::FunctionCallbackInfo& args); - static void SerialNumber(const v8::FunctionCallbackInfo& args); - static void Raw(const v8::FunctionCallbackInfo& args); - static void PublicKey(const v8::FunctionCallbackInfo& args); - static void Pem(const v8::FunctionCallbackInfo& args); - static void CheckCA(const v8::FunctionCallbackInfo& args); - static void CheckHost(const v8::FunctionCallbackInfo& args); - static void CheckEmail(const v8::FunctionCallbackInfo& args); - static void CheckIP(const v8::FunctionCallbackInfo& args); - static void CheckIssued(const v8::FunctionCallbackInfo& args); - static void CheckPrivateKey(const v8::FunctionCallbackInfo& args); - static void Verify(const v8::FunctionCallbackInfo& args); - static void ToLegacy(const v8::FunctionCallbackInfo& args); - static void GetIssuerCert(const v8::FunctionCallbackInfo& args); - - X509* get() { return cert_->get(); } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(X509Certificate) - SET_SELF_SIZE(X509Certificate) - - class X509CertificateTransferData : public worker::TransferData { - public: - explicit X509CertificateTransferData( - const std::shared_ptr& data) - : data_(data) {} - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - SET_MEMORY_INFO_NAME(X509CertificateTransferData) - SET_SELF_SIZE(X509CertificateTransferData) - SET_NO_MEMORY_INFO() - - private: - std::shared_ptr data_; - }; - - BaseObject::TransferMode GetTransferMode() const override; - std::unique_ptr CloneForMessaging() const override; - - private: - X509Certificate( - Environment* env, - v8::Local object, - std::shared_ptr cert, - STACK_OF(X509)* issuer_chain = nullptr); - - std::shared_ptr cert_; - BaseObjectPtr issuer_cert_; -}; - -} // namespace crypto -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_CRYPTO_CRYPTO_X509_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/debug_utils-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/debug_utils-inl.h deleted file mode 100644 index d87dd62c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/debug_utils-inl.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef SRC_DEBUG_UTILS_INL_H_ -#define SRC_DEBUG_UTILS_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "debug_utils.h" -#include "env.h" - -#include - -namespace node { - -struct ToStringHelper { - template - static std::string Convert( - const T& value, - std::string(T::* to_string)() const = &T::ToString) { - return (value.*to_string)(); - } - template ::value, bool>::type, - typename dummy = bool> - static std::string Convert(const T& value) { return std::to_string(value); } - static std::string Convert(const char* value) { - return value != nullptr ? value : "(null)"; - } - static std::string Convert(const std::string& value) { return value; } - static std::string Convert(bool value) { return value ? "true" : "false"; } - template ::value, int>::type = 0> - static std::string BaseConvert(const T& value) { - auto v = static_cast(value); - char ret[3 * sizeof(T)]; - char* ptr = ret + 3 * sizeof(T) - 1; - *ptr = '\0'; - const char* digits = "0123456789abcdef"; - do { - unsigned digit = v & ((1 << BASE_BITS) - 1); - *--ptr = - (BASE_BITS < 4 ? static_cast('0' + digit) : digits[digit]); - } while ((v >>= BASE_BITS) != 0); - return ptr; - } - template ::value, int>::type = 0> - static std::string BaseConvert(T value) { - return Convert(std::forward(value)); - } -}; - -template -std::string ToString(const T& value) { - return ToStringHelper::Convert(value); -} - -template -std::string ToBaseString(const T& value) { - return ToStringHelper::BaseConvert(value); -} - -inline std::string SPrintFImpl(const char* format) { - const char* p = strchr(format, '%'); - if (LIKELY(p == nullptr)) return format; - CHECK_EQ(p[1], '%'); // Only '%%' allowed when there are no arguments. - - return std::string(format, p + 1) + SPrintFImpl(p + 2); -} - -template -std::string COLD_NOINLINE SPrintFImpl( // NOLINT(runtime/string) - const char* format, Arg&& arg, Args&&... args) { - const char* p = strchr(format, '%'); - CHECK_NOT_NULL(p); // If you hit this, you passed in too many arguments. - std::string ret(format, p); - // Ignore long / size_t modifiers - while (strchr("lz", *++p) != nullptr) {} - switch (*p) { - case '%': { - return ret + '%' + SPrintFImpl(p + 1, - std::forward(arg), - std::forward(args)...); - } - default: { - return ret + '%' + SPrintFImpl(p, - std::forward(arg), - std::forward(args)...); - } - case 'd': - case 'i': - case 'u': - case 's': - ret += ToString(arg); - break; - case 'o': - ret += ToBaseString<3>(arg); - break; - case 'x': - ret += ToBaseString<4>(arg); - break; - case 'X': - ret += node::ToUpper(ToBaseString<4>(arg)); - break; - case 'p': { - CHECK(std::is_pointer::type>::value); - char out[20]; - int n = snprintf(out, - sizeof(out), - "%p", - *reinterpret_cast(&arg)); - CHECK_GE(n, 0); - ret += out; - break; - } - } - return ret + SPrintFImpl(p + 1, std::forward(args)...); -} - -template -std::string COLD_NOINLINE SPrintF( // NOLINT(runtime/string) - const char* format, Args&&... args) { - return SPrintFImpl(format, std::forward(args)...); -} - -template -void COLD_NOINLINE FPrintF(FILE* file, const char* format, Args&&... args) { - FWrite(file, SPrintF(format, std::forward(args)...)); -} - -template -inline void FORCE_INLINE Debug(EnabledDebugList* list, - DebugCategory cat, - const char* format, - Args&&... args) { - if (!UNLIKELY(list->enabled(cat))) return; - FPrintF(stderr, format, std::forward(args)...); -} - -inline void FORCE_INLINE Debug(EnabledDebugList* list, - DebugCategory cat, - const char* message) { - if (!UNLIKELY(list->enabled(cat))) return; - FPrintF(stderr, "%s", message); -} - -template -inline void FORCE_INLINE -Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args) { - Debug(env->enabled_debug_list(), cat, format, std::forward(args)...); -} - -inline void FORCE_INLINE Debug(Environment* env, - DebugCategory cat, - const char* message) { - Debug(env->enabled_debug_list(), cat, message); -} - -template -inline void Debug(Environment* env, - DebugCategory cat, - const std::string& format, - Args&&... args) { - Debug(env->enabled_debug_list(), - cat, - format.c_str(), - std::forward(args)...); -} - -// Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that -// the FORCE_INLINE flag on them doesn't apply to the contents of this function -// as well. -// We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing -// this function for speed and it should rather focus on keeping it out of -// hot code paths. In particular, we want to keep the string concatenating code -// out of the function containing the original `Debug()` call. -template -void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap, - const char* format, - Args&&... args) { - Debug(async_wrap->env(), - static_cast(async_wrap->provider_type()), - async_wrap->diagnostic_name() + " " + format + "\n", - std::forward(args)...); -} - -template -inline void FORCE_INLINE Debug(AsyncWrap* async_wrap, - const char* format, - Args&&... args) { - DCHECK_NOT_NULL(async_wrap); - DebugCategory cat = static_cast(async_wrap->provider_type()); - if (!UNLIKELY(async_wrap->env()->enabled_debug_list()->enabled(cat))) return; - UnconditionalAsyncWrapDebug(async_wrap, format, std::forward(args)...); -} - -template -inline void FORCE_INLINE Debug(AsyncWrap* async_wrap, - const std::string& format, - Args&&... args) { - Debug(async_wrap, format.c_str(), std::forward(args)...); -} - -namespace per_process { - -template -inline void FORCE_INLINE Debug(DebugCategory cat, - const char* format, - Args&&... args) { - Debug(&enabled_debug_list, cat, format, std::forward(args)...); -} - -inline void FORCE_INLINE Debug(DebugCategory cat, const char* message) { - Debug(&enabled_debug_list, cat, message); -} - -} // namespace per_process -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_DEBUG_UTILS_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/debug_utils.h b/repo/packages/s/scriptx-legacy/include/libnode/debug_utils.h deleted file mode 100644 index 37749335..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/debug_utils.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef SRC_DEBUG_UTILS_H_ -#define SRC_DEBUG_UTILS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" - -#include -#include -#include - -// Use FORCE_INLINE on functions that have a debug-category-enabled check first -// and then ideally only a single function call following it, to maintain -// performance for the common case (no debugging used). -#ifdef __GNUC__ -#define FORCE_INLINE __attribute__((always_inline)) -#define COLD_NOINLINE __attribute__((cold, noinline)) -#else -#define FORCE_INLINE -#define COLD_NOINLINE -#endif - -namespace node { -class Environment; - -template -inline std::string ToString(const T& value); - -// C++-style variant of sprintf()/fprintf() that: -// - Returns an std::string -// - Handles \0 bytes correctly -// - Supports %p and %s. %d, %i and %u are aliases for %s. -// - Accepts any class that has a ToString() method for stringification. -template -inline std::string SPrintF(const char* format, Args&&... args); -template -inline void FPrintF(FILE* file, const char* format, Args&&... args); -void FWrite(FILE* file, const std::string& str); - -// Listing the AsyncWrap provider types first enables us to cast directly -// from a provider type to a debug category. -#define DEBUG_CATEGORY_NAMES(V) \ - NODE_ASYNC_PROVIDER_TYPES(V) \ - V(DIAGNOSTICS) \ - V(HUGEPAGES) \ - V(INSPECTOR_SERVER) \ - V(INSPECTOR_PROFILER) \ - V(CODE_CACHE) \ - V(NGTCP2_DEBUG) \ - V(WASI) \ - V(MKSNAPSHOT) - -enum class DebugCategory { -#define V(name) name, - DEBUG_CATEGORY_NAMES(V) -#undef V - CATEGORY_COUNT -}; - -class EnabledDebugList { - public: - bool enabled(DebugCategory category) const { - DCHECK_GE(static_cast(category), 0); - DCHECK_LT(static_cast(category), - static_cast(DebugCategory::CATEGORY_COUNT)); - return enabled_[static_cast(category)]; - } - - // Uses NODE_DEBUG_NATIVE to initialize the categories. When env is not a - // nullptr, the environment variables set in the Environment are used. - // Otherwise the system environment variables are used. - void Parse(Environment* env); - - private: - // Set all categories matching cats to the value of enabled. - void Parse(const std::string& cats, bool enabled); - void set_enabled(DebugCategory category, bool enabled) { - DCHECK_GE(static_cast(category), 0); - DCHECK_LT(static_cast(category), - static_cast(DebugCategory::CATEGORY_COUNT)); - enabled_[static_cast(category)] = true; - } - - bool enabled_[static_cast(DebugCategory::CATEGORY_COUNT)] = {false}; -}; - -template -inline void FORCE_INLINE Debug(EnabledDebugList* list, - DebugCategory cat, - const char* format, - Args&&... args); - -inline void FORCE_INLINE Debug(EnabledDebugList* list, - DebugCategory cat, - const char* message); - -template -inline void FORCE_INLINE -Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args); - -inline void FORCE_INLINE Debug(Environment* env, - DebugCategory cat, - const char* message); - -template -inline void Debug(Environment* env, - DebugCategory cat, - const std::string& format, - Args&&... args); - -// Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that -// the FORCE_INLINE flag on them doesn't apply to the contents of this function -// as well. -// We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing -// this function for speed and it should rather focus on keeping it out of -// hot code paths. In particular, we want to keep the string concatenating code -// out of the function containing the original `Debug()` call. -template -void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap, - const char* format, - Args&&... args); - -template -inline void FORCE_INLINE Debug(AsyncWrap* async_wrap, - const char* format, - Args&&... args); - -template -inline void FORCE_INLINE Debug(AsyncWrap* async_wrap, - const std::string& format, - Args&&... args); - -// Debug helper for inspecting the currently running `node` executable. -class NativeSymbolDebuggingContext { - public: - static std::unique_ptr New(); - - class SymbolInfo { - public: - std::string name; - std::string filename; - size_t line = 0; - size_t dis = 0; - - std::string Display() const; - }; - - NativeSymbolDebuggingContext() = default; - virtual ~NativeSymbolDebuggingContext() = default; - - virtual SymbolInfo LookupSymbol(void* address) { return {}; } - virtual bool IsMapped(void* address) { return false; } - virtual int GetStackTrace(void** frames, int count) { return 0; } - - NativeSymbolDebuggingContext(const NativeSymbolDebuggingContext&) = delete; - NativeSymbolDebuggingContext(NativeSymbolDebuggingContext&&) = delete; - NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&) - = delete; - NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&&) - = delete; - static std::vector GetLoadedLibraries(); -}; - -// Variant of `uv_loop_close` that tries to be as helpful as possible -// about giving information on currently existing handles, if there are any, -// but still aborts the process. -void CheckedUvLoopClose(uv_loop_t* loop); -void PrintLibuvHandleInformation(uv_loop_t* loop, FILE* stream); - -namespace per_process { -extern EnabledDebugList enabled_debug_list; - -template -inline void FORCE_INLINE Debug(DebugCategory cat, - const char* format, - Args&&... args); - -inline void FORCE_INLINE Debug(DebugCategory cat, const char* message); -} // namespace per_process -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_DEBUG_UTILS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/diagnosticfilename-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/diagnosticfilename-inl.h deleted file mode 100644 index a0d44fd5..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/diagnosticfilename-inl.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SRC_DIAGNOSTICFILENAME_INL_H_ -#define SRC_DIAGNOSTICFILENAME_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_internals.h" -namespace node { - -class Environment; - -inline DiagnosticFilename::DiagnosticFilename( - Environment* env, - const char* prefix, - const char* ext) : - filename_(MakeFilename(env->thread_id(), prefix, ext)) { -} - -inline DiagnosticFilename::DiagnosticFilename( - uint64_t thread_id, - const char* prefix, - const char* ext) : - filename_(MakeFilename(thread_id, prefix, ext)) { -} - -inline const char* DiagnosticFilename::operator*() const { - return filename_.c_str(); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_DIAGNOSTICFILENAME_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/env-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/env-inl.h deleted file mode 100644 index 4a34393c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/env-inl.h +++ /dev/null @@ -1,1297 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_ENV_INL_H_ -#define SRC_ENV_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" -#include "allocated_buffer-inl.h" -#include "callback_queue-inl.h" -#include "env.h" -#include "node.h" -#include "node_context_data.h" -#include "node_perf_common.h" -#include "util-inl.h" -#include "uv.h" -#include "v8-fast-api-calls.h" -#include "v8.h" - -#include -#include - -#include - -namespace node { - -inline v8::Isolate* IsolateData::isolate() const { - return isolate_; -} - -inline uv_loop_t* IsolateData::event_loop() const { - return event_loop_; -} - -inline NodeArrayBufferAllocator* IsolateData::node_allocator() const { - return node_allocator_; -} - -inline MultiIsolatePlatform* IsolateData::platform() const { - return platform_; -} - -inline void IsolateData::set_worker_context(worker::Worker* context) { - CHECK_NULL(worker_context_); // Should be set only once. - worker_context_ = context; -} - -inline worker::Worker* IsolateData::worker_context() const { - return worker_context_; -} - -inline v8::Local IsolateData::async_wrap_provider(int index) const { - return async_wrap_providers_[index].Get(isolate_); -} - -inline AliasedUint32Array& AsyncHooks::fields() { - return fields_; -} - -inline AliasedFloat64Array& AsyncHooks::async_id_fields() { - return async_id_fields_; -} - -inline AliasedFloat64Array& AsyncHooks::async_ids_stack() { - return async_ids_stack_; -} - -v8::Local AsyncHooks::js_execution_async_resources() { - if (UNLIKELY(js_execution_async_resources_.IsEmpty())) { - js_execution_async_resources_.Reset( - env()->isolate(), v8::Array::New(env()->isolate())); - } - return PersistentToLocal::Strong(js_execution_async_resources_); -} - -v8::Local AsyncHooks::native_execution_async_resource(size_t i) { - if (i >= native_execution_async_resources_.size()) return {}; - return native_execution_async_resources_[i]; -} - -inline void AsyncHooks::SetJSPromiseHooks(v8::Local init, - v8::Local before, - v8::Local after, - v8::Local resolve) { - js_promise_hooks_[0].Reset(env()->isolate(), init); - js_promise_hooks_[1].Reset(env()->isolate(), before); - js_promise_hooks_[2].Reset(env()->isolate(), after); - js_promise_hooks_[3].Reset(env()->isolate(), resolve); - for (auto it = contexts_.begin(); it != contexts_.end(); it++) { - if (it->IsEmpty()) { - it = contexts_.erase(it); - it--; - continue; - } - PersistentToLocal::Weak(env()->isolate(), *it) - ->SetPromiseHooks(init, before, after, resolve); - } -} - -inline v8::Local AsyncHooks::provider_string(int idx) { - return env()->isolate_data()->async_wrap_provider(idx); -} - -inline void AsyncHooks::no_force_checks() { - fields_[kCheck] -= 1; -} - -inline Environment* AsyncHooks::env() { - return Environment::ForAsyncHooks(this); -} - -// Remember to keep this code aligned with pushAsyncContext() in JS. -inline void AsyncHooks::push_async_context(double async_id, - double trigger_async_id, - v8::Local resource) { - // Since async_hooks is experimental, do only perform the check - // when async_hooks is enabled. - if (fields_[kCheck] > 0) { - CHECK_GE(async_id, -1); - CHECK_GE(trigger_async_id, -1); - } - - uint32_t offset = fields_[kStackLength]; - if (offset * 2 >= async_ids_stack_.Length()) - grow_async_ids_stack(); - async_ids_stack_[2 * offset] = async_id_fields_[kExecutionAsyncId]; - async_ids_stack_[2 * offset + 1] = async_id_fields_[kTriggerAsyncId]; - fields_[kStackLength] += 1; - async_id_fields_[kExecutionAsyncId] = async_id; - async_id_fields_[kTriggerAsyncId] = trigger_async_id; - -#ifdef DEBUG - for (uint32_t i = offset; i < native_execution_async_resources_.size(); i++) - CHECK(native_execution_async_resources_[i].IsEmpty()); -#endif - - // When this call comes from JS (as a way of increasing the stack size), - // `resource` will be empty, because JS caches these values anyway. - if (!resource.IsEmpty()) { - native_execution_async_resources_.resize(offset + 1); - // Caveat: This is a v8::Local<> assignment, we do not keep a v8::Global<>! - native_execution_async_resources_[offset] = resource; - } -} - -// Remember to keep this code aligned with popAsyncContext() in JS. -inline bool AsyncHooks::pop_async_context(double async_id) { - // In case of an exception then this may have already been reset, if the - // stack was multiple MakeCallback()'s deep. - if (UNLIKELY(fields_[kStackLength] == 0)) return false; - - // Ask for the async_id to be restored as a check that the stack - // hasn't been corrupted. - // Since async_hooks is experimental, do only perform the check - // when async_hooks is enabled. - if (UNLIKELY(fields_[kCheck] > 0 && - async_id_fields_[kExecutionAsyncId] != async_id)) { - FailWithCorruptedAsyncStack(async_id); - } - - uint32_t offset = fields_[kStackLength] - 1; - async_id_fields_[kExecutionAsyncId] = async_ids_stack_[2 * offset]; - async_id_fields_[kTriggerAsyncId] = async_ids_stack_[2 * offset + 1]; - fields_[kStackLength] = offset; - - if (LIKELY(offset < native_execution_async_resources_.size() && - !native_execution_async_resources_[offset].IsEmpty())) { -#ifdef DEBUG - for (uint32_t i = offset + 1; - i < native_execution_async_resources_.size(); - i++) { - CHECK(native_execution_async_resources_[i].IsEmpty()); - } -#endif - native_execution_async_resources_.resize(offset); - if (native_execution_async_resources_.size() < - native_execution_async_resources_.capacity() / 2 && - native_execution_async_resources_.size() > 16) { - native_execution_async_resources_.shrink_to_fit(); - } - } - - if (UNLIKELY(js_execution_async_resources()->Length() > offset)) { - v8::HandleScope handle_scope(env()->isolate()); - USE(js_execution_async_resources()->Set( - env()->context(), - env()->length_string(), - v8::Integer::NewFromUnsigned(env()->isolate(), offset))); - } - - return fields_[kStackLength] > 0; -} - -void AsyncHooks::clear_async_id_stack() { - v8::Isolate* isolate = env()->isolate(); - v8::HandleScope handle_scope(isolate); - if (!js_execution_async_resources_.IsEmpty()) { - USE(PersistentToLocal::Strong(js_execution_async_resources_)->Set( - env()->context(), - env()->length_string(), - v8::Integer::NewFromUnsigned(isolate, 0))); - } - native_execution_async_resources_.clear(); - native_execution_async_resources_.shrink_to_fit(); - - async_id_fields_[kExecutionAsyncId] = 0; - async_id_fields_[kTriggerAsyncId] = 0; - fields_[kStackLength] = 0; -} - -inline void AsyncHooks::AddContext(v8::Local ctx) { - ctx->SetPromiseHooks( - js_promise_hooks_[0].IsEmpty() ? - v8::Local() : - PersistentToLocal::Strong(js_promise_hooks_[0]), - js_promise_hooks_[1].IsEmpty() ? - v8::Local() : - PersistentToLocal::Strong(js_promise_hooks_[1]), - js_promise_hooks_[2].IsEmpty() ? - v8::Local() : - PersistentToLocal::Strong(js_promise_hooks_[2]), - js_promise_hooks_[3].IsEmpty() ? - v8::Local() : - PersistentToLocal::Strong(js_promise_hooks_[3])); - - size_t id = contexts_.size(); - contexts_.resize(id + 1); - contexts_[id].Reset(env()->isolate(), ctx); - contexts_[id].SetWeak(); -} - -inline void AsyncHooks::RemoveContext(v8::Local ctx) { - v8::Isolate* isolate = env()->isolate(); - v8::HandleScope handle_scope(isolate); - for (auto it = contexts_.begin(); it != contexts_.end(); it++) { - if (it->IsEmpty()) { - it = contexts_.erase(it); - it--; - continue; - } - v8::Local saved_context = - PersistentToLocal::Weak(isolate, *it); - if (saved_context == ctx) { - it->Reset(); - contexts_.erase(it); - break; - } - } -} - -// The DefaultTriggerAsyncIdScope(AsyncWrap*) constructor is defined in -// async_wrap-inl.h to avoid a circular dependency. - -inline AsyncHooks::DefaultTriggerAsyncIdScope ::DefaultTriggerAsyncIdScope( - Environment* env, double default_trigger_async_id) - : async_hooks_(env->async_hooks()) { - if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) { - CHECK_GE(default_trigger_async_id, 0); - } - - old_default_trigger_async_id_ = - async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId]; - async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] = - default_trigger_async_id; -} - -inline AsyncHooks::DefaultTriggerAsyncIdScope ::~DefaultTriggerAsyncIdScope() { - async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] = - old_default_trigger_async_id_; -} - -Environment* Environment::ForAsyncHooks(AsyncHooks* hooks) { - return ContainerOf(&Environment::async_hooks_, hooks); -} - -inline size_t Environment::async_callback_scope_depth() const { - return async_callback_scope_depth_; -} - -inline void Environment::PushAsyncCallbackScope() { - async_callback_scope_depth_++; -} - -inline void Environment::PopAsyncCallbackScope() { - async_callback_scope_depth_--; -} - -inline AliasedUint32Array& ImmediateInfo::fields() { - return fields_; -} - -inline uint32_t ImmediateInfo::count() const { - return fields_[kCount]; -} - -inline uint32_t ImmediateInfo::ref_count() const { - return fields_[kRefCount]; -} - -inline bool ImmediateInfo::has_outstanding() const { - return fields_[kHasOutstanding] == 1; -} - -inline void ImmediateInfo::ref_count_inc(uint32_t increment) { - fields_[kRefCount] += increment; -} - -inline void ImmediateInfo::ref_count_dec(uint32_t decrement) { - fields_[kRefCount] -= decrement; -} - -inline AliasedUint8Array& TickInfo::fields() { - return fields_; -} - -inline bool TickInfo::has_tick_scheduled() const { - return fields_[kHasTickScheduled] == 1; -} - -inline bool TickInfo::has_rejection_to_warn() const { - return fields_[kHasRejectionToWarn] == 1; -} - -inline void Environment::AssignToContext(v8::Local context, - const ContextInfo& info) { - context->SetAlignedPointerInEmbedderData( - ContextEmbedderIndex::kEnvironment, this); - // Used by Environment::GetCurrent to know that we are on a node context. - context->SetAlignedPointerInEmbedderData( - ContextEmbedderIndex::kContextTag, Environment::kNodeContextTagPtr); - // Used to retrieve bindings - context->SetAlignedPointerInEmbedderData( - ContextEmbedderIndex::kBindingListIndex, &(this->bindings_)); - -#if HAVE_INSPECTOR - inspector_agent()->ContextCreated(context, info); -#endif // HAVE_INSPECTOR - - this->async_hooks()->AddContext(context); -} - -inline Environment* Environment::GetCurrent(v8::Isolate* isolate) { - if (UNLIKELY(!isolate->InContext())) return nullptr; - v8::HandleScope handle_scope(isolate); - return GetCurrent(isolate->GetCurrentContext()); -} - -inline Environment* Environment::GetCurrent(v8::Local context) { - if (UNLIKELY(context.IsEmpty())) { - return nullptr; - } - if (UNLIKELY(context->GetNumberOfEmbedderDataFields() <= - ContextEmbedderIndex::kContextTag)) { - return nullptr; - } - if (UNLIKELY(context->GetAlignedPointerFromEmbedderData( - ContextEmbedderIndex::kContextTag) != - Environment::kNodeContextTagPtr)) { - return nullptr; - } - return static_cast( - context->GetAlignedPointerFromEmbedderData( - ContextEmbedderIndex::kEnvironment)); -} - -inline Environment* Environment::GetCurrent( - const v8::FunctionCallbackInfo& info) { - return GetCurrent(info.GetIsolate()->GetCurrentContext()); -} - -template -inline Environment* Environment::GetCurrent( - const v8::PropertyCallbackInfo& info) { - return GetCurrent(info.GetIsolate()->GetCurrentContext()); -} - -template -inline T* Environment::GetBindingData(const v8::PropertyCallbackInfo& info) { - return GetBindingData(info.GetIsolate()->GetCurrentContext()); -} - -template -inline T* Environment::GetBindingData( - const v8::FunctionCallbackInfo& info) { - return GetBindingData(info.GetIsolate()->GetCurrentContext()); -} - -template -inline T* Environment::GetBindingData(v8::Local context) { - BindingDataStore* map = static_cast( - context->GetAlignedPointerFromEmbedderData( - ContextEmbedderIndex::kBindingListIndex)); - DCHECK_NOT_NULL(map); - auto it = map->find(T::type_name); - if (UNLIKELY(it == map->end())) return nullptr; - T* result = static_cast(it->second.get()); - DCHECK_NOT_NULL(result); - DCHECK_EQ(result->env(), GetCurrent(context)); - return result; -} - -template -inline T* Environment::AddBindingData( - v8::Local context, - v8::Local target) { - DCHECK_EQ(GetCurrent(context), this); - // This won't compile if T is not a BaseObject subclass. - BaseObjectPtr item = MakeDetachedBaseObject(this, target); - BindingDataStore* map = static_cast( - context->GetAlignedPointerFromEmbedderData( - ContextEmbedderIndex::kBindingListIndex)); - DCHECK_NOT_NULL(map); - auto result = map->emplace(T::type_name, item); - CHECK(result.second); - DCHECK_EQ(GetBindingData(context), item.get()); - return item.get(); -} - -inline v8::Isolate* Environment::isolate() const { - return isolate_; -} - -inline Environment* Environment::from_timer_handle(uv_timer_t* handle) { - return ContainerOf(&Environment::timer_handle_, handle); -} - -inline uv_timer_t* Environment::timer_handle() { - return &timer_handle_; -} - -inline Environment* Environment::from_immediate_check_handle( - uv_check_t* handle) { - return ContainerOf(&Environment::immediate_check_handle_, handle); -} - -inline uv_check_t* Environment::immediate_check_handle() { - return &immediate_check_handle_; -} - -inline uv_idle_t* Environment::immediate_idle_handle() { - return &immediate_idle_handle_; -} - -inline void Environment::RegisterHandleCleanup(uv_handle_t* handle, - HandleCleanupCb cb, - void* arg) { - handle_cleanup_queue_.push_back(HandleCleanup{handle, cb, arg}); -} - -template -inline void Environment::CloseHandle(T* handle, OnCloseCallback callback) { - handle_cleanup_waiting_++; - static_assert(sizeof(T) >= sizeof(uv_handle_t), "T is a libuv handle"); - static_assert(offsetof(T, data) == offsetof(uv_handle_t, data), - "T is a libuv handle"); - static_assert(offsetof(T, close_cb) == offsetof(uv_handle_t, close_cb), - "T is a libuv handle"); - struct CloseData { - Environment* env; - OnCloseCallback callback; - void* original_data; - }; - handle->data = new CloseData { this, callback, handle->data }; - uv_close(reinterpret_cast(handle), [](uv_handle_t* handle) { - std::unique_ptr data { static_cast(handle->data) }; - data->env->handle_cleanup_waiting_--; - handle->data = data->original_data; - data->callback(reinterpret_cast(handle)); - }); -} - -void Environment::IncreaseWaitingRequestCounter() { - request_waiting_++; -} - -void Environment::DecreaseWaitingRequestCounter() { - request_waiting_--; - CHECK_GE(request_waiting_, 0); -} - -inline uv_loop_t* Environment::event_loop() const { - return isolate_data()->event_loop(); -} - -inline void Environment::TryLoadAddon( - const char* filename, - int flags, - const std::function& was_loaded) { - loaded_addons_.emplace_back(filename, flags); - if (!was_loaded(&loaded_addons_.back())) { - loaded_addons_.pop_back(); - } -} - -#if HAVE_INSPECTOR -inline bool Environment::is_in_inspector_console_call() const { - return is_in_inspector_console_call_; -} - -inline void Environment::set_is_in_inspector_console_call(bool value) { - is_in_inspector_console_call_ = value; -} -#endif - -inline AsyncHooks* Environment::async_hooks() { - return &async_hooks_; -} - -inline ImmediateInfo* Environment::immediate_info() { - return &immediate_info_; -} - -inline TickInfo* Environment::tick_info() { - return &tick_info_; -} - -inline uint64_t Environment::timer_base() const { - return timer_base_; -} - -inline std::shared_ptr Environment::env_vars() { - return env_vars_; -} - -inline void Environment::set_env_vars(std::shared_ptr env_vars) { - env_vars_ = env_vars; -} - -inline bool Environment::printed_error() const { - return printed_error_; -} - -inline void Environment::set_printed_error(bool value) { - printed_error_ = value; -} - -inline void Environment::set_trace_sync_io(bool value) { - trace_sync_io_ = value; -} - -inline bool Environment::abort_on_uncaught_exception() const { - return options_->abort_on_uncaught_exception; -} - -inline void Environment::set_force_context_aware(bool value) { - options_->force_context_aware = value; -} - -inline bool Environment::force_context_aware() const { - return options_->force_context_aware; -} - -inline void Environment::set_abort_on_uncaught_exception(bool value) { - options_->abort_on_uncaught_exception = value; -} - -inline AliasedUint32Array& Environment::should_abort_on_uncaught_toggle() { - return should_abort_on_uncaught_toggle_; -} - -inline AliasedInt32Array& Environment::stream_base_state() { - return stream_base_state_; -} - -inline uint32_t Environment::get_next_module_id() { - return module_id_counter_++; -} -inline uint32_t Environment::get_next_script_id() { - return script_id_counter_++; -} -inline uint32_t Environment::get_next_function_id() { - return function_id_counter_++; -} - -ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope( - Environment* env) - : env_(env) { - env_->PushShouldNotAbortOnUncaughtScope(); -} - -ShouldNotAbortOnUncaughtScope::~ShouldNotAbortOnUncaughtScope() { - Close(); -} - -void ShouldNotAbortOnUncaughtScope::Close() { - if (env_ != nullptr) { - env_->PopShouldNotAbortOnUncaughtScope(); - env_ = nullptr; - } -} - -inline void Environment::PushShouldNotAbortOnUncaughtScope() { - should_not_abort_scope_counter_++; -} - -inline void Environment::PopShouldNotAbortOnUncaughtScope() { - should_not_abort_scope_counter_--; -} - -inline bool Environment::inside_should_not_abort_on_uncaught_scope() const { - return should_not_abort_scope_counter_ > 0; -} - -inline std::vector* Environment::destroy_async_id_list() { - return &destroy_async_id_list_; -} - -inline double Environment::new_async_id() { - async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter] += 1; - return async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter]; -} - -inline double Environment::execution_async_id() { - return async_hooks()->async_id_fields()[AsyncHooks::kExecutionAsyncId]; -} - -inline double Environment::trigger_async_id() { - return async_hooks()->async_id_fields()[AsyncHooks::kTriggerAsyncId]; -} - -inline double Environment::get_default_trigger_async_id() { - double default_trigger_async_id = - async_hooks()->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId]; - // If defaultTriggerAsyncId isn't set, use the executionAsyncId - if (default_trigger_async_id < 0) - default_trigger_async_id = execution_async_id(); - return default_trigger_async_id; -} - -inline std::shared_ptr Environment::options() { - return options_; -} - -inline const std::vector& Environment::argv() { - return argv_; -} - -inline const std::vector& Environment::exec_argv() { - return exec_argv_; -} - -inline const std::string& Environment::exec_path() const { - return exec_path_; -} - -inline std::string Environment::GetCwd() { - char cwd[PATH_MAX_BYTES]; - size_t size = PATH_MAX_BYTES; - const int err = uv_cwd(cwd, &size); - - if (err == 0) { - CHECK_GT(size, 0); - return cwd; - } - - // This can fail if the cwd is deleted. In that case, fall back to - // exec_path. - const std::string& exec_path = exec_path_; - return exec_path.substr(0, exec_path.find_last_of(kPathSeparator)); -} - -#if HAVE_INSPECTOR -inline void Environment::set_coverage_directory(const char* dir) { - coverage_directory_ = std::string(dir); -} - -inline void Environment::set_coverage_connection( - std::unique_ptr connection) { - CHECK_NULL(coverage_connection_); - std::swap(coverage_connection_, connection); -} - -inline profiler::V8CoverageConnection* Environment::coverage_connection() { - return coverage_connection_.get(); -} - -inline const std::string& Environment::coverage_directory() const { - return coverage_directory_; -} - -inline void Environment::set_cpu_profiler_connection( - std::unique_ptr connection) { - CHECK_NULL(cpu_profiler_connection_); - std::swap(cpu_profiler_connection_, connection); -} - -inline profiler::V8CpuProfilerConnection* -Environment::cpu_profiler_connection() { - return cpu_profiler_connection_.get(); -} - -inline void Environment::set_cpu_prof_interval(uint64_t interval) { - cpu_prof_interval_ = interval; -} - -inline uint64_t Environment::cpu_prof_interval() const { - return cpu_prof_interval_; -} - -inline void Environment::set_cpu_prof_name(const std::string& name) { - cpu_prof_name_ = name; -} - -inline const std::string& Environment::cpu_prof_name() const { - return cpu_prof_name_; -} - -inline void Environment::set_cpu_prof_dir(const std::string& dir) { - cpu_prof_dir_ = dir; -} - -inline const std::string& Environment::cpu_prof_dir() const { - return cpu_prof_dir_; -} - -inline void Environment::set_heap_profiler_connection( - std::unique_ptr connection) { - CHECK_NULL(heap_profiler_connection_); - std::swap(heap_profiler_connection_, connection); -} - -inline profiler::V8HeapProfilerConnection* -Environment::heap_profiler_connection() { - return heap_profiler_connection_.get(); -} - -inline void Environment::set_heap_prof_name(const std::string& name) { - heap_prof_name_ = name; -} - -inline const std::string& Environment::heap_prof_name() const { - return heap_prof_name_; -} - -inline void Environment::set_heap_prof_dir(const std::string& dir) { - heap_prof_dir_ = dir; -} - -inline const std::string& Environment::heap_prof_dir() const { - return heap_prof_dir_; -} - -inline void Environment::set_heap_prof_interval(uint64_t interval) { - heap_prof_interval_ = interval; -} - -inline uint64_t Environment::heap_prof_interval() const { - return heap_prof_interval_; -} - -#endif // HAVE_INSPECTOR - -inline -std::shared_ptr> Environment::inspector_host_port() { - return inspector_host_port_; -} - -inline std::shared_ptr IsolateData::options() { - return options_; -} - -inline void IsolateData::set_options( - std::shared_ptr options) { - options_ = std::move(options); -} - -template -void Environment::SetImmediate(Fn&& cb, CallbackFlags::Flags flags) { - auto callback = native_immediates_.CreateCallback(std::move(cb), flags); - native_immediates_.Push(std::move(callback)); - - if (flags & CallbackFlags::kRefed) { - if (immediate_info()->ref_count() == 0) - ToggleImmediateRef(true); - immediate_info()->ref_count_inc(1); - } -} - -template -void Environment::SetImmediateThreadsafe(Fn&& cb, CallbackFlags::Flags flags) { - auto callback = native_immediates_threadsafe_.CreateCallback( - std::move(cb), flags); - { - Mutex::ScopedLock lock(native_immediates_threadsafe_mutex_); - native_immediates_threadsafe_.Push(std::move(callback)); - if (task_queues_async_initialized_) - uv_async_send(&task_queues_async_); - } -} - -template -void Environment::RequestInterrupt(Fn&& cb) { - auto callback = native_immediates_interrupts_.CreateCallback( - std::move(cb), CallbackFlags::kRefed); - { - Mutex::ScopedLock lock(native_immediates_threadsafe_mutex_); - native_immediates_interrupts_.Push(std::move(callback)); - if (task_queues_async_initialized_) - uv_async_send(&task_queues_async_); - } - RequestInterruptFromV8(); -} - -inline bool Environment::can_call_into_js() const { - return can_call_into_js_ && !is_stopping(); -} - -inline void Environment::set_can_call_into_js(bool can_call_into_js) { - can_call_into_js_ = can_call_into_js; -} - -inline bool Environment::has_run_bootstrapping_code() const { - return has_run_bootstrapping_code_; -} - -inline void Environment::DoneBootstrapping() { - has_run_bootstrapping_code_ = true; - // This adjusts the return value of base_object_created_after_bootstrap() so - // that tests that check the count do not have to account for internally - // created BaseObjects. - base_object_created_by_bootstrap_ = base_object_count_; -} - -inline bool Environment::has_serialized_options() const { - return has_serialized_options_; -} - -inline void Environment::set_has_serialized_options(bool value) { - has_serialized_options_ = value; -} - -inline bool Environment::is_main_thread() const { - return worker_context() == nullptr; -} - -inline bool Environment::no_native_addons() const { - return (flags_ & EnvironmentFlags::kNoNativeAddons) || - !options_->allow_native_addons; -} - -inline bool Environment::should_not_register_esm_loader() const { - return flags_ & EnvironmentFlags::kNoRegisterESMLoader; -} - -inline bool Environment::owns_process_state() const { - return flags_ & EnvironmentFlags::kOwnsProcessState; -} - -inline bool Environment::owns_inspector() const { - return flags_ & EnvironmentFlags::kOwnsInspector; -} - -inline bool Environment::should_create_inspector() const { - return (flags_ & EnvironmentFlags::kNoCreateInspector) == 0; -} - -inline bool Environment::tracks_unmanaged_fds() const { - return flags_ & EnvironmentFlags::kTrackUnmanagedFds; -} - -inline bool Environment::hide_console_windows() const { - return flags_ & EnvironmentFlags::kHideConsoleWindows; -} - -inline bool Environment::no_global_search_paths() const { - return (flags_ & EnvironmentFlags::kNoGlobalSearchPaths) || - !options_->global_search_paths; -} - -bool Environment::filehandle_close_warning() const { - return emit_filehandle_warning_; -} - -void Environment::set_filehandle_close_warning(bool on) { - emit_filehandle_warning_ = on; -} - -void Environment::set_source_maps_enabled(bool on) { - source_maps_enabled_ = on; -} - -bool Environment::source_maps_enabled() const { - return source_maps_enabled_; -} - -inline uint64_t Environment::thread_id() const { - return thread_id_; -} - -inline worker::Worker* Environment::worker_context() const { - return isolate_data()->worker_context(); -} - -inline void Environment::add_sub_worker_context(worker::Worker* context) { - sub_worker_contexts_.insert(context); -} - -inline void Environment::remove_sub_worker_context(worker::Worker* context) { - sub_worker_contexts_.erase(context); -} - -template -inline void Environment::ForEachWorker(Fn&& iterator) { - for (worker::Worker* w : sub_worker_contexts_) iterator(w); -} - -inline void Environment::add_refs(int64_t diff) { - task_queues_async_refs_ += diff; - CHECK_GE(task_queues_async_refs_, 0); - if (task_queues_async_refs_ == 0) - uv_unref(reinterpret_cast(&task_queues_async_)); - else - uv_ref(reinterpret_cast(&task_queues_async_)); -} - -inline bool Environment::is_stopping() const { - return is_stopping_.load(); -} - -inline void Environment::set_stopping(bool value) { - is_stopping_.store(value); -} - -inline std::list* Environment::extra_linked_bindings() { - return &extra_linked_bindings_; -} - -inline node_module* Environment::extra_linked_bindings_head() { - return extra_linked_bindings_.size() > 0 ? - &extra_linked_bindings_.front() : nullptr; -} - -inline node_module* Environment::extra_linked_bindings_tail() { - return extra_linked_bindings_.size() > 0 ? - &extra_linked_bindings_.back() : nullptr; -} - -inline const Mutex& Environment::extra_linked_bindings_mutex() const { - return extra_linked_bindings_mutex_; -} - -inline performance::PerformanceState* Environment::performance_state() { - return performance_state_.get(); -} - -inline IsolateData* Environment::isolate_data() const { - return isolate_data_; -} - -inline uv_buf_t Environment::allocate_managed_buffer( - const size_t suggested_size) { - NoArrayBufferZeroFillScope no_zero_fill_scope(isolate_data()); - std::unique_ptr bs = - v8::ArrayBuffer::NewBackingStore(isolate(), suggested_size); - uv_buf_t buf = uv_buf_init(static_cast(bs->Data()), bs->ByteLength()); - released_allocated_buffers()->emplace(buf.base, std::move(bs)); - return buf; -} - -inline std::unique_ptr Environment::release_managed_buffer( - const uv_buf_t& buf) { - std::unique_ptr bs; - if (buf.base != nullptr) { - auto map = released_allocated_buffers(); - auto it = map->find(buf.base); - CHECK_NE(it, map->end()); - bs = std::move(it->second); - map->erase(it); - } - return bs; -} - -std::unordered_map>* - Environment::released_allocated_buffers() { - return &released_allocated_buffers_; -} - -inline void Environment::ThrowError(const char* errmsg) { - ThrowError(v8::Exception::Error, errmsg); -} - -inline void Environment::ThrowTypeError(const char* errmsg) { - ThrowError(v8::Exception::TypeError, errmsg); -} - -inline void Environment::ThrowRangeError(const char* errmsg) { - ThrowError(v8::Exception::RangeError, errmsg); -} - -inline void Environment::ThrowError( - v8::Local (*fun)(v8::Local), - const char* errmsg) { - v8::HandleScope handle_scope(isolate()); - isolate()->ThrowException(fun(OneByteString(isolate(), errmsg))); -} - -inline void Environment::ThrowErrnoException(int errorno, - const char* syscall, - const char* message, - const char* path) { - isolate()->ThrowException( - ErrnoException(isolate(), errorno, syscall, message, path)); -} - -inline void Environment::ThrowUVException(int errorno, - const char* syscall, - const char* message, - const char* path, - const char* dest) { - isolate()->ThrowException( - UVException(isolate(), errorno, syscall, message, path, dest)); -} - -inline v8::Local Environment::NewFunctionTemplate( - v8::FunctionCallback callback, - v8::Local signature, - v8::ConstructorBehavior behavior, - v8::SideEffectType side_effect_type, - const v8::CFunction* c_function) { - return v8::FunctionTemplate::New(isolate(), - callback, - v8::Local(), - signature, - 0, - behavior, - side_effect_type, - c_function); -} - -inline void Environment::SetMethod(v8::Local that, - const char* name, - v8::FunctionCallback callback) { - v8::Local context = isolate()->GetCurrentContext(); - v8::Local function = - NewFunctionTemplate(callback, v8::Local(), - v8::ConstructorBehavior::kThrow, - v8::SideEffectType::kHasSideEffect) - ->GetFunction(context) - .ToLocalChecked(); - // kInternalized strings are created in the old space. - const v8::NewStringType type = v8::NewStringType::kInternalized; - v8::Local name_string = - v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked(); - that->Set(context, name_string, function).Check(); - function->SetName(name_string); // NODE_SET_METHOD() compatibility. -} - -inline void Environment::SetFastMethod(v8::Local that, - const char* name, - v8::FunctionCallback slow_callback, - const v8::CFunction* c_function) { - v8::Local context = isolate()->GetCurrentContext(); - v8::Local function = - NewFunctionTemplate(slow_callback, - v8::Local(), - v8::ConstructorBehavior::kThrow, - v8::SideEffectType::kHasNoSideEffect, - c_function) - ->GetFunction(context) - .ToLocalChecked(); - const v8::NewStringType type = v8::NewStringType::kInternalized; - v8::Local name_string = - v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked(); - that->Set(context, name_string, function).Check(); -} - -inline void Environment::SetMethodNoSideEffect(v8::Local that, - const char* name, - v8::FunctionCallback callback) { - v8::Local context = isolate()->GetCurrentContext(); - v8::Local function = - NewFunctionTemplate(callback, v8::Local(), - v8::ConstructorBehavior::kThrow, - v8::SideEffectType::kHasNoSideEffect) - ->GetFunction(context) - .ToLocalChecked(); - // kInternalized strings are created in the old space. - const v8::NewStringType type = v8::NewStringType::kInternalized; - v8::Local name_string = - v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked(); - that->Set(context, name_string, function).Check(); - function->SetName(name_string); // NODE_SET_METHOD() compatibility. -} - -inline void Environment::SetProtoMethod(v8::Local that, - const char* name, - v8::FunctionCallback callback) { - v8::Local signature = v8::Signature::New(isolate(), that); - v8::Local t = - NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow, - v8::SideEffectType::kHasSideEffect); - // kInternalized strings are created in the old space. - const v8::NewStringType type = v8::NewStringType::kInternalized; - v8::Local name_string = - v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked(); - that->PrototypeTemplate()->Set(name_string, t); - t->SetClassName(name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility. -} - -inline void Environment::SetProtoMethodNoSideEffect( - v8::Local that, - const char* name, - v8::FunctionCallback callback) { - v8::Local signature = v8::Signature::New(isolate(), that); - v8::Local t = - NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow, - v8::SideEffectType::kHasNoSideEffect); - // kInternalized strings are created in the old space. - const v8::NewStringType type = v8::NewStringType::kInternalized; - v8::Local name_string = - v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked(); - that->PrototypeTemplate()->Set(name_string, t); - t->SetClassName(name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility. -} - -inline void Environment::SetInstanceMethod(v8::Local that, - const char* name, - v8::FunctionCallback callback) { - v8::Local signature = v8::Signature::New(isolate(), that); - v8::Local t = - NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow, - v8::SideEffectType::kHasSideEffect); - // kInternalized strings are created in the old space. - const v8::NewStringType type = v8::NewStringType::kInternalized; - v8::Local name_string = - v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked(); - that->InstanceTemplate()->Set(name_string, t); - t->SetClassName(name_string); -} - -inline void Environment::SetConstructorFunction( - v8::Local that, - const char* name, - v8::Local tmpl, - SetConstructorFunctionFlag flag) { - SetConstructorFunction(that, OneByteString(isolate(), name), tmpl, flag); -} - -inline void Environment::SetConstructorFunction( - v8::Local that, - v8::Local name, - v8::Local tmpl, - SetConstructorFunctionFlag flag) { - if (LIKELY(flag == SetConstructorFunctionFlag::SET_CLASS_NAME)) - tmpl->SetClassName(name); - that->Set( - context(), - name, - tmpl->GetFunction(context()).ToLocalChecked()).Check(); -} - -void Environment::AddCleanupHook(CleanupCallback fn, void* arg) { - auto insertion_info = cleanup_hooks_.emplace(CleanupHookCallback { - fn, arg, cleanup_hook_counter_++ - }); - // Make sure there was no existing element with these values. - CHECK_EQ(insertion_info.second, true); -} - -void Environment::RemoveCleanupHook(CleanupCallback fn, void* arg) { - CleanupHookCallback search { fn, arg, 0 }; - cleanup_hooks_.erase(search); -} - -size_t CleanupHookCallback::Hash::operator()( - const CleanupHookCallback& cb) const { - return std::hash()(cb.arg_); -} - -bool CleanupHookCallback::Equal::operator()( - const CleanupHookCallback& a, const CleanupHookCallback& b) const { - return a.fn_ == b.fn_ && a.arg_ == b.arg_; -} - -BaseObject* CleanupHookCallback::GetBaseObject() const { - if (fn_ == BaseObject::DeleteMe) - return static_cast(arg_); - else - return nullptr; -} - -template -void Environment::ForEachBaseObject(T&& iterator) { - for (const auto& hook : cleanup_hooks_) { - BaseObject* obj = hook.GetBaseObject(); - if (obj != nullptr) - iterator(obj); - } -} - -template -void Environment::ForEachBindingData(T&& iterator) { - BindingDataStore* map = static_cast( - context()->GetAlignedPointerFromEmbedderData( - ContextEmbedderIndex::kBindingListIndex)); - DCHECK_NOT_NULL(map); - for (auto& it : *map) { - iterator(it.first, it.second); - } -} - -void Environment::modify_base_object_count(int64_t delta) { - base_object_count_ += delta; -} - -int64_t Environment::base_object_created_after_bootstrap() const { - return base_object_count_ - base_object_created_by_bootstrap_; -} - -int64_t Environment::base_object_count() const { - return base_object_count_; -} - -void Environment::set_main_utf16(std::unique_ptr str) { - CHECK(!main_utf16_); - main_utf16_ = std::move(str); -} - -void Environment::set_process_exit_handler( - std::function&& handler) { - process_exit_handler_ = std::move(handler); -} - -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) -#define V(TypeName, PropertyName) \ - inline \ - v8::Local IsolateData::PropertyName() const { \ - return PropertyName ## _ .Get(isolate_); \ - } - PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) - PER_ISOLATE_SYMBOL_PROPERTIES(VY) - PER_ISOLATE_STRING_PROPERTIES(VS) -#undef V -#undef VS -#undef VY -#undef VP - -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) -#define V(TypeName, PropertyName) \ - inline v8::Local Environment::PropertyName() const { \ - return isolate_data()->PropertyName(); \ - } - PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) - PER_ISOLATE_SYMBOL_PROPERTIES(VY) - PER_ISOLATE_STRING_PROPERTIES(VS) -#undef V -#undef VS -#undef VY -#undef VP - -#define V(PropertyName, TypeName) \ - inline v8::Local Environment::PropertyName() const { \ - return PersistentToLocal::Strong(PropertyName ## _); \ - } \ - inline void Environment::set_ ## PropertyName(v8::Local value) { \ - PropertyName ## _.Reset(isolate(), value); \ - } - ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) - ENVIRONMENT_STRONG_PERSISTENT_VALUES(V) -#undef V - -v8::Local Environment::context() const { - return PersistentToLocal::Strong(context_); -} - -} // namespace node - -// These two files depend on each other. Including base_object-inl.h after this -// file is the easiest way to avoid issues with that circular dependency. -#include "base_object-inl.h" - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ENV_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/env.h b/repo/packages/s/scriptx-legacy/include/libnode/env.h deleted file mode 100644 index cda7a52f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/env.h +++ /dev/null @@ -1,1644 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_ENV_H_ -#define SRC_ENV_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" -#if HAVE_INSPECTOR -#include "inspector_agent.h" -#include "inspector_profiler.h" -#endif -#include "callback_queue.h" -#include "debug_utils.h" -#include "handle_wrap.h" -#include "node.h" -#include "node_binding.h" -#include "node_external_reference.h" -#include "node_main_instance.h" -#include "node_options.h" -#include "node_perf_common.h" -#include "node_snapshotable.h" -#include "req_wrap.h" -#include "util.h" -#include "uv.h" -#include "v8.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace node { - -namespace contextify { -class ContextifyScript; -class CompiledFnEntry; -} - -namespace performance { -class PerformanceState; -} - -namespace tracing { -class AgentWriterHandle; -} - -#if HAVE_INSPECTOR -namespace profiler { -class V8CoverageConnection; -class V8CpuProfilerConnection; -class V8HeapProfilerConnection; -} // namespace profiler - -namespace inspector { -class ParentInspectorHandle; -} -#endif // HAVE_INSPECTOR - -namespace worker { -class Worker; -} - -namespace loader { -class ModuleWrap; - -struct PackageConfig { - enum class Exists { Yes, No }; - enum class IsValid { Yes, No }; - enum class HasMain { Yes, No }; - enum class HasName { Yes, No }; - enum PackageType : uint32_t { None = 0, CommonJS, Module }; - - const Exists exists; - const IsValid is_valid; - const HasMain has_main; - const std::string main; - const HasName has_name; - const std::string name; - const PackageType type; - - v8::Global exports; -}; -} // namespace loader - -enum class FsStatsOffset { - kDev = 0, - kMode, - kNlink, - kUid, - kGid, - kRdev, - kBlkSize, - kIno, - kSize, - kBlocks, - kATimeSec, - kATimeNsec, - kMTimeSec, - kMTimeNsec, - kCTimeSec, - kCTimeNsec, - kBirthTimeSec, - kBirthTimeNsec, - kFsStatsFieldsNumber -}; - -// Stat fields buffers contain twice the number of entries in an uv_stat_t -// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances. -constexpr size_t kFsStatsBufferLength = - static_cast(FsStatsOffset::kFsStatsFieldsNumber) * 2; - -// PER_ISOLATE_* macros: We have a lot of per-isolate properties -// and adding and maintaining their getters and setters by hand would be -// difficult so let's make the preprocessor generate them for us. -// -// In each macro, `V` is expected to be the name of a macro or function which -// accepts the number of arguments provided in each tuple in the macro body, -// typically two. The named function will be invoked against each tuple. -// -// Make sure that any macro V defined for use with the PER_ISOLATE_* macros is -// undefined again after use. - -// Private symbols are per-isolate primitives but Environment proxies them -// for the sake of convenience. Strings should be ASCII-only and have a -// "node:" prefix to avoid name clashes with third-party code. -#define PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V) \ - V(alpn_buffer_private_symbol, "node:alpnBuffer") \ - V(arrow_message_private_symbol, "node:arrowMessage") \ - V(contextify_context_private_symbol, "node:contextify:context") \ - V(contextify_global_private_symbol, "node:contextify:global") \ - V(decorated_private_symbol, "node:decorated") \ - V(napi_type_tag, "node:napi:type_tag") \ - V(napi_wrapper, "node:napi:wrapper") \ - V(untransferable_object_private_symbol, "node:untransferableObject") \ - -// Symbols are per-isolate primitives but Environment proxies them -// for the sake of convenience. -#define PER_ISOLATE_SYMBOL_PROPERTIES(V) \ - V(async_id_symbol, "async_id_symbol") \ - V(handle_onclose_symbol, "handle_onclose") \ - V(no_message_symbol, "no_message_symbol") \ - V(messaging_deserialize_symbol, "messaging_deserialize_symbol") \ - V(messaging_transfer_symbol, "messaging_transfer_symbol") \ - V(messaging_clone_symbol, "messaging_clone_symbol") \ - V(messaging_transfer_list_symbol, "messaging_transfer_list_symbol") \ - V(oninit_symbol, "oninit") \ - V(owner_symbol, "owner_symbol") \ - V(onpskexchange_symbol, "onpskexchange") \ - V(resource_symbol, "resource_symbol") \ - V(trigger_async_id_symbol, "trigger_async_id_symbol") \ - -// Strings are per-isolate primitives but Environment proxies them -// for the sake of convenience. Strings should be ASCII-only. -#define PER_ISOLATE_STRING_PROPERTIES(V) \ - V(ack_string, "ack") \ - V(address_string, "address") \ - V(aliases_string, "aliases") \ - V(args_string, "args") \ - V(asn1curve_string, "asn1Curve") \ - V(async_ids_stack_string, "async_ids_stack") \ - V(bits_string, "bits") \ - V(block_list_string, "blockList") \ - V(buffer_string, "buffer") \ - V(bytes_parsed_string, "bytesParsed") \ - V(bytes_read_string, "bytesRead") \ - V(bytes_written_string, "bytesWritten") \ - V(cached_data_produced_string, "cachedDataProduced") \ - V(cached_data_rejected_string, "cachedDataRejected") \ - V(cached_data_string, "cachedData") \ - V(cache_key_string, "cacheKey") \ - V(change_string, "change") \ - V(channel_string, "channel") \ - V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \ - V(clone_unsupported_type_str, "Cannot transfer object of unsupported type.") \ - V(code_string, "code") \ - V(commonjs_string, "commonjs") \ - V(config_string, "config") \ - V(constants_string, "constants") \ - V(crypto_dh_string, "dh") \ - V(crypto_dsa_string, "dsa") \ - V(crypto_ec_string, "ec") \ - V(crypto_ed25519_string, "ed25519") \ - V(crypto_ed448_string, "ed448") \ - V(crypto_x25519_string, "x25519") \ - V(crypto_x448_string, "x448") \ - V(crypto_rsa_string, "rsa") \ - V(crypto_rsa_pss_string, "rsa-pss") \ - V(cwd_string, "cwd") \ - V(data_string, "data") \ - V(default_is_true_string, "defaultIsTrue") \ - V(deserialize_info_string, "deserializeInfo") \ - V(dest_string, "dest") \ - V(destroyed_string, "destroyed") \ - V(detached_string, "detached") \ - V(dh_string, "DH") \ - V(divisor_length_string, "divisorLength") \ - V(dns_a_string, "A") \ - V(dns_aaaa_string, "AAAA") \ - V(dns_caa_string, "CAA") \ - V(dns_critical_string, "critical") \ - V(dns_cname_string, "CNAME") \ - V(dns_mx_string, "MX") \ - V(dns_naptr_string, "NAPTR") \ - V(dns_ns_string, "NS") \ - V(dns_ptr_string, "PTR") \ - V(dns_soa_string, "SOA") \ - V(dns_srv_string, "SRV") \ - V(dns_txt_string, "TXT") \ - V(done_string, "done") \ - V(duration_string, "duration") \ - V(ecdh_string, "ECDH") \ - V(emit_string, "emit") \ - V(emit_warning_string, "emitWarning") \ - V(empty_object_string, "{}") \ - V(encoding_string, "encoding") \ - V(entries_string, "entries") \ - V(entry_type_string, "entryType") \ - V(env_pairs_string, "envPairs") \ - V(env_var_settings_string, "envVarSettings") \ - V(errno_string, "errno") \ - V(error_string, "error") \ - V(exchange_string, "exchange") \ - V(exit_code_string, "exitCode") \ - V(expire_string, "expire") \ - V(exponent_string, "exponent") \ - V(exports_string, "exports") \ - V(ext_key_usage_string, "ext_key_usage") \ - V(external_stream_string, "_externalStream") \ - V(family_string, "family") \ - V(fatal_exception_string, "_fatalException") \ - V(fd_string, "fd") \ - V(fields_string, "fields") \ - V(file_string, "file") \ - V(filename_string, "filename") \ - V(fingerprint256_string, "fingerprint256") \ - V(fingerprint512_string, "fingerprint512") \ - V(fingerprint_string, "fingerprint") \ - V(flags_string, "flags") \ - V(flowlabel_string, "flowlabel") \ - V(fragment_string, "fragment") \ - V(frames_received_string, "framesReceived") \ - V(frames_sent_string, "framesSent") \ - V(function_string, "function") \ - V(get_data_clone_error_string, "_getDataCloneError") \ - V(get_shared_array_buffer_id_string, "_getSharedArrayBufferId") \ - V(gid_string, "gid") \ - V(h2_string, "h2") \ - V(handle_string, "handle") \ - V(hash_algorithm_string, "hashAlgorithm") \ - V(help_text_string, "helpText") \ - V(homedir_string, "homedir") \ - V(host_string, "host") \ - V(hostmaster_string, "hostmaster") \ - V(http_1_1_string, "http/1.1") \ - V(id_string, "id") \ - V(identity_string, "identity") \ - V(ignore_string, "ignore") \ - V(infoaccess_string, "infoAccess") \ - V(inherit_string, "inherit") \ - V(input_string, "input") \ - V(internal_binding_string, "internalBinding") \ - V(internal_string, "internal") \ - V(ipv4_string, "IPv4") \ - V(ipv6_string, "IPv6") \ - V(isclosing_string, "isClosing") \ - V(issuer_string, "issuer") \ - V(issuercert_string, "issuerCertificate") \ - V(jwk_crv_string, "crv") \ - V(jwk_d_string, "d") \ - V(jwk_dp_string, "dp") \ - V(jwk_dq_string, "dq") \ - V(jwk_dsa_string, "DSA") \ - V(jwk_e_string, "e") \ - V(jwk_ec_string, "EC") \ - V(jwk_g_string, "g") \ - V(jwk_k_string, "k") \ - V(jwk_p_string, "p") \ - V(jwk_q_string, "q") \ - V(jwk_qi_string, "qi") \ - V(jwk_kty_string, "kty") \ - V(jwk_n_string, "n") \ - V(jwk_oct_string, "oct") \ - V(jwk_okp_string, "OKP") \ - V(jwk_rsa_string, "RSA") \ - V(jwk_x_string, "x") \ - V(jwk_y_string, "y") \ - V(kill_signal_string, "killSignal") \ - V(kind_string, "kind") \ - V(length_string, "length") \ - V(library_string, "library") \ - V(mac_string, "mac") \ - V(max_buffer_string, "maxBuffer") \ - V(max_concurrent_streams_string, "maxConcurrentStreams") \ - V(message_port_constructor_string, "MessagePort") \ - V(message_port_string, "messagePort") \ - V(message_string, "message") \ - V(messageerror_string, "messageerror") \ - V(mgf1_hash_algorithm_string, "mgf1HashAlgorithm") \ - V(minttl_string, "minttl") \ - V(module_string, "module") \ - V(modulus_string, "modulus") \ - V(modulus_length_string, "modulusLength") \ - V(name_string, "name") \ - V(named_curve_string, "namedCurve") \ - V(netmask_string, "netmask") \ - V(next_string, "next") \ - V(nistcurve_string, "nistCurve") \ - V(node_string, "node") \ - V(nsname_string, "nsname") \ - V(ocsp_request_string, "OCSPRequest") \ - V(oncertcb_string, "oncertcb") \ - V(onchange_string, "onchange") \ - V(onclienthello_string, "onclienthello") \ - V(oncomplete_string, "oncomplete") \ - V(onconnection_string, "onconnection") \ - V(ondone_string, "ondone") \ - V(onerror_string, "onerror") \ - V(onexit_string, "onexit") \ - V(onhandshakedone_string, "onhandshakedone") \ - V(onhandshakestart_string, "onhandshakestart") \ - V(onkeylog_string, "onkeylog") \ - V(onmessage_string, "onmessage") \ - V(onnewsession_string, "onnewsession") \ - V(onocspresponse_string, "onocspresponse") \ - V(onreadstart_string, "onreadstart") \ - V(onreadstop_string, "onreadstop") \ - V(onshutdown_string, "onshutdown") \ - V(onsignal_string, "onsignal") \ - V(onunpipe_string, "onunpipe") \ - V(onwrite_string, "onwrite") \ - V(openssl_error_stack, "opensslErrorStack") \ - V(options_string, "options") \ - V(order_string, "order") \ - V(output_string, "output") \ - V(overlapped_string, "overlapped") \ - V(parse_error_string, "Parse Error") \ - V(password_string, "password") \ - V(path_string, "path") \ - V(pending_handle_string, "pendingHandle") \ - V(pid_string, "pid") \ - V(ping_rtt_string, "pingRTT") \ - V(pipe_source_string, "pipeSource") \ - V(pipe_string, "pipe") \ - V(pipe_target_string, "pipeTarget") \ - V(port1_string, "port1") \ - V(port2_string, "port2") \ - V(port_string, "port") \ - V(preference_string, "preference") \ - V(primordials_string, "primordials") \ - V(priority_string, "priority") \ - V(process_string, "process") \ - V(promise_string, "promise") \ - V(psk_string, "psk") \ - V(pubkey_string, "pubkey") \ - V(public_exponent_string, "publicExponent") \ - V(query_string, "query") \ - V(rate_string, "rate") \ - V(raw_string, "raw") \ - V(read_host_object_string, "_readHostObject") \ - V(readable_string, "readable") \ - V(reason_string, "reason") \ - V(refresh_string, "refresh") \ - V(regexp_string, "regexp") \ - V(rename_string, "rename") \ - V(replacement_string, "replacement") \ - V(require_string, "require") \ - V(retry_string, "retry") \ - V(salt_length_string, "saltLength") \ - V(scheme_string, "scheme") \ - V(scopeid_string, "scopeid") \ - V(serial_number_string, "serialNumber") \ - V(serial_string, "serial") \ - V(servername_string, "servername") \ - V(service_string, "service") \ - V(session_id_string, "sessionId") \ - V(shell_string, "shell") \ - V(signal_string, "signal") \ - V(sink_string, "sink") \ - V(size_string, "size") \ - V(sni_context_err_string, "Invalid SNI context") \ - V(sni_context_string, "sni_context") \ - V(source_string, "source") \ - V(stack_string, "stack") \ - V(standard_name_string, "standardName") \ - V(start_time_string, "startTime") \ - V(state_string, "state") \ - V(stats_string, "stats") \ - V(status_string, "status") \ - V(stdio_string, "stdio") \ - V(stream_average_duration_string, "streamAverageDuration") \ - V(stream_count_string, "streamCount") \ - V(subject_string, "subject") \ - V(subjectaltname_string, "subjectaltname") \ - V(syscall_string, "syscall") \ - V(target_string, "target") \ - V(thread_id_string, "threadId") \ - V(ticketkeycallback_string, "onticketkeycallback") \ - V(timeout_string, "timeout") \ - V(time_to_first_byte_string, "timeToFirstByte") \ - V(time_to_first_byte_sent_string, "timeToFirstByteSent") \ - V(time_to_first_header_string, "timeToFirstHeader") \ - V(tls_ticket_string, "tlsTicket") \ - V(transfer_string, "transfer") \ - V(ttl_string, "ttl") \ - V(type_string, "type") \ - V(uid_string, "uid") \ - V(unknown_string, "") \ - V(url_special_ftp_string, "ftp:") \ - V(url_special_file_string, "file:") \ - V(url_special_http_string, "http:") \ - V(url_special_https_string, "https:") \ - V(url_special_ws_string, "ws:") \ - V(url_special_wss_string, "wss:") \ - V(url_string, "url") \ - V(username_string, "username") \ - V(valid_from_string, "valid_from") \ - V(valid_to_string, "valid_to") \ - V(value_string, "value") \ - V(verify_error_string, "verifyError") \ - V(version_string, "version") \ - V(weight_string, "weight") \ - V(windows_hide_string, "windowsHide") \ - V(windows_verbatim_arguments_string, "windowsVerbatimArguments") \ - V(wrap_string, "wrap") \ - V(writable_string, "writable") \ - V(write_host_object_string, "_writeHostObject") \ - V(write_queue_size_string, "writeQueueSize") \ - V(x_forwarded_string, "x-forwarded-for") \ - V(zero_return_string, "ZERO_RETURN") - -#define ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) \ - V(async_wrap_ctor_template, v8::FunctionTemplate) \ - V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ - V(base_object_ctor_template, v8::FunctionTemplate) \ - V(binding_data_ctor_template, v8::FunctionTemplate) \ - V(blob_constructor_template, v8::FunctionTemplate) \ - V(blocklist_constructor_template, v8::FunctionTemplate) \ - V(compiled_fn_entry_template, v8::ObjectTemplate) \ - V(dir_instance_template, v8::ObjectTemplate) \ - V(fd_constructor_template, v8::ObjectTemplate) \ - V(fdclose_constructor_template, v8::ObjectTemplate) \ - V(filehandlereadwrap_template, v8::ObjectTemplate) \ - V(fsreqpromise_constructor_template, v8::ObjectTemplate) \ - V(handle_wrap_ctor_template, v8::FunctionTemplate) \ - V(histogram_ctor_template, v8::FunctionTemplate) \ - V(http2settings_constructor_template, v8::ObjectTemplate) \ - V(http2stream_constructor_template, v8::ObjectTemplate) \ - V(http2ping_constructor_template, v8::ObjectTemplate) \ - V(i18n_converter_template, v8::ObjectTemplate) \ - V(intervalhistogram_constructor_template, v8::FunctionTemplate) \ - V(libuv_stream_wrap_ctor_template, v8::FunctionTemplate) \ - V(message_port_constructor_template, v8::FunctionTemplate) \ - V(microtask_queue_ctor_template, v8::FunctionTemplate) \ - V(pipe_constructor_template, v8::FunctionTemplate) \ - V(promise_wrap_template, v8::ObjectTemplate) \ - V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \ - V(script_context_constructor_template, v8::FunctionTemplate) \ - V(secure_context_constructor_template, v8::FunctionTemplate) \ - V(shutdown_wrap_template, v8::ObjectTemplate) \ - V(socketaddress_constructor_template, v8::FunctionTemplate) \ - V(streambaseoutputstream_constructor_template, v8::ObjectTemplate) \ - V(qlogoutputstream_constructor_template, v8::ObjectTemplate) \ - V(tcp_constructor_template, v8::FunctionTemplate) \ - V(tty_constructor_template, v8::FunctionTemplate) \ - V(write_wrap_template, v8::ObjectTemplate) \ - V(worker_heap_snapshot_taker_template, v8::ObjectTemplate) \ - V(x509_constructor_template, v8::FunctionTemplate) - -#define ENVIRONMENT_STRONG_PERSISTENT_VALUES(V) \ - V(async_hooks_after_function, v8::Function) \ - V(async_hooks_before_function, v8::Function) \ - V(async_hooks_callback_trampoline, v8::Function) \ - V(async_hooks_binding, v8::Object) \ - V(async_hooks_destroy_function, v8::Function) \ - V(async_hooks_init_function, v8::Function) \ - V(async_hooks_promise_resolve_function, v8::Function) \ - V(buffer_prototype_object, v8::Object) \ - V(crypto_key_object_constructor, v8::Function) \ - V(crypto_key_object_handle_constructor, v8::Function) \ - V(crypto_key_object_private_constructor, v8::Function) \ - V(crypto_key_object_public_constructor, v8::Function) \ - V(crypto_key_object_secret_constructor, v8::Function) \ - V(domexception_function, v8::Function) \ - V(enhance_fatal_stack_after_inspector, v8::Function) \ - V(enhance_fatal_stack_before_inspector, v8::Function) \ - V(fs_use_promises_symbol, v8::Symbol) \ - V(host_import_module_dynamically_callback, v8::Function) \ - V(host_initialize_import_meta_object_callback, v8::Function) \ - V(http2session_on_altsvc_function, v8::Function) \ - V(http2session_on_error_function, v8::Function) \ - V(http2session_on_frame_error_function, v8::Function) \ - V(http2session_on_goaway_data_function, v8::Function) \ - V(http2session_on_headers_function, v8::Function) \ - V(http2session_on_origin_function, v8::Function) \ - V(http2session_on_ping_function, v8::Function) \ - V(http2session_on_priority_function, v8::Function) \ - V(http2session_on_settings_function, v8::Function) \ - V(http2session_on_stream_close_function, v8::Function) \ - V(http2session_on_stream_trailers_function, v8::Function) \ - V(internal_binding_loader, v8::Function) \ - V(immediate_callback_function, v8::Function) \ - V(inspector_console_extension_installer, v8::Function) \ - V(inspector_disable_async_hooks, v8::Function) \ - V(inspector_enable_async_hooks, v8::Function) \ - V(messaging_deserialize_create_object, v8::Function) \ - V(message_port, v8::Object) \ - V(native_module_require, v8::Function) \ - V(performance_entry_callback, v8::Function) \ - V(performance_entry_template, v8::Function) \ - V(prepare_stack_trace_callback, v8::Function) \ - V(process_object, v8::Object) \ - V(primordials, v8::Object) \ - V(primordials_safe_map_prototype_object, v8::Object) \ - V(primordials_safe_set_prototype_object, v8::Object) \ - V(primordials_safe_weak_map_prototype_object, v8::Object) \ - V(primordials_safe_weak_set_prototype_object, v8::Object) \ - V(promise_hook_handler, v8::Function) \ - V(promise_reject_callback, v8::Function) \ - V(script_data_constructor_function, v8::Function) \ - V(source_map_cache_getter, v8::Function) \ - V(tick_callback_function, v8::Function) \ - V(timers_callback_function, v8::Function) \ - V(tls_wrap_constructor_function, v8::Function) \ - V(trace_category_state_function, v8::Function) \ - V(udp_constructor_function, v8::Function) \ - V(url_constructor_function, v8::Function) - -class Environment; -struct AllocatedBuffer; - -typedef size_t SnapshotIndex; -class IsolateData : public MemoryRetainer { - public: - IsolateData(v8::Isolate* isolate, - uv_loop_t* event_loop, - MultiIsolatePlatform* platform = nullptr, - ArrayBufferAllocator* node_allocator = nullptr, - const std::vector* indexes = nullptr); - SET_MEMORY_INFO_NAME(IsolateData) - SET_SELF_SIZE(IsolateData) - void MemoryInfo(MemoryTracker* tracker) const override; - std::vector Serialize(v8::SnapshotCreator* creator); - - inline uv_loop_t* event_loop() const; - inline MultiIsolatePlatform* platform() const; - inline std::shared_ptr options(); - inline void set_options(std::shared_ptr options); - - inline NodeArrayBufferAllocator* node_allocator() const; - - inline worker::Worker* worker_context() const; - inline void set_worker_context(worker::Worker* context); - -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) -#define V(TypeName, PropertyName) \ - inline v8::Local PropertyName() const; - PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) - PER_ISOLATE_SYMBOL_PROPERTIES(VY) - PER_ISOLATE_STRING_PROPERTIES(VS) -#undef V -#undef VY -#undef VS -#undef VP - inline v8::Local async_wrap_provider(int index) const; - - size_t max_young_gen_size = 1; - std::unordered_map> static_str_map; - - inline v8::Isolate* isolate() const; - IsolateData(const IsolateData&) = delete; - IsolateData& operator=(const IsolateData&) = delete; - IsolateData(IsolateData&&) = delete; - IsolateData& operator=(IsolateData&&) = delete; - - private: - void DeserializeProperties(const std::vector* indexes); - void CreateProperties(); - -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) -#define V(TypeName, PropertyName) \ - v8::Eternal PropertyName ## _; - PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) - PER_ISOLATE_SYMBOL_PROPERTIES(VY) - PER_ISOLATE_STRING_PROPERTIES(VS) -#undef V -#undef VY -#undef VS -#undef VP - // Keep a list of all Persistent strings used for AsyncWrap Provider types. - std::array, AsyncWrap::PROVIDERS_LENGTH> - async_wrap_providers_; - - v8::Isolate* const isolate_; - uv_loop_t* const event_loop_; - NodeArrayBufferAllocator* const node_allocator_; - MultiIsolatePlatform* platform_; - std::shared_ptr options_; - worker::Worker* worker_context_ = nullptr; -}; - -struct ContextInfo { - explicit ContextInfo(const std::string& name) : name(name) {} - const std::string name; - std::string origin; - bool is_default = false; -}; - -class EnabledDebugList; - -class KVStore { - public: - KVStore() = default; - virtual ~KVStore() = default; - KVStore(const KVStore&) = delete; - KVStore& operator=(const KVStore&) = delete; - KVStore(KVStore&&) = delete; - KVStore& operator=(KVStore&&) = delete; - - virtual v8::MaybeLocal Get(v8::Isolate* isolate, - v8::Local key) const = 0; - virtual v8::Maybe Get(const char* key) const = 0; - virtual void Set(v8::Isolate* isolate, - v8::Local key, - v8::Local value) = 0; - virtual int32_t Query(v8::Isolate* isolate, - v8::Local key) const = 0; - virtual int32_t Query(const char* key) const = 0; - virtual void Delete(v8::Isolate* isolate, v8::Local key) = 0; - virtual v8::Local Enumerate(v8::Isolate* isolate) const = 0; - - virtual std::shared_ptr Clone(v8::Isolate* isolate) const; - virtual v8::Maybe AssignFromObject(v8::Local context, - v8::Local entries); - - static std::shared_ptr CreateMapKVStore(); -}; - -namespace per_process { -extern std::shared_ptr system_environment; -} - -struct EnvSerializeInfo; - -class AsyncHooks : public MemoryRetainer { - public: - SET_MEMORY_INFO_NAME(AsyncHooks) - SET_SELF_SIZE(AsyncHooks) - void MemoryInfo(MemoryTracker* tracker) const override; - - // Reason for both UidFields and Fields are that one is stored as a double* - // and the other as a uint32_t*. - enum Fields { - kInit, - kBefore, - kAfter, - kDestroy, - kPromiseResolve, - kTotals, - kCheck, - kStackLength, - kUsesExecutionAsyncResource, - kFieldsCount, - }; - - enum UidFields { - kExecutionAsyncId, - kTriggerAsyncId, - kAsyncIdCounter, - kDefaultTriggerAsyncId, - kUidFieldsCount, - }; - - inline AliasedUint32Array& fields(); - inline AliasedFloat64Array& async_id_fields(); - inline AliasedFloat64Array& async_ids_stack(); - inline v8::Local js_execution_async_resources(); - // Returns the native executionAsyncResource value at stack index `index`. - // Resources provided on the JS side are not stored on the native stack, - // in which case an empty `Local<>` is returned. - // The `js_execution_async_resources` array contains the value in that case. - inline v8::Local native_execution_async_resource(size_t index); - - inline void SetJSPromiseHooks(v8::Local init, - v8::Local before, - v8::Local after, - v8::Local resolve); - - inline v8::Local provider_string(int idx); - - inline void no_force_checks(); - inline Environment* env(); - - // NB: This call does not take (co-)ownership of `execution_async_resource`. - // The lifetime of the `v8::Local<>` pointee must last until - // `pop_async_context()` or `clear_async_id_stack()` are called. - inline void push_async_context(double async_id, double trigger_async_id, - v8::Local execution_async_resource); - inline bool pop_async_context(double async_id); - inline void clear_async_id_stack(); // Used in fatal exceptions. - - inline void AddContext(v8::Local ctx); - inline void RemoveContext(v8::Local ctx); - - AsyncHooks(const AsyncHooks&) = delete; - AsyncHooks& operator=(const AsyncHooks&) = delete; - AsyncHooks(AsyncHooks&&) = delete; - AsyncHooks& operator=(AsyncHooks&&) = delete; - ~AsyncHooks() = default; - - // Used to set the kDefaultTriggerAsyncId in a scope. This is instead of - // passing the trigger_async_id along with other constructor arguments. - class DefaultTriggerAsyncIdScope { - public: - DefaultTriggerAsyncIdScope() = delete; - explicit DefaultTriggerAsyncIdScope(Environment* env, - double init_trigger_async_id); - explicit DefaultTriggerAsyncIdScope(AsyncWrap* async_wrap); - ~DefaultTriggerAsyncIdScope(); - - DefaultTriggerAsyncIdScope(const DefaultTriggerAsyncIdScope&) = delete; - DefaultTriggerAsyncIdScope& operator=(const DefaultTriggerAsyncIdScope&) = - delete; - DefaultTriggerAsyncIdScope(DefaultTriggerAsyncIdScope&&) = delete; - DefaultTriggerAsyncIdScope& operator=(DefaultTriggerAsyncIdScope&&) = - delete; - - private: - AsyncHooks* async_hooks_; - double old_default_trigger_async_id_; - }; - - struct SerializeInfo { - AliasedBufferIndex async_ids_stack; - AliasedBufferIndex fields; - AliasedBufferIndex async_id_fields; - SnapshotIndex js_execution_async_resources; - std::vector native_execution_async_resources; - }; - - SerializeInfo Serialize(v8::Local context, - v8::SnapshotCreator* creator); - void Deserialize(v8::Local context); - - private: - friend class Environment; // So we can call the constructor. - explicit AsyncHooks(v8::Isolate* isolate, const SerializeInfo* info); - - [[noreturn]] void FailWithCorruptedAsyncStack(double expected_async_id); - - // Stores the ids of the current execution context stack. - AliasedFloat64Array async_ids_stack_; - // Attached to a Uint32Array that tracks the number of active hooks for - // each type. - AliasedUint32Array fields_; - // Attached to a Float64Array that tracks the state of async resources. - AliasedFloat64Array async_id_fields_; - - void grow_async_ids_stack(); - - v8::Global js_execution_async_resources_; - std::vector> native_execution_async_resources_; - - // Non-empty during deserialization - const SerializeInfo* info_ = nullptr; - - std::vector> contexts_; - - std::array, 4> js_promise_hooks_; -}; - -class ImmediateInfo : public MemoryRetainer { - public: - inline AliasedUint32Array& fields(); - inline uint32_t count() const; - inline uint32_t ref_count() const; - inline bool has_outstanding() const; - inline void ref_count_inc(uint32_t increment); - inline void ref_count_dec(uint32_t decrement); - - ImmediateInfo(const ImmediateInfo&) = delete; - ImmediateInfo& operator=(const ImmediateInfo&) = delete; - ImmediateInfo(ImmediateInfo&&) = delete; - ImmediateInfo& operator=(ImmediateInfo&&) = delete; - ~ImmediateInfo() = default; - - SET_MEMORY_INFO_NAME(ImmediateInfo) - SET_SELF_SIZE(ImmediateInfo) - void MemoryInfo(MemoryTracker* tracker) const override; - - struct SerializeInfo { - AliasedBufferIndex fields; - }; - SerializeInfo Serialize(v8::Local context, - v8::SnapshotCreator* creator); - void Deserialize(v8::Local context); - - private: - friend class Environment; // So we can call the constructor. - explicit ImmediateInfo(v8::Isolate* isolate, const SerializeInfo* info); - - enum Fields { kCount, kRefCount, kHasOutstanding, kFieldsCount }; - - AliasedUint32Array fields_; -}; - -class TickInfo : public MemoryRetainer { - public: - inline AliasedUint8Array& fields(); - inline bool has_tick_scheduled() const; - inline bool has_rejection_to_warn() const; - - SET_MEMORY_INFO_NAME(TickInfo) - SET_SELF_SIZE(TickInfo) - void MemoryInfo(MemoryTracker* tracker) const override; - - TickInfo(const TickInfo&) = delete; - TickInfo& operator=(const TickInfo&) = delete; - TickInfo(TickInfo&&) = delete; - TickInfo& operator=(TickInfo&&) = delete; - ~TickInfo() = default; - - struct SerializeInfo { - AliasedBufferIndex fields; - }; - SerializeInfo Serialize(v8::Local context, - v8::SnapshotCreator* creator); - void Deserialize(v8::Local context); - - private: - friend class Environment; // So we can call the constructor. - explicit TickInfo(v8::Isolate* isolate, const SerializeInfo* info); - - enum Fields { kHasTickScheduled = 0, kHasRejectionToWarn, kFieldsCount }; - - AliasedUint8Array fields_; -}; - -class TrackingTraceStateObserver : - public v8::TracingController::TraceStateObserver { - public: - explicit TrackingTraceStateObserver(Environment* env) : env_(env) {} - - void OnTraceEnabled() override { - UpdateTraceCategoryState(); - } - - void OnTraceDisabled() override { - UpdateTraceCategoryState(); - } - - private: - void UpdateTraceCategoryState(); - - Environment* env_; -}; - -class ShouldNotAbortOnUncaughtScope { - public: - explicit inline ShouldNotAbortOnUncaughtScope(Environment* env); - inline void Close(); - inline ~ShouldNotAbortOnUncaughtScope(); - ShouldNotAbortOnUncaughtScope(const ShouldNotAbortOnUncaughtScope&) = delete; - ShouldNotAbortOnUncaughtScope& operator=( - const ShouldNotAbortOnUncaughtScope&) = delete; - ShouldNotAbortOnUncaughtScope(ShouldNotAbortOnUncaughtScope&&) = delete; - ShouldNotAbortOnUncaughtScope& operator=(ShouldNotAbortOnUncaughtScope&&) = - delete; - - private: - Environment* env_; -}; - -class CleanupHookCallback { - public: - typedef void (*Callback)(void*); - - CleanupHookCallback(Callback fn, - void* arg, - uint64_t insertion_order_counter) - : fn_(fn), arg_(arg), insertion_order_counter_(insertion_order_counter) {} - - // Only hashes `arg_`, since that is usually enough to identify the hook. - struct Hash { - inline size_t operator()(const CleanupHookCallback& cb) const; - }; - - // Compares by `fn_` and `arg_` being equal. - struct Equal { - inline bool operator()(const CleanupHookCallback& a, - const CleanupHookCallback& b) const; - }; - - inline BaseObject* GetBaseObject() const; - - private: - friend class Environment; - Callback fn_; - void* arg_; - - // We keep track of the insertion order for these objects, so that we can - // call the callbacks in reverse order when we are cleaning up. - uint64_t insertion_order_counter_; -}; - -struct PropInfo { - std::string name; // name for debugging - size_t id; // In the list - in case there are any empty entries - SnapshotIndex index; // In the snapshot -}; - -typedef void (*DeserializeRequestCallback)(v8::Local context, - v8::Local holder, - int index, - InternalFieldInfo* info); -struct DeserializeRequest { - DeserializeRequestCallback cb; - v8::Global holder; - int index; - InternalFieldInfo* info = nullptr; // Owned by the request - - // Move constructor - DeserializeRequest(DeserializeRequest&& other) = default; -}; - -struct EnvSerializeInfo { - std::vector bindings; - std::vector native_modules; - AsyncHooks::SerializeInfo async_hooks; - TickInfo::SerializeInfo tick_info; - ImmediateInfo::SerializeInfo immediate_info; - performance::PerformanceState::SerializeInfo performance_state; - AliasedBufferIndex stream_base_state; - AliasedBufferIndex should_abort_on_uncaught_toggle; - - std::vector persistent_templates; - std::vector persistent_values; - - SnapshotIndex context; - friend std::ostream& operator<<(std::ostream& o, const EnvSerializeInfo& i); -}; - -struct SnapshotData { - SnapshotData() { blob.data = nullptr; } - v8::StartupData blob; - std::vector isolate_data_indices; - EnvSerializeInfo env_info; -}; - -class Environment : public MemoryRetainer { - public: - Environment(const Environment&) = delete; - Environment& operator=(const Environment&) = delete; - Environment(Environment&&) = delete; - Environment& operator=(Environment&&) = delete; - - SET_MEMORY_INFO_NAME(Environment) - - inline size_t SelfSize() const override; - bool IsRootNode() const override { return true; } - void MemoryInfo(MemoryTracker* tracker) const override; - - EnvSerializeInfo Serialize(v8::SnapshotCreator* creator); - void CreateProperties(); - void DeserializeProperties(const EnvSerializeInfo* info); - - void PrintInfoForSnapshotIfDebug(); - void PrintAllBaseObjects(); - void VerifyNoStrongBaseObjects(); - void EnqueueDeserializeRequest(DeserializeRequestCallback cb, - v8::Local holder, - int index, - InternalFieldInfo* info); - void RunDeserializeRequests(); - // Should be called before InitializeInspector() - void InitializeDiagnostics(); - - std::string GetCwd(); - -#if HAVE_INSPECTOR - // If the environment is created for a worker, pass parent_handle and - // the ownership if transferred into the Environment. - int InitializeInspector( - std::unique_ptr parent_handle); -#endif - - v8::MaybeLocal BootstrapInternalLoaders(); - v8::MaybeLocal BootstrapNode(); - v8::MaybeLocal RunBootstrapping(); - - inline size_t async_callback_scope_depth() const; - inline void PushAsyncCallbackScope(); - inline void PopAsyncCallbackScope(); - - static inline Environment* GetCurrent(v8::Isolate* isolate); - static inline Environment* GetCurrent(v8::Local context); - static inline Environment* GetCurrent( - const v8::FunctionCallbackInfo& info); - - template - static inline Environment* GetCurrent( - const v8::PropertyCallbackInfo& info); - - // Methods created using SetMethod(), SetPrototypeMethod(), etc. inside - // this scope can access the created T* object using - // GetBindingData(args) later. - template - T* AddBindingData(v8::Local context, - v8::Local target); - template - static inline T* GetBindingData(const v8::PropertyCallbackInfo& info); - template - static inline T* GetBindingData( - const v8::FunctionCallbackInfo& info); - template - static inline T* GetBindingData(v8::Local context); - - typedef std::unordered_map< - FastStringKey, - BaseObjectPtr, - FastStringKey::Hash> BindingDataStore; - - // Create an Environment without initializing a main Context. Use - // InitializeMainContext() to initialize a main context for it. - Environment(IsolateData* isolate_data, - v8::Isolate* isolate, - const std::vector& args, - const std::vector& exec_args, - const EnvSerializeInfo* env_info, - EnvironmentFlags::Flags flags, - ThreadId thread_id); - void InitializeMainContext(v8::Local context, - const EnvSerializeInfo* env_info); - // Create an Environment and initialize the provided main context for it. - Environment(IsolateData* isolate_data, - v8::Local context, - const std::vector& args, - const std::vector& exec_args, - const EnvSerializeInfo* env_info, - EnvironmentFlags::Flags flags, - ThreadId thread_id); - ~Environment() override; - - void InitializeLibuv(); - inline const std::vector& exec_argv(); - inline const std::vector& argv(); - const std::string& exec_path() const; - - typedef void (*HandleCleanupCb)(Environment* env, - uv_handle_t* handle, - void* arg); - struct HandleCleanup { - uv_handle_t* handle_; - HandleCleanupCb cb_; - void* arg_; - }; - - void RegisterHandleCleanups(); - void CleanupHandles(); - void Exit(int code); - void ExitEnv(); - - // Register clean-up cb to be called on environment destruction. - inline void RegisterHandleCleanup(uv_handle_t* handle, - HandleCleanupCb cb, - void* arg); - - template - inline void CloseHandle(T* handle, OnCloseCallback callback); - - inline void AssignToContext(v8::Local context, - const ContextInfo& info); - - void StartProfilerIdleNotifier(); - - inline v8::Isolate* isolate() const; - inline uv_loop_t* event_loop() const; - inline void TryLoadAddon( - const char* filename, - int flags, - const std::function& was_loaded); - - static inline Environment* from_timer_handle(uv_timer_t* handle); - inline uv_timer_t* timer_handle(); - - static inline Environment* from_immediate_check_handle(uv_check_t* handle); - inline uv_check_t* immediate_check_handle(); - inline uv_idle_t* immediate_idle_handle(); - - inline void IncreaseWaitingRequestCounter(); - inline void DecreaseWaitingRequestCounter(); - - inline AsyncHooks* async_hooks(); - inline ImmediateInfo* immediate_info(); - inline TickInfo* tick_info(); - inline uint64_t timer_base() const; - inline std::shared_ptr env_vars(); - inline void set_env_vars(std::shared_ptr env_vars); - - inline IsolateData* isolate_data() const; - - inline bool printed_error() const; - inline void set_printed_error(bool value); - - void PrintSyncTrace() const; - inline void set_trace_sync_io(bool value); - - inline void set_force_context_aware(bool value); - inline bool force_context_aware() const; - - // This stores whether the --abort-on-uncaught-exception flag was passed - // to Node. - inline bool abort_on_uncaught_exception() const; - inline void set_abort_on_uncaught_exception(bool value); - // This is a pseudo-boolean that keeps track of whether an uncaught exception - // should abort the process or not if --abort-on-uncaught-exception was - // passed to Node. If the flag was not passed, it is ignored. - inline AliasedUint32Array& should_abort_on_uncaught_toggle(); - - inline AliasedInt32Array& stream_base_state(); - - // The necessary API for async_hooks. - inline double new_async_id(); - inline double execution_async_id(); - inline double trigger_async_id(); - inline double get_default_trigger_async_id(); - - // List of id's that have been destroyed and need the destroy() cb called. - inline std::vector* destroy_async_id_list(); - - std::set internal_bindings; - std::set native_modules_with_cache; - std::set native_modules_without_cache; - // This is only filled during deserialization. We use a vector since - // it's only used for tests. - std::vector native_modules_in_snapshot; - - std::unordered_multimap hash_to_module_map; - std::unordered_map id_to_module_map; - std::unordered_map - id_to_script_map; - std::unordered_map id_to_function_map; - - inline uint32_t get_next_module_id(); - inline uint32_t get_next_script_id(); - inline uint32_t get_next_function_id(); - - EnabledDebugList* enabled_debug_list() { return &enabled_debug_list_; } - - inline performance::PerformanceState* performance_state(); - - void CollectUVExceptionInfo(v8::Local context, - int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr, - const char* dest = nullptr); - - // If this flag is set, calls into JS (if they would be observable - // from userland) must be avoided. This flag does not indicate whether - // calling into JS is allowed from a VM perspective at this point. - inline bool can_call_into_js() const; - inline void set_can_call_into_js(bool can_call_into_js); - - // Increase or decrease a counter that manages whether this Environment - // keeps the event loop alive on its own or not. The counter starts out at 0, - // meaning it does not, and any positive value will make it keep the event - // loop alive. - // This is used by Workers to manage their own .ref()/.unref() implementation, - // as Workers aren't directly associated with their own libuv handles. - inline void add_refs(int64_t diff); - - inline bool has_run_bootstrapping_code() const; - inline void DoneBootstrapping(); - - inline bool has_serialized_options() const; - inline void set_has_serialized_options(bool has_serialized_options); - - inline bool is_main_thread() const; - inline bool no_native_addons() const; - inline bool should_not_register_esm_loader() const; - inline bool should_create_inspector() const; - inline bool owns_process_state() const; - inline bool owns_inspector() const; - inline bool tracks_unmanaged_fds() const; - inline bool hide_console_windows() const; - inline bool no_global_search_paths() const; - inline uint64_t thread_id() const; - inline worker::Worker* worker_context() const; - Environment* worker_parent_env() const; - inline void add_sub_worker_context(worker::Worker* context); - inline void remove_sub_worker_context(worker::Worker* context); - void stop_sub_worker_contexts(); - template - inline void ForEachWorker(Fn&& iterator); - inline bool is_stopping() const; - inline void set_stopping(bool value); - inline std::list* extra_linked_bindings(); - inline node_module* extra_linked_bindings_head(); - inline node_module* extra_linked_bindings_tail(); - inline const Mutex& extra_linked_bindings_mutex() const; - - inline bool filehandle_close_warning() const; - inline void set_filehandle_close_warning(bool on); - - inline void set_source_maps_enabled(bool on); - inline bool source_maps_enabled() const; - - inline void ThrowError(const char* errmsg); - inline void ThrowTypeError(const char* errmsg); - inline void ThrowRangeError(const char* errmsg); - inline void ThrowErrnoException(int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr); - inline void ThrowUVException(int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr, - const char* dest = nullptr); - - inline v8::Local NewFunctionTemplate( - v8::FunctionCallback callback, - v8::Local signature = v8::Local(), - v8::ConstructorBehavior behavior = v8::ConstructorBehavior::kAllow, - v8::SideEffectType side_effect = v8::SideEffectType::kHasSideEffect, - const v8::CFunction* c_function = nullptr); - - // Convenience methods for NewFunctionTemplate(). - inline void SetMethod(v8::Local that, - const char* name, - v8::FunctionCallback callback); - - inline void SetFastMethod(v8::Local that, - const char* name, - v8::FunctionCallback slow_callback, - const v8::CFunction* c_function); - - inline void SetProtoMethod(v8::Local that, - const char* name, - v8::FunctionCallback callback); - - inline void SetInstanceMethod(v8::Local that, - const char* name, - v8::FunctionCallback callback); - - - // Safe variants denote the function has no side effects. - inline void SetMethodNoSideEffect(v8::Local that, - const char* name, - v8::FunctionCallback callback); - inline void SetProtoMethodNoSideEffect(v8::Local that, - const char* name, - v8::FunctionCallback callback); - - enum class SetConstructorFunctionFlag { - NONE, - SET_CLASS_NAME, - }; - - inline void SetConstructorFunction(v8::Local that, - const char* name, - v8::Local tmpl, - SetConstructorFunctionFlag flag = - SetConstructorFunctionFlag::SET_CLASS_NAME); - - inline void SetConstructorFunction(v8::Local that, - v8::Local name, - v8::Local tmpl, - SetConstructorFunctionFlag flag = - SetConstructorFunctionFlag::SET_CLASS_NAME); - - void AtExit(void (*cb)(void* arg), void* arg); - void RunAtExitCallbacks(); - - void RunWeakRefCleanup(); - - // Strings and private symbols are shared across shared contexts - // The getters simply proxy to the per-isolate primitive. -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) -#define V(TypeName, PropertyName) \ - inline v8::Local PropertyName() const; - PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) - PER_ISOLATE_SYMBOL_PROPERTIES(VY) - PER_ISOLATE_STRING_PROPERTIES(VS) -#undef V -#undef VS -#undef VY -#undef VP - -#define V(PropertyName, TypeName) \ - inline v8::Local PropertyName() const; \ - inline void set_ ## PropertyName(v8::Local value); - ENVIRONMENT_STRONG_PERSISTENT_VALUES(V) - ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) -#undef V - - inline v8::Local context() const; - -#if HAVE_INSPECTOR - inline inspector::Agent* inspector_agent() const { - return inspector_agent_.get(); - } - - inline bool is_in_inspector_console_call() const; - inline void set_is_in_inspector_console_call(bool value); -#endif - - typedef ListHead HandleWrapQueue; - typedef ListHead ReqWrapQueue; - - inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; } - inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; } - - inline bool EmitProcessEnvWarning() { - bool current_value = emit_env_nonstring_warning_; - emit_env_nonstring_warning_ = false; - return current_value; - } - - inline bool EmitErrNameWarning() { - bool current_value = emit_err_name_warning_; - emit_err_name_warning_ = false; - return current_value; - } - - // cb will be called as cb(env) on the next event loop iteration. - // Unlike the JS setImmediate() function, nested SetImmediate() calls will - // be run without returning control to the event loop, similar to nextTick(). - template - inline void SetImmediate( - Fn&& cb, CallbackFlags::Flags flags = CallbackFlags::kRefed); - template - // This behaves like SetImmediate() but can be called from any thread. - inline void SetImmediateThreadsafe( - Fn&& cb, CallbackFlags::Flags flags = CallbackFlags::kRefed); - // This behaves like V8's Isolate::RequestInterrupt(), but also accounts for - // the event loop (i.e. combines the V8 function with SetImmediate()). - // The passed callback may not throw exceptions. - // This function can be called from any thread. - template - inline void RequestInterrupt(Fn&& cb); - // This needs to be available for the JS-land setImmediate(). - void ToggleImmediateRef(bool ref); - - inline void PushShouldNotAbortOnUncaughtScope(); - inline void PopShouldNotAbortOnUncaughtScope(); - inline bool inside_should_not_abort_on_uncaught_scope() const; - - static inline Environment* ForAsyncHooks(AsyncHooks* hooks); - - v8::Local GetNow(); - void ScheduleTimer(int64_t duration); - void ToggleTimerRef(bool ref); - - using CleanupCallback = CleanupHookCallback::Callback; - inline void AddCleanupHook(CleanupCallback cb, void* arg); - inline void RemoveCleanupHook(CleanupCallback cb, void* arg); - void RunCleanup(); - - static size_t NearHeapLimitCallback(void* data, - size_t current_heap_limit, - size_t initial_heap_limit); - static void BuildEmbedderGraph(v8::Isolate* isolate, - v8::EmbedderGraph* graph, - void* data); - - inline std::shared_ptr options(); - inline std::shared_ptr> inspector_host_port(); - - // The BaseObject count is a debugging helper that makes sure that there are - // no memory leaks caused by BaseObjects staying alive longer than expected - // (in particular, no circular BaseObjectPtr references). - inline void modify_base_object_count(int64_t delta); - inline int64_t base_object_created_after_bootstrap() const; - inline int64_t base_object_count() const; - - inline int32_t stack_trace_limit() const { return 10; } - -#if HAVE_INSPECTOR - void set_coverage_connection( - std::unique_ptr connection); - profiler::V8CoverageConnection* coverage_connection(); - - inline void set_coverage_directory(const char* directory); - inline const std::string& coverage_directory() const; - - void set_cpu_profiler_connection( - std::unique_ptr connection); - profiler::V8CpuProfilerConnection* cpu_profiler_connection(); - - inline void set_cpu_prof_name(const std::string& name); - inline const std::string& cpu_prof_name() const; - - inline void set_cpu_prof_interval(uint64_t interval); - inline uint64_t cpu_prof_interval() const; - - inline void set_cpu_prof_dir(const std::string& dir); - inline const std::string& cpu_prof_dir() const; - - void set_heap_profiler_connection( - std::unique_ptr connection); - profiler::V8HeapProfilerConnection* heap_profiler_connection(); - - inline void set_heap_prof_name(const std::string& name); - inline const std::string& heap_prof_name() const; - - inline void set_heap_prof_dir(const std::string& dir); - inline const std::string& heap_prof_dir() const; - - inline void set_heap_prof_interval(uint64_t interval); - inline uint64_t heap_prof_interval() const; - -#endif // HAVE_INSPECTOR - - inline void set_main_utf16(std::unique_ptr); - inline void set_process_exit_handler( - std::function&& handler); - - void RunAndClearNativeImmediates(bool only_refed = false); - void RunAndClearInterrupts(); - - inline uv_buf_t allocate_managed_buffer(const size_t suggested_size); - inline std::unique_ptr release_managed_buffer( - const uv_buf_t& buf); - inline std::unordered_map>* - released_allocated_buffers(); - - void AddUnmanagedFd(int fd); - void RemoveUnmanagedFd(int fd); - - template - void ForEachBindingData(T&& iterator); - - private: - inline void ThrowError(v8::Local (*fun)(v8::Local), - const char* errmsg); - - std::list loaded_addons_; - v8::Isolate* const isolate_; - IsolateData* const isolate_data_; - uv_timer_t timer_handle_; - uv_check_t immediate_check_handle_; - uv_idle_t immediate_idle_handle_; - uv_prepare_t idle_prepare_handle_; - uv_check_t idle_check_handle_; - uv_async_t task_queues_async_; - int64_t task_queues_async_refs_ = 0; - - AsyncHooks async_hooks_; - ImmediateInfo immediate_info_; - TickInfo tick_info_; - const uint64_t timer_base_; - std::shared_ptr env_vars_; - bool printed_error_ = false; - bool trace_sync_io_ = false; - bool emit_env_nonstring_warning_ = true; - bool emit_err_name_warning_ = true; - bool emit_filehandle_warning_ = true; - bool source_maps_enabled_ = false; - - size_t async_callback_scope_depth_ = 0; - std::vector destroy_async_id_list_; - -#if HAVE_INSPECTOR - std::unique_ptr coverage_connection_; - std::unique_ptr cpu_profiler_connection_; - std::string coverage_directory_; - std::string cpu_prof_dir_; - std::string cpu_prof_name_; - uint64_t cpu_prof_interval_; - std::unique_ptr heap_profiler_connection_; - std::string heap_prof_dir_; - std::string heap_prof_name_; - uint64_t heap_prof_interval_; -#endif // HAVE_INSPECTOR - - std::shared_ptr options_; - // options_ contains debug options parsed from CLI arguments, - // while inspector_host_port_ stores the actual inspector host - // and port being used. For example the port is -1 by default - // and can be specified as 0 (meaning any port allocated when the - // server starts listening), but when the inspector server starts - // the inspector_host_port_->port() will be the actual port being - // used. - std::shared_ptr> inspector_host_port_; - std::vector exec_argv_; - std::vector argv_; - std::string exec_path_; - - bool is_processing_heap_limit_callback_ = false; - int64_t heap_limit_snapshot_taken_ = 0; - - uint32_t module_id_counter_ = 0; - uint32_t script_id_counter_ = 0; - uint32_t function_id_counter_ = 0; - - AliasedUint32Array should_abort_on_uncaught_toggle_; - int should_not_abort_scope_counter_ = 0; - - std::unique_ptr trace_state_observer_; - - AliasedInt32Array stream_base_state_; - - uint64_t environment_start_time_; - std::unique_ptr performance_state_; - - bool has_run_bootstrapping_code_ = false; - bool has_serialized_options_ = false; - - std::atomic_bool can_call_into_js_ { true }; - uint64_t flags_; - uint64_t thread_id_; - std::unordered_set sub_worker_contexts_; - - static void* const kNodeContextTagPtr; - static int const kNodeContextTag; - -#if HAVE_INSPECTOR - std::unique_ptr inspector_agent_; - bool is_in_inspector_console_call_ = false; -#endif - - std::list deserialize_requests_; - - // handle_wrap_queue_ and req_wrap_queue_ needs to be at a fixed offset from - // the start of the class because it is used by - // src/node_postmortem_metadata.cc to calculate offsets and generate debug - // symbols for Environment, which assumes that the position of members in - // memory are predictable. For more information please refer to - // `doc/contributing/node-postmortem-support.md` - friend int GenDebugSymbols(); - HandleWrapQueue handle_wrap_queue_; - ReqWrapQueue req_wrap_queue_; - std::list handle_cleanup_queue_; - int handle_cleanup_waiting_ = 0; - int request_waiting_ = 0; - - EnabledDebugList enabled_debug_list_; - - std::list extra_linked_bindings_; - Mutex extra_linked_bindings_mutex_; - - static void RunTimers(uv_timer_t* handle); - - struct ExitCallback { - void (*cb_)(void* arg); - void* arg_; - }; - - std::list at_exit_functions_; - - typedef CallbackQueue NativeImmediateQueue; - NativeImmediateQueue native_immediates_; - Mutex native_immediates_threadsafe_mutex_; - NativeImmediateQueue native_immediates_threadsafe_; - NativeImmediateQueue native_immediates_interrupts_; - // Also guarded by native_immediates_threadsafe_mutex_. This can be used when - // trying to post tasks from other threads to an Environment, as the libuv - // handle for the immediate queues (task_queues_async_) may not be initialized - // yet or already have been destroyed. - bool task_queues_async_initialized_ = false; - - std::atomic interrupt_data_ {nullptr}; - void RequestInterruptFromV8(); - static void CheckImmediate(uv_check_t* handle); - - BindingDataStore bindings_; - - // Use an unordered_set, so that we have efficient insertion and removal. - std::unordered_set cleanup_hooks_; - uint64_t cleanup_hook_counter_ = 0; - bool started_cleanup_ = false; - - int64_t base_object_count_ = 0; - int64_t base_object_created_by_bootstrap_ = 0; - std::atomic_bool is_stopping_ { false }; - - std::unordered_set unmanaged_fds_; - - std::function process_exit_handler_ { - DefaultProcessExitHandler }; - - template - void ForEachBaseObject(T&& iterator); - -#define V(PropertyName, TypeName) v8::Global PropertyName ## _; - ENVIRONMENT_STRONG_PERSISTENT_VALUES(V) - ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) -#undef V - - v8::Global context_; - - // Keeps the main script source alive is one was passed to LoadEnvironment(). - // We should probably find a way to just use plain `v8::String`s created from - // the source passed to LoadEnvironment() directly instead. - std::unique_ptr main_utf16_; - - // Used by AllocatedBuffer::release() to keep track of the BackingStore for - // a given pointer. - std::unordered_map> - released_allocated_buffers_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_ENV_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/handle_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/handle_wrap.h deleted file mode 100644 index 2e06829b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/handle_wrap.h +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_HANDLE_WRAP_H_ -#define SRC_HANDLE_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "util.h" -#include "uv.h" -#include "v8.h" - -namespace node { - -class Environment; -class ExternalReferenceRegistry; - -// Rules: -// -// - Do not throw from handle methods. Set errno. -// -// - MakeCallback may only be made directly off the event loop. -// That is there can be no JavaScript stack frames underneath it. -// (Is there any way to assert that?) -// -// - No use of v8::WeakReferenceCallback. The close callback signifies that -// we're done with a handle - external resources can be freed. -// -// - Reusable? -// -// - The uv_close_cb is used to free the c++ object. The close callback -// is not made into javascript land. -// -// - uv_ref, uv_unref counts are managed at this layer to avoid needless -// js/c++ boundary crossing. At the javascript layer that should all be -// taken care of. - -class HandleWrap : public AsyncWrap { - public: - static void Close(const v8::FunctionCallbackInfo& args); - static void Ref(const v8::FunctionCallbackInfo& args); - static void Unref(const v8::FunctionCallbackInfo& args); - static void HasRef(const v8::FunctionCallbackInfo& args); - - static inline bool IsAlive(const HandleWrap* wrap) { - return wrap != nullptr && - wrap->IsDoneInitializing() && - wrap->state_ != kClosed; - } - - static inline bool HasRef(const HandleWrap* wrap) { - return IsAlive(wrap) && uv_has_ref(wrap->GetHandle()); - } - - inline uv_handle_t* GetHandle() const { return handle_; } - - virtual void Close( - v8::Local close_callback = v8::Local()); - - static v8::Local GetConstructorTemplate( - Environment* env); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - protected: - HandleWrap(Environment* env, - v8::Local object, - uv_handle_t* handle, - AsyncWrap::ProviderType provider); - virtual void OnClose() {} - void OnGCCollect() final; - bool IsNotIndicativeOfMemoryLeakAtExit() const override; - - void MarkAsInitialized(); - void MarkAsUninitialized(); - - inline bool IsHandleClosing() const { - return state_ == kClosing || state_ == kClosed; - } - - static void OnClose(uv_handle_t* handle); - - private: - friend class Environment; - friend void GetActiveHandles(const v8::FunctionCallbackInfo&); - - // handle_wrap_queue_ needs to be at a fixed offset from the start of the - // class because it is used by src/node_postmortem_metadata.cc to calculate - // offsets and generate debug symbols for HandleWrap, which assumes that the - // position of members in memory are predictable. For more information please - // refer to `doc/contributing/node-postmortem-support.md` - friend int GenDebugSymbols(); - ListNode handle_wrap_queue_; - enum { kInitialized, kClosing, kClosed } state_; - uv_handle_t* const handle_; -}; - - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_HANDLE_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/histogram-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/histogram-inl.h deleted file mode 100644 index 3b8712c8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/histogram-inl.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef SRC_HISTOGRAM_INL_H_ -#define SRC_HISTOGRAM_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "histogram.h" -#include "base_object-inl.h" -#include "node_internals.h" - -namespace node { - -void Histogram::Reset() { - Mutex::ScopedLock lock(mutex_); - hdr_reset(histogram_.get()); - exceeds_ = 0; - count_ = 0; - prev_ = 0; -} - -double Histogram::Add(const Histogram& other) { - Mutex::ScopedLock lock(mutex_); - count_ += other.count_; - exceeds_ += other.exceeds_; - if (other.prev_ > prev_) - prev_ = other.prev_; - return static_cast(hdr_add(histogram_.get(), other.histogram_.get())); -} - -size_t Histogram::Count() const { - Mutex::ScopedLock lock(mutex_); - return count_; -} - -int64_t Histogram::Min() const { - Mutex::ScopedLock lock(mutex_); - return hdr_min(histogram_.get()); -} - -int64_t Histogram::Max() const { - Mutex::ScopedLock lock(mutex_); - return hdr_max(histogram_.get()); -} - -double Histogram::Mean() const { - Mutex::ScopedLock lock(mutex_); - return hdr_mean(histogram_.get()); -} - -double Histogram::Stddev() const { - Mutex::ScopedLock lock(mutex_); - return hdr_stddev(histogram_.get()); -} - -int64_t Histogram::Percentile(double percentile) const { - Mutex::ScopedLock lock(mutex_); - CHECK_GT(percentile, 0); - CHECK_LE(percentile, 100); - return hdr_value_at_percentile(histogram_.get(), percentile); -} - -template -void Histogram::Percentiles(Iterator&& fn) { - Mutex::ScopedLock lock(mutex_); - hdr_iter iter; - hdr_iter_percentile_init(&iter, histogram_.get(), 1); - while (hdr_iter_next(&iter)) { - double key = iter.specifics.percentiles.percentile; - fn(key, iter.value); - } -} - -bool Histogram::Record(int64_t value) { - Mutex::ScopedLock lock(mutex_); - bool recorded = hdr_record_value(histogram_.get(), value); - if (!recorded) - exceeds_++; - else - count_++; - return recorded; -} - -uint64_t Histogram::RecordDelta() { - Mutex::ScopedLock lock(mutex_); - uint64_t time = uv_hrtime(); - int64_t delta = 0; - if (prev_ > 0) { - CHECK_GE(time, prev_); - delta = time - prev_; - if (hdr_record_value(histogram_.get(), delta)) - count_++; - else - exceeds_++; - } - prev_ = time; - return delta; -} - -size_t Histogram::GetMemorySize() const { - Mutex::ScopedLock lock(mutex_); - return hdr_get_memory_size(histogram_.get()); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_HISTOGRAM_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/histogram.h b/repo/packages/s/scriptx-legacy/include/libnode/histogram.h deleted file mode 100644 index d526bba8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/histogram.h +++ /dev/null @@ -1,239 +0,0 @@ -#ifndef SRC_HISTOGRAM_H_ -#define SRC_HISTOGRAM_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "hdr_histogram.h" -#include "base_object.h" -#include "memory_tracker.h" -#include "node_messaging.h" -#include "util.h" -#include "v8.h" -#include "uv.h" - -#include -#include -#include -#include - -namespace node { - -class ExternalReferenceRegistry; - -constexpr int kDefaultHistogramFigures = 3; - -class Histogram : public MemoryRetainer { - public: - struct Options { - int64_t lowest = 1; - int64_t highest = std::numeric_limits::max(); - int figures = kDefaultHistogramFigures; - }; - - explicit Histogram(const Options& options); - virtual ~Histogram() = default; - - inline bool Record(int64_t value); - inline void Reset(); - inline int64_t Min() const; - inline int64_t Max() const; - inline double Mean() const; - inline double Stddev() const; - inline int64_t Percentile(double percentile) const; - inline size_t Exceeds() const { return exceeds_; } - inline size_t Count() const; - - inline uint64_t RecordDelta(); - - inline double Add(const Histogram& other); - - // Iterator is a function type that takes two doubles as argument, one for - // percentile and one for the value at that percentile. - template - inline void Percentiles(Iterator&& fn); - - inline size_t GetMemorySize() const; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Histogram) - SET_SELF_SIZE(Histogram) - - private: - using HistogramPointer = DeleteFnPtr; - HistogramPointer histogram_; - uint64_t prev_ = 0; - size_t exceeds_ = 0; - size_t count_ = 0; - Mutex mutex_; -}; - -class HistogramImpl { - public: - explicit HistogramImpl( - const Histogram::Options& options = Histogram::Options {}); - explicit HistogramImpl(std::shared_ptr histogram); - - Histogram* operator->() { return histogram_.get(); } - - const std::shared_ptr& histogram() const { return histogram_; } - - private: - std::shared_ptr histogram_; -}; - -class HistogramBase : public BaseObject, public HistogramImpl { - public: - static v8::Local GetConstructorTemplate( - Environment* env); - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - static BaseObjectPtr Create( - Environment* env, - const Histogram::Options& options = Histogram::Options {}); - - static BaseObjectPtr Create( - Environment* env, - std::shared_ptr histogram); - - static void New(const v8::FunctionCallbackInfo& args); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(HistogramBase) - SET_SELF_SIZE(HistogramBase) - - static void GetCountBigInt(const v8::FunctionCallbackInfo& args); - static void GetMinBigInt(const v8::FunctionCallbackInfo& args); - static void GetMaxBigInt(const v8::FunctionCallbackInfo& args); - static void GetExceedsBigInt(const v8::FunctionCallbackInfo& args); - - static void GetCount(const v8::FunctionCallbackInfo& args); - static void GetMin(const v8::FunctionCallbackInfo& args); - static void GetMax(const v8::FunctionCallbackInfo& args); - static void GetMean(const v8::FunctionCallbackInfo& args); - static void GetExceeds(const v8::FunctionCallbackInfo& args); - static void GetStddev(const v8::FunctionCallbackInfo& args); - static void GetPercentile( - const v8::FunctionCallbackInfo& args); - static void GetPercentileBigInt( - const v8::FunctionCallbackInfo& args); - static void GetPercentiles( - const v8::FunctionCallbackInfo& args); - static void GetPercentilesBigInt( - const v8::FunctionCallbackInfo& args); - static void DoReset(const v8::FunctionCallbackInfo& args); - static void Record(const v8::FunctionCallbackInfo& args); - static void RecordDelta(const v8::FunctionCallbackInfo& args); - static void Add(const v8::FunctionCallbackInfo& args); - - HistogramBase( - Environment* env, - v8::Local wrap, - const Histogram::Options& options = Histogram::Options {}); - - HistogramBase( - Environment* env, - v8::Local wrap, - std::shared_ptr histogram); - - TransferMode GetTransferMode() const override { - return TransferMode::kCloneable; - } - std::unique_ptr CloneForMessaging() const override; - - class HistogramTransferData : public worker::TransferData { - public: - explicit HistogramTransferData(const HistogramBase* histogram) - : histogram_(histogram->histogram()) {} - - explicit HistogramTransferData(std::shared_ptr histogram) - : histogram_(std::move(histogram)) {} - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(HistogramTransferData) - SET_SELF_SIZE(HistogramTransferData) - - private: - std::shared_ptr histogram_; - }; -}; - -class IntervalHistogram : public HandleWrap, public HistogramImpl { - public: - enum class StartFlags { - NONE, - RESET - }; - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - static v8::Local GetConstructorTemplate( - Environment* env); - - static BaseObjectPtr Create( - Environment* env, - int32_t interval, - std::function on_interval, - const Histogram::Options& options); - - IntervalHistogram( - Environment* env, - v8::Local wrap, - AsyncWrap::ProviderType type, - int32_t interval, - std::function on_interval, - const Histogram::Options& options = Histogram::Options {}); - - static void GetCountBigInt(const v8::FunctionCallbackInfo& args); - static void GetMinBigInt(const v8::FunctionCallbackInfo& args); - static void GetMaxBigInt(const v8::FunctionCallbackInfo& args); - static void GetExceedsBigInt(const v8::FunctionCallbackInfo& args); - - static void GetCount(const v8::FunctionCallbackInfo& args); - static void GetMin(const v8::FunctionCallbackInfo& args); - static void GetMax(const v8::FunctionCallbackInfo& args); - static void GetMean(const v8::FunctionCallbackInfo& args); - static void GetExceeds(const v8::FunctionCallbackInfo& args); - static void GetStddev(const v8::FunctionCallbackInfo& args); - static void GetPercentile( - const v8::FunctionCallbackInfo& args); - static void GetPercentileBigInt( - const v8::FunctionCallbackInfo& args); - static void GetPercentiles( - const v8::FunctionCallbackInfo& args); - static void GetPercentilesBigInt( - const v8::FunctionCallbackInfo& args); - static void DoReset(const v8::FunctionCallbackInfo& args); - static void Start(const v8::FunctionCallbackInfo& args); - static void Stop(const v8::FunctionCallbackInfo& args); - - TransferMode GetTransferMode() const override { - return TransferMode::kCloneable; - } - std::unique_ptr CloneForMessaging() const override; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(IntervalHistogram) - SET_SELF_SIZE(IntervalHistogram) - - private: - static void TimerCB(uv_timer_t* handle); - void OnStart(StartFlags flags = StartFlags::RESET); - void OnStop(); - - bool enabled_ = false; - int32_t interval_ = 0; - std::function on_interval_; - uv_timer_t timer_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_HISTOGRAM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector/main_thread_interface.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector/main_thread_interface.h deleted file mode 100644 index 3ec5b3db..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector/main_thread_interface.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef SRC_INSPECTOR_MAIN_THREAD_INTERFACE_H_ -#define SRC_INSPECTOR_MAIN_THREAD_INTERFACE_H_ - -#if !HAVE_INSPECTOR -#error("This header can only be used when inspector is enabled") -#endif - -#include "inspector_agent.h" -#include "node_mutex.h" - -#include -#include -#include -#include - -namespace v8_inspector { -class StringBuffer; -class StringView; -} // namespace v8_inspector - -namespace node { -namespace inspector { -class MainThreadInterface; - -class Request { - public: - virtual void Call(MainThreadInterface*) = 0; - virtual ~Request() = default; -}; - -class Deletable { - public: - virtual ~Deletable() = default; -}; - -std::unique_ptr Utf8ToStringView( - const std::string& message); - -using MessageQueue = std::deque>; - -class MainThreadHandle : public std::enable_shared_from_this { - public: - explicit MainThreadHandle(MainThreadInterface* main_thread) - : main_thread_(main_thread) { - } - ~MainThreadHandle() { - Mutex::ScopedLock scoped_lock(block_lock_); - CHECK_NULL(main_thread_); // main_thread_ should have called Reset - } - std::unique_ptr Connect( - std::unique_ptr delegate, - bool prevent_shutdown); - int newObjectId() { - return ++next_object_id_; - } - bool Post(std::unique_ptr request); - std::unique_ptr MakeDelegateThreadSafe( - std::unique_ptr delegate); - bool Expired(); - - private: - void Reset(); - - MainThreadInterface* main_thread_; - Mutex block_lock_; - int next_session_id_ = 0; - std::atomic_int next_object_id_ = {1}; - - friend class MainThreadInterface; -}; - -class MainThreadInterface : - public std::enable_shared_from_this { - public: - explicit MainThreadInterface(Agent* agent); - ~MainThreadInterface(); - - void DispatchMessages(); - void Post(std::unique_ptr request); - bool WaitForFrontendEvent(); - std::shared_ptr GetHandle(); - Agent* inspector_agent() { - return agent_; - } - void AddObject(int handle, std::unique_ptr object); - Deletable* GetObject(int id); - Deletable* GetObjectIfExists(int id); - void RemoveObject(int handle); - - private: - MessageQueue requests_; - Mutex requests_lock_; // requests_ live across threads - // This queue is to maintain the order of the messages for the cases - // when we reenter the DispatchMessages function. - MessageQueue dispatching_message_queue_; - bool dispatching_messages_ = false; - ConditionVariable incoming_message_cond_; - // Used from any thread - Agent* const agent_; - std::shared_ptr handle_; - std::unordered_map> managed_objects_; -}; - -} // namespace inspector -} // namespace node -#endif // SRC_INSPECTOR_MAIN_THREAD_INTERFACE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector/node_string.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector/node_string.h deleted file mode 100644 index 1b8560b6..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector/node_string.h +++ /dev/null @@ -1,105 +0,0 @@ -// Bridges V8 Inspector generated code with the std::string used by the Node -// Compare to V8 counterpart - deps/v8/src/inspector/string-util.h -#ifndef SRC_INSPECTOR_NODE_STRING_H_ -#define SRC_INSPECTOR_NODE_STRING_H_ - -#include "util.h" -#include "v8-inspector.h" - -#include -#include -#include - -namespace node { -namespace inspector { -namespace protocol { - -class Value; - -using String = std::string; -using StringBuilder = std::ostringstream; -using ProtocolMessage = std::string; - -namespace StringUtil { -// NOLINTNEXTLINE(runtime/references) This is V8 API... -inline void builderAppend(StringBuilder& builder, char c) { - builder.put(c); -} - -// NOLINTNEXTLINE(runtime/references) -inline void builderAppend(StringBuilder& builder, const char* value, - size_t length) { - builder.write(value, length); -} - -// NOLINTNEXTLINE(runtime/references) -inline void builderAppend(StringBuilder& builder, const char* value) { - builderAppend(builder, value, std::strlen(value)); -} - -// NOLINTNEXTLINE(runtime/references) -inline void builderAppend(StringBuilder& builder, const String& string) { - builder << string; -} - -// NOLINTNEXTLINE(runtime/references) -inline void builderReserve(StringBuilder& builder, size_t) { - // ostringstream does not have a counterpart -} -inline String substring(const String& string, size_t start, size_t count) { - return string.substr(start, count); -} -inline String fromInteger(int n) { - return std::to_string(n); -} -inline String builderToString(const StringBuilder& builder) { - return builder.str(); -} -inline size_t find(const String& string, const char* substring) { - return string.find(substring); -} -String fromDouble(double d); -double toDouble(const char* buffer, size_t length, bool* ok); - -String StringViewToUtf8(v8_inspector::StringView view); - -// NOLINTNEXTLINE(runtime/references) -void builderAppendQuotedString(StringBuilder& builder, const String&); -std::unique_ptr parseJSON(const String&); -std::unique_ptr parseJSON(v8_inspector::StringView view); - -std::unique_ptr parseMessage(const std::string& message, bool binary); -ProtocolMessage jsonToMessage(String message); -ProtocolMessage binaryToMessage(std::vector message); -String fromUTF8(const uint8_t* data, size_t length); -String fromUTF16(const uint16_t* data, size_t length); -const uint8_t* CharactersUTF8(const String& s); -size_t CharacterCount(const String& s); - -// Unimplemented. The generated code will fall back to CharactersUTF8(). -inline uint8_t* CharactersLatin1(const String& s) { return nullptr; } -inline const uint16_t* CharactersUTF16(const String& s) { return nullptr; } - -extern size_t kNotFound; -} // namespace StringUtil - -// A read-only sequence of uninterpreted bytes with reference-counted storage. -// Though the templates for generating the protocol bindings reference -// this type, js_protocol.pdl doesn't have a field of type 'binary', so -// therefore it's unnecessary to provide an implementation here. -class Binary { - public: - const uint8_t* data() const { UNREACHABLE(); } - size_t size() const { UNREACHABLE(); } - String toBase64() const { UNREACHABLE(); } - static Binary fromBase64(const String& base64, bool* success) { - UNREACHABLE(); - } - static Binary fromSpan(const uint8_t* data, size_t size) { UNREACHABLE(); } -}; - -} // namespace protocol -} // namespace inspector -} // namespace node - -#endif // SRC_INSPECTOR_NODE_STRING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector/runtime_agent.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector/runtime_agent.h deleted file mode 100644 index 4c249f8e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector/runtime_agent.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SRC_INSPECTOR_RUNTIME_AGENT_H_ -#define SRC_INSPECTOR_RUNTIME_AGENT_H_ - -#include "node/inspector/protocol/NodeRuntime.h" -#include "v8.h" - -namespace node { -class Environment; - -namespace inspector { -namespace protocol { - -class RuntimeAgent : public NodeRuntime::Backend { - public: - RuntimeAgent(); - - void Wire(UberDispatcher* dispatcher); - - DispatchResponse notifyWhenWaitingForDisconnect(bool enabled) override; - - bool notifyWaitingForDisconnect(); - - private: - std::shared_ptr frontend_; - bool notify_when_waiting_for_disconnect_; -}; -} // namespace protocol -} // namespace inspector -} // namespace node - -#endif // SRC_INSPECTOR_RUNTIME_AGENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector/tracing_agent.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector/tracing_agent.h deleted file mode 100644 index e23d2fad..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector/tracing_agent.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef SRC_INSPECTOR_TRACING_AGENT_H_ -#define SRC_INSPECTOR_TRACING_AGENT_H_ - -#include "node/inspector/protocol/NodeTracing.h" -#include "tracing/agent.h" -#include "v8.h" - - -namespace node { -class Environment; - -namespace inspector { -class MainThreadHandle; - -namespace protocol { - -class TracingAgent : public NodeTracing::Backend { - public: - explicit TracingAgent(Environment*, std::shared_ptr); - ~TracingAgent() override; - - void Wire(UberDispatcher* dispatcher); - - DispatchResponse start( - std::unique_ptr traceConfig) override; - DispatchResponse stop() override; - DispatchResponse getCategories( - std::unique_ptr>* categories) override; - - private: - Environment* env_; - std::shared_ptr main_thread_; - tracing::AgentWriterHandle trace_writer_; - int frontend_object_id_; - std::shared_ptr frontend_; -}; - - -} // namespace protocol -} // namespace inspector -} // namespace node - -#endif // SRC_INSPECTOR_TRACING_AGENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_agent.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_agent.h deleted file mode 100644 index 1bd25189..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_agent.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef SRC_INSPECTOR_WORKER_AGENT_H_ -#define SRC_INSPECTOR_WORKER_AGENT_H_ - -#include "node/inspector/protocol/NodeWorker.h" -#include "v8.h" - - -namespace node { -namespace inspector { -class WorkerManagerEventHandle; -class WorkerManager; - -namespace protocol { -class NodeWorkers; - -class WorkerAgent : public NodeWorker::Backend { - public: - explicit WorkerAgent(std::weak_ptr manager); - ~WorkerAgent() override = default; - - void Wire(UberDispatcher* dispatcher); - - DispatchResponse sendMessageToWorker(const String& message, - const String& sessionId) override; - - DispatchResponse enable(bool waitForDebuggerOnStart) override; - DispatchResponse disable() override; - DispatchResponse detach(const String& sessionId) override; - - private: - std::shared_ptr frontend_; - std::weak_ptr manager_; - std::unique_ptr event_handle_; - std::shared_ptr workers_; -}; -} // namespace protocol -} // namespace inspector -} // namespace node - -#endif // SRC_INSPECTOR_WORKER_AGENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_inspector.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_inspector.h deleted file mode 100644 index 540d98c7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector/worker_inspector.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef SRC_INSPECTOR_WORKER_INSPECTOR_H_ -#define SRC_INSPECTOR_WORKER_INSPECTOR_H_ - -#if !HAVE_INSPECTOR -#error("This header can only be used when inspector is enabled") -#endif - -#include -#include -#include -#include - -namespace node { -namespace inspector { -class InspectorSession; -class InspectorSessionDelegate; -class MainThreadHandle; -class WorkerManager; - -class WorkerDelegate { - public: - virtual void WorkerCreated(const std::string& title, - const std::string& url, - bool waiting, - std::shared_ptr worker) = 0; - virtual ~WorkerDelegate() = default; -}; - -class WorkerManagerEventHandle { - public: - explicit WorkerManagerEventHandle(std::shared_ptr manager, - int id) - : manager_(manager), id_(id) {} - void SetWaitOnStart(bool wait_on_start); - ~WorkerManagerEventHandle(); - - private: - std::shared_ptr manager_; - int id_; -}; - -struct WorkerInfo { - WorkerInfo(const std::string& target_title, - const std::string& target_url, - std::shared_ptr worker_thread) - : title(target_title), - url(target_url), - worker_thread(worker_thread) {} - std::string title; - std::string url; - std::shared_ptr worker_thread; -}; - -class ParentInspectorHandle { - public: - ParentInspectorHandle(uint64_t id, - const std::string& url, - std::shared_ptr parent_thread, - bool wait_for_connect); - ~ParentInspectorHandle(); - std::unique_ptr NewParentInspectorHandle( - uint64_t thread_id, const std::string& url) { - return std::make_unique(thread_id, - url, - parent_thread_, - wait_); - } - void WorkerStarted(std::shared_ptr worker_thread, - bool waiting); - bool WaitForConnect() { - return wait_; - } - const std::string& url() const { return url_; } - std::unique_ptr Connect( - std::unique_ptr delegate, - bool prevent_shutdown); - - private: - uint64_t id_; - std::string url_; - std::shared_ptr parent_thread_; - bool wait_; -}; - -class WorkerManager : public std::enable_shared_from_this { - public: - explicit WorkerManager(std::shared_ptr thread) - : thread_(thread) {} - - std::unique_ptr NewParentHandle( - uint64_t thread_id, const std::string& url); - void WorkerStarted(uint64_t session_id, const WorkerInfo& info, bool waiting); - void WorkerFinished(uint64_t session_id); - std::unique_ptr SetAutoAttach( - std::unique_ptr attach_delegate); - void SetWaitOnStartForDelegate(int id, bool wait); - void RemoveAttachDelegate(int id); - std::shared_ptr MainThread() { - return thread_; - } - - private: - std::shared_ptr thread_; - std::unordered_map children_; - std::unordered_map> delegates_; - // If any one needs it, workers stop for all - std::unordered_set delegates_waiting_on_start_; - int next_delegate_id_ = 0; -}; -} // namespace inspector -} // namespace node - -#endif // SRC_INSPECTOR_WORKER_INSPECTOR_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector_agent.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector_agent.h deleted file mode 100644 index 744e139d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector_agent.h +++ /dev/null @@ -1,144 +0,0 @@ -#pragma once - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#if !HAVE_INSPECTOR -#error("This header can only be used when inspector is enabled") -#endif - -#include "node_options.h" -#include "v8.h" - -#include -#include - -namespace v8_inspector { -class StringView; -} // namespace v8_inspector - -namespace node { -// Forward declaration to break recursive dependency chain with src/env.h. -class Environment; -struct ContextInfo; - -namespace inspector { -class InspectorIo; -class ParentInspectorHandle; -class NodeInspectorClient; -class WorkerManager; - -class InspectorSession { - public: - virtual ~InspectorSession() = default; - virtual void Dispatch(const v8_inspector::StringView& message) = 0; -}; - -class InspectorSessionDelegate { - public: - virtual ~InspectorSessionDelegate() = default; - virtual void SendMessageToFrontend(const v8_inspector::StringView& message) - = 0; -}; - -class Agent { - public: - explicit Agent(node::Environment* env); - ~Agent(); - - // Create client_, may create io_ if option enabled - bool Start(const std::string& path, - const DebugOptions& options, - std::shared_ptr> host_port, - bool is_main); - // Stop and destroy io_ - void Stop(); - - bool IsListening() { return io_ != nullptr; } - // Returns true if the Node inspector is actually in use. It will be true - // if either the user explicitly opted into inspector (e.g. with the - // --inspect command line flag) or if inspector JS API had been used. - bool IsActive(); - - // Blocks till frontend connects and sends "runIfWaitingForDebugger" - void WaitForConnect(); - // Blocks till all the sessions with "WaitForDisconnectOnShutdown" disconnect - void WaitForDisconnect(); - void ReportUncaughtException(v8::Local error, - v8::Local message); - - // Async stack traces instrumentation. - void AsyncTaskScheduled(const v8_inspector::StringView& taskName, void* task, - bool recurring); - void AsyncTaskCanceled(void* task); - void AsyncTaskStarted(void* task); - void AsyncTaskFinished(void* task); - void AllAsyncTasksCanceled(); - - void RegisterAsyncHook(v8::Isolate* isolate, - v8::Local enable_function, - v8::Local disable_function); - void EnableAsyncHook(); - void DisableAsyncHook(); - - void SetParentHandle(std::unique_ptr parent_handle); - std::unique_ptr GetParentHandle( - uint64_t thread_id, const std::string& url); - - // Called to create inspector sessions that can be used from the same thread. - // The inspector responds by using the delegate to send messages back. - std::unique_ptr Connect( - std::unique_ptr delegate, - bool prevent_shutdown); - - // Called from the worker to create inspector sessions that is connected - // to the main thread. - // The inspector responds by using the delegate to send messages back. - std::unique_ptr ConnectToMainThread( - std::unique_ptr delegate, - bool prevent_shutdown); - - void PauseOnNextJavascriptStatement(const std::string& reason); - - std::string GetWsUrl() const; - - // Can only be called from the main thread. - bool StartIoThread(); - - // Calls StartIoThread() from off the main thread. - void RequestIoThreadStart(); - - const DebugOptions& options() { return debug_options_; } - std::shared_ptr> host_port() { return host_port_; } - void ContextCreated(v8::Local context, const ContextInfo& info); - - // Interface for interacting with inspectors in worker threads - std::shared_ptr GetWorkerManager(); - - inline Environment* env() const { return parent_env_; } - - private: - void ToggleAsyncHook(v8::Isolate* isolate, v8::Local fn); - - node::Environment* parent_env_; - // Encapsulates majority of the Inspector functionality - std::shared_ptr client_; - // Interface for transports, e.g. WebSocket server - std::unique_ptr io_; - std::unique_ptr parent_handle_; - std::string path_; - - // This is a copy of the debug options parsed from CLI in the Environment. - // Do not use the host_port in that, instead manipulate the shared host_port_ - // pointer which is meant to store the actual host and port of the inspector - // server. - DebugOptions debug_options_; - std::shared_ptr> host_port_; - - bool pending_enable_async_hook_ = false; - bool pending_disable_async_hook_ = false; -}; - -} // namespace inspector -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector_io.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector_io.h deleted file mode 100644 index 10cca26f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector_io.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#if !HAVE_INSPECTOR -#error("This header can only be used when inspector is enabled") -#endif - -#include "inspector_socket_server.h" -#include "node_mutex.h" - -#include "uv.h" - -#include -#include - -namespace node { -// Forward declaration to break recursive dependency chain with src/env.h. -class Environment; -namespace inspector { - -class MainThreadHandle; -class RequestQueue; - -class InspectorIo { - public: - // Start the inspector agent thread, waiting for it to initialize - // bool Start(); - // Returns empty pointer if thread was not started - static std::unique_ptr Start( - std::shared_ptr main_thread, - const std::string& path, - std::shared_ptr> host_port, - const InspectPublishUid& inspect_publish_uid); - - // Will block till the transport thread shuts down - ~InspectorIo(); - - void StopAcceptingNewConnections(); - std::string GetWsUrl() const; - - private: - InspectorIo(std::shared_ptr handle, - const std::string& path, - std::shared_ptr> host_port, - const InspectPublishUid& inspect_publish_uid); - - // Wrapper for agent->ThreadMain() - static void ThreadMain(void* agent); - - // Runs a uv_loop_t - void ThreadMain(); - - // This is a thread-safe object that will post async tasks. It lives as long - // as an Inspector object lives (almost as long as an Isolate). - std::shared_ptr main_thread_; - // Used to post on a frontend interface thread, lives while the server is - // running - std::shared_ptr request_queue_; - std::shared_ptr> host_port_; - InspectPublishUid inspect_publish_uid_; - - // The IO thread runs its own uv_loop to implement the TCP server off - // the main thread. - uv_thread_t thread_; - - // For setting up interthread communications - Mutex thread_start_lock_; - ConditionVariable thread_start_condition_; - std::string script_name_; - // May be accessed from any thread - const std::string id_; -}; - -} // namespace inspector -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector_profiler.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector_profiler.h deleted file mode 100644 index be74153b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector_profiler.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef SRC_INSPECTOR_PROFILER_H_ -#define SRC_INSPECTOR_PROFILER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#if !HAVE_INSPECTOR -#error("This header can only be used when inspector is enabled") -#endif - -#include -#include "inspector_agent.h" - -namespace node { -// Forward declaration to break recursive dependency chain with src/env.h. -class Environment; - -namespace profiler { - -class V8ProfilerConnection { - public: - class V8ProfilerSessionDelegate : public inspector::InspectorSessionDelegate { - public: - explicit V8ProfilerSessionDelegate(V8ProfilerConnection* connection) - : connection_(connection) {} - - void SendMessageToFrontend( - const v8_inspector::StringView& message) override; - - private: - V8ProfilerConnection* connection_; - }; - - explicit V8ProfilerConnection(Environment* env); - virtual ~V8ProfilerConnection() = default; - - Environment* env() const { return env_; } - - // Dispatch a protocol message, and returns the id of the message. - // `method` does not need to be surrounded by quotes. - // The optional `params` should be formatted in JSON. - // The strings should be in one byte characters - which is enough for - // the commands we use here. - uint32_t DispatchMessage(const char* method, - const char* params = nullptr, - bool is_profile_request = false); - - // Use DispatchMessage() to dispatch necessary inspector messages - // to start and end the profiling. - virtual void Start() = 0; - virtual void End() = 0; - - // Return a descriptive name of the profile for debugging. - virtual const char* type() const = 0; - // Return if the profile is ending and the response can be parsed. - virtual bool ending() const = 0; - // Return the directory where the profile should be placed. - virtual std::string GetDirectory() const = 0; - // Return the filename the profile should be written as. - virtual std::string GetFilename() const = 0; - // Return the profile object parsed from `message.result`, - // which will be then written as a JSON. - virtual v8::MaybeLocal GetProfile( - v8::Local result) = 0; - virtual void WriteProfile(v8::Local result); - - bool HasProfileId(uint32_t id) const { - return profile_ids_.find(id) != profile_ids_.end(); - } - - void RemoveProfileId(uint32_t id) { profile_ids_.erase(id); } - - private: - uint32_t next_id() { return id_++; } - std::unique_ptr session_; - uint32_t id_ = 1; - std::unordered_set profile_ids_; - - protected: - Environment* env_ = nullptr; -}; - -class V8CoverageConnection : public V8ProfilerConnection { - public: - explicit V8CoverageConnection(Environment* env) : V8ProfilerConnection(env) {} - - void Start() override; - void End() override; - - const char* type() const override { return "coverage"; } - bool ending() const override { return ending_; } - - std::string GetDirectory() const override; - std::string GetFilename() const override; - v8::MaybeLocal GetProfile(v8::Local result) override; - void WriteProfile(v8::Local result) override; - void WriteSourceMapCache(); - void TakeCoverage(); - void StopCoverage(); - - private: - std::unique_ptr session_; - bool ending_ = false; -}; - -class V8CpuProfilerConnection : public V8ProfilerConnection { - public: - explicit V8CpuProfilerConnection(Environment* env) - : V8ProfilerConnection(env) {} - - void Start() override; - void End() override; - - const char* type() const override { return "CPU"; } - bool ending() const override { return ending_; } - - std::string GetDirectory() const override; - std::string GetFilename() const override; - v8::MaybeLocal GetProfile(v8::Local result) override; - - private: - std::unique_ptr session_; - bool ending_ = false; -}; - -class V8HeapProfilerConnection : public V8ProfilerConnection { - public: - explicit V8HeapProfilerConnection(Environment* env) - : V8ProfilerConnection(env) {} - - void Start() override; - void End() override; - - const char* type() const override { return "heap"; } - bool ending() const override { return ending_; } - - std::string GetDirectory() const override; - std::string GetFilename() const override; - v8::MaybeLocal GetProfile(v8::Local result) override; - - private: - std::unique_ptr session_; - bool ending_ = false; -}; - -} // namespace profiler -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_INSPECTOR_PROFILER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector_socket.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector_socket.h deleted file mode 100644 index a6a18923..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector_socket.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef SRC_INSPECTOR_SOCKET_H_ -#define SRC_INSPECTOR_SOCKET_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "util.h" -#include "uv.h" - -#include -#include - -namespace node { -namespace inspector { - -class ProtocolHandler; - -// HTTP Wrapper around a uv_tcp_t -class InspectorSocket { - public: - class Delegate { - public: - virtual void OnHttpGet(const std::string& host, - const std::string& path) = 0; - virtual void OnSocketUpgrade(const std::string& host, - const std::string& path, - const std::string& accept_key) = 0; - virtual void OnWsFrame(const std::vector& frame) = 0; - virtual ~Delegate() = default; - }; - - using DelegatePointer = std::unique_ptr; - using Pointer = std::unique_ptr; - - static Pointer Accept(uv_stream_t* server, DelegatePointer delegate); - - ~InspectorSocket(); - - void AcceptUpgrade(const std::string& accept_key); - void CancelHandshake(); - void Write(const char* data, size_t len); - void SwitchProtocol(ProtocolHandler* handler); - std::string GetHost(); - - InspectorSocket(const InspectorSocket&) = delete; - InspectorSocket& operator=(const InspectorSocket&) = delete; - - private: - static void Shutdown(ProtocolHandler*); - InspectorSocket() = default; - - DeleteFnPtr protocol_handler_; -}; - - -} // namespace inspector -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_INSPECTOR_SOCKET_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/inspector_socket_server.h b/repo/packages/s/scriptx-legacy/include/libnode/inspector_socket_server.h deleted file mode 100644 index 98d4e7d0..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/inspector_socket_server.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef SRC_INSPECTOR_SOCKET_SERVER_H_ -#define SRC_INSPECTOR_SOCKET_SERVER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "inspector_agent.h" -#include "inspector_socket.h" -#include "uv.h" - -#include -#include -#include - -#if !HAVE_INSPECTOR -#error("This header can only be used when inspector is enabled") -#endif - -namespace node { -namespace inspector { - -std::string FormatWsAddress(const std::string& host, int port, - const std::string& target_id, - bool include_protocol); - -class InspectorSocketServer; -class SocketSession; -class ServerSocket; - -class SocketServerDelegate { - public: - virtual void AssignServer(InspectorSocketServer* server) = 0; - virtual void StartSession(int session_id, const std::string& target_id) = 0; - virtual void EndSession(int session_id) = 0; - virtual void MessageReceived(int session_id, const std::string& message) = 0; - virtual std::vector GetTargetIds() = 0; - virtual std::string GetTargetTitle(const std::string& id) = 0; - virtual std::string GetTargetUrl(const std::string& id) = 0; - virtual ~SocketServerDelegate() = default; -}; - -// HTTP Server, writes messages requested as TransportActions, and responds -// to HTTP requests and WS upgrades. - -class InspectorSocketServer { - public: - InspectorSocketServer(std::unique_ptr delegate, - uv_loop_t* loop, - const std::string& host, - int port, - const InspectPublishUid& inspect_publish_uid, - FILE* out = stderr); - ~InspectorSocketServer(); - - // Start listening on host/port - bool Start(); - - // Called by the TransportAction sent with InspectorIo::Write(): - // kKill and kStop - void Stop(); - // kSendMessage - void Send(int session_id, const std::string& message); - // kKill - void TerminateConnections(); - int Port() const; - - // Session connection lifecycle - void Accept(int server_port, uv_stream_t* server_socket); - bool HandleGetRequest(int session_id, const std::string& host, - const std::string& path); - void SessionStarted(int session_id, const std::string& target_id, - const std::string& ws_id); - void SessionTerminated(int session_id); - void MessageReceived(int session_id, const std::string& message) { - delegate_->MessageReceived(session_id, message); - } - SocketSession* Session(int session_id); - bool done() const { - return server_sockets_.empty() && connected_sessions_.empty(); - } - - static void CloseServerSocket(ServerSocket*); - using ServerSocketPtr = DeleteFnPtr; - - private: - void SendListResponse(InspectorSocket* socket, const std::string& host, - SocketSession* session); - std::string GetFrontendURL(bool is_compat, - const std::string &formatted_address); - bool TargetExists(const std::string& id); - - enum class ServerState {kNew, kRunning, kStopped}; - uv_loop_t* loop_; - std::unique_ptr delegate_; - const std::string host_; - int port_; - InspectPublishUid inspect_publish_uid_; - std::vector server_sockets_; - std::map>> - connected_sessions_; - int next_session_id_; - FILE* out_; - ServerState state_; -}; - -} // namespace inspector -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_INSPECTOR_SOCKET_SERVER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api.h b/repo/packages/s/scriptx-legacy/include/libnode/js_native_api.h deleted file mode 100644 index 50ccf11e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api.h +++ /dev/null @@ -1,578 +0,0 @@ -#ifndef SRC_JS_NATIVE_API_H_ -#define SRC_JS_NATIVE_API_H_ - -// This file needs to be compatible with C compilers. -#include // NOLINT(modernize-deprecated-headers) -#include // NOLINT(modernize-deprecated-headers) - -// Use INT_MAX, this should only be consumed by the pre-processor anyway. -#define NAPI_VERSION_EXPERIMENTAL 2147483647 -#ifndef NAPI_VERSION -#ifdef NAPI_EXPERIMENTAL -#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL -#else -// The baseline version for N-API. -// The NAPI_VERSION controls which version will be used by default when -// compilling a native addon. If the addon developer specifically wants to use -// functions available in a new version of N-API that is not yet ported in all -// LTS versions, they can set NAPI_VERSION knowing that they have specifically -// depended on that version. -#define NAPI_VERSION 8 -#endif -#endif - -#include "js_native_api_types.h" - -// If you need __declspec(dllimport), either include instead, or -// define NAPI_EXTERN as __declspec(dllimport) on the compiler's command line. -#ifndef NAPI_EXTERN - #ifdef _WIN32 - #define NAPI_EXTERN __declspec(dllexport) - #elif defined(__wasm32__) - #define NAPI_EXTERN __attribute__((visibility("default"))) \ - __attribute__((__import_module__("napi"))) - #else - #define NAPI_EXTERN __attribute__((visibility("default"))) - #endif -#endif - -#define NAPI_AUTO_LENGTH SIZE_MAX - -#ifdef __cplusplus -#define EXTERN_C_START extern "C" { -#define EXTERN_C_END } -#else -#define EXTERN_C_START -#define EXTERN_C_END -#endif - -EXTERN_C_START - -NAPI_EXTERN napi_status -napi_get_last_error_info(napi_env env, - const napi_extended_error_info** result); - -// Getters for defined singletons -NAPI_EXTERN napi_status napi_get_undefined(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_get_null(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_get_global(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_get_boolean(napi_env env, - bool value, - napi_value* result); - -// Methods to create Primitive types/Objects -NAPI_EXTERN napi_status napi_create_object(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_create_array(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_create_array_with_length(napi_env env, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_double(napi_env env, - double value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_int32(napi_env env, - int32_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_uint32(napi_env env, - uint32_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_int64(napi_env env, - int64_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_string_latin1(napi_env env, - const char* str, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_string_utf8(napi_env env, - const char* str, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_string_utf16(napi_env env, - const char16_t* str, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_symbol(napi_env env, - napi_value description, - napi_value* result); -#ifdef NAPI_EXPERIMENTAL -NAPI_EXTERN napi_status node_api_symbol_for(napi_env env, - const char* utf8description, - size_t length, - napi_value* result); -#endif // NAPI_EXPERIMENTAL -NAPI_EXTERN napi_status napi_create_function(napi_env env, - const char* utf8name, - size_t length, - napi_callback cb, - void* data, - napi_value* result); -NAPI_EXTERN napi_status napi_create_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); -NAPI_EXTERN napi_status napi_create_type_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); -NAPI_EXTERN napi_status napi_create_range_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); -#ifdef NAPI_EXPERIMENTAL -NAPI_EXTERN napi_status node_api_create_syntax_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); -#endif // NAPI_EXPERIMENTAL - -// Methods to get the native napi_value from Primitive type -NAPI_EXTERN napi_status napi_typeof(napi_env env, - napi_value value, - napi_valuetype* result); -NAPI_EXTERN napi_status napi_get_value_double(napi_env env, - napi_value value, - double* result); -NAPI_EXTERN napi_status napi_get_value_int32(napi_env env, - napi_value value, - int32_t* result); -NAPI_EXTERN napi_status napi_get_value_uint32(napi_env env, - napi_value value, - uint32_t* result); -NAPI_EXTERN napi_status napi_get_value_int64(napi_env env, - napi_value value, - int64_t* result); -NAPI_EXTERN napi_status napi_get_value_bool(napi_env env, - napi_value value, - bool* result); - -// Copies LATIN-1 encoded bytes from a string into a buffer. -NAPI_EXTERN napi_status napi_get_value_string_latin1(napi_env env, - napi_value value, - char* buf, - size_t bufsize, - size_t* result); - -// Copies UTF-8 encoded bytes from a string into a buffer. -NAPI_EXTERN napi_status napi_get_value_string_utf8(napi_env env, - napi_value value, - char* buf, - size_t bufsize, - size_t* result); - -// Copies UTF-16 encoded bytes from a string into a buffer. -NAPI_EXTERN napi_status napi_get_value_string_utf16(napi_env env, - napi_value value, - char16_t* buf, - size_t bufsize, - size_t* result); - -// Methods to coerce values -// These APIs may execute user scripts -NAPI_EXTERN napi_status napi_coerce_to_bool(napi_env env, - napi_value value, - napi_value* result); -NAPI_EXTERN napi_status napi_coerce_to_number(napi_env env, - napi_value value, - napi_value* result); -NAPI_EXTERN napi_status napi_coerce_to_object(napi_env env, - napi_value value, - napi_value* result); -NAPI_EXTERN napi_status napi_coerce_to_string(napi_env env, - napi_value value, - napi_value* result); - -// Methods to work with Objects -NAPI_EXTERN napi_status napi_get_prototype(napi_env env, - napi_value object, - napi_value* result); -NAPI_EXTERN napi_status napi_get_property_names(napi_env env, - napi_value object, - napi_value* result); -NAPI_EXTERN napi_status napi_set_property(napi_env env, - napi_value object, - napi_value key, - napi_value value); -NAPI_EXTERN napi_status napi_has_property(napi_env env, - napi_value object, - napi_value key, - bool* result); -NAPI_EXTERN napi_status napi_get_property(napi_env env, - napi_value object, - napi_value key, - napi_value* result); -NAPI_EXTERN napi_status napi_delete_property(napi_env env, - napi_value object, - napi_value key, - bool* result); -NAPI_EXTERN napi_status napi_has_own_property(napi_env env, - napi_value object, - napi_value key, - bool* result); -NAPI_EXTERN napi_status napi_set_named_property(napi_env env, - napi_value object, - const char* utf8name, - napi_value value); -NAPI_EXTERN napi_status napi_has_named_property(napi_env env, - napi_value object, - const char* utf8name, - bool* result); -NAPI_EXTERN napi_status napi_get_named_property(napi_env env, - napi_value object, - const char* utf8name, - napi_value* result); -NAPI_EXTERN napi_status napi_set_element(napi_env env, - napi_value object, - uint32_t index, - napi_value value); -NAPI_EXTERN napi_status napi_has_element(napi_env env, - napi_value object, - uint32_t index, - bool* result); -NAPI_EXTERN napi_status napi_get_element(napi_env env, - napi_value object, - uint32_t index, - napi_value* result); -NAPI_EXTERN napi_status napi_delete_element(napi_env env, - napi_value object, - uint32_t index, - bool* result); -NAPI_EXTERN napi_status -napi_define_properties(napi_env env, - napi_value object, - size_t property_count, - const napi_property_descriptor* properties); - -// Methods to work with Arrays -NAPI_EXTERN napi_status napi_is_array(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_get_array_length(napi_env env, - napi_value value, - uint32_t* result); - -// Methods to compare values -NAPI_EXTERN napi_status napi_strict_equals(napi_env env, - napi_value lhs, - napi_value rhs, - bool* result); - -// Methods to work with Functions -NAPI_EXTERN napi_status napi_call_function(napi_env env, - napi_value recv, - napi_value func, - size_t argc, - const napi_value* argv, - napi_value* result); -NAPI_EXTERN napi_status napi_new_instance(napi_env env, - napi_value constructor, - size_t argc, - const napi_value* argv, - napi_value* result); -NAPI_EXTERN napi_status napi_instanceof(napi_env env, - napi_value object, - napi_value constructor, - bool* result); - -// Methods to work with napi_callbacks - -// Gets all callback info in a single call. (Ugly, but faster.) -NAPI_EXTERN napi_status napi_get_cb_info( - napi_env env, // [in] NAPI environment handle - napi_callback_info cbinfo, // [in] Opaque callback-info handle - size_t* argc, // [in-out] Specifies the size of the provided argv array - // and receives the actual count of args. - napi_value* argv, // [out] Array of values - napi_value* this_arg, // [out] Receives the JS 'this' arg for the call - void** data); // [out] Receives the data pointer for the callback. - -NAPI_EXTERN napi_status napi_get_new_target(napi_env env, - napi_callback_info cbinfo, - napi_value* result); -NAPI_EXTERN napi_status -napi_define_class(napi_env env, - const char* utf8name, - size_t length, - napi_callback constructor, - void* data, - size_t property_count, - const napi_property_descriptor* properties, - napi_value* result); - -// Methods to work with external data objects -NAPI_EXTERN napi_status napi_wrap(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result); -NAPI_EXTERN napi_status napi_unwrap(napi_env env, - napi_value js_object, - void** result); -NAPI_EXTERN napi_status napi_remove_wrap(napi_env env, - napi_value js_object, - void** result); -NAPI_EXTERN napi_status napi_create_external(napi_env env, - void* data, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result); -NAPI_EXTERN napi_status napi_get_value_external(napi_env env, - napi_value value, - void** result); - -// Methods to control object lifespan - -// Set initial_refcount to 0 for a weak reference, >0 for a strong reference. -NAPI_EXTERN napi_status napi_create_reference(napi_env env, - napi_value value, - uint32_t initial_refcount, - napi_ref* result); - -// Deletes a reference. The referenced value is released, and may -// be GC'd unless there are other references to it. -NAPI_EXTERN napi_status napi_delete_reference(napi_env env, napi_ref ref); - -// Increments the reference count, optionally returning the resulting count. -// After this call the reference will be a strong reference because its -// refcount is >0, and the referenced object is effectively "pinned". -// Calling this when the refcount is 0 and the object is unavailable -// results in an error. -NAPI_EXTERN napi_status napi_reference_ref(napi_env env, - napi_ref ref, - uint32_t* result); - -// Decrements the reference count, optionally returning the resulting count. -// If the result is 0 the reference is now weak and the object may be GC'd -// at any time if there are no other references. Calling this when the -// refcount is already 0 results in an error. -NAPI_EXTERN napi_status napi_reference_unref(napi_env env, - napi_ref ref, - uint32_t* result); - -// Attempts to get a referenced value. If the reference is weak, -// the value might no longer be available, in that case the call -// is still successful but the result is NULL. -NAPI_EXTERN napi_status napi_get_reference_value(napi_env env, - napi_ref ref, - napi_value* result); - -NAPI_EXTERN napi_status napi_open_handle_scope(napi_env env, - napi_handle_scope* result); -NAPI_EXTERN napi_status napi_close_handle_scope(napi_env env, - napi_handle_scope scope); -NAPI_EXTERN napi_status -napi_open_escapable_handle_scope(napi_env env, - napi_escapable_handle_scope* result); -NAPI_EXTERN napi_status -napi_close_escapable_handle_scope(napi_env env, - napi_escapable_handle_scope scope); - -NAPI_EXTERN napi_status napi_escape_handle(napi_env env, - napi_escapable_handle_scope scope, - napi_value escapee, - napi_value* result); - -// Methods to support error handling -NAPI_EXTERN napi_status napi_throw(napi_env env, napi_value error); -NAPI_EXTERN napi_status napi_throw_error(napi_env env, - const char* code, - const char* msg); -NAPI_EXTERN napi_status napi_throw_type_error(napi_env env, - const char* code, - const char* msg); -NAPI_EXTERN napi_status napi_throw_range_error(napi_env env, - const char* code, - const char* msg); -#ifdef NAPI_EXPERIMENTAL -NAPI_EXTERN napi_status node_api_throw_syntax_error(napi_env env, - const char* code, - const char* msg); -#endif // NAPI_EXPERIMENTAL -NAPI_EXTERN napi_status napi_is_error(napi_env env, - napi_value value, - bool* result); - -// Methods to support catching exceptions -NAPI_EXTERN napi_status napi_is_exception_pending(napi_env env, bool* result); -NAPI_EXTERN napi_status napi_get_and_clear_last_exception(napi_env env, - napi_value* result); - -// Methods to work with array buffers and typed arrays -NAPI_EXTERN napi_status napi_is_arraybuffer(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_create_arraybuffer(napi_env env, - size_t byte_length, - void** data, - napi_value* result); -NAPI_EXTERN napi_status -napi_create_external_arraybuffer(napi_env env, - void* external_data, - size_t byte_length, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result); -NAPI_EXTERN napi_status napi_get_arraybuffer_info(napi_env env, - napi_value arraybuffer, - void** data, - size_t* byte_length); -NAPI_EXTERN napi_status napi_is_typedarray(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_create_typedarray(napi_env env, - napi_typedarray_type type, - size_t length, - napi_value arraybuffer, - size_t byte_offset, - napi_value* result); -NAPI_EXTERN napi_status napi_get_typedarray_info(napi_env env, - napi_value typedarray, - napi_typedarray_type* type, - size_t* length, - void** data, - napi_value* arraybuffer, - size_t* byte_offset); - -NAPI_EXTERN napi_status napi_create_dataview(napi_env env, - size_t length, - napi_value arraybuffer, - size_t byte_offset, - napi_value* result); -NAPI_EXTERN napi_status napi_is_dataview(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_get_dataview_info(napi_env env, - napi_value dataview, - size_t* bytelength, - void** data, - napi_value* arraybuffer, - size_t* byte_offset); - -// version management -NAPI_EXTERN napi_status napi_get_version(napi_env env, uint32_t* result); - -// Promises -NAPI_EXTERN napi_status napi_create_promise(napi_env env, - napi_deferred* deferred, - napi_value* promise); -NAPI_EXTERN napi_status napi_resolve_deferred(napi_env env, - napi_deferred deferred, - napi_value resolution); -NAPI_EXTERN napi_status napi_reject_deferred(napi_env env, - napi_deferred deferred, - napi_value rejection); -NAPI_EXTERN napi_status napi_is_promise(napi_env env, - napi_value value, - bool* is_promise); - -// Running a script -NAPI_EXTERN napi_status napi_run_script(napi_env env, - napi_value script, - napi_value* result); - -// Memory management -NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, - int64_t change_in_bytes, - int64_t* adjusted_value); - -#if NAPI_VERSION >= 5 - -// Dates -NAPI_EXTERN napi_status napi_create_date(napi_env env, - double time, - napi_value* result); - -NAPI_EXTERN napi_status napi_is_date(napi_env env, - napi_value value, - bool* is_date); - -NAPI_EXTERN napi_status napi_get_date_value(napi_env env, - napi_value value, - double* result); - -// Add finalizer for pointer -NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result); - -#endif // NAPI_VERSION >= 5 - -#if NAPI_VERSION >= 6 - -// BigInt -NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, - int64_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_bigint_uint64(napi_env env, - uint64_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_bigint_words(napi_env env, - int sign_bit, - size_t word_count, - const uint64_t* words, - napi_value* result); -NAPI_EXTERN napi_status napi_get_value_bigint_int64(napi_env env, - napi_value value, - int64_t* result, - bool* lossless); -NAPI_EXTERN napi_status napi_get_value_bigint_uint64(napi_env env, - napi_value value, - uint64_t* result, - bool* lossless); -NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env, - napi_value value, - int* sign_bit, - size_t* word_count, - uint64_t* words); - -// Object -NAPI_EXTERN napi_status -napi_get_all_property_names(napi_env env, - napi_value object, - napi_key_collection_mode key_mode, - napi_key_filter key_filter, - napi_key_conversion key_conversion, - napi_value* result); - -// Instance data -NAPI_EXTERN napi_status napi_set_instance_data(napi_env env, - void* data, - napi_finalize finalize_cb, - void* finalize_hint); - -NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, - void** data); -#endif // NAPI_VERSION >= 6 - -#if NAPI_VERSION >= 7 -// ArrayBuffer detaching -NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, - napi_value arraybuffer); - -NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env, - napi_value value, - bool* result); -#endif // NAPI_VERSION >= 7 - -#if NAPI_VERSION >= 8 -// Type tagging -NAPI_EXTERN napi_status napi_type_tag_object(napi_env env, - napi_value value, - const napi_type_tag* type_tag); - -NAPI_EXTERN napi_status -napi_check_object_type_tag(napi_env env, - napi_value value, - const napi_type_tag* type_tag, - bool* result); -NAPI_EXTERN napi_status napi_object_freeze(napi_env env, - napi_value object); -NAPI_EXTERN napi_status napi_object_seal(napi_env env, - napi_value object); -#endif // NAPI_VERSION >= 8 - -EXTERN_C_END - -#endif // SRC_JS_NATIVE_API_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_types.h b/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_types.h deleted file mode 100644 index 6aba0662..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_types.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef SRC_JS_NATIVE_API_TYPES_H_ -#define SRC_JS_NATIVE_API_TYPES_H_ - -// This file needs to be compatible with C compilers. -// This is a public include file, and these includes have essentially -// became part of it's API. -#include // NOLINT(modernize-deprecated-headers) -#include // NOLINT(modernize-deprecated-headers) - -#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) - typedef uint16_t char16_t; -#endif - -// JSVM API types are all opaque pointers for ABI stability -// typedef undefined structs instead of void* for compile time type safety -typedef struct napi_env__* napi_env; -typedef struct napi_value__* napi_value; -typedef struct napi_ref__* napi_ref; -typedef struct napi_handle_scope__* napi_handle_scope; -typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; -typedef struct napi_callback_info__* napi_callback_info; -typedef struct napi_deferred__* napi_deferred; - -typedef enum { - napi_default = 0, - napi_writable = 1 << 0, - napi_enumerable = 1 << 1, - napi_configurable = 1 << 2, - - // Used with napi_define_class to distinguish static properties - // from instance properties. Ignored by napi_define_properties. - napi_static = 1 << 10, - -#if NAPI_VERSION >= 8 - // Default for class methods. - napi_default_method = napi_writable | napi_configurable, - - // Default for object properties, like in JS obj[prop]. - napi_default_jsproperty = napi_writable | - napi_enumerable | - napi_configurable, -#endif // NAPI_VERSION >= 8 -} napi_property_attributes; - -typedef enum { - // ES6 types (corresponds to typeof) - napi_undefined, - napi_null, - napi_boolean, - napi_number, - napi_string, - napi_symbol, - napi_object, - napi_function, - napi_external, - napi_bigint, -} napi_valuetype; - -typedef enum { - napi_int8_array, - napi_uint8_array, - napi_uint8_clamped_array, - napi_int16_array, - napi_uint16_array, - napi_int32_array, - napi_uint32_array, - napi_float32_array, - napi_float64_array, - napi_bigint64_array, - napi_biguint64_array, -} napi_typedarray_type; - -typedef enum { - napi_ok, - napi_invalid_arg, - napi_object_expected, - napi_string_expected, - napi_name_expected, - napi_function_expected, - napi_number_expected, - napi_boolean_expected, - napi_array_expected, - napi_generic_failure, - napi_pending_exception, - napi_cancelled, - napi_escape_called_twice, - napi_handle_scope_mismatch, - napi_callback_scope_mismatch, - napi_queue_full, - napi_closing, - napi_bigint_expected, - napi_date_expected, - napi_arraybuffer_expected, - napi_detachable_arraybuffer_expected, - napi_would_deadlock // unused -} napi_status; -// Note: when adding a new enum value to `napi_status`, please also update -// * `const int last_status` in the definition of `napi_get_last_error_info()' -// in file js_native_api_v8.cc. -// * `const char* error_messages[]` in file js_native_api_v8.cc with a brief -// message explaining the error. -// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly -// added value(s). - -typedef napi_value (*napi_callback)(napi_env env, - napi_callback_info info); -typedef void (*napi_finalize)(napi_env env, - void* finalize_data, - void* finalize_hint); - -typedef struct { - // One of utf8name or name should be NULL. - const char* utf8name; - napi_value name; - - napi_callback method; - napi_callback getter; - napi_callback setter; - napi_value value; - - napi_property_attributes attributes; - void* data; -} napi_property_descriptor; - -typedef struct { - const char* error_message; - void* engine_reserved; - uint32_t engine_error_code; - napi_status error_code; -} napi_extended_error_info; - -#if NAPI_VERSION >= 6 -typedef enum { - napi_key_include_prototypes, - napi_key_own_only -} napi_key_collection_mode; - -typedef enum { - napi_key_all_properties = 0, - napi_key_writable = 1, - napi_key_enumerable = 1 << 1, - napi_key_configurable = 1 << 2, - napi_key_skip_strings = 1 << 3, - napi_key_skip_symbols = 1 << 4 -} napi_key_filter; - -typedef enum { - napi_key_keep_numbers, - napi_key_numbers_to_strings -} napi_key_conversion; -#endif // NAPI_VERSION >= 6 - -#if NAPI_VERSION >= 8 -typedef struct { - uint64_t lower; - uint64_t upper; -} napi_type_tag; -#endif // NAPI_VERSION >= 8 - -#endif // SRC_JS_NATIVE_API_TYPES_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8.h b/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8.h deleted file mode 100644 index bdf68505..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8.h +++ /dev/null @@ -1,453 +0,0 @@ -#ifndef SRC_JS_NATIVE_API_V8_H_ -#define SRC_JS_NATIVE_API_V8_H_ - -// This file needs to be compatible with C compilers. -#include // NOLINT(modernize-deprecated-headers) -#include "js_native_api_types.h" -#include "js_native_api_v8_internals.h" - -static napi_status napi_clear_last_error(napi_env env); - -namespace v8impl { - -class RefTracker { - public: - RefTracker() {} - virtual ~RefTracker() {} - virtual void Finalize(bool isEnvTeardown) {} - - typedef RefTracker RefList; - - inline void Link(RefList* list) { - prev_ = list; - next_ = list->next_; - if (next_ != nullptr) { - next_->prev_ = this; - } - list->next_ = this; - } - - inline void Unlink() { - if (prev_ != nullptr) { - prev_->next_ = next_; - } - if (next_ != nullptr) { - next_->prev_ = prev_; - } - prev_ = nullptr; - next_ = nullptr; - } - - static void FinalizeAll(RefList* list) { - while (list->next_ != nullptr) { - list->next_->Finalize(true); - } - } - - private: - RefList* next_ = nullptr; - RefList* prev_ = nullptr; -}; - -} // end of namespace v8impl - -struct napi_env__ { - explicit napi_env__(v8::Local context) - : isolate(context->GetIsolate()), - context_persistent(isolate, context) { - CHECK_EQ(isolate, context->GetIsolate()); - napi_clear_last_error(this); - } - virtual ~napi_env__() { - // First we must finalize those references that have `napi_finalizer` - // callbacks. The reason is that addons might store other references which - // they delete during their `napi_finalizer` callbacks. If we deleted such - // references here first, they would be doubly deleted when the - // `napi_finalizer` deleted them subsequently. - v8impl::RefTracker::FinalizeAll(&finalizing_reflist); - v8impl::RefTracker::FinalizeAll(&reflist); - } - v8::Isolate* const isolate; // Shortcut for context()->GetIsolate() - v8impl::Persistent context_persistent; - - inline v8::Local context() const { - return v8impl::PersistentToLocal::Strong(context_persistent); - } - - inline void Ref() { refs++; } - inline void Unref() { if ( --refs == 0) delete this; } - - virtual bool can_call_into_js() const { return true; } - virtual v8::Maybe mark_arraybuffer_as_untransferable( - v8::Local ab) const { - return v8::Just(true); - } - - static inline void - HandleThrow(napi_env env, v8::Local value) { - env->isolate->ThrowException(value); - } - - template - inline void CallIntoModule(T&& call, U&& handle_exception = HandleThrow) { - int open_handle_scopes_before = open_handle_scopes; - int open_callback_scopes_before = open_callback_scopes; - napi_clear_last_error(this); - call(this); - CHECK_EQ(open_handle_scopes, open_handle_scopes_before); - CHECK_EQ(open_callback_scopes, open_callback_scopes_before); - if (!last_exception.IsEmpty()) { - handle_exception(this, last_exception.Get(this->isolate)); - last_exception.Reset(); - } - } - - virtual void CallFinalizer(napi_finalize cb, void* data, void* hint) { - v8::HandleScope handle_scope(isolate); - CallIntoModule([&](napi_env env) { - cb(env, data, hint); - }); - } - - v8impl::Persistent last_exception; - - // We store references in two different lists, depending on whether they have - // `napi_finalizer` callbacks, because we must first finalize the ones that - // have such a callback. See `~napi_env__()` above for details. - v8impl::RefTracker::RefList reflist; - v8impl::RefTracker::RefList finalizing_reflist; - napi_extended_error_info last_error; - int open_handle_scopes = 0; - int open_callback_scopes = 0; - int refs = 1; - void* instance_data = nullptr; -}; - -// This class is used to keep a napi_env live in a way that -// is exception safe versus calling Ref/Unref directly -class EnvRefHolder { - public: - explicit EnvRefHolder(napi_env env) : _env(env) { - _env->Ref(); - } - - explicit EnvRefHolder(const EnvRefHolder& other): _env(other.env()) { - _env->Ref(); - } - - EnvRefHolder(EnvRefHolder&& other) { - _env = other._env; - other._env = nullptr; - } - - ~EnvRefHolder() { - if (_env != nullptr) { - _env->Unref(); - } - } - - napi_env env(void) const { - return _env; - } - - private: - napi_env _env; -}; - -static inline napi_status napi_clear_last_error(napi_env env) { - env->last_error.error_code = napi_ok; - - // TODO(boingoing): Should this be a callback? - env->last_error.engine_error_code = 0; - env->last_error.engine_reserved = nullptr; - env->last_error.error_message = nullptr; - return napi_ok; -} - -static inline -napi_status napi_set_last_error(napi_env env, napi_status error_code, - uint32_t engine_error_code = 0, - void* engine_reserved = nullptr) { - env->last_error.error_code = error_code; - env->last_error.engine_error_code = engine_error_code; - env->last_error.engine_reserved = engine_reserved; - return error_code; -} - -#define RETURN_STATUS_IF_FALSE(env, condition, status) \ - do { \ - if (!(condition)) { \ - return napi_set_last_error((env), (status)); \ - } \ - } while (0) - -#define RETURN_STATUS_IF_FALSE_WITH_PREAMBLE(env, condition, status) \ - do { \ - if (!(condition)) { \ - return napi_set_last_error( \ - (env), try_catch.HasCaught() ? napi_pending_exception : (status)); \ - } \ - } while (0) - -#define CHECK_ENV(env) \ - do { \ - if ((env) == nullptr) { \ - return napi_invalid_arg; \ - } \ - } while (0) - -#define CHECK_ARG(env, arg) \ - RETURN_STATUS_IF_FALSE((env), ((arg) != nullptr), napi_invalid_arg) - -#define CHECK_ARG_WITH_PREAMBLE(env, arg) \ - RETURN_STATUS_IF_FALSE_WITH_PREAMBLE((env), \ - ((arg) != nullptr), \ - napi_invalid_arg) - -#define CHECK_MAYBE_EMPTY(env, maybe, status) \ - RETURN_STATUS_IF_FALSE((env), !((maybe).IsEmpty()), (status)) - -#define CHECK_MAYBE_EMPTY_WITH_PREAMBLE(env, maybe, status) \ - RETURN_STATUS_IF_FALSE_WITH_PREAMBLE((env), !((maybe).IsEmpty()), (status)) - -// NAPI_PREAMBLE is not wrapped in do..while: try_catch must have function scope -#define NAPI_PREAMBLE(env) \ - CHECK_ENV((env)); \ - RETURN_STATUS_IF_FALSE((env), \ - (env)->last_exception.IsEmpty() && (env)->can_call_into_js(), \ - napi_pending_exception); \ - napi_clear_last_error((env)); \ - v8impl::TryCatch try_catch((env)) - -#define CHECK_TO_TYPE(env, type, context, result, src, status) \ - do { \ - CHECK_ARG((env), (src)); \ - auto maybe = v8impl::V8LocalValueFromJsValue((src))->To##type((context)); \ - CHECK_MAYBE_EMPTY((env), maybe, (status)); \ - (result) = maybe.ToLocalChecked(); \ - } while (0) - -#define CHECK_TO_TYPE_WITH_PREAMBLE(env, type, context, result, src, status) \ - do { \ - CHECK_ARG_WITH_PREAMBLE((env), (src)); \ - auto maybe = v8impl::V8LocalValueFromJsValue((src))->To##type((context)); \ - CHECK_MAYBE_EMPTY_WITH_PREAMBLE((env), maybe, (status)); \ - (result) = maybe.ToLocalChecked(); \ - } while (0) - -#define CHECK_TO_FUNCTION(env, result, src) \ - do { \ - CHECK_ARG((env), (src)); \ - v8::Local v8value = v8impl::V8LocalValueFromJsValue((src)); \ - RETURN_STATUS_IF_FALSE((env), v8value->IsFunction(), napi_invalid_arg); \ - (result) = v8value.As(); \ - } while (0) - -#define CHECK_TO_OBJECT(env, context, result, src) \ - CHECK_TO_TYPE((env), Object, (context), (result), (src), napi_object_expected) - -#define CHECK_TO_OBJECT_WITH_PREAMBLE(env, context, result, src) \ - CHECK_TO_TYPE_WITH_PREAMBLE((env), \ - Object, \ - (context), \ - (result), \ - (src), \ - napi_object_expected) - -#define CHECK_TO_STRING(env, context, result, src) \ - CHECK_TO_TYPE((env), String, (context), (result), (src), napi_string_expected) - -#define GET_RETURN_STATUS(env) \ - (!try_catch.HasCaught() ? napi_ok \ - : napi_set_last_error((env), napi_pending_exception)) - -#define THROW_RANGE_ERROR_IF_FALSE(env, condition, error, message) \ - do { \ - if (!(condition)) { \ - napi_throw_range_error((env), (error), (message)); \ - return napi_set_last_error((env), napi_generic_failure); \ - } \ - } while (0) - -#define RETURN_STATUS_IF_FALSE_WITH_PREAMBLE(env, condition, status) \ - do { \ - if (!(condition)) { \ - return napi_set_last_error( \ - (env), try_catch.HasCaught() ? napi_pending_exception : (status)); \ - } \ - } while (0) - -#define CHECK_MAYBE_EMPTY_WITH_PREAMBLE(env, maybe, status) \ - RETURN_STATUS_IF_FALSE_WITH_PREAMBLE((env), !((maybe).IsEmpty()), (status)) - -namespace v8impl { - -//=== Conversion between V8 Handles and napi_value ======================== - -// This asserts v8::Local<> will always be implemented with a single -// pointer field so that we can pass it around as a void*. -static_assert(sizeof(v8::Local) == sizeof(napi_value), - "Cannot convert between v8::Local and napi_value"); - -inline napi_value JsValueFromV8LocalValue(v8::Local local) { - return reinterpret_cast(*local); -} - -inline v8::Local V8LocalValueFromJsValue(napi_value v) { - v8::Local local; - memcpy(static_cast(&local), &v, sizeof(v)); - return local; -} - -// Adapter for napi_finalize callbacks. -class Finalizer { - public: - // Some Finalizers are run during shutdown when the napi_env is destroyed, - // and some need to keep an explicit reference to the napi_env because they - // are run independently. - enum EnvReferenceMode { - kNoEnvReference, - kKeepEnvReference - }; - - protected: - Finalizer(napi_env env, - napi_finalize finalize_callback, - void* finalize_data, - void* finalize_hint, - EnvReferenceMode refmode = kNoEnvReference) - : _env(env), - _finalize_callback(finalize_callback), - _finalize_data(finalize_data), - _finalize_hint(finalize_hint), - _has_env_reference(refmode == kKeepEnvReference) { - if (_has_env_reference) - _env->Ref(); - } - - ~Finalizer() { - if (_has_env_reference) - _env->Unref(); - } - - public: - static Finalizer* New(napi_env env, - napi_finalize finalize_callback = nullptr, - void* finalize_data = nullptr, - void* finalize_hint = nullptr, - EnvReferenceMode refmode = kNoEnvReference) { - return new Finalizer( - env, finalize_callback, finalize_data, finalize_hint, refmode); - } - - static void Delete(Finalizer* finalizer) { - delete finalizer; - } - - protected: - napi_env _env; - napi_finalize _finalize_callback; - void* _finalize_data; - void* _finalize_hint; - bool _finalize_ran = false; - bool _has_env_reference = false; -}; - -class TryCatch : public v8::TryCatch { - public: - explicit TryCatch(napi_env env) - : v8::TryCatch(env->isolate), _env(env) {} - - ~TryCatch() { - if (HasCaught()) { - _env->last_exception.Reset(_env->isolate, Exception()); - } - } - - private: - napi_env _env; -}; - -// Wrapper around v8impl::Persistent that implements reference counting. -class RefBase : protected Finalizer, RefTracker { - protected: - RefBase(napi_env env, - uint32_t initial_refcount, - bool delete_self, - napi_finalize finalize_callback, - void* finalize_data, - void* finalize_hint); - - public: - static RefBase* New(napi_env env, - uint32_t initial_refcount, - bool delete_self, - napi_finalize finalize_callback, - void* finalize_data, - void* finalize_hint); - - static inline void Delete(RefBase* reference); - - virtual ~RefBase(); - void* Data(); - uint32_t Ref(); - uint32_t Unref(); - uint32_t RefCount(); - - protected: - void Finalize(bool is_env_teardown = false) override; - - private: - uint32_t _refcount; - bool _delete_self; -}; - -class Reference : public RefBase { - using SecondPassCallParameterRef = Reference*; - - protected: - template - Reference(napi_env env, v8::Local value, Args&&... args); - - public: - static Reference* New(napi_env env, - v8::Local value, - uint32_t initial_refcount, - bool delete_self, - napi_finalize finalize_callback = nullptr, - void* finalize_data = nullptr, - void* finalize_hint = nullptr); - - virtual ~Reference(); - uint32_t Ref(); - uint32_t Unref(); - v8::Local Get(); - - protected: - void Finalize(bool is_env_teardown = false) override; - - private: - void ClearWeak(); - void SetWeak(); - - static void FinalizeCallback( - const v8::WeakCallbackInfo& data); - static void SecondPassCallback( - const v8::WeakCallbackInfo& data); - - v8impl::Persistent _persistent; - SecondPassCallParameterRef* _secondPassParameter; - bool _secondPassScheduled; - - FRIEND_TEST(JsNativeApiV8Test, Reference); -}; - -} // end of namespace v8impl - -#define STATUS_CALL(call) \ - do { \ - napi_status status = (call); \ - if (status != napi_ok) return status; \ - } while (0) - -#endif // SRC_JS_NATIVE_API_V8_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8_internals.h b/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8_internals.h deleted file mode 100644 index 8428390e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/js_native_api_v8_internals.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef SRC_JS_NATIVE_API_V8_INTERNALS_H_ -#define SRC_JS_NATIVE_API_V8_INTERNALS_H_ - -// The V8 implementation of N-API, including `js_native_api_v8.h` uses certain -// idioms which require definition here. For example, it uses a variant of -// persistent references which need not be reset in the constructor. It is the -// responsibility of this file to define these idioms. Optionally, this file -// may also define `NAPI_VERSION` and set it to the version of N-API to be -// exposed. - -// In the case of the Node.js implementation of N-API some of the idioms are -// imported directly from Node.js by including `node_internals.h` below. Others -// are bridged to remove references to the `node` namespace. `node_version.h`, -// included below, defines `NAPI_VERSION`. - -#include "node_version.h" -#include "env.h" -#include "node_internals.h" -#include "gtest/gtest_prod.h" - -#define NAPI_ARRAYSIZE(array) \ - node::arraysize((array)) - -#define NAPI_FIXED_ONE_BYTE_STRING(isolate, string) \ - node::FIXED_ONE_BYTE_STRING((isolate), (string)) - -#define NAPI_PRIVATE_KEY(context, suffix) \ - (node::Environment::GetCurrent((context))->napi_ ## suffix()) - -namespace v8impl { - -template -using Persistent = v8::Global; - -using PersistentToLocal = node::PersistentToLocal; - -} // end of namespace v8impl - -#endif // SRC_JS_NATIVE_API_V8_INTERNALS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/js_stream.h b/repo/packages/s/scriptx-legacy/include/libnode/js_stream.h deleted file mode 100644 index d96b3d00..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/js_stream.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SRC_JS_STREAM_H_ -#define SRC_JS_STREAM_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "stream_base.h" - -namespace node { - -class Environment; - -class JSStream : public AsyncWrap, public StreamBase { - public: - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - - bool IsAlive() override; - bool IsClosing() override; - int ReadStart() override; - int ReadStop() override; - - int DoShutdown(ShutdownWrap* req_wrap) override; - int DoWrite(WriteWrap* w, - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle) override; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(JSStream) - SET_SELF_SIZE(JSStream) - - protected: - JSStream(Environment* env, v8::Local obj); - - AsyncWrap* GetAsyncWrap() override; - - static void New(const v8::FunctionCallbackInfo& args); - static void ReadBuffer(const v8::FunctionCallbackInfo& args); - static void EmitEOF(const v8::FunctionCallbackInfo& args); - - template - static void Finish(const v8::FunctionCallbackInfo& args); -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_JS_STREAM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/json_utils.h b/repo/packages/s/scriptx-legacy/include/libnode/json_utils.h deleted file mode 100644 index 3ece077a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/json_utils.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef SRC_JSON_UTILS_H_ -#define SRC_JSON_UTILS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include -#include - -namespace node { - -std::string EscapeJsonChars(const std::string& str); -std::string Reindent(const std::string& str, int indentation); - -// JSON compiler definitions. -class JSONWriter { - public: - JSONWriter(std::ostream& out, bool compact) - : out_(out), compact_(compact) {} - - private: - inline void indent() { indent_ += 2; } - inline void deindent() { indent_ -= 2; } - inline void advance() { - if (compact_) return; - for (int i = 0; i < indent_; i++) out_ << ' '; - } - inline void write_one_space() { - if (compact_) return; - out_ << ' '; - } - inline void write_new_line() { - if (compact_) return; - out_ << '\n'; - } - - public: - inline void json_start() { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - out_ << '{'; - indent(); - state_ = kObjectStart; - } - - inline void json_end() { - write_new_line(); - deindent(); - advance(); - out_ << '}'; - state_ = kAfterValue; - } - template - inline void json_objectstart(T key) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_string(key); - out_ << ':'; - write_one_space(); - out_ << '{'; - indent(); - state_ = kObjectStart; - } - - template - inline void json_arraystart(T key) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_string(key); - out_ << ':'; - write_one_space(); - out_ << '['; - indent(); - state_ = kObjectStart; - } - inline void json_objectend() { - write_new_line(); - deindent(); - advance(); - out_ << '}'; - if (indent_ == 0) { - // Top-level object is complete, so end the line. - out_ << '\n'; - } - state_ = kAfterValue; - } - - inline void json_arrayend() { - write_new_line(); - deindent(); - advance(); - out_ << ']'; - state_ = kAfterValue; - } - template - inline void json_keyvalue(const T& key, const U& value) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_string(key); - out_ << ':'; - write_one_space(); - write_value(value); - state_ = kAfterValue; - } - - template - inline void json_element(const U& value) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_value(value); - state_ = kAfterValue; - } - - struct Null {}; // Usable as a JSON value. - - struct ForeignJSON { - std::string as_string; - }; - - private: - template ::is_specialized, bool>::type> - inline void write_value(T number) { - if (std::is_same::value) - out_ << (number ? "true" : "false"); - else - out_ << number; - } - - inline void write_value(Null null) { out_ << "null"; } - inline void write_value(const char* str) { write_string(str); } - inline void write_value(const std::string& str) { write_string(str); } - - inline void write_value(const ForeignJSON& json) { - out_ << Reindent(json.as_string, indent_); - } - - inline void write_string(const std::string& str) { - out_ << '"' << EscapeJsonChars(str) << '"'; - } - inline void write_string(const char* str) { write_string(std::string(str)); } - - enum JSONState { kObjectStart, kAfterValue }; - std::ostream& out_; - bool compact_; - int indent_ = 0; - int state_ = kObjectStart; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_JSON_UTILS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/large_pages/node_large_page.h b/repo/packages/s/scriptx-legacy/include/libnode/large_pages/node_large_page.h deleted file mode 100644 index 622cf09e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/large_pages/node_large_page.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2018 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom -// the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES -// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -// OR OTHER DEALINGS IN THE SOFTWARE. -// -// SPDX-License-Identifier: MIT - -#ifndef SRC_LARGE_PAGES_NODE_LARGE_PAGE_H_ -#define SRC_LARGE_PAGES_NODE_LARGE_PAGE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -namespace node { -int MapStaticCodeToLargePages(); -const char* LargePagesError(int status); -} // namespace node - -#endif // NODE_WANT_INTERNALS -#endif // SRC_LARGE_PAGES_NODE_LARGE_PAGE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/memory_tracker-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/memory_tracker-inl.h deleted file mode 100644 index 0ba44f1f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/memory_tracker-inl.h +++ /dev/null @@ -1,356 +0,0 @@ -#ifndef SRC_MEMORY_TRACKER_INL_H_ -#define SRC_MEMORY_TRACKER_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "memory_tracker.h" - -namespace node { - -// Fallback edge_name if node_name is not available, or "" if edge_name -// is not available either. -inline const char* GetNodeName(const char* node_name, const char* edge_name) { - if (node_name != nullptr) { - return node_name; - } - if (edge_name != nullptr) { - return edge_name; - } - return ""; -} - -class MemoryRetainerNode : public v8::EmbedderGraph::Node { - public: - inline MemoryRetainerNode(MemoryTracker* tracker, - const MemoryRetainer* retainer) - : retainer_(retainer) { - CHECK_NOT_NULL(retainer_); - v8::HandleScope handle_scope(tracker->isolate()); - v8::Local obj = retainer_->WrappedObject(); - if (!obj.IsEmpty()) wrapper_node_ = tracker->graph()->V8Node(obj); - - name_ = retainer_->MemoryInfoName(); - size_ = retainer_->SelfSize(); - } - - inline MemoryRetainerNode(MemoryTracker* tracker, - const char* name, - size_t size, - bool is_root_node = false) - : retainer_(nullptr) { - name_ = name; - size_ = size; - is_root_node_ = is_root_node; - } - - const char* Name() override { return name_.c_str(); } - const char* NamePrefix() override { return "Node /"; } - size_t SizeInBytes() override { return size_; } - // TODO(addaleax): Merging this with the "official" WrapperNode() method - // seems to lose accuracy, e.g. SizeInBytes() is disregarded. - // Figure out whether to do anything about that. - Node* JSWrapperNode() { return wrapper_node_; } - - bool IsRootNode() override { - if (retainer_ != nullptr) { - return retainer_->IsRootNode(); - } - return is_root_node_; - } - - private: - friend class MemoryTracker; - - // If retainer_ is not nullptr, then it must have a wrapper_node_, - // and we have - // name_ == retainer_->MemoryInfoName() - // size_ == retainer_->SelfSize() - // is_root_node_ == retainer_->IsRootNode() - const MemoryRetainer* retainer_; - Node* wrapper_node_ = nullptr; - - // Otherwise (retainer == nullptr), we set these fields in an ad-hoc way - bool is_root_node_ = false; - std::string name_; - size_t size_ = 0; -}; - -void MemoryTracker::TrackFieldWithSize(const char* edge_name, - size_t size, - const char* node_name) { - if (size > 0) AddNode(GetNodeName(node_name, edge_name), size, edge_name); -} - -void MemoryTracker::TrackInlineFieldWithSize(const char* edge_name, - size_t size, - const char* node_name) { - if (size > 0) AddNode(GetNodeName(node_name, edge_name), size, edge_name); - CHECK(CurrentNode()); - CurrentNode()->size_ -= size; -} - -void MemoryTracker::TrackField(const char* edge_name, - const MemoryRetainer& value, - const char* node_name) { - TrackField(edge_name, &value); -} - -void MemoryTracker::TrackField(const char* edge_name, - const MemoryRetainer* value, - const char* node_name) { - if (value == nullptr) return; - auto it = seen_.find(value); - if (it != seen_.end()) { - graph_->AddEdge(CurrentNode(), it->second, edge_name); - } else { - Track(value, edge_name); - } -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const std::unique_ptr& value, - const char* node_name) { - if (value.get() == nullptr) { - return; - } - TrackField(edge_name, value.get(), node_name); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const std::shared_ptr& value, - const char* node_name) { - if (value.get() == nullptr) { - return; - } - TrackField(edge_name, value.get(), node_name); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const BaseObjectPtrImpl& value, - const char* node_name) { - if (value.get() == nullptr || kIsWeak) return; - TrackField(edge_name, value.get(), node_name); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const T& value, - const char* node_name, - const char* element_name, - bool subtract_from_self) { - // If the container is empty, the size has been accounted into the parent's - // self size - if (value.begin() == value.end()) return; - // Fall back to edge name if node names are not provided - if (CurrentNode() != nullptr && subtract_from_self) { - // Shift the self size of this container out to a separate node - CurrentNode()->size_ -= sizeof(T); - } - PushNode(GetNodeName(node_name, edge_name), sizeof(T), edge_name); - for (Iterator it = value.begin(); it != value.end(); ++it) { - // Use nullptr as edge names so the elements appear as indexed properties - TrackField(nullptr, *it, element_name); - } - PopNode(); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const std::queue& value, - const char* node_name, - const char* element_name) { - struct ContainerGetter : public std::queue { - static const typename std::queue::container_type& Get( - const std::queue& value) { - return value.*&ContainerGetter::c; - } - }; - - const auto& container = ContainerGetter::Get(value); - TrackField(edge_name, container, node_name, element_name); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const T& value, - const char* node_name) { - // For numbers, creating new nodes is not worth the overhead. - CurrentNode()->size_ += sizeof(T); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const std::pair& value, - const char* node_name) { - PushNode(node_name == nullptr ? "pair" : node_name, - sizeof(const std::pair), - edge_name); - // TODO(joyeecheung): special case if one of these is a number type - // that meets the test_for_number trait so that their sizes don't get - // merged into the pair node - TrackField("first", value.first); - TrackField("second", value.second); - PopNode(); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const std::basic_string& value, - const char* node_name) { - TrackFieldWithSize(edge_name, value.size() * sizeof(T), "std::basic_string"); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const v8::Eternal& value, - const char* node_name) { - TrackField(edge_name, value.Get(isolate_)); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const v8::PersistentBase& value, - const char* node_name) { - if (value.IsWeak()) return; - TrackField(edge_name, value.Get(isolate_)); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const v8::Local& value, - const char* node_name) { - if (!value.IsEmpty()) - graph_->AddEdge(CurrentNode(), graph_->V8Node(value), edge_name); -} - -template -void MemoryTracker::TrackField(const char* edge_name, - const MallocedBuffer& value, - const char* node_name) { - TrackFieldWithSize(edge_name, value.size, "MallocedBuffer"); -} - -void MemoryTracker::TrackField(const char* edge_name, - const v8::BackingStore* value, - const char* node_name) { - TrackFieldWithSize(edge_name, value->ByteLength(), "BackingStore"); -} - -void MemoryTracker::TrackField(const char* name, - const uv_buf_t& value, - const char* node_name) { - TrackFieldWithSize(name, value.len, "uv_buf_t"); -} - -void MemoryTracker::TrackField(const char* name, - const uv_timer_t& value, - const char* node_name) { - TrackFieldWithSize(name, sizeof(value), "uv_timer_t"); -} - -void MemoryTracker::TrackField(const char* name, - const uv_async_t& value, - const char* node_name) { - TrackFieldWithSize(name, sizeof(value), "uv_async_t"); -} - -void MemoryTracker::TrackInlineField(const char* name, - const uv_async_t& value, - const char* node_name) { - TrackInlineFieldWithSize(name, sizeof(value), "uv_async_t"); -} - -template -void MemoryTracker::TrackField(const char* name, - const AliasedBufferBase& value, - const char* node_name) { - TrackField(name, value.GetJSArray(), "AliasedBuffer"); -} - -void MemoryTracker::Track(const MemoryRetainer* retainer, - const char* edge_name) { - v8::HandleScope handle_scope(isolate_); - auto it = seen_.find(retainer); - if (it != seen_.end()) { - if (CurrentNode() != nullptr) { - graph_->AddEdge(CurrentNode(), it->second, edge_name); - } - return; // It has already been tracked, no need to call MemoryInfo again - } - MemoryRetainerNode* n = PushNode(retainer, edge_name); - retainer->MemoryInfo(this); - CHECK_EQ(CurrentNode(), n); - CHECK_NE(n->size_, 0); - PopNode(); -} - -void MemoryTracker::TrackInlineField(const MemoryRetainer* retainer, - const char* edge_name) { - Track(retainer, edge_name); - CHECK(CurrentNode()); - CurrentNode()->size_ -= retainer->SelfSize(); -} - -MemoryRetainerNode* MemoryTracker::CurrentNode() const { - if (node_stack_.empty()) return nullptr; - return node_stack_.top(); -} - -MemoryRetainerNode* MemoryTracker::AddNode(const MemoryRetainer* retainer, - const char* edge_name) { - auto it = seen_.find(retainer); - if (it != seen_.end()) { - return it->second; - } - - MemoryRetainerNode* n = new MemoryRetainerNode(this, retainer); - graph_->AddNode(std::unique_ptr(n)); - seen_[retainer] = n; - if (CurrentNode() != nullptr) graph_->AddEdge(CurrentNode(), n, edge_name); - - if (n->JSWrapperNode() != nullptr) { - graph_->AddEdge(n, n->JSWrapperNode(), "wrapped"); - graph_->AddEdge(n->JSWrapperNode(), n, "wrapper"); - } - - return n; -} - -MemoryRetainerNode* MemoryTracker::AddNode(const char* node_name, - size_t size, - const char* edge_name) { - MemoryRetainerNode* n = new MemoryRetainerNode(this, node_name, size); - graph_->AddNode(std::unique_ptr(n)); - - if (CurrentNode() != nullptr) graph_->AddEdge(CurrentNode(), n, edge_name); - - return n; -} - -MemoryRetainerNode* MemoryTracker::PushNode(const MemoryRetainer* retainer, - const char* edge_name) { - MemoryRetainerNode* n = AddNode(retainer, edge_name); - node_stack_.push(n); - return n; -} - -MemoryRetainerNode* MemoryTracker::PushNode(const char* node_name, - size_t size, - const char* edge_name) { - MemoryRetainerNode* n = AddNode(node_name, size, edge_name); - node_stack_.push(n); - return n; -} - -void MemoryTracker::PopNode() { - node_stack_.pop(); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_MEMORY_TRACKER_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/memory_tracker.h b/repo/packages/s/scriptx-legacy/include/libnode/memory_tracker.h deleted file mode 100644 index 1896624b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/memory_tracker.h +++ /dev/null @@ -1,284 +0,0 @@ -#pragma once - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" -#include "v8-profiler.h" - -#include - -#include -#include -#include -#include -#include - -namespace node { - -// Set the node name of a MemoryRetainer to klass -#define SET_MEMORY_INFO_NAME(Klass) \ - inline std::string MemoryInfoName() const override { return #Klass; } - -// Set the self size of a MemoryRetainer to the stack-allocated size of a -// certain class -#define SET_SELF_SIZE(Klass) \ - inline size_t SelfSize() const override { return sizeof(Klass); } - -// Used when there is no additional fields to track -#define SET_NO_MEMORY_INFO() \ - inline void MemoryInfo(node::MemoryTracker* tracker) const override {} - -class MemoryTracker; -class MemoryRetainerNode; -template -class BaseObjectPtrImpl; - -namespace crypto { -class NodeBIO; -} - -class CleanupHookCallback; - -/* Example: - * - * class ExampleRetainer : public MemoryRetainer { - * public: - * // Or use SET_NO_MEMORY_INFO() when there is no additional fields - * // to track. - * void MemoryInfo(MemoryTracker* tracker) const override { - * // Node name and size comes from the MemoryInfoName and SelfSize of - * // AnotherRetainerClass - * tracker->TrackField("another_retainer", another_retainer_); - * - * // Add non_pointer_retainer as a separate node into the graph - * // and track its memory information recursively. - * // Note that we need to make sure its size is not accounted in - * // ExampleRetainer::SelfSize(). - * tracker->TrackField("non_pointer_retainer", &non_pointer_retainer_); - * - * // Specify node name and size explicitly - * tracker->TrackFieldWithSize("internal_member", - * internal_member_.size(), - * "InternalClass"); - * // Node name falls back to the edge name, - * // elements in the container appear as grandchildren nodes - * tracker->TrackField("vector", vector_); - * // Node name and size come from the JS object - * tracker->TrackField("target", target_); - * } - * - * // Or use SET_MEMORY_INFO_NAME(ExampleRetainer) - * std::string MemoryInfoName() const override { - * return "ExampleRetainer"; - * } - * - * // Classes that only want to return its sizeof() value can use the - * // SET_SELF_SIZE(Class) macro instead. - * size_t SelfSize() const override { - * // We need to exclude the size of non_pointer_retainer so that - * // we can track it separately in ExampleRetainer::MemoryInfo(). - * return sizeof(ExampleRetainer) - sizeof(NonPointerRetainerClass); - * } - * - * // Note: no need to implement these two methods when implementing - * // a BaseObject or an AsyncWrap class - * bool IsRootNode() const override { return !wrapped_.IsWeak(); } - * v8::Local WrappedObject() const override { - * return node::PersistentToLocal::Default(wrapped_); - * } - * - * private: - * AnotherRetainerClass* another_retainer_; - * NonPointerRetainerClass non_pointer_retainer; - * InternalClass internal_member_; - * std::vector vector_; - * v8::Global target_; - * - * v8::Global wrapped_; - * } - * - * This creates the following graph: - * Node / ExampleRetainer - * |> another_retainer :: Node / AnotherRetainerClass - * |> internal_member :: Node / InternalClass - * |> vector :: Node / vector (elements will be grandchildren) - * |> [1] :: Node / uv_async_t (uv_async_t has predefined names) - * |> [2] :: Node / uv_async_t - * |> ... - * |> target :: TargetClass (JS class name of the target object) - * |> wrapped :: WrappedClass (JS class name of the wrapped object) - * |> wrapper :: Node / ExampleRetainer (back reference) - */ -class MemoryRetainer { - public: - virtual ~MemoryRetainer() = default; - - // Subclasses should implement these methods to provide information - // for the V8 heap snapshot generator. - // The MemoryInfo() method is assumed to be called within a context - // where all the edges start from the node of the current retainer, - // and point to the nodes as specified by tracker->Track* calls. - virtual void MemoryInfo(MemoryTracker* tracker) const = 0; - virtual std::string MemoryInfoName() const = 0; - virtual size_t SelfSize() const = 0; - - virtual v8::Local WrappedObject() const { - return v8::Local(); - } - - virtual bool IsRootNode() const { return false; } -}; - -class MemoryTracker { - public: - // Used to specify node name and size explicitly - inline void TrackFieldWithSize(const char* edge_name, - size_t size, - const char* node_name = nullptr); - inline void TrackInlineFieldWithSize(const char* edge_name, - size_t size, - const char* node_name = nullptr); - - // Shortcut to extract the underlying object out of the smart pointer - template - inline void TrackField(const char* edge_name, - const std::unique_ptr& value, - const char* node_name = nullptr); - - template - inline void TrackField(const char* edge_name, - const std::shared_ptr& value, - const char* node_name = nullptr); - - template - void TrackField(const char* edge_name, - const BaseObjectPtrImpl& value, - const char* node_name = nullptr); - - // For containers, the elements will be graphed as grandchildren nodes - // if the container is not empty. - // By default, we assume the parent count the stack size of the container - // into its SelfSize so that will be subtracted from the parent size when we - // spin off a new node for the container. - // TODO(joyeecheung): use RTTI to retrieve the class name at runtime? - template - inline void TrackField(const char* edge_name, - const T& value, - const char* node_name = nullptr, - const char* element_name = nullptr, - bool subtract_from_self = true); - template - inline void TrackField(const char* edge_name, - const std::queue& value, - const char* node_name = nullptr, - const char* element_name = nullptr); - template - inline void TrackField(const char* edge_name, - const std::pair& value, - const char* node_name = nullptr); - - // For the following types, node_name will be ignored and predefined names - // will be used instead. They are only in the signature for template - // expansion. - inline void TrackField(const char* edge_name, - const MemoryRetainer& value, - const char* node_name = nullptr); - inline void TrackField(const char* edge_name, - const MemoryRetainer* value, - const char* node_name = nullptr); - template - inline void TrackField(const char* edge_name, - const std::basic_string& value, - const char* node_name = nullptr); - template ::is_specialized, bool>::type, - typename dummy = bool> - inline void TrackField(const char* edge_name, - const T& value, - const char* node_name = nullptr); - template - void TrackField(const char* edge_name, - const v8::Eternal& value, - const char* node_name); - template - inline void TrackField(const char* edge_name, - const v8::PersistentBase& value, - const char* node_name = nullptr); - template - inline void TrackField(const char* edge_name, - const v8::Local& value, - const char* node_name = nullptr); - template - inline void TrackField(const char* edge_name, - const MallocedBuffer& value, - const char* node_name = nullptr); - inline void TrackField(const char* edge_name, - const v8::BackingStore* value, - const char* node_name = nullptr); - inline void TrackField(const char* edge_name, - const uv_buf_t& value, - const char* node_name = nullptr); - inline void TrackField(const char* edge_name, - const uv_timer_t& value, - const char* node_name = nullptr); - inline void TrackField(const char* edge_name, - const uv_async_t& value, - const char* node_name = nullptr); - inline void TrackInlineField(const char* edge_name, - const uv_async_t& value, - const char* node_name = nullptr); - template - inline void TrackField(const char* edge_name, - const AliasedBufferBase& value, - const char* node_name = nullptr); - - // Put a memory container into the graph, create an edge from - // the current node if there is one on the stack. - inline void Track(const MemoryRetainer* retainer, - const char* edge_name = nullptr); - - // Useful for parents that do not wish to perform manual - // adjustments to its `SelfSize()` when embedding retainer - // objects inline. - // Put a memory container into the graph, create an edge from - // the current node if there is one on the stack - there should - // be one, of the container object which the current field is part of. - // Reduce the size of memory from the container so as to avoid - // duplication in accounting. - inline void TrackInlineField(const MemoryRetainer* retainer, - const char* edge_name = nullptr); - - inline v8::EmbedderGraph* graph() { return graph_; } - inline v8::Isolate* isolate() { return isolate_; } - - inline explicit MemoryTracker(v8::Isolate* isolate, - v8::EmbedderGraph* graph) - : isolate_(isolate), graph_(graph) {} - - private: - typedef std::unordered_map - NodeMap; - - inline MemoryRetainerNode* CurrentNode() const; - inline MemoryRetainerNode* AddNode(const MemoryRetainer* retainer, - const char* edge_name = nullptr); - inline MemoryRetainerNode* PushNode(const MemoryRetainer* retainer, - const char* edge_name = nullptr); - inline MemoryRetainerNode* AddNode(const char* node_name, - size_t size, - const char* edge_name = nullptr); - inline MemoryRetainerNode* PushNode(const char* node_name, - size_t size, - const char* edge_name = nullptr); - inline void PopNode(); - - v8::Isolate* isolate_; - v8::EmbedderGraph* graph_; - std::stack node_stack_; - NodeMap seen_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/repo/packages/s/scriptx-legacy/include/libnode/module_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/module_wrap.h deleted file mode 100644 index 58b233d0..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/module_wrap.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef SRC_MODULE_WRAP_H_ -#define SRC_MODULE_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include -#include "base_object.h" - -namespace node { - -class Environment; - -namespace contextify { -class ContextifyContext; -} - -namespace loader { - -enum ScriptType : int { - kScript, - kModule, - kFunction, -}; - -enum HostDefinedOptions : int { - kType = 8, - kID = 9, - kLength = 10, -}; - -class ModuleWrap : public BaseObject { - public: - enum InternalFields { - kModuleWrapBaseField = BaseObject::kInternalFieldCount, - kURLSlot, - kSyntheticEvaluationStepsSlot, - kContextObjectSlot, // Object whose creation context is the target Context - kInternalFieldCount - }; - - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void HostInitializeImportMetaObjectCallback( - v8::Local context, - v8::Local module, - v8::Local meta); - - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackField("resolve_cache", resolve_cache_); - } - - inline uint32_t id() { return id_; } - v8::Local context() const; - static ModuleWrap* GetFromID(node::Environment*, uint32_t id); - - SET_MEMORY_INFO_NAME(ModuleWrap) - SET_SELF_SIZE(ModuleWrap) - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { - // XXX: The garbage collection rules for ModuleWrap are *super* unclear. - // Do these objects ever get GC'd? Are we just okay with leaking them? - return true; - } - - private: - ModuleWrap(Environment* env, - v8::Local object, - v8::Local module, - v8::Local url); - ~ModuleWrap() override; - - static void New(const v8::FunctionCallbackInfo& args); - static void Link(const v8::FunctionCallbackInfo& args); - static void Instantiate(const v8::FunctionCallbackInfo& args); - static void Evaluate(const v8::FunctionCallbackInfo& args); - static void GetNamespace(const v8::FunctionCallbackInfo& args); - static void GetStatus(const v8::FunctionCallbackInfo& args); - static void GetError(const v8::FunctionCallbackInfo& args); - static void GetStaticDependencySpecifiers( - const v8::FunctionCallbackInfo& args); - - static void SetImportModuleDynamicallyCallback( - const v8::FunctionCallbackInfo& args); - static void SetInitializeImportMetaObjectCallback( - const v8::FunctionCallbackInfo& args); - static v8::MaybeLocal SyntheticModuleEvaluationStepsCallback( - v8::Local context, v8::Local module); - static void SetSyntheticExport( - const v8::FunctionCallbackInfo& args); - static void CreateCachedData(const v8::FunctionCallbackInfo& args); - - static v8::MaybeLocal ResolveModuleCallback( - v8::Local context, - v8::Local specifier, - v8::Local import_assertions, - v8::Local referrer); - static ModuleWrap* GetFromModule(node::Environment*, v8::Local); - - v8::Global module_; - std::unordered_map> resolve_cache_; - contextify::ContextifyContext* contextify_context_ = nullptr; - bool synthetic_ = false; - bool linked_ = false; - uint32_t id_; -}; - -} // namespace loader -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_MODULE_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node.h b/repo/packages/s/scriptx-legacy/include/libnode/node.h deleted file mode 100644 index 966edcd0..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node.h +++ /dev/null @@ -1,1158 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_H_ -#define SRC_NODE_H_ - -#ifdef _WIN32 -# ifndef BUILDING_NODE_EXTENSION -# define NODE_EXTERN __declspec(dllexport) -# else -# define NODE_EXTERN __declspec(dllimport) -# endif -#else -# define NODE_EXTERN __attribute__((visibility("default"))) -#endif - -#ifdef BUILDING_NODE_EXTENSION -# undef BUILDING_V8_SHARED -# undef BUILDING_UV_SHARED -# define USING_V8_SHARED 1 -# define USING_UV_SHARED 1 -#endif - -// This should be defined in make system. -// See issue https://github.com/nodejs/node-v0.x-archive/issues/1236 -#if defined(__MINGW32__) || defined(_MSC_VER) -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 // Windows Server 2008 -#endif - -#ifndef NOMINMAX -# define NOMINMAX -#endif - -#endif - -#if defined(_MSC_VER) -#define PATH_MAX MAX_PATH -#endif - -#ifdef _WIN32 -# define SIGKILL 9 -#endif - -#include "v8.h" // NOLINT(build/include_order) - -#include "v8-platform.h" // NOLINT(build/include_order) -#include "node_version.h" // NODE_MODULE_VERSION - -#include -#include - -// We cannot use __POSIX__ in this header because that's only defined when -// building Node.js. -#ifndef _WIN32 -#include -#endif // _WIN32 - -#define NODE_MAKE_VERSION(major, minor, patch) \ - ((major) * 0x1000 + (minor) * 0x100 + (patch)) - -#ifdef __clang__ -# define NODE_CLANG_AT_LEAST(major, minor, patch) \ - (NODE_MAKE_VERSION(major, minor, patch) <= \ - NODE_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)) -#else -# define NODE_CLANG_AT_LEAST(major, minor, patch) (0) -#endif - -#ifdef __GNUC__ -# define NODE_GNUC_AT_LEAST(major, minor, patch) \ - (NODE_MAKE_VERSION(major, minor, patch) <= \ - NODE_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)) -#else -# define NODE_GNUC_AT_LEAST(major, minor, patch) (0) -#endif - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -# define NODE_DEPRECATED(message, declarator) declarator -#else // NODE_WANT_INTERNALS -# if NODE_CLANG_AT_LEAST(2, 9, 0) || NODE_GNUC_AT_LEAST(4, 5, 0) -# define NODE_DEPRECATED(message, declarator) \ - __attribute__((deprecated(message))) declarator -# elif defined(_MSC_VER) -# define NODE_DEPRECATED(message, declarator) \ - __declspec(deprecated) declarator -# else -# define NODE_DEPRECATED(message, declarator) declarator -# endif -#endif - -// Forward-declare libuv loop -struct uv_loop_s; - -struct napi_module; - -// Forward-declare these functions now to stop MSVS from becoming -// terminally confused when it's done in node_internals.h -namespace node { - -namespace tracing { - -class TracingController; - -} - -NODE_EXTERN v8::Local ErrnoException(v8::Isolate* isolate, - int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr); -NODE_EXTERN v8::Local UVException(v8::Isolate* isolate, - int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr, - const char* dest = nullptr); - -NODE_DEPRECATED("Use ErrnoException(isolate, ...)", - inline v8::Local ErrnoException( - int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr) { - return ErrnoException(v8::Isolate::GetCurrent(), - errorno, - syscall, - message, - path); -}) - -NODE_DEPRECATED("Use UVException(isolate, ...)", - inline v8::Local UVException(int errorno, - const char* syscall = nullptr, - const char* message = nullptr, - const char* path = nullptr) { - return UVException(v8::Isolate::GetCurrent(), - errorno, - syscall, - message, - path); -}) - -/* - * These methods need to be called in a HandleScope. - * - * It is preferred that you use the `MakeCallback` overloads taking - * `async_context` arguments. - */ - -NODE_DEPRECATED("Use MakeCallback(..., async_context)", - NODE_EXTERN v8::Local MakeCallback( - v8::Isolate* isolate, - v8::Local recv, - const char* method, - int argc, - v8::Local* argv)); -NODE_DEPRECATED("Use MakeCallback(..., async_context)", - NODE_EXTERN v8::Local MakeCallback( - v8::Isolate* isolate, - v8::Local recv, - v8::Local symbol, - int argc, - v8::Local* argv)); -NODE_DEPRECATED("Use MakeCallback(..., async_context)", - NODE_EXTERN v8::Local MakeCallback( - v8::Isolate* isolate, - v8::Local recv, - v8::Local callback, - int argc, - v8::Local* argv)); - -} // namespace node - -#include -#include - -#ifndef NODE_STRINGIFY -# define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) -# define NODE_STRINGIFY_HELPER(n) #n -#endif - -#ifdef _WIN32 -#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_ -# define _SSIZE_T_DEFINED -#endif -#else // !_WIN32 -# include // size_t, ssize_t -#endif // _WIN32 - - -namespace node { - -class IsolateData; -class Environment; - -namespace ProcessFlags { -enum Flags : uint64_t { - kNoFlags = 0, - // Enable stdio inheritance, which is disabled by default. - kEnableStdioInheritance = 1 << 0, - // Disable reading the NODE_OPTIONS environment variable. - kDisableNodeOptionsEnv = 1 << 1, - // Do not parse CLI options. - kDisableCLIOptions = 1 << 2, - // Do not initialize ICU. - kNoICU = 1 << 3, -}; -} // namespace ProcessFlags - -// TODO(addaleax): Officially deprecate this and replace it with something -// better suited for a public embedder API. -NODE_EXTERN int Start(int argc, char* argv[]); - -// Tear down Node.js while it is running (there are active handles -// in the loop and / or actively executing JavaScript code). -NODE_EXTERN int Stop(Environment* env); - -// Set up per-process state needed to run Node.js. This will consume arguments -// from argv, fill exec_argv, and possibly add errors resulting from parsing -// the arguments to `errors`. The return value is a suggested exit code for the -// program; If it is 0, then initializing Node.js succeeded. -NODE_EXTERN int InitializeNodeWithArgs( - std::vector* argv, - std::vector* exec_argv, - std::vector* errors); -// TODO(zcbenz): Turn above overloaded version into below's default argument. -NODE_EXTERN int InitializeNodeWithArgs( - std::vector* argv, - std::vector* exec_argv, - std::vector* errors, - ProcessFlags::Flags flags); - -enum OptionEnvvarSettings { - kAllowedInEnvironment, - kDisallowedInEnvironment -}; - -NODE_EXTERN int ProcessGlobalArgs(std::vector* args, - std::vector* exec_args, - std::vector* errors, - OptionEnvvarSettings settings); - -class NodeArrayBufferAllocator; - -// An ArrayBuffer::Allocator class with some Node.js-specific tweaks. If you do -// not have to use another allocator, using this class is recommended: -// - It supports Buffer.allocUnsafe() and Buffer.allocUnsafeSlow() with -// uninitialized memory. -// - It supports transferring, rather than copying, ArrayBuffers when using -// MessagePorts. -class NODE_EXTERN ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - public: - // If `always_debug` is true, create an ArrayBuffer::Allocator instance - // that performs additional integrity checks (e.g. make sure that only memory - // that was allocated by the it is also freed by it). - // This can also be set using the --debug-arraybuffer-allocations flag. - static std::unique_ptr Create( - bool always_debug = false); - - private: - virtual NodeArrayBufferAllocator* GetImpl() = 0; - - friend class IsolateData; -}; - -// Legacy equivalents for ArrayBufferAllocator::Create(). -NODE_EXTERN ArrayBufferAllocator* CreateArrayBufferAllocator(); -NODE_EXTERN void FreeArrayBufferAllocator(ArrayBufferAllocator* allocator); - -class NODE_EXTERN IsolatePlatformDelegate { - public: - virtual std::shared_ptr GetForegroundTaskRunner() = 0; - virtual bool IdleTasksEnabled() = 0; -}; - -class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { - public: - ~MultiIsolatePlatform() override = default; - // Returns true if work was dispatched or executed. New tasks that are - // posted during flushing of the queue are postponed until the next - // flushing. - virtual bool FlushForegroundTasks(v8::Isolate* isolate) = 0; - virtual void DrainTasks(v8::Isolate* isolate) = 0; - - // This needs to be called between the calls to `Isolate::Allocate()` and - // `Isolate::Initialize()`, so that initialization can already start - // using the platform. - // When using `NewIsolate()`, this is taken care of by that function. - // This function may only be called once per `Isolate`. - virtual void RegisterIsolate(v8::Isolate* isolate, - struct uv_loop_s* loop) = 0; - // This method can be used when an application handles task scheduling on its - // own through `IsolatePlatformDelegate`. Upon registering an isolate with - // this overload any other method in this class with the exception of - // `UnregisterIsolate` *must not* be used on that isolate. - virtual void RegisterIsolate(v8::Isolate* isolate, - IsolatePlatformDelegate* delegate) = 0; - - // This function may only be called once per `Isolate`, and discard any - // pending delayed tasks scheduled for that isolate. - // This needs to be called right before calling `Isolate::Dispose()`. - virtual void UnregisterIsolate(v8::Isolate* isolate) = 0; - - // The platform should call the passed function once all state associated - // with the given isolate has been cleaned up. This can, but does not have to, - // happen asynchronously. - virtual void AddIsolateFinishedCallback(v8::Isolate* isolate, - void (*callback)(void*), - void* data) = 0; - - static std::unique_ptr Create( - int thread_pool_size, - v8::TracingController* tracing_controller = nullptr); -}; - -enum IsolateSettingsFlags { - MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0, - DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1, - SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2, - SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3 -}; - -struct IsolateSettings { - uint64_t flags = MESSAGE_LISTENER_WITH_ERROR_LEVEL | - DETAILED_SOURCE_POSITIONS_FOR_PROFILING; - v8::MicrotasksPolicy policy = v8::MicrotasksPolicy::kExplicit; - - // Error handling callbacks - v8::Isolate::AbortOnUncaughtExceptionCallback - should_abort_on_uncaught_exception_callback = nullptr; - v8::FatalErrorCallback fatal_error_callback = nullptr; - v8::PrepareStackTraceCallback prepare_stack_trace_callback = nullptr; - - // Miscellaneous callbacks - v8::PromiseRejectCallback promise_reject_callback = nullptr; - v8::AllowWasmCodeGenerationCallback - allow_wasm_code_generation_callback = nullptr; -}; - -// Overriding IsolateSettings may produce unexpected behavior -// in Node.js core functionality, so proceed at your own risk. -NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate, - const IsolateSettings& settings); - -// Set a number of callbacks for the `isolate`, in particular the Node.js -// uncaught exception listener. -NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate); - -// Creates a new isolate with Node.js-specific settings. -// This is a convenience method equivalent to using SetIsolateCreateParams(), -// Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(), -// Isolate::Initialize(), and SetIsolateUpForNode(). -NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator, - struct uv_loop_s* event_loop, - MultiIsolatePlatform* platform = nullptr); -NODE_EXTERN v8::Isolate* NewIsolate( - std::shared_ptr allocator, - struct uv_loop_s* event_loop, - MultiIsolatePlatform* platform); - -// Creates a new context with Node.js-specific tweaks. -NODE_EXTERN v8::Local NewContext( - v8::Isolate* isolate, - v8::Local object_template = - v8::Local()); - -// Runs Node.js-specific tweaks on an already constructed context -// Return value indicates success of operation -NODE_EXTERN bool InitializeContext(v8::Local context); - -// If `platform` is passed, it will be used to register new Worker instances. -// It can be `nullptr`, in which case creating new Workers inside of -// Environments that use this `IsolateData` will not work. -NODE_EXTERN IsolateData* CreateIsolateData( - v8::Isolate* isolate, - struct uv_loop_s* loop, - MultiIsolatePlatform* platform = nullptr, - ArrayBufferAllocator* allocator = nullptr); -NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data); - -struct ThreadId { - uint64_t id = static_cast(-1); -}; -NODE_EXTERN ThreadId AllocateEnvironmentThreadId(); - -namespace EnvironmentFlags { -enum Flags : uint64_t { - kNoFlags = 0, - // Use the default behaviour for Node.js instances. - kDefaultFlags = 1 << 0, - // Controls whether this Environment is allowed to affect per-process state - // (e.g. cwd, process title, uid, etc.). - // This is set when using kDefaultFlags. - kOwnsProcessState = 1 << 1, - // Set if this Environment instance is associated with the global inspector - // handling code (i.e. listening on SIGUSR1). - // This is set when using kDefaultFlags. - kOwnsInspector = 1 << 2, - // Set if Node.js should not run its own esm loader. This is needed by some - // embedders, because it's possible for the Node.js esm loader to conflict - // with another one in an embedder environment, e.g. Blink's in Chromium. - kNoRegisterESMLoader = 1 << 3, - // Set this flag to make Node.js track "raw" file descriptors, i.e. managed - // by fs.open() and fs.close(), and close them during FreeEnvironment(). - kTrackUnmanagedFds = 1 << 4, - // Set this flag to force hiding console windows when spawning child - // processes. This is usually used when embedding Node.js in GUI programs on - // Windows. - kHideConsoleWindows = 1 << 5, - // Set this flag to disable loading native addons via `process.dlopen`. - // This environment flag is especially important for worker threads - // so that a worker thread can't load a native addon even if `execArgv` - // is overwritten and `--no-addons` is not specified but was specified - // for this Environment instance. - kNoNativeAddons = 1 << 6, - // Set this flag to disable searching modules from global paths like - // $HOME/.node_modules and $NODE_PATH. This is used by standalone apps that - // do not expect to have their behaviors changed because of globally - // installed modules. - kNoGlobalSearchPaths = 1 << 7, - // Controls whether or not the Environment should call V8Inspector::create(). - // This control is needed by embedders who may not want to initialize the V8 - // inspector in situations where one has already been created, - // e.g. Blink's in Chromium. - kNoCreateInspector = 1 << 9 -}; -} // namespace EnvironmentFlags - -struct InspectorParentHandle { - virtual ~InspectorParentHandle(); -}; - -// TODO(addaleax): Maybe move per-Environment options parsing here. -// Returns nullptr when the Environment cannot be created e.g. there are -// pending JavaScript exceptions. -NODE_EXTERN Environment* CreateEnvironment( - IsolateData* isolate_data, - v8::Local context, - const std::vector& args, - const std::vector& exec_args, - EnvironmentFlags::Flags flags = EnvironmentFlags::kDefaultFlags, - ThreadId thread_id = {} /* allocates a thread id automatically */, - std::unique_ptr inspector_parent_handle = {}); - -// Returns a handle that can be passed to `LoadEnvironment()`, making the -// child Environment accessible to the inspector as if it were a Node.js Worker. -// `child_thread_id` can be created using `AllocateEnvironmentThreadId()` -// and then later passed on to `CreateEnvironment()` to create the child -// Environment, together with the inspector handle. -// This method should not be called while the parent Environment is active -// on another thread. -NODE_EXTERN std::unique_ptr GetInspectorParentHandle( - Environment* parent_env, - ThreadId child_thread_id, - const char* child_url); - -struct StartExecutionCallbackInfo { - v8::Local process_object; - v8::Local native_require; -}; - -using StartExecutionCallback = - std::function(const StartExecutionCallbackInfo&)>; - -NODE_EXTERN v8::MaybeLocal LoadEnvironment( - Environment* env, - StartExecutionCallback cb); -NODE_EXTERN v8::MaybeLocal LoadEnvironment( - Environment* env, - const char* main_script_source_utf8); -NODE_EXTERN void FreeEnvironment(Environment* env); - -// Set a callback that is called when process.exit() is called from JS, -// overriding the default handler. -// It receives the Environment* instance and the exit code as arguments. -// This could e.g. call Stop(env); in order to terminate execution and stop -// the event loop. -// The default handler disposes of the global V8 platform instance, if one is -// being used, and calls exit(). -NODE_EXTERN void SetProcessExitHandler( - Environment* env, - std::function&& handler); -NODE_EXTERN void DefaultProcessExitHandler(Environment* env, int exit_code); - -// This may return nullptr if context is not associated with a Node instance. -NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local context); -NODE_EXTERN IsolateData* GetEnvironmentIsolateData(Environment* env); -NODE_EXTERN ArrayBufferAllocator* GetArrayBufferAllocator(IsolateData* data); - -NODE_EXTERN void OnFatalError(const char* location, const char* message); -NODE_EXTERN void PromiseRejectCallback(v8::PromiseRejectMessage message); -NODE_EXTERN bool AllowWasmCodeGenerationCallback(v8::Local context, - v8::Local); -NODE_EXTERN bool ShouldAbortOnUncaughtException(v8::Isolate* isolate); -NODE_EXTERN v8::MaybeLocal PrepareStackTraceCallback( - v8::Local context, - v8::Local exception, - v8::Local trace); - -// This returns the MultiIsolatePlatform used for an Environment or IsolateData -// instance, if one exists. -NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env); -NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env); - -NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead", - NODE_EXTERN MultiIsolatePlatform* CreatePlatform( - int thread_pool_size, - v8::TracingController* tracing_controller)); -NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead", - NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform)); - -// Get/set the currently active tracing controller. Using CreatePlatform() -// will implicitly set this by default. This is global and should be initialized -// along with the v8::Platform instance that is being used. `controller` -// is allowed to be `nullptr`. -// This is used for tracing events from Node.js itself. V8 uses the tracing -// controller returned from the active `v8::Platform` instance. -NODE_EXTERN v8::TracingController* GetTracingController(); -NODE_EXTERN void SetTracingController(v8::TracingController* controller); - -// Run `process.emit('beforeExit')` as it would usually happen when Node.js is -// run in standalone mode. -NODE_EXTERN v8::Maybe EmitProcessBeforeExit(Environment* env); -NODE_DEPRECATED("Use Maybe version (EmitProcessBeforeExit) instead", - NODE_EXTERN void EmitBeforeExit(Environment* env)); -// Run `process.emit('exit')` as it would usually happen when Node.js is run -// in standalone mode. The return value corresponds to the exit code. -NODE_EXTERN v8::Maybe EmitProcessExit(Environment* env); -NODE_DEPRECATED("Use Maybe version (EmitProcessExit) instead", - NODE_EXTERN int EmitExit(Environment* env)); - -// Runs hooks added through `AtExit()`. This is part of `FreeEnvironment()`, -// so calling it manually is typically not necessary. -NODE_EXTERN void RunAtExit(Environment* env); - -// This may return nullptr if the current v8::Context is not associated -// with a Node instance. -NODE_EXTERN struct uv_loop_s* GetCurrentEventLoop(v8::Isolate* isolate); - -// Runs the main loop for a given Environment. This roughly performs the -// following steps: -// 1. Call uv_run() on the event loop until it is drained. -// 2. Call platform->DrainTasks() on the associated platform/isolate. -// 3. If the event loop is alive again, go to Step 1. -// 4. Call EmitProcessBeforeExit(). -// 5. If the event loop is alive again, go to Step 1. -// 6. Call EmitProcessExit() and forward the return value. -// If at any point node::Stop() is called, the function will attempt to return -// as soon as possible, returning an empty `Maybe`. -// This function only works if `env` has an associated `MultiIsolatePlatform`. -NODE_EXTERN v8::Maybe SpinEventLoop(Environment* env); - -class NODE_EXTERN CommonEnvironmentSetup { - public: - ~CommonEnvironmentSetup(); - - // Create a new CommonEnvironmentSetup, that is, a group of objects that - // together form the typical setup for a single Node.js Environment instance. - // If any error occurs, `*errors` will be populated and the returned pointer - // will be empty. - // env_args will be passed through as arguments to CreateEnvironment(), after - // `isolate_data` and `context`. - template - static std::unique_ptr Create( - MultiIsolatePlatform* platform, - std::vector* errors, - EnvironmentArgs&&... env_args); - - struct uv_loop_s* event_loop() const; - std::shared_ptr array_buffer_allocator() const; - v8::Isolate* isolate() const; - IsolateData* isolate_data() const; - Environment* env() const; - v8::Local context() const; - - CommonEnvironmentSetup(const CommonEnvironmentSetup&) = delete; - CommonEnvironmentSetup& operator=(const CommonEnvironmentSetup&) = delete; - CommonEnvironmentSetup(CommonEnvironmentSetup&&) = delete; - CommonEnvironmentSetup& operator=(CommonEnvironmentSetup&&) = delete; - - private: - struct Impl; - Impl* impl_; - CommonEnvironmentSetup( - MultiIsolatePlatform*, - std::vector*, - std::function); -}; - -// Implementation for CommonEnvironmentSetup::Create -template -std::unique_ptr CommonEnvironmentSetup::Create( - MultiIsolatePlatform* platform, - std::vector* errors, - EnvironmentArgs&&... env_args) { - auto ret = std::unique_ptr(new CommonEnvironmentSetup( - platform, errors, - [&](const CommonEnvironmentSetup* setup) -> Environment* { - return CreateEnvironment( - setup->isolate_data(), setup->context(), - std::forward(env_args)...); - })); - if (!errors->empty()) ret.reset(); - return ret; -} - -/* Converts a unixtime to V8 Date */ -NODE_DEPRECATED("Use v8::Date::New() directly", - inline v8::Local NODE_UNIXTIME_V8(double time) { - return v8::Date::New( - v8::Isolate::GetCurrent()->GetCurrentContext(), - 1000 * time) - .ToLocalChecked(); - }) -#define NODE_UNIXTIME_V8 node::NODE_UNIXTIME_V8 -NODE_DEPRECATED("Use v8::Date::ValueOf() directly", - inline double NODE_V8_UNIXTIME(v8::Local date) { - return date->ValueOf() / 1000; -}) -#define NODE_V8_UNIXTIME node::NODE_V8_UNIXTIME - -#define NODE_DEFINE_CONSTANT(target, constant) \ - do { \ - v8::Isolate* isolate = target->GetIsolate(); \ - v8::Local context = isolate->GetCurrentContext(); \ - v8::Local constant_name = \ - v8::String::NewFromUtf8(isolate, #constant, \ - v8::NewStringType::kInternalized).ToLocalChecked(); \ - v8::Local constant_value = \ - v8::Number::New(isolate, static_cast(constant)); \ - v8::PropertyAttribute constant_attributes = \ - static_cast(v8::ReadOnly | v8::DontDelete); \ - (target)->DefineOwnProperty(context, \ - constant_name, \ - constant_value, \ - constant_attributes).Check(); \ - } \ - while (0) - -#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \ - do { \ - v8::Isolate* isolate = target->GetIsolate(); \ - v8::Local context = isolate->GetCurrentContext(); \ - v8::Local constant_name = \ - v8::String::NewFromUtf8(isolate, #constant, \ - v8::NewStringType::kInternalized) \ - .ToLocalChecked(); \ - v8::Local constant_value = \ - v8::Number::New(isolate, static_cast(constant)); \ - v8::PropertyAttribute constant_attributes = \ - static_cast(v8::ReadOnly | \ - v8::DontDelete | \ - v8::DontEnum); \ - (target)->DefineOwnProperty(context, \ - constant_name, \ - constant_value, \ - constant_attributes).Check(); \ - } \ - while (0) - -// Used to be a macro, hence the uppercase name. -inline void NODE_SET_METHOD(v8::Local recv, - const char* name, - v8::FunctionCallback callback) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); - v8::Local t = v8::FunctionTemplate::New(isolate, - callback); - v8::Local fn_name = v8::String::NewFromUtf8(isolate, name, - v8::NewStringType::kInternalized).ToLocalChecked(); - t->SetClassName(fn_name); - recv->Set(fn_name, t); -} - -// Used to be a macro, hence the uppercase name. -inline void NODE_SET_METHOD(v8::Local recv, - const char* name, - v8::FunctionCallback callback) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local t = v8::FunctionTemplate::New(isolate, - callback); - v8::Local fn = t->GetFunction(context).ToLocalChecked(); - v8::Local fn_name = v8::String::NewFromUtf8(isolate, name, - v8::NewStringType::kInternalized).ToLocalChecked(); - fn->SetName(fn_name); - recv->Set(context, fn_name, fn).Check(); -} -#define NODE_SET_METHOD node::NODE_SET_METHOD - -// Used to be a macro, hence the uppercase name. -// Not a template because it only makes sense for FunctionTemplates. -inline void NODE_SET_PROTOTYPE_METHOD(v8::Local recv, - const char* name, - v8::FunctionCallback callback) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); - v8::Local s = v8::Signature::New(isolate, recv); - v8::Local t = - v8::FunctionTemplate::New(isolate, callback, v8::Local(), s); - v8::Local fn_name = v8::String::NewFromUtf8(isolate, name, - v8::NewStringType::kInternalized).ToLocalChecked(); - t->SetClassName(fn_name); - recv->PrototypeTemplate()->Set(fn_name, t); -} -#define NODE_SET_PROTOTYPE_METHOD node::NODE_SET_PROTOTYPE_METHOD - -// BINARY is a deprecated alias of LATIN1. -// BASE64URL is not currently exposed to the JavaScript side. -enum encoding { - ASCII, - UTF8, - BASE64, - UCS2, - BINARY, - HEX, - BUFFER, - BASE64URL, - LATIN1 = BINARY -}; - -NODE_EXTERN enum encoding ParseEncoding( - v8::Isolate* isolate, - v8::Local encoding_v, - enum encoding default_encoding = LATIN1); - -NODE_EXTERN void FatalException(v8::Isolate* isolate, - const v8::TryCatch& try_catch); - -NODE_EXTERN v8::Local Encode(v8::Isolate* isolate, - const char* buf, - size_t len, - enum encoding encoding = LATIN1); - -// Warning: This reverses endianness on Big Endian platforms, even though the -// signature using uint16_t implies that it should not. -NODE_EXTERN v8::Local Encode(v8::Isolate* isolate, - const uint16_t* buf, - size_t len); - -// Returns -1 if the handle was not valid for decoding -NODE_EXTERN ssize_t DecodeBytes(v8::Isolate* isolate, - v8::Local, - enum encoding encoding = LATIN1); -// returns bytes written. -NODE_EXTERN ssize_t DecodeWrite(v8::Isolate* isolate, - char* buf, - size_t buflen, - v8::Local, - enum encoding encoding = LATIN1); -#ifdef _WIN32 -NODE_EXTERN v8::Local WinapiErrnoException( - v8::Isolate* isolate, - int errorno, - const char* syscall = nullptr, - const char* msg = "", - const char* path = nullptr); -#endif - -const char* signo_string(int errorno); - - -typedef void (*addon_register_func)( - v8::Local exports, - v8::Local module, - void* priv); - -typedef void (*addon_context_register_func)( - v8::Local exports, - v8::Local module, - v8::Local context, - void* priv); - -enum ModuleFlags { - kLinked = 0x02 -}; - -struct node_module { - int nm_version; - unsigned int nm_flags; - void* nm_dso_handle; - const char* nm_filename; - node::addon_register_func nm_register_func; - node::addon_context_register_func nm_context_register_func; - const char* nm_modname; - void* nm_priv; - struct node_module* nm_link; -}; - -extern "C" NODE_EXTERN void node_module_register(void* mod); - -#ifdef _WIN32 -# define NODE_MODULE_EXPORT __declspec(dllexport) -#else -# define NODE_MODULE_EXPORT __attribute__((visibility("default"))) -#endif - -#ifdef NODE_SHARED_MODE -# define NODE_CTOR_PREFIX -#else -# define NODE_CTOR_PREFIX static -#endif - -#if defined(_MSC_VER) -#pragma section(".CRT$XCU", read) -#define NODE_C_CTOR(fn) \ - NODE_CTOR_PREFIX void __cdecl fn(void); \ - __declspec(dllexport, allocate(".CRT$XCU")) \ - void (__cdecl*fn ## _)(void) = fn; \ - NODE_CTOR_PREFIX void __cdecl fn(void) -#else -#define NODE_C_CTOR(fn) \ - NODE_CTOR_PREFIX void fn(void) __attribute__((constructor)); \ - NODE_CTOR_PREFIX void fn(void) -#endif - -#define NODE_MODULE_X(modname, regfunc, priv, flags) \ - extern "C" { \ - static node::node_module _module = \ - { \ - NODE_MODULE_VERSION, \ - flags, \ - NULL, /* NOLINT (readability/null_usage) */ \ - __FILE__, \ - (node::addon_register_func) (regfunc), \ - NULL, /* NOLINT (readability/null_usage) */ \ - NODE_STRINGIFY(modname), \ - priv, \ - NULL /* NOLINT (readability/null_usage) */ \ - }; \ - NODE_C_CTOR(_register_ ## modname) { \ - node_module_register(&_module); \ - } \ - } - -#define NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, priv, flags) \ - extern "C" { \ - static node::node_module _module = \ - { \ - NODE_MODULE_VERSION, \ - flags, \ - NULL, /* NOLINT (readability/null_usage) */ \ - __FILE__, \ - NULL, /* NOLINT (readability/null_usage) */ \ - (node::addon_context_register_func) (regfunc), \ - NODE_STRINGIFY(modname), \ - priv, \ - NULL /* NOLINT (readability/null_usage) */ \ - }; \ - NODE_C_CTOR(_register_ ## modname) { \ - node_module_register(&_module); \ - } \ - } - -// Usage: `NODE_MODULE(NODE_GYP_MODULE_NAME, InitializerFunction)` -// If no NODE_MODULE is declared, Node.js looks for the well-known -// symbol `node_register_module_v${NODE_MODULE_VERSION}`. -#define NODE_MODULE(modname, regfunc) \ - NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) - -#define NODE_MODULE_CONTEXT_AWARE(modname, regfunc) \ - /* NOLINTNEXTLINE (readability/null_usage) */ \ - NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0) - -// Embedders can use this type of binding for statically linked native bindings. -// It is used the same way addon bindings are used, except that linked bindings -// can be accessed through `process._linkedBinding(modname)`. -#define NODE_MODULE_LINKED(modname, regfunc) \ - /* NOLINTNEXTLINE (readability/null_usage) */ \ - NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, \ - node::ModuleFlags::kLinked) - -/* - * For backward compatibility in add-on modules. - */ -#define NODE_MODULE_DECL /* nothing */ - -#define NODE_MODULE_INITIALIZER_BASE node_register_module_v - -#define NODE_MODULE_INITIALIZER_X(base, version) \ - NODE_MODULE_INITIALIZER_X_HELPER(base, version) - -#define NODE_MODULE_INITIALIZER_X_HELPER(base, version) base##version - -#define NODE_MODULE_INITIALIZER \ - NODE_MODULE_INITIALIZER_X(NODE_MODULE_INITIALIZER_BASE, \ - NODE_MODULE_VERSION) - -#define NODE_MODULE_INIT() \ - extern "C" NODE_MODULE_EXPORT void \ - NODE_MODULE_INITIALIZER(v8::Local exports, \ - v8::Local module, \ - v8::Local context); \ - NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME, \ - NODE_MODULE_INITIALIZER) \ - void NODE_MODULE_INITIALIZER(v8::Local exports, \ - v8::Local module, \ - v8::Local context) - -// Allows embedders to add a binding to the current Environment* that can be -// accessed through process._linkedBinding() in the target Environment and all -// Worker threads that it creates. -// In each variant, the registration function needs to be usable at least for -// the time during which the Environment exists. -NODE_EXTERN void AddLinkedBinding(Environment* env, const node_module& mod); -NODE_EXTERN void AddLinkedBinding(Environment* env, - const struct napi_module& mod); -NODE_EXTERN void AddLinkedBinding(Environment* env, - const char* name, - addon_context_register_func fn, - void* priv); - -/* Registers a callback with the passed-in Environment instance. The callback - * is called after the event loop exits, but before the VM is disposed. - * Callbacks are run in reverse order of registration, i.e. newest first. - */ -NODE_EXTERN void AtExit(Environment* env, - void (*cb)(void* arg), - void* arg); - -typedef double async_id; -struct async_context { - ::node::async_id async_id; - ::node::async_id trigger_async_id; -}; - -/* This is a lot like node::AtExit, except that the hooks added via this - * function are run before the AtExit ones and will always be registered - * for the current Environment instance. - * These functions are safe to use in an addon supporting multiple - * threads/isolates. */ -NODE_EXTERN void AddEnvironmentCleanupHook(v8::Isolate* isolate, - void (*fun)(void* arg), - void* arg); - -NODE_EXTERN void RemoveEnvironmentCleanupHook(v8::Isolate* isolate, - void (*fun)(void* arg), - void* arg); - -/* These are async equivalents of the above. After the cleanup hook is invoked, - * `cb(cbarg)` *must* be called, and attempting to remove the cleanup hook will - * have no effect. */ -struct ACHHandle; -struct NODE_EXTERN DeleteACHHandle { void operator()(ACHHandle*) const; }; -typedef std::unique_ptr AsyncCleanupHookHandle; - -/* This function is not intended to be used externally, it exists to aid in - * keeping ABI compatibility between Node and Electron. */ -NODE_EXTERN ACHHandle* AddEnvironmentCleanupHookInternal( - v8::Isolate* isolate, - void (*fun)(void* arg, void (*cb)(void*), void* cbarg), - void* arg); -inline AsyncCleanupHookHandle AddEnvironmentCleanupHook( - v8::Isolate* isolate, - void (*fun)(void* arg, void (*cb)(void*), void* cbarg), - void* arg) { - return AsyncCleanupHookHandle(AddEnvironmentCleanupHookInternal(isolate, fun, - arg)); -} - -/* This function is not intended to be used externally, it exists to aid in - * keeping ABI compatibility between Node and Electron. */ -NODE_EXTERN void RemoveEnvironmentCleanupHookInternal(ACHHandle* holder); -inline void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder) { - RemoveEnvironmentCleanupHookInternal(holder.get()); -} - -/* Returns the id of the current execution context. If the return value is - * zero then no execution has been set. This will happen if the user handles - * I/O from native code. */ -NODE_EXTERN async_id AsyncHooksGetExecutionAsyncId(v8::Isolate* isolate); - -/* Return same value as async_hooks.triggerAsyncId(); */ -NODE_EXTERN async_id AsyncHooksGetTriggerAsyncId(v8::Isolate* isolate); - -/* If the native API doesn't inherit from the helper class then the callbacks - * must be triggered manually. This triggers the init() callback. The return - * value is the async id assigned to the resource. - * - * The `trigger_async_id` parameter should correspond to the resource which is - * creating the new resource, which will usually be the return value of - * `AsyncHooksGetTriggerAsyncId()`. */ -NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate, - v8::Local resource, - const char* name, - async_id trigger_async_id = -1); - -NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate, - v8::Local resource, - v8::Local name, - async_id trigger_async_id = -1); - -/* Emit the destroy() callback. The overload taking an `Environment*` argument - * should be used when the Isolate’s current Context is not associated with - * a Node.js Environment, or when there is no current Context, for example - * when calling this function during garbage collection. In that case, the - * `Environment*` value should have been acquired previously, e.g. through - * `GetCurrentEnvironment()`. */ -NODE_EXTERN void EmitAsyncDestroy(v8::Isolate* isolate, - async_context asyncContext); -NODE_EXTERN void EmitAsyncDestroy(Environment* env, - async_context asyncContext); - -class InternalCallbackScope; - -/* This class works like `MakeCallback()` in that it sets up a specific - * asyncContext as the current one and informs the async_hooks and domains - * modules that this context is currently active. - * - * `MakeCallback()` is a wrapper around this class as well as - * `Function::Call()`. Either one of these mechanisms needs to be used for - * top-level calls into JavaScript (i.e. without any existing JS stack). - * - * This object should be stack-allocated to ensure that it is contained in a - * valid HandleScope. - * - * Exceptions happening within this scope will be treated like uncaught - * exceptions. If this behaviour is undesirable, a new `v8::TryCatch` scope - * needs to be created inside of this scope. - */ -class NODE_EXTERN CallbackScope { - public: - CallbackScope(v8::Isolate* isolate, - v8::Local resource, - async_context asyncContext); - CallbackScope(Environment* env, - v8::Local resource, - async_context asyncContext); - ~CallbackScope(); - - void operator=(const CallbackScope&) = delete; - void operator=(CallbackScope&&) = delete; - CallbackScope(const CallbackScope&) = delete; - CallbackScope(CallbackScope&&) = delete; - - private: - InternalCallbackScope* private_; - v8::TryCatch try_catch_; -}; - -/* An API specific to emit before/after callbacks is unnecessary because - * MakeCallback will automatically call them for you. - * - * These methods may create handles on their own, so run them inside a - * HandleScope. - * - * `asyncId` and `triggerAsyncId` should correspond to the values returned by - * `EmitAsyncInit()` and `AsyncHooksGetTriggerAsyncId()`, respectively, when the - * invoking resource was created. If these values are unknown, 0 can be passed. - * */ -NODE_EXTERN -v8::MaybeLocal MakeCallback(v8::Isolate* isolate, - v8::Local recv, - v8::Local callback, - int argc, - v8::Local* argv, - async_context asyncContext); -NODE_EXTERN -v8::MaybeLocal MakeCallback(v8::Isolate* isolate, - v8::Local recv, - const char* method, - int argc, - v8::Local* argv, - async_context asyncContext); -NODE_EXTERN -v8::MaybeLocal MakeCallback(v8::Isolate* isolate, - v8::Local recv, - v8::Local symbol, - int argc, - v8::Local* argv, - async_context asyncContext); - -/* Helper class users can optionally inherit from. If - * `AsyncResource::MakeCallback()` is used, then all four callbacks will be - * called automatically. */ -class NODE_EXTERN AsyncResource { - public: - AsyncResource(v8::Isolate* isolate, - v8::Local resource, - const char* name, - async_id trigger_async_id = -1); - - virtual ~AsyncResource(); - - AsyncResource(const AsyncResource&) = delete; - void operator=(const AsyncResource&) = delete; - - v8::MaybeLocal MakeCallback( - v8::Local callback, - int argc, - v8::Local* argv); - - v8::MaybeLocal MakeCallback( - const char* method, - int argc, - v8::Local* argv); - - v8::MaybeLocal MakeCallback( - v8::Local symbol, - int argc, - v8::Local* argv); - - v8::Local get_resource(); - async_id get_async_id() const; - async_id get_trigger_async_id() const; - - protected: - class NODE_EXTERN CallbackScope : public node::CallbackScope { - public: - explicit CallbackScope(AsyncResource* res); - }; - - private: - Environment* env_; - v8::Global resource_; - async_context async_context_; -}; - -#ifndef _WIN32 -// Register a signal handler without interrupting any handlers that node -// itself needs. This does override handlers registered through -// process.on('SIG...', function() { ... }). The `reset_handler` flag indicates -// whether the signal handler for the given signal should be reset to its -// default value before executing the handler (i.e. it works like SA_RESETHAND). -// The `reset_handler` flag is invalid when `signal` is SIGSEGV. -NODE_EXTERN -void RegisterSignalHandler(int signal, - void (*handler)(int signal, - siginfo_t* info, - void* ucontext), - bool reset_handler = false); -#endif // _WIN32 - -} // namespace node - -#endif // SRC_NODE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_api.h b/repo/packages/s/scriptx-legacy/include/libnode/node_api.h deleted file mode 100644 index 1772c67c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_api.h +++ /dev/null @@ -1,275 +0,0 @@ -#ifndef SRC_NODE_API_H_ -#define SRC_NODE_API_H_ - -#ifdef BUILDING_NODE_EXTENSION - #ifdef _WIN32 - // Building native module against node - #define NAPI_EXTERN __declspec(dllimport) - #elif defined(__wasm32__) - #define NAPI_EXTERN __attribute__((__import_module__("napi"))) - #endif -#endif -#include "js_native_api.h" -#include "node_api_types.h" - -struct uv_loop_s; // Forward declaration. - -#ifdef _WIN32 -# define NAPI_MODULE_EXPORT __declspec(dllexport) -#else -# define NAPI_MODULE_EXPORT __attribute__((visibility("default"))) -#endif - -#if defined(__GNUC__) -# define NAPI_NO_RETURN __attribute__((noreturn)) -#elif defined(_WIN32) -# define NAPI_NO_RETURN __declspec(noreturn) -#else -# define NAPI_NO_RETURN -#endif - -typedef napi_value (*napi_addon_register_func)(napi_env env, - napi_value exports); - -typedef struct napi_module { - int nm_version; - unsigned int nm_flags; - const char* nm_filename; - napi_addon_register_func nm_register_func; - const char* nm_modname; - void* nm_priv; - void* reserved[4]; -} napi_module; - -#define NAPI_MODULE_VERSION 1 - -#if defined(_MSC_VER) -#pragma section(".CRT$XCU", read) -#define NAPI_C_CTOR(fn) \ - static void __cdecl fn(void); \ - __declspec(dllexport, allocate(".CRT$XCU")) void(__cdecl * fn##_)(void) = \ - fn; \ - static void __cdecl fn(void) -#else -#define NAPI_C_CTOR(fn) \ - static void fn(void) __attribute__((constructor)); \ - static void fn(void) -#endif - -#define NAPI_MODULE_X(modname, regfunc, priv, flags) \ - EXTERN_C_START \ - static napi_module _module = \ - { \ - NAPI_MODULE_VERSION, \ - flags, \ - __FILE__, \ - regfunc, \ - #modname, \ - priv, \ - {0}, \ - }; \ - NAPI_C_CTOR(_register_ ## modname) { \ - napi_module_register(&_module); \ - } \ - EXTERN_C_END - -#define NAPI_MODULE_INITIALIZER_X(base, version) \ - NAPI_MODULE_INITIALIZER_X_HELPER(base, version) -#define NAPI_MODULE_INITIALIZER_X_HELPER(base, version) base##version - -#ifdef __wasm32__ -#define NAPI_WASM_INITIALIZER \ - NAPI_MODULE_INITIALIZER_X(napi_register_wasm_v, NAPI_MODULE_VERSION) -#define NAPI_MODULE(modname, regfunc) \ - EXTERN_C_START \ - NAPI_MODULE_EXPORT napi_value NAPI_WASM_INITIALIZER(napi_env env, \ - napi_value exports) { \ - return regfunc(env, exports); \ - } \ - EXTERN_C_END -#else -#define NAPI_MODULE(modname, regfunc) \ - NAPI_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) -#endif - -#define NAPI_MODULE_INITIALIZER_BASE napi_register_module_v - -#define NAPI_MODULE_INITIALIZER \ - NAPI_MODULE_INITIALIZER_X(NAPI_MODULE_INITIALIZER_BASE, \ - NAPI_MODULE_VERSION) - -#define NAPI_MODULE_INIT() \ - EXTERN_C_START \ - NAPI_MODULE_EXPORT napi_value \ - NAPI_MODULE_INITIALIZER(napi_env env, napi_value exports); \ - EXTERN_C_END \ - NAPI_MODULE(NODE_GYP_MODULE_NAME, NAPI_MODULE_INITIALIZER) \ - napi_value NAPI_MODULE_INITIALIZER(napi_env env, \ - napi_value exports) - -EXTERN_C_START - -NAPI_EXTERN void napi_module_register(napi_module* mod); - -NAPI_EXTERN NAPI_NO_RETURN void napi_fatal_error(const char* location, - size_t location_len, - const char* message, - size_t message_len); - -// Methods for custom handling of async operations -NAPI_EXTERN napi_status napi_async_init(napi_env env, - napi_value async_resource, - napi_value async_resource_name, - napi_async_context* result); - -NAPI_EXTERN napi_status napi_async_destroy(napi_env env, - napi_async_context async_context); - -NAPI_EXTERN napi_status napi_make_callback(napi_env env, - napi_async_context async_context, - napi_value recv, - napi_value func, - size_t argc, - const napi_value* argv, - napi_value* result); - -// Methods to provide node::Buffer functionality with napi types -NAPI_EXTERN napi_status napi_create_buffer(napi_env env, - size_t length, - void** data, - napi_value* result); -NAPI_EXTERN napi_status napi_create_external_buffer(napi_env env, - size_t length, - void* data, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result); -NAPI_EXTERN napi_status napi_create_buffer_copy(napi_env env, - size_t length, - const void* data, - void** result_data, - napi_value* result); -NAPI_EXTERN napi_status napi_is_buffer(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_get_buffer_info(napi_env env, - napi_value value, - void** data, - size_t* length); - -// Methods to manage simple async operations -NAPI_EXTERN -napi_status napi_create_async_work(napi_env env, - napi_value async_resource, - napi_value async_resource_name, - napi_async_execute_callback execute, - napi_async_complete_callback complete, - void* data, - napi_async_work* result); -NAPI_EXTERN napi_status napi_delete_async_work(napi_env env, - napi_async_work work); -NAPI_EXTERN napi_status napi_queue_async_work(napi_env env, - napi_async_work work); -NAPI_EXTERN napi_status napi_cancel_async_work(napi_env env, - napi_async_work work); - -// version management -NAPI_EXTERN -napi_status napi_get_node_version(napi_env env, - const napi_node_version** version); - -#if NAPI_VERSION >= 2 - -// Return the current libuv event loop for a given environment -NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, - struct uv_loop_s** loop); - -#endif // NAPI_VERSION >= 2 - -#if NAPI_VERSION >= 3 - -NAPI_EXTERN napi_status napi_fatal_exception(napi_env env, napi_value err); - -NAPI_EXTERN napi_status napi_add_env_cleanup_hook(napi_env env, - void (*fun)(void* arg), - void* arg); - -NAPI_EXTERN napi_status napi_remove_env_cleanup_hook(napi_env env, - void (*fun)(void* arg), - void* arg); - -NAPI_EXTERN napi_status napi_open_callback_scope(napi_env env, - napi_value resource_object, - napi_async_context context, - napi_callback_scope* result); - -NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env, - napi_callback_scope scope); - -#endif // NAPI_VERSION >= 3 - -#if NAPI_VERSION >= 4 - -#ifndef __wasm32__ -// Calling into JS from other threads -NAPI_EXTERN napi_status -napi_create_threadsafe_function(napi_env env, - napi_value func, - napi_value async_resource, - napi_value async_resource_name, - size_t max_queue_size, - size_t initial_thread_count, - void* thread_finalize_data, - napi_finalize thread_finalize_cb, - void* context, - napi_threadsafe_function_call_js call_js_cb, - napi_threadsafe_function* result); - -NAPI_EXTERN napi_status -napi_get_threadsafe_function_context(napi_threadsafe_function func, - void** result); - -NAPI_EXTERN napi_status -napi_call_threadsafe_function(napi_threadsafe_function func, - void* data, - napi_threadsafe_function_call_mode is_blocking); - -NAPI_EXTERN napi_status -napi_acquire_threadsafe_function(napi_threadsafe_function func); - -NAPI_EXTERN napi_status -napi_release_threadsafe_function(napi_threadsafe_function func, - napi_threadsafe_function_release_mode mode); - -NAPI_EXTERN napi_status -napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func); - -NAPI_EXTERN napi_status -napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func); -#endif // __wasm32__ - -#endif // NAPI_VERSION >= 4 - -#if NAPI_VERSION >= 8 - -NAPI_EXTERN napi_status napi_add_async_cleanup_hook( - napi_env env, - napi_async_cleanup_hook hook, - void* arg, - napi_async_cleanup_hook_handle* remove_handle); - -NAPI_EXTERN napi_status napi_remove_async_cleanup_hook( - napi_async_cleanup_hook_handle remove_handle); - -#endif // NAPI_VERSION >= 8 - -#ifdef NAPI_EXPERIMENTAL - -NAPI_EXTERN napi_status -node_api_get_module_file_name(napi_env env, const char** result); - -#endif // NAPI_EXPERIMENTAL - -EXTERN_C_END - -#endif // SRC_NODE_API_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_api_internals.h b/repo/packages/s/scriptx-legacy/include/libnode/node_api_internals.h deleted file mode 100644 index 318ada38..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_api_internals.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef SRC_NODE_API_INTERNALS_H_ -#define SRC_NODE_API_INTERNALS_H_ - -#include "v8.h" -#define NAPI_EXPERIMENTAL -#include "env-inl.h" -#include "js_native_api_v8.h" -#include "node_api.h" -#include "util-inl.h" - -struct node_napi_env__ : public napi_env__ { - node_napi_env__(v8::Local context, - const std::string& module_filename); - - bool can_call_into_js() const override; - v8::Maybe mark_arraybuffer_as_untransferable( - v8::Local ab) const override; - void CallFinalizer(napi_finalize cb, void* data, void* hint) override; - - inline node::Environment* node_env() const { - return node::Environment::GetCurrent(context()); - } - inline const char* GetFilename() const { return filename.c_str(); } - - std::string filename; -}; - -using node_napi_env = node_napi_env__*; - -#endif // SRC_NODE_API_INTERNALS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_api_types.h b/repo/packages/s/scriptx-legacy/include/libnode/node_api_types.h deleted file mode 100644 index 58ffc61b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_api_types.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef SRC_NODE_API_TYPES_H_ -#define SRC_NODE_API_TYPES_H_ - -#include "js_native_api_types.h" - -typedef struct napi_callback_scope__* napi_callback_scope; -typedef struct napi_async_context__* napi_async_context; -typedef struct napi_async_work__* napi_async_work; -#if NAPI_VERSION >= 4 -typedef struct napi_threadsafe_function__* napi_threadsafe_function; -#endif // NAPI_VERSION >= 4 - -#if NAPI_VERSION >= 4 -typedef enum { - napi_tsfn_release, - napi_tsfn_abort -} napi_threadsafe_function_release_mode; - -typedef enum { - napi_tsfn_nonblocking, - napi_tsfn_blocking -} napi_threadsafe_function_call_mode; -#endif // NAPI_VERSION >= 4 - -typedef void (*napi_async_execute_callback)(napi_env env, - void* data); -typedef void (*napi_async_complete_callback)(napi_env env, - napi_status status, - void* data); -#if NAPI_VERSION >= 4 -typedef void (*napi_threadsafe_function_call_js)(napi_env env, - napi_value js_callback, - void* context, - void* data); -#endif // NAPI_VERSION >= 4 - -typedef struct { - uint32_t major; - uint32_t minor; - uint32_t patch; - const char* release; -} napi_node_version; - -#if NAPI_VERSION >= 8 -typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle; -typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle, - void* data); -#endif // NAPI_VERSION >= 8 - -#endif // SRC_NODE_API_TYPES_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_binding.h b/repo/packages/s/scriptx-legacy/include/libnode/node_binding.h deleted file mode 100644 index 5bced5b4..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_binding.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef SRC_NODE_BINDING_H_ -#define SRC_NODE_BINDING_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#if defined(__POSIX__) -#include -#endif - -#include "node.h" -#define NAPI_EXPERIMENTAL -#include "node_api.h" -#include "uv.h" - -enum { - NM_F_BUILTIN = 1 << 0, // Unused. - NM_F_LINKED = 1 << 1, - NM_F_INTERNAL = 1 << 2, - NM_F_DELETEME = 1 << 3, -}; - -// Make sure our internal values match the public API's values. -static_assert(static_cast(NM_F_LINKED) == - static_cast(node::ModuleFlags::kLinked), - "NM_F_LINKED != node::ModuleFlags::kLinked"); - -#define NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, priv, flags) \ - static node::node_module _module = { \ - NODE_MODULE_VERSION, \ - flags, \ - nullptr, \ - __FILE__, \ - nullptr, \ - (node::addon_context_register_func)(regfunc), \ - NODE_STRINGIFY(modname), \ - priv, \ - nullptr}; \ - void _register_##modname() { node_module_register(&_module); } - -void napi_module_register_by_symbol(v8::Local exports, - v8::Local module, - v8::Local context, - napi_addon_register_func init); - -namespace node { - -#define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc) \ - NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_INTERNAL) - -// Globals per process -// This is set by node::Init() which is used by embedders -extern bool node_is_initialized; - -namespace binding { - -class DLib { - public: -#ifdef __POSIX__ - static const int kDefaultFlags = RTLD_LAZY; -#else - static const int kDefaultFlags = 0; -#endif - - DLib(const char* filename, int flags); - - bool Open(); - void Close(); - void* GetSymbolAddress(const char* name); - void SaveInGlobalHandleMap(node_module* mp); - node_module* GetSavedModuleFromGlobalHandleMap(); - - const std::string filename_; - const int flags_; - std::string errmsg_; - void* handle_; -#ifndef __POSIX__ - uv_lib_t lib_; -#endif - bool has_entry_in_global_handle_map_ = false; - - DLib(const DLib&) = delete; - DLib& operator=(const DLib&) = delete; -}; - -// Call _register functions for all of -// the built-in modules. Because built-in modules don't -// use the __attribute__((constructor)). Need to -// explicitly call the _register* functions. -void RegisterBuiltinModules(); -void GetInternalBinding(const v8::FunctionCallbackInfo& args); -void GetLinkedBinding(const v8::FunctionCallbackInfo& args); -void DLOpen(const v8::FunctionCallbackInfo& args); - -} // namespace binding - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_BINDING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_blob.h b/repo/packages/s/scriptx-legacy/include/libnode/node_blob.h deleted file mode 100644 index 61f4da65..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_blob.h +++ /dev/null @@ -1,191 +0,0 @@ -#ifndef SRC_NODE_BLOB_H_ -#define SRC_NODE_BLOB_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "base_object.h" -#include "env.h" -#include "memory_tracker.h" -#include "node_internals.h" -#include "node_snapshotable.h" -#include "node_worker.h" -#include "v8.h" - -#include -#include -#include - -namespace node { - -struct BlobEntry { - std::shared_ptr store; - size_t length; - size_t offset; -}; - -class Blob : public BaseObject { - public: - static void RegisterExternalReferences( - ExternalReferenceRegistry* registry); - - static void Initialize( - v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - - static void New(const v8::FunctionCallbackInfo& args); - static void ToArrayBuffer(const v8::FunctionCallbackInfo& args); - static void ToSlice(const v8::FunctionCallbackInfo& args); - static void StoreDataObject(const v8::FunctionCallbackInfo& args); - static void GetDataObject(const v8::FunctionCallbackInfo& args); - static void RevokeDataObject(const v8::FunctionCallbackInfo& args); - - static v8::Local GetConstructorTemplate( - Environment* env); - - static BaseObjectPtr Create( - Environment* env, - const std::vector store, - size_t length); - - static bool HasInstance(Environment* env, v8::Local object); - - const std::vector entries() const { - return store_; - } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Blob) - SET_SELF_SIZE(Blob) - - // Copies the contents of the Blob into an ArrayBuffer. - v8::MaybeLocal GetArrayBuffer(Environment* env); - - BaseObjectPtr Slice(Environment* env, size_t start, size_t end); - - inline size_t length() const { return length_; } - - class BlobTransferData : public worker::TransferData { - public: - explicit BlobTransferData( - const std::vector& store, - size_t length) - : store_(store), - length_(length) {} - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - SET_MEMORY_INFO_NAME(BlobTransferData) - SET_SELF_SIZE(BlobTransferData) - SET_NO_MEMORY_INFO() - - private: - std::vector store_; - size_t length_ = 0; - }; - - BaseObject::TransferMode GetTransferMode() const override; - std::unique_ptr CloneForMessaging() const override; - - Blob( - Environment* env, - v8::Local obj, - const std::vector& store, - size_t length); - - private: - std::vector store_; - size_t length_ = 0; -}; - -class FixedSizeBlobCopyJob : public AsyncWrap, public ThreadPoolWork { - public: - enum class Mode { - SYNC, - ASYNC - }; - - static void RegisterExternalReferences( - ExternalReferenceRegistry* registry); - static void Initialize(Environment* env, v8::Local target); - static void New(const v8::FunctionCallbackInfo& args); - static void Run(const v8::FunctionCallbackInfo& args); - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { - return true; - } - - void DoThreadPoolWork() override; - void AfterThreadPoolWork(int status) override; - - Mode mode() const { return mode_; } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(FixedSizeBlobCopyJob) - SET_SELF_SIZE(FixedSizeBlobCopyJob) - - private: - FixedSizeBlobCopyJob( - Environment* env, - v8::Local object, - Blob* blob, - Mode mode = Mode::ASYNC); - - Mode mode_; - std::vector source_; - std::shared_ptr destination_; - size_t length_ = 0; -}; - -class BlobBindingData : public SnapshotableObject { - public: - explicit BlobBindingData(Environment* env, v8::Local wrap); - - SERIALIZABLE_OBJECT_METHODS() - - static constexpr FastStringKey type_name{"node::BlobBindingData"}; - static constexpr EmbedderObjectType type_int = - EmbedderObjectType::k_blob_binding_data; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_SELF_SIZE(BlobBindingData) - SET_MEMORY_INFO_NAME(BlobBindingData) - - struct StoredDataObject : public MemoryRetainer { - BaseObjectPtr blob; - size_t length; - std::string type; - - StoredDataObject() = default; - - StoredDataObject( - const BaseObjectPtr& blob_, - size_t length_, - const std::string& type_); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_SELF_SIZE(StoredDataObject) - SET_MEMORY_INFO_NAME(StoredDataObject) - }; - - void store_data_object( - const std::string& uuid, - const StoredDataObject& object); - - void revoke_data_object(const std::string& uuid); - - StoredDataObject get_data_object(const std::string& uuid); - - private: - std::unordered_map data_objects_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_BLOB_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_bob-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_bob-inl.h deleted file mode 100644 index 578e45e9..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_bob-inl.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SRC_NODE_BOB_INL_H_ -#define SRC_NODE_BOB_INL_H_ - -#include "node_bob.h" - -#include - -namespace node { -namespace bob { - -template -int SourceImpl::Pull( - Next next, - int options, - T* data, - size_t count, - size_t max_count_hint) { - - int status; - if (eos_) { - status = bob::Status::STATUS_EOS; - std::move(next)(status, nullptr, 0, [](size_t len) {}); - return status; - } - - status = DoPull(std::move(next), options, data, count, max_count_hint); - - if (status == bob::Status::STATUS_END) - eos_ = true; - - return status; -} - -} // namespace bob -} // namespace node - -#endif // SRC_NODE_BOB_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_bob.h b/repo/packages/s/scriptx-legacy/include/libnode/node_bob.h deleted file mode 100644 index 74571608..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_bob.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef SRC_NODE_BOB_H_ -#define SRC_NODE_BOB_H_ - -#include - -namespace node { -namespace bob { - -constexpr size_t kMaxCountHint = 16; - -// Negative status codes indicate error conditions. -enum Status : int { - // Indicates that an attempt was made to pull after end. - STATUS_EOS = -1, - - // Indicates the end of the stream. No additional - // data will be available and the consumer should stop - // pulling. - STATUS_END = 0, - - // Indicates that there is additional data available - // and the consumer may continue to pull. - STATUS_CONTINUE = 1, - - // Indicates that there is no additional data available - // but the stream has not ended. The consumer should not - // continue to pull but may resume pulling later when - // data is available. - STATUS_BLOCK = 2, - - // Indicates that there is no additional data available - // but the stream has not ended and the source will call - // next again later when data is available. STATUS_WAIT - // must not be used with the OPTIONS_SYNC option. - STATUS_WAIT = 3, -}; - -enum Options : int { - OPTIONS_NONE = 0, - - // Indicates that the consumer is requesting the end - // of the stream. - OPTIONS_END = 1, - - // Indicates that the consumer requires the source to - // invoke Next synchronously. If the source is - // unable to provide data immediately but the - // stream has not yet ended, it should call Next - // using STATUS_BLOCK. When not set, the source - // may call Next asynchronously. - OPTIONS_SYNC = 2 -}; - -// There are Sources and there are Consumers. -// -// Consumers get data by calling Source::Pull, -// optionally passing along a status and allocated -// buffer space for the source to fill, and a Next -// function the Source will call when data is -// available. -// -// The source calls Next to deliver the data. It can -// choose to either use the allocated buffer space -// provided by the consumer or it can allocate its own -// buffers and push those instead. If it allocates -// its own, it can send a Done function that the -// Sink will call when it is done consuming the data. -using Done = std::function; -template -using Next = std::function; - -template -class Source { - public: - virtual int Pull( - Next next, - int options, - T* data, - size_t count, - size_t max_count_hint = kMaxCountHint) = 0; -}; - - -template -class SourceImpl : public Source { - public: - int Pull( - Next next, - int options, - T* data, - size_t count, - size_t max_count_hint = kMaxCountHint) override; - - bool is_eos() const { return eos_; } - - protected: - virtual int DoPull( - Next next, - int options, - T* data, - size_t count, - size_t max_count_hint) = 0; - - private: - bool eos_ = false; -}; - -} // namespace bob -} // namespace node - -#endif // SRC_NODE_BOB_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_buffer.h b/repo/packages/s/scriptx-legacy/include/libnode/node_buffer.h deleted file mode 100644 index 606a6f5c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_buffer.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_BUFFER_H_ -#define SRC_NODE_BUFFER_H_ - -#include "node.h" -#include "v8.h" - -namespace node { - -namespace Buffer { - -static const size_t kMaxLength = v8::TypedArray::kMaxLength; - -typedef void (*FreeCallback)(char* data, void* hint); - -NODE_EXTERN bool HasInstance(v8::Local val); -NODE_EXTERN bool HasInstance(v8::Local val); -NODE_EXTERN char* Data(v8::Local val); -NODE_EXTERN char* Data(v8::Local val); -NODE_EXTERN size_t Length(v8::Local val); -NODE_EXTERN size_t Length(v8::Local val); - -// public constructor - data is copied -NODE_EXTERN v8::MaybeLocal Copy(v8::Isolate* isolate, - const char* data, - size_t len); - -// public constructor -NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, size_t length); - -// public constructor from string -NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, - v8::Local string, - enum encoding enc = UTF8); - -// public constructor - data is used, callback is passed data on object gc -NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, - char* data, - size_t length, - FreeCallback callback, - void* hint); - -// public constructor - data is used. -NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, - char* data, - size_t len); - -// Creates a Buffer instance over an existing ArrayBuffer. -NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, - v8::Local ab, - size_t byte_offset, - size_t length); - -// This is verbose to be explicit with inline commenting -static inline bool IsWithinBounds(size_t off, size_t len, size_t max) { - // Asking to seek too far into the buffer - // check to avoid wrapping in subsequent subtraction - if (off > max) - return false; - - // Asking for more than is left over in the buffer - if (max - off < len) - return false; - - // Otherwise we're in bounds - return true; -} - -} // namespace Buffer -} // namespace node - -#endif // SRC_NODE_BUFFER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_constants.h b/repo/packages/s/scriptx-legacy/include/libnode/node_constants.h deleted file mode 100644 index d7de705f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_constants.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_CONSTANTS_H_ -#define SRC_NODE_CONSTANTS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node.h" -#include "v8.h" - -#if HAVE_OPENSSL - -#ifndef RSA_PSS_SALTLEN_DIGEST -#define RSA_PSS_SALTLEN_DIGEST -1 -#endif - -#ifndef RSA_PSS_SALTLEN_MAX_SIGN -#define RSA_PSS_SALTLEN_MAX_SIGN -2 -#endif - -#ifndef RSA_PSS_SALTLEN_AUTO -#define RSA_PSS_SALTLEN_AUTO -2 -#endif - -#if defined(NODE_OPENSSL_DEFAULT_CIPHER_LIST) -#define DEFAULT_CIPHER_LIST_CORE NODE_OPENSSL_DEFAULT_CIPHER_LIST -#else -// TLSv1.3 suites start with TLS_, and are the OpenSSL defaults, see: -// https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_ciphersuites.html -#define DEFAULT_CIPHER_LIST_CORE \ - "TLS_AES_256_GCM_SHA384:" \ - "TLS_CHACHA20_POLY1305_SHA256:" \ - "TLS_AES_128_GCM_SHA256:" \ - "ECDHE-RSA-AES128-GCM-SHA256:" \ - "ECDHE-ECDSA-AES128-GCM-SHA256:" \ - "ECDHE-RSA-AES256-GCM-SHA384:" \ - "ECDHE-ECDSA-AES256-GCM-SHA384:" \ - "DHE-RSA-AES128-GCM-SHA256:" \ - "ECDHE-RSA-AES128-SHA256:" \ - "DHE-RSA-AES128-SHA256:" \ - "ECDHE-RSA-AES256-SHA384:" \ - "DHE-RSA-AES256-SHA384:" \ - "ECDHE-RSA-AES256-SHA256:" \ - "DHE-RSA-AES256-SHA256:" \ - "HIGH:" \ - "!aNULL:" \ - "!eNULL:" \ - "!EXPORT:" \ - "!DES:" \ - "!RC4:" \ - "!MD5:" \ - "!PSK:" \ - "!SRP:" \ - "!CAMELLIA" -#endif // NODE_OPENSSL_DEFAULT_CIPHER_LIST -#endif // HAVE_OPENSSL - -namespace node { - -void DefineConstants(v8::Isolate* isolate, v8::Local target); -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_CONSTANTS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_context_data.h b/repo/packages/s/scriptx-legacy/include/libnode/node_context_data.h deleted file mode 100644 index 912e65b4..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_context_data.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SRC_NODE_CONTEXT_DATA_H_ -#define SRC_NODE_CONTEXT_DATA_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -namespace node { - -// Pick an index that's hopefully out of the way when we're embedded inside -// another application. Performance-wise or memory-wise it doesn't matter: -// Context::SetAlignedPointerInEmbedderData() is backed by a FixedArray, -// worst case we pay a one-time penalty for resizing the array. -#ifndef NODE_CONTEXT_EMBEDDER_DATA_INDEX -#define NODE_CONTEXT_EMBEDDER_DATA_INDEX 32 -#endif - -#ifndef NODE_CONTEXT_SANDBOX_OBJECT_INDEX -#define NODE_CONTEXT_SANDBOX_OBJECT_INDEX 33 -#endif - -#ifndef NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX -#define NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX 34 -#endif - -#ifndef NODE_CONTEXT_TAG -#define NODE_CONTEXT_TAG 35 -#endif - -#ifndef NODE_BINDING_LIST -#define NODE_BINDING_LIST_INDEX 36 -#endif - -enum ContextEmbedderIndex { - kEnvironment = NODE_CONTEXT_EMBEDDER_DATA_INDEX, - kSandboxObject = NODE_CONTEXT_SANDBOX_OBJECT_INDEX, - kAllowWasmCodeGeneration = NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX, - kContextTag = NODE_CONTEXT_TAG, - kBindingListIndex = NODE_BINDING_LIST_INDEX -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_CONTEXT_DATA_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_contextify.h b/repo/packages/s/scriptx-legacy/include/libnode/node_contextify.h deleted file mode 100644 index c9ba78b8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_contextify.h +++ /dev/null @@ -1,196 +0,0 @@ -#ifndef SRC_NODE_CONTEXTIFY_H_ -#define SRC_NODE_CONTEXTIFY_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object-inl.h" -#include "node_context_data.h" -#include "node_errors.h" - -namespace node { -class ExternalReferenceRegistry; - -namespace contextify { - -class MicrotaskQueueWrap : public BaseObject { - public: - MicrotaskQueueWrap(Environment* env, v8::Local obj); - - const std::shared_ptr& microtask_queue() const; - - static void Init(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - static void New(const v8::FunctionCallbackInfo& args); - - // This could have methods for running the microtask queue, if we ever decide - // to make that fully customizable from userland. - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(MicrotaskQueueWrap) - SET_SELF_SIZE(MicrotaskQueueWrap) - - private: - std::shared_ptr microtask_queue_; -}; - -struct ContextOptions { - v8::Local name; - v8::Local origin; - v8::Local allow_code_gen_strings; - v8::Local allow_code_gen_wasm; - BaseObjectPtr microtask_queue_wrap; -}; - -class ContextifyContext { - public: - enum InternalFields { kSlot, kInternalFieldCount }; - ContextifyContext(Environment* env, - v8::Local sandbox_obj, - const ContextOptions& options); - ~ContextifyContext(); - static void CleanupHook(void* arg); - - v8::MaybeLocal CreateDataWrapper(Environment* env); - v8::MaybeLocal CreateV8Context(Environment* env, - v8::Local sandbox_obj, - const ContextOptions& options); - static void Init(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - static ContextifyContext* ContextFromContextifiedSandbox( - Environment* env, - const v8::Local& sandbox); - - inline Environment* env() const { - return env_; - } - - inline v8::Local context() const { - return PersistentToLocal::Default(env()->isolate(), context_); - } - - inline v8::Local global_proxy() const { - return context()->Global(); - } - - inline v8::Local sandbox() const { - return context()->GetEmbedderData(ContextEmbedderIndex::kSandboxObject) - .As(); - } - - inline std::shared_ptr microtask_queue() const { - if (!microtask_queue_wrap_) return {}; - return microtask_queue_wrap_->microtask_queue(); - } - - - template - static ContextifyContext* Get(const v8::PropertyCallbackInfo& args); - - private: - static void MakeContext(const v8::FunctionCallbackInfo& args); - static void IsContext(const v8::FunctionCallbackInfo& args); - static void CompileFunction( - const v8::FunctionCallbackInfo& args); - static void WeakCallback( - const v8::WeakCallbackInfo& data); - static void PropertyGetterCallback( - v8::Local property, - const v8::PropertyCallbackInfo& args); - static void PropertySetterCallback( - v8::Local property, - v8::Local value, - const v8::PropertyCallbackInfo& args); - static void PropertyDescriptorCallback( - v8::Local property, - const v8::PropertyCallbackInfo& args); - static void PropertyDefinerCallback( - v8::Local property, - const v8::PropertyDescriptor& desc, - const v8::PropertyCallbackInfo& args); - static void PropertyDeleterCallback( - v8::Local property, - const v8::PropertyCallbackInfo& args); - static void PropertyEnumeratorCallback( - const v8::PropertyCallbackInfo& args); - static void IndexedPropertyGetterCallback( - uint32_t index, - const v8::PropertyCallbackInfo& args); - static void IndexedPropertySetterCallback( - uint32_t index, - v8::Local value, - const v8::PropertyCallbackInfo& args); - static void IndexedPropertyDescriptorCallback( - uint32_t index, - const v8::PropertyCallbackInfo& args); - static void IndexedPropertyDefinerCallback( - uint32_t index, - const v8::PropertyDescriptor& desc, - const v8::PropertyCallbackInfo& args); - static void IndexedPropertyDeleterCallback( - uint32_t index, - const v8::PropertyCallbackInfo& args); - Environment* const env_; - v8::Global context_; - BaseObjectPtr microtask_queue_wrap_; -}; - -class ContextifyScript : public BaseObject { - public: - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(ContextifyScript) - SET_SELF_SIZE(ContextifyScript) - - ContextifyScript(Environment* env, v8::Local object); - ~ContextifyScript() override; - - static void Init(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - static void New(const v8::FunctionCallbackInfo& args); - static bool InstanceOf(Environment* env, const v8::Local& args); - static void CreateCachedData( - const v8::FunctionCallbackInfo& args); - static void RunInThisContext(const v8::FunctionCallbackInfo& args); - static void RunInContext(const v8::FunctionCallbackInfo& args); - static bool EvalMachine(Environment* env, - const int64_t timeout, - const bool display_errors, - const bool break_on_sigint, - const bool break_on_first_line, - std::shared_ptr microtask_queue, - const v8::FunctionCallbackInfo& args); - - inline uint32_t id() { return id_; } - - private: - v8::Global script_; - uint32_t id_; -}; - -class CompiledFnEntry final : public BaseObject { - public: - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(CompiledFnEntry) - SET_SELF_SIZE(CompiledFnEntry) - - CompiledFnEntry(Environment* env, - v8::Local object, - uint32_t id, - v8::Local script); - ~CompiledFnEntry(); - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { return true; } - - private: - uint32_t id_; - v8::Global script_; - - static void WeakCallback(const v8::WeakCallbackInfo& data); -}; - -} // namespace contextify -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_CONTEXTIFY_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_crypto.h b/repo/packages/s/scriptx-legacy/include/libnode/node_crypto.h deleted file mode 100644 index 94fe8796..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_crypto.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_CRYPTO_H_ -#define SRC_NODE_CRYPTO_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -// All of the crypto definitions previously contained in this header -// have been split across multiple headers in src/crypto. This header -// remains for convenience for any code that still imports it. New -// code should include the relevant src/crypto headers directly. -#include "crypto/crypto_aes.h" -#include "crypto/crypto_bio.h" -#include "crypto/crypto_cipher.h" -#include "crypto/crypto_context.h" -#include "crypto/crypto_dh.h" -#include "crypto/crypto_dsa.h" -#include "crypto/crypto_ec.h" -#include "crypto/crypto_groups.h" -#include "crypto/crypto_hash.h" -#include "crypto/crypto_hkdf.h" -#include "crypto/crypto_hmac.h" -#include "crypto/crypto_keygen.h" -#include "crypto/crypto_keys.h" -#include "crypto/crypto_pbkdf2.h" -#include "crypto/crypto_random.h" -#include "crypto/crypto_rsa.h" -#include "crypto/crypto_scrypt.h" -#include "crypto/crypto_sig.h" -#include "crypto/crypto_spkac.h" -#include "crypto/crypto_tls.h" -#include "crypto/crypto_timing.h" -#include "crypto/crypto_util.h" -#include "crypto/crypto_x509.h" - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_CRYPTO_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_dir.h b/repo/packages/s/scriptx-legacy/include/libnode/node_dir.h deleted file mode 100644 index 5fcc3632..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_dir.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SRC_NODE_DIR_H_ -#define SRC_NODE_DIR_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_file.h" - -namespace node { - -namespace fs_dir { - -// Needed to propagate `uv_dir_t`. -class DirHandle : public AsyncWrap { - public: - static DirHandle* New(Environment* env, uv_dir_t* dir); - ~DirHandle() override; - - static void New(const v8::FunctionCallbackInfo& args); - static void Read(const v8::FunctionCallbackInfo& args); - static void Close(const v8::FunctionCallbackInfo& args); - - inline uv_dir_t* dir() { return dir_; } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(DirHandle) - SET_SELF_SIZE(DirHandle) - - DirHandle(const DirHandle&) = delete; - DirHandle& operator=(const DirHandle&) = delete; - DirHandle(const DirHandle&&) = delete; - DirHandle& operator=(const DirHandle&&) = delete; - - private: - DirHandle(Environment* env, v8::Local obj, uv_dir_t* dir); - - // Synchronous close that emits a warning - void GCClose(); - - uv_dir_t* dir_; - // Multiple entries are read through a single libuv call. - std::vector dirents_; - bool closing_ = false; - bool closed_ = false; -}; - -} // namespace fs_dir - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_DIR_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_dtrace.h b/repo/packages/s/scriptx-legacy/include/libnode/node_dtrace.h deleted file mode 100644 index b887542a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_dtrace.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_DTRACE_H_ -#define SRC_NODE_DTRACE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "v8.h" - -extern "C" { -/* - * The following structures are passed directly to DTrace when probes are fired. - * Translators in node.d translate these structures into the corresponding D - * structures, taking care of dealing with the user process data model (32-bit - * or 64-bit) and structure versions (see node_dtrace_http_server_request_t - * below). - */ - -typedef struct { - int32_t fd; - int32_t port; - char* remote; - int32_t buffered; -} node_dtrace_connection_t; - -typedef struct { - char* url; - char* method; -} node_dtrace_http_client_request_t; - -/* - * The original version of this structure contained only a url and method, just - * like the client request above. To add the new forwardedFor field, the - * structure layout was changed to begin with an integer version. The - * translator knows whether it's looking at an old- or new-version structure - * based on whether the version field's value is a reasonable pointer (i.e. - * address greater than 4K). No doubt this is filthy, but there's not much else - * we can do, and it works reliably. - * - * This version of the structure also contains padding that should be zeroed out - * by the consumer so that future versions of the translator can simply check if - * a field is present by checking it against nullptr. - */ -typedef struct { - union { - uint32_t version; - uintptr_t unused; /* for compat. with old 64-bit struct */ - } _un; - char* url; - char* method; - char* forwardedFor; - char* _pad[8]; -} node_dtrace_http_server_request_t; - -} // extern "C" - -namespace node { - -class Environment; - -void InitDTrace(Environment* env); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_DTRACE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_errors.h b/repo/packages/s/scriptx-legacy/include/libnode/node_errors.h deleted file mode 100644 index f540b3e2..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_errors.h +++ /dev/null @@ -1,277 +0,0 @@ -#ifndef SRC_NODE_ERRORS_H_ -#define SRC_NODE_ERRORS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "debug_utils-inl.h" -#include "env.h" -#include "v8.h" - -// Use ostringstream to print exact-width integer types -// because the format specifiers are not available on AIX. -#include - -namespace node { - -enum ErrorHandlingMode { CONTEXTIFY_ERROR, FATAL_ERROR, MODULE_ERROR }; -void AppendExceptionLine(Environment* env, - v8::Local er, - v8::Local message, - enum ErrorHandlingMode mode); - -[[noreturn]] void FatalError(const char* location, const char* message); -void OnFatalError(const char* location, const char* message); - -// Helpers to construct errors similar to the ones provided by -// lib/internal/errors.js. -// Example: with `V(ERR_INVALID_ARG_TYPE, TypeError)`, there will be -// `node::ERR_INVALID_ARG_TYPE(isolate, "message")` returning -// a `Local` containing the TypeError with proper code and message - -#define ERRORS_WITH_CODE(V) \ - V(ERR_BUFFER_CONTEXT_NOT_AVAILABLE, Error) \ - V(ERR_BUFFER_OUT_OF_BOUNDS, RangeError) \ - V(ERR_BUFFER_TOO_LARGE, Error) \ - V(ERR_CLOSED_MESSAGE_PORT, Error) \ - V(ERR_CONSTRUCT_CALL_REQUIRED, TypeError) \ - V(ERR_CONSTRUCT_CALL_INVALID, TypeError) \ - V(ERR_CRYPTO_INITIALIZATION_FAILED, Error) \ - V(ERR_CRYPTO_INVALID_AUTH_TAG, TypeError) \ - V(ERR_CRYPTO_INVALID_COUNTER, TypeError) \ - V(ERR_CRYPTO_INVALID_CURVE, TypeError) \ - V(ERR_CRYPTO_INVALID_DIGEST, TypeError) \ - V(ERR_CRYPTO_INVALID_IV, TypeError) \ - V(ERR_CRYPTO_INVALID_JWK, TypeError) \ - V(ERR_CRYPTO_INVALID_KEYLEN, RangeError) \ - V(ERR_CRYPTO_INVALID_KEYPAIR, RangeError) \ - V(ERR_CRYPTO_INVALID_KEYTYPE, RangeError) \ - V(ERR_CRYPTO_INVALID_MESSAGELEN, RangeError) \ - V(ERR_CRYPTO_INVALID_SCRYPT_PARAMS, RangeError) \ - V(ERR_CRYPTO_INVALID_STATE, Error) \ - V(ERR_CRYPTO_INVALID_TAG_LENGTH, RangeError) \ - V(ERR_CRYPTO_JWK_UNSUPPORTED_CURVE, Error) \ - V(ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE, Error) \ - V(ERR_CRYPTO_OPERATION_FAILED, Error) \ - V(ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH, RangeError) \ - V(ERR_CRYPTO_UNKNOWN_CIPHER, Error) \ - V(ERR_CRYPTO_UNKNOWN_DH_GROUP, Error) \ - V(ERR_CRYPTO_UNSUPPORTED_OPERATION, Error) \ - V(ERR_CRYPTO_JOB_INIT_FAILED, Error) \ - V(ERR_DLOPEN_DISABLED, Error) \ - V(ERR_DLOPEN_FAILED, Error) \ - V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, Error) \ - V(ERR_INVALID_ADDRESS, Error) \ - V(ERR_INVALID_ARG_VALUE, TypeError) \ - V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \ - V(ERR_INVALID_ARG_TYPE, TypeError) \ - V(ERR_INVALID_MODULE, Error) \ - V(ERR_INVALID_THIS, TypeError) \ - V(ERR_INVALID_TRANSFER_OBJECT, TypeError) \ - V(ERR_MEMORY_ALLOCATION_FAILED, Error) \ - V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \ - V(ERR_MISSING_ARGS, TypeError) \ - V(ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST, TypeError) \ - V(ERR_MISSING_PASSPHRASE, TypeError) \ - V(ERR_MISSING_PLATFORM_FOR_WORKER, Error) \ - V(ERR_NON_CONTEXT_AWARE_DISABLED, Error) \ - V(ERR_OUT_OF_RANGE, RangeError) \ - V(ERR_SCRIPT_EXECUTION_INTERRUPTED, Error) \ - V(ERR_SCRIPT_EXECUTION_TIMEOUT, Error) \ - V(ERR_STRING_TOO_LONG, Error) \ - V(ERR_TLS_INVALID_PROTOCOL_METHOD, TypeError) \ - V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \ - V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \ - V(ERR_VM_MODULE_LINK_FAILURE, Error) \ - V(ERR_WASI_NOT_STARTED, Error) \ - V(ERR_WORKER_INIT_FAILED, Error) \ - V(ERR_PROTO_ACCESS, Error) - -#define V(code, type) \ - template \ - inline v8::Local code( \ - v8::Isolate* isolate, const char* format, Args&&... args) { \ - std::string message = SPrintF(format, std::forward(args)...); \ - v8::Local js_code = OneByteString(isolate, #code); \ - v8::Local js_msg = \ - OneByteString(isolate, message.c_str(), message.length()); \ - v8::Local e = v8::Exception::type(js_msg) \ - ->ToObject(isolate->GetCurrentContext()) \ - .ToLocalChecked(); \ - e->Set(isolate->GetCurrentContext(), \ - OneByteString(isolate, "code"), \ - js_code) \ - .Check(); \ - return e; \ - } \ - template \ - inline void THROW_##code( \ - v8::Isolate* isolate, const char* format, Args&&... args) { \ - isolate->ThrowException( \ - code(isolate, format, std::forward(args)...)); \ - } \ - template \ - inline void THROW_##code( \ - Environment* env, const char* format, Args&&... args) { \ - THROW_##code(env->isolate(), format, std::forward(args)...); \ - } -ERRORS_WITH_CODE(V) -#undef V - -// Errors with predefined static messages - -#define PREDEFINED_ERROR_MESSAGES(V) \ - V(ERR_BUFFER_CONTEXT_NOT_AVAILABLE, \ - "Buffer is not available for the current Context") \ - V(ERR_CLOSED_MESSAGE_PORT, "Cannot send data on closed MessagePort") \ - V(ERR_CONSTRUCT_CALL_INVALID, "Constructor cannot be called") \ - V(ERR_CONSTRUCT_CALL_REQUIRED, "Cannot call constructor without `new`") \ - V(ERR_CRYPTO_INITIALIZATION_FAILED, "Initialization failed") \ - V(ERR_CRYPTO_INVALID_AUTH_TAG, "Invalid authentication tag") \ - V(ERR_CRYPTO_INVALID_COUNTER, "Invalid counter") \ - V(ERR_CRYPTO_INVALID_CURVE, "Invalid EC curve name") \ - V(ERR_CRYPTO_INVALID_DIGEST, "Invalid digest") \ - V(ERR_CRYPTO_INVALID_IV, "Invalid initialization vector") \ - V(ERR_CRYPTO_INVALID_JWK, "Invalid JWK format") \ - V(ERR_CRYPTO_INVALID_KEYLEN, "Invalid key length") \ - V(ERR_CRYPTO_INVALID_KEYPAIR, "Invalid key pair") \ - V(ERR_CRYPTO_INVALID_KEYTYPE, "Invalid key type") \ - V(ERR_CRYPTO_INVALID_MESSAGELEN, "Invalid message length") \ - V(ERR_CRYPTO_INVALID_SCRYPT_PARAMS, "Invalid scrypt params") \ - V(ERR_CRYPTO_INVALID_STATE, "Invalid state") \ - V(ERR_CRYPTO_INVALID_TAG_LENGTH, "Invalid taglength") \ - V(ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE, "Unsupported JWK Key Type.") \ - V(ERR_CRYPTO_OPERATION_FAILED, "Operation failed") \ - V(ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH, \ - "Input buffers must have the same byte length") \ - V(ERR_CRYPTO_UNKNOWN_CIPHER, "Unknown cipher") \ - V(ERR_CRYPTO_UNKNOWN_DH_GROUP, "Unknown DH group") \ - V(ERR_CRYPTO_UNSUPPORTED_OPERATION, "Unsupported crypto operation") \ - V(ERR_CRYPTO_JOB_INIT_FAILED, "Failed to initialize crypto job config") \ - V(ERR_DLOPEN_FAILED, "DLOpen failed") \ - V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \ - "Context not associated with Node.js environment") \ - V(ERR_INVALID_ADDRESS, "Invalid socket address") \ - V(ERR_INVALID_MODULE, "No such module") \ - V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \ - V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \ - V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \ - V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \ - V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, \ - "A message object could not be deserialized successfully in the target " \ - "vm.Context") \ - V(ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST, \ - "Object that needs transfer was found in message but not listed " \ - "in transferList") \ - V(ERR_MISSING_PLATFORM_FOR_WORKER, \ - "The V8 platform used by this instance of Node does not support " \ - "creating Workers") \ - V(ERR_NON_CONTEXT_AWARE_DISABLED, \ - "Loading non context-aware native modules has been disabled") \ - V(ERR_SCRIPT_EXECUTION_INTERRUPTED, \ - "Script execution was interrupted by `SIGINT`") \ - V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \ - V(ERR_WASI_NOT_STARTED, "wasi.start() has not been called") \ - V(ERR_WORKER_INIT_FAILED, "Worker initialization failure") \ - V(ERR_PROTO_ACCESS, \ - "Accessing Object.prototype.__proto__ has been " \ - "disallowed with --disable-proto=throw") - -#define V(code, message) \ - inline v8::Local code(v8::Isolate* isolate) { \ - return code(isolate, message); \ - } \ - inline void THROW_ ## code(v8::Isolate* isolate) { \ - isolate->ThrowException(code(isolate, message)); \ - } \ - inline void THROW_ ## code(Environment* env) { \ - THROW_ ## code(env->isolate()); \ - } - PREDEFINED_ERROR_MESSAGES(V) -#undef V - -// Errors with predefined non-static messages -inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env, - int64_t timeout) { - std::ostringstream message; - message << "Script execution timed out after "; - message << timeout << "ms"; - THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str()); -} - -inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { - char message[128]; - snprintf(message, sizeof(message), - "Cannot create a Buffer larger than 0x%zx bytes", - v8::TypedArray::kMaxLength); - return ERR_BUFFER_TOO_LARGE(isolate, message); -} - -inline v8::Local ERR_STRING_TOO_LONG(v8::Isolate* isolate) { - char message[128]; - snprintf(message, sizeof(message), - "Cannot create a string longer than 0x%x characters", - v8::String::kMaxLength); - return ERR_STRING_TOO_LONG(isolate, message); -} - -#define THROW_AND_RETURN_IF_NOT_BUFFER(env, val, prefix) \ - do { \ - if (!Buffer::HasInstance(val)) \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - prefix " must be a buffer"); \ - } while (0) - -#define THROW_AND_RETURN_IF_NOT_STRING(env, val, prefix) \ - do { \ - if (!val->IsString()) \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - prefix " must be a string"); \ - } while (0) - -namespace errors { - -class TryCatchScope : public v8::TryCatch { - public: - enum class CatchMode { kNormal, kFatal }; - - explicit TryCatchScope(Environment* env, CatchMode mode = CatchMode::kNormal) - : v8::TryCatch(env->isolate()), env_(env), mode_(mode) {} - ~TryCatchScope(); - - // Since the dtor is not virtual we need to make sure no one creates - // object of it in the free store that might be held by polymorphic pointers. - void* operator new(std::size_t count) = delete; - void* operator new[](std::size_t count) = delete; - TryCatchScope(TryCatchScope&) = delete; - TryCatchScope(TryCatchScope&&) = delete; - TryCatchScope operator=(TryCatchScope&) = delete; - TryCatchScope operator=(TryCatchScope&&) = delete; - - private: - Environment* env_; - CatchMode mode_; -}; - -// Trigger the global uncaught exception handler `process._fatalException` -// in JS land (which emits the 'uncaughtException' event). If that returns -// true, continue program execution, otherwise exit the process. -void TriggerUncaughtException(v8::Isolate* isolate, - const v8::TryCatch& try_catch); -void TriggerUncaughtException(v8::Isolate* isolate, - v8::Local error, - v8::Local message, - bool from_promise = false); - -const char* errno_string(int errorno); -void PerIsolateMessageListener(v8::Local message, - v8::Local error); - -void DecorateErrorStack(Environment* env, - const errors::TryCatchScope& try_catch); -} // namespace errors - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_ERRORS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_external_reference.h b/repo/packages/s/scriptx-legacy/include/libnode/node_external_reference.h deleted file mode 100644 index c57a01ff..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_external_reference.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef SRC_NODE_EXTERNAL_REFERENCE_H_ -#define SRC_NODE_EXTERNAL_REFERENCE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include "v8-fast-api-calls.h" -#include "v8.h" - -namespace node { - -using CFunctionCallback = void (*)(v8::Local receiver); - -// This class manages the external references from the V8 heap -// to the C++ addresses in Node.js. -class ExternalReferenceRegistry { - public: - ExternalReferenceRegistry(); - -#define ALLOWED_EXTERNAL_REFERENCE_TYPES(V) \ - V(CFunctionCallback) \ - V(const v8::CFunctionInfo*) \ - V(v8::FunctionCallback) \ - V(v8::AccessorGetterCallback) \ - V(v8::AccessorSetterCallback) \ - V(v8::AccessorNameGetterCallback) \ - V(v8::AccessorNameSetterCallback) \ - V(v8::GenericNamedPropertyDefinerCallback) \ - V(v8::GenericNamedPropertyDeleterCallback) \ - V(v8::GenericNamedPropertyEnumeratorCallback) \ - V(v8::GenericNamedPropertyQueryCallback) \ - V(v8::GenericNamedPropertySetterCallback) - -#define V(ExternalReferenceType) \ - void Register(ExternalReferenceType addr) { RegisterT(addr); } - ALLOWED_EXTERNAL_REFERENCE_TYPES(V) -#undef V - - // This can be called only once. - const std::vector& external_references(); - - bool is_empty() { return external_references_.empty(); } - - private: - template - void RegisterT(T* address) { - external_references_.push_back(reinterpret_cast(address)); - } - bool is_finalized_ = false; - std::vector external_references_; -}; - -#define EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \ - V(async_wrap) \ - V(binding) \ - V(blob) \ - V(buffer) \ - V(contextify) \ - V(credentials) \ - V(env_var) \ - V(errors) \ - V(fs) \ - V(fs_dir) \ - V(fs_event_wrap) \ - V(handle_wrap) \ - V(heap_utils) \ - V(messaging) \ - V(native_module) \ - V(options) \ - V(os) \ - V(performance) \ - V(process_methods) \ - V(process_object) \ - V(report) \ - V(task_queue) \ - V(tcp_wrap) \ - V(tty_wrap) \ - V(url) \ - V(util) \ - V(pipe_wrap) \ - V(serdes) \ - V(string_decoder) \ - V(stream_wrap) \ - V(signal_wrap) \ - V(trace_events) \ - V(timers) \ - V(types) \ - V(uv) \ - V(v8) \ - V(zlib) \ - V(worker) - -#if NODE_HAVE_I18N_SUPPORT -#define EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) V(icu) -#else -#define EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) -#endif // NODE_HAVE_I18N_SUPPORT - -#if HAVE_INSPECTOR -#define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) \ - V(inspector) \ - V(profiler) -#else -#define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) -#endif // HAVE_INSPECTOR - -#if HAVE_DTRACE || HAVE_ETW -#define EXTERNAL_REFERENCE_BINDING_LIST_DTRACE(V) V(dtrace) -#else -#define EXTERNAL_REFERENCE_BINDING_LIST_DTRACE(V) -#endif - -#if HAVE_OPENSSL -#define EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) V(crypto) V(tls_wrap) -#else -#define EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) -#endif // HAVE_OPENSSL - -#define EXTERNAL_REFERENCE_BINDING_LIST(V) \ - EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \ - EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) \ - EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) \ - EXTERNAL_REFERENCE_BINDING_LIST_DTRACE(V) \ - EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V) - -} // namespace node - -// Declare all the external reference registration functions here, -// and define them later with #NODE_MODULE_EXTERNAL_REFERENCE(modname, func); -#define V(modname) \ - void _register_external_reference_##modname( \ - node::ExternalReferenceRegistry* registry); -EXTERNAL_REFERENCE_BINDING_LIST(V) -#undef V - -#define NODE_MODULE_EXTERNAL_REFERENCE(modname, func) \ - void _register_external_reference_##modname( \ - node::ExternalReferenceRegistry* registry) { \ - func(registry); \ - } -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_EXTERNAL_REFERENCE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_file-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_file-inl.h deleted file mode 100644 index 0188261b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_file-inl.h +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef SRC_NODE_FILE_INL_H_ -#define SRC_NODE_FILE_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_file.h" -#include "req_wrap-inl.h" - -namespace node { -namespace fs { - -FSContinuationData::FSContinuationData(uv_fs_t* req, int mode, uv_fs_cb done_cb) - : done_cb_(done_cb), req_(req), mode_(mode) { -} - -void FSContinuationData::PushPath(std::string&& path) { - paths_.emplace_back(std::move(path)); -} - -void FSContinuationData::PushPath(const std::string& path) { - paths_.push_back(path); -} - -void FSContinuationData::MaybeSetFirstPath(const std::string& path) { - if (first_path_.empty()) { - first_path_ = path; - } -} - -std::string FSContinuationData::PopPath() { - CHECK(!paths_.empty()); - std::string path = std::move(paths_.back()); - paths_.pop_back(); - return path; -} - -void FSContinuationData::Done(int result) { - req_->result = result; - done_cb_(req_); -} - -FSReqBase::FSReqBase(BindingData* binding_data, - v8::Local req, - AsyncWrap::ProviderType type, - bool use_bigint) - : ReqWrap(binding_data->env(), req, type), - use_bigint_(use_bigint), - binding_data_(binding_data) { -} - -void FSReqBase::Init(const char* syscall, - const char* data, - size_t len, - enum encoding encoding) { - syscall_ = syscall; - encoding_ = encoding; - - if (data != nullptr) { - CHECK(!has_data_); - buffer_.AllocateSufficientStorage(len + 1); - buffer_.SetLengthAndZeroTerminate(len); - memcpy(*buffer_, data, len); - has_data_ = true; - } -} - -FSReqBase::FSReqBuffer& -FSReqBase::Init(const char* syscall, size_t len, enum encoding encoding) { - syscall_ = syscall; - encoding_ = encoding; - - buffer_.AllocateSufficientStorage(len + 1); - has_data_ = false; // so that the data does not show up in error messages - return buffer_; -} - -FSReqCallback::FSReqCallback(BindingData* binding_data, - v8::Local req, - bool use_bigint) - : FSReqBase(binding_data, - req, - AsyncWrap::PROVIDER_FSREQCALLBACK, - use_bigint) {} - -template -void FillStatsArray(AliasedBufferBase* fields, - const uv_stat_t* s, - const size_t offset) { -#define SET_FIELD_WITH_STAT(stat_offset, stat) \ - fields->SetValue(offset + static_cast(FsStatsOffset::stat_offset), \ - static_cast(stat)) - -#define SET_FIELD_WITH_TIME_STAT(stat_offset, stat) \ - /* NOLINTNEXTLINE(runtime/int) */ \ - SET_FIELD_WITH_STAT(stat_offset, static_cast(stat)) - - SET_FIELD_WITH_STAT(kDev, s->st_dev); - SET_FIELD_WITH_STAT(kMode, s->st_mode); - SET_FIELD_WITH_STAT(kNlink, s->st_nlink); - SET_FIELD_WITH_STAT(kUid, s->st_uid); - SET_FIELD_WITH_STAT(kGid, s->st_gid); - SET_FIELD_WITH_STAT(kRdev, s->st_rdev); - SET_FIELD_WITH_STAT(kBlkSize, s->st_blksize); - SET_FIELD_WITH_STAT(kIno, s->st_ino); - SET_FIELD_WITH_STAT(kSize, s->st_size); - SET_FIELD_WITH_STAT(kBlocks, s->st_blocks); - - SET_FIELD_WITH_TIME_STAT(kATimeSec, s->st_atim.tv_sec); - SET_FIELD_WITH_TIME_STAT(kATimeNsec, s->st_atim.tv_nsec); - SET_FIELD_WITH_TIME_STAT(kMTimeSec, s->st_mtim.tv_sec); - SET_FIELD_WITH_TIME_STAT(kMTimeNsec, s->st_mtim.tv_nsec); - SET_FIELD_WITH_TIME_STAT(kCTimeSec, s->st_ctim.tv_sec); - SET_FIELD_WITH_TIME_STAT(kCTimeNsec, s->st_ctim.tv_nsec); - SET_FIELD_WITH_TIME_STAT(kBirthTimeSec, s->st_birthtim.tv_sec); - SET_FIELD_WITH_TIME_STAT(kBirthTimeNsec, s->st_birthtim.tv_nsec); - -#undef SET_FIELD_WITH_TIME_STAT -#undef SET_FIELD_WITH_STAT -} - -v8::Local FillGlobalStatsArray(BindingData* binding_data, - const bool use_bigint, - const uv_stat_t* s, - const bool second) { - const ptrdiff_t offset = - second ? static_cast(FsStatsOffset::kFsStatsFieldsNumber) : 0; - if (use_bigint) { - auto* const arr = &binding_data->stats_field_bigint_array; - FillStatsArray(arr, s, offset); - return arr->GetJSArray(); - } else { - auto* const arr = &binding_data->stats_field_array; - FillStatsArray(arr, s, offset); - return arr->GetJSArray(); - } -} - -template -FSReqPromise* -FSReqPromise::New(BindingData* binding_data, - bool use_bigint) { - Environment* env = binding_data->env(); - v8::Local obj; - if (!env->fsreqpromise_constructor_template() - ->NewInstance(env->context()) - .ToLocal(&obj)) { - return nullptr; - } - v8::Local resolver; - if (!v8::Promise::Resolver::New(env->context()).ToLocal(&resolver) || - obj->Set(env->context(), env->promise_string(), resolver).IsNothing()) { - return nullptr; - } - return new FSReqPromise(binding_data, obj, use_bigint); -} - -template -FSReqPromise::~FSReqPromise() { - // Validate that the promise was explicitly resolved or rejected. - CHECK(finished_); -} - -template -FSReqPromise::FSReqPromise( - BindingData* binding_data, - v8::Local obj, - bool use_bigint) - : FSReqBase(binding_data, - obj, - AsyncWrap::PROVIDER_FSREQPROMISE, - use_bigint), - stats_field_array_( - env()->isolate(), - static_cast(FsStatsOffset::kFsStatsFieldsNumber)) {} - -template -void FSReqPromise::Reject(v8::Local reject) { - finished_ = true; - v8::HandleScope scope(env()->isolate()); - InternalCallbackScope callback_scope(this); - v8::Local value = - object()->Get(env()->context(), - env()->promise_string()).ToLocalChecked(); - v8::Local resolver = value.As(); - USE(resolver->Reject(env()->context(), reject).FromJust()); -} - -template -void FSReqPromise::Resolve(v8::Local value) { - finished_ = true; - v8::HandleScope scope(env()->isolate()); - InternalCallbackScope callback_scope(this); - v8::Local val = - object()->Get(env()->context(), - env()->promise_string()).ToLocalChecked(); - v8::Local resolver = val.As(); - USE(resolver->Resolve(env()->context(), value).FromJust()); -} - -template -void FSReqPromise::ResolveStat(const uv_stat_t* stat) { - FillStatsArray(&stats_field_array_, stat); - Resolve(stats_field_array_.GetJSArray()); -} - -template -void FSReqPromise::SetReturnValue( - const v8::FunctionCallbackInfo& args) { - v8::Local val = - object()->Get(env()->context(), - env()->promise_string()).ToLocalChecked(); - v8::Local resolver = val.As(); - args.GetReturnValue().Set(resolver->GetPromise()); -} - -template -void FSReqPromise::MemoryInfo(MemoryTracker* tracker) const { - FSReqBase::MemoryInfo(tracker); - tracker->TrackField("stats_field_array", stats_field_array_); -} - -FSReqBase* GetReqWrap(const v8::FunctionCallbackInfo& args, - int index, - bool use_bigint) { - v8::Local value = args[index]; - if (value->IsObject()) { - return Unwrap(value.As()); - } - - BindingData* binding_data = Environment::GetBindingData(args); - Environment* env = binding_data->env(); - if (value->StrictEquals(env->fs_use_promises_symbol())) { - if (use_bigint) { - return FSReqPromise::New(binding_data, use_bigint); - } else { - return FSReqPromise::New(binding_data, use_bigint); - } - } - return nullptr; -} - -// Returns nullptr if the operation fails from the start. -template -FSReqBase* AsyncDestCall(Environment* env, FSReqBase* req_wrap, - const v8::FunctionCallbackInfo& args, - const char* syscall, const char* dest, - size_t len, enum encoding enc, uv_fs_cb after, - Func fn, Args... fn_args) { - CHECK_NOT_NULL(req_wrap); - req_wrap->Init(syscall, dest, len, enc); - int err = req_wrap->Dispatch(fn, fn_args..., after); - if (err < 0) { - uv_fs_t* uv_req = req_wrap->req(); - uv_req->result = err; - uv_req->path = nullptr; - after(uv_req); // after may delete req_wrap if there is an error - req_wrap = nullptr; - } else { - req_wrap->SetReturnValue(args); - } - - return req_wrap; -} - -// Returns nullptr if the operation fails from the start. -template -FSReqBase* AsyncCall(Environment* env, - FSReqBase* req_wrap, - const v8::FunctionCallbackInfo& args, - const char* syscall, enum encoding enc, - uv_fs_cb after, Func fn, Args... fn_args) { - return AsyncDestCall(env, req_wrap, args, - syscall, nullptr, 0, enc, - after, fn, fn_args...); -} - -// Template counterpart of SYNC_CALL, except that it only puts -// the error number and the syscall in the context instead of -// creating an error in the C++ land. -// ctx must be checked using value->IsObject() before being passed. -template -int SyncCall(Environment* env, v8::Local ctx, - FSReqWrapSync* req_wrap, const char* syscall, - Func fn, Args... args) { - env->PrintSyncTrace(); - int err = fn(env->event_loop(), &(req_wrap->req), args..., nullptr); - if (err < 0) { - v8::Local context = env->context(); - v8::Local ctx_obj = ctx.As(); - v8::Isolate* isolate = env->isolate(); - ctx_obj->Set(context, - env->errno_string(), - v8::Integer::New(isolate, err)).Check(); - ctx_obj->Set(context, - env->syscall_string(), - OneByteString(isolate, syscall)).Check(); - } - return err; -} - -} // namespace fs -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_FILE_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_file.h b/repo/packages/s/scriptx-legacy/include/libnode/node_file.h deleted file mode 100644 index cf98c5c9..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_file.h +++ /dev/null @@ -1,426 +0,0 @@ -#ifndef SRC_NODE_FILE_H_ -#define SRC_NODE_FILE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" -#include "node_messaging.h" -#include "node_snapshotable.h" -#include "stream_base.h" - -namespace node { -namespace fs { - -class FileHandleReadWrap; - -class BindingData : public SnapshotableObject { - public: - explicit BindingData(Environment* env, v8::Local wrap); - - AliasedFloat64Array stats_field_array; - AliasedBigUint64Array stats_field_bigint_array; - - std::vector> - file_handle_read_wrap_freelist; - - SERIALIZABLE_OBJECT_METHODS() - static constexpr FastStringKey type_name{"node::fs::BindingData"}; - static constexpr EmbedderObjectType type_int = - EmbedderObjectType::k_fs_binding_data; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_SELF_SIZE(BindingData) - SET_MEMORY_INFO_NAME(BindingData) -}; - -// structure used to store state during a complex operation, e.g., mkdirp. -class FSContinuationData : public MemoryRetainer { - public: - inline FSContinuationData(uv_fs_t* req, int mode, uv_fs_cb done_cb); - - inline void PushPath(std::string&& path); - inline void PushPath(const std::string& path); - inline std::string PopPath(); - // Used by mkdirp to track the first path created: - inline void MaybeSetFirstPath(const std::string& path); - inline void Done(int result); - - int mode() const { return mode_; } - const std::vector& paths() const { return paths_; } - const std::string& first_path() const { return first_path_; } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(FSContinuationData) - SET_SELF_SIZE(FSContinuationData) - - private: - uv_fs_cb done_cb_; - uv_fs_t* req_; - int mode_; - std::vector paths_; - std::string first_path_; -}; - -class FSReqBase : public ReqWrap { - public: - typedef MaybeStackBuffer FSReqBuffer; - - inline FSReqBase(BindingData* binding_data, - v8::Local req, - AsyncWrap::ProviderType type, - bool use_bigint); - ~FSReqBase() override; - - inline void Init(const char* syscall, - const char* data, - size_t len, - enum encoding encoding); - inline FSReqBuffer& Init(const char* syscall, size_t len, - enum encoding encoding); - - virtual void Reject(v8::Local reject) = 0; - virtual void Resolve(v8::Local value) = 0; - virtual void ResolveStat(const uv_stat_t* stat) = 0; - virtual void SetReturnValue( - const v8::FunctionCallbackInfo& args) = 0; - - const char* syscall() const { return syscall_; } - const char* data() const { return has_data_ ? *buffer_ : nullptr; } - enum encoding encoding() const { return encoding_; } - bool use_bigint() const { return use_bigint_; } - bool is_plain_open() const { return is_plain_open_; } - - void set_is_plain_open(bool value) { is_plain_open_ = value; } - - FSContinuationData* continuation_data() const { - return continuation_data_.get(); - } - void set_continuation_data(std::unique_ptr data) { - continuation_data_ = std::move(data); - } - - static FSReqBase* from_req(uv_fs_t* req) { - return static_cast(ReqWrap::from_req(req)); - } - - FSReqBase(const FSReqBase&) = delete; - FSReqBase& operator=(const FSReqBase&) = delete; - - void MemoryInfo(MemoryTracker* tracker) const override; - - BindingData* binding_data(); - - private: - std::unique_ptr continuation_data_; - enum encoding encoding_ = UTF8; - bool has_data_ = false; - bool use_bigint_ = false; - bool is_plain_open_ = false; - const char* syscall_ = nullptr; - - BaseObjectPtr binding_data_; - - // Typically, the content of buffer_ is something like a file name, so - // something around 64 bytes should be enough. - FSReqBuffer buffer_; -}; - -class FSReqCallback final : public FSReqBase { - public: - inline FSReqCallback(BindingData* binding_data, - v8::Local req, - bool use_bigint); - - void Reject(v8::Local reject) override; - void Resolve(v8::Local value) override; - void ResolveStat(const uv_stat_t* stat) override; - void SetReturnValue(const v8::FunctionCallbackInfo& args) override; - - SET_MEMORY_INFO_NAME(FSReqCallback) - SET_SELF_SIZE(FSReqCallback) - - FSReqCallback(const FSReqCallback&) = delete; - FSReqCallback& operator=(const FSReqCallback&) = delete; -}; - -template -void FillStatsArray(AliasedBufferBase* fields, - const uv_stat_t* s, - const size_t offset = 0); - -inline v8::Local FillGlobalStatsArray(BindingData* binding_data, - const bool use_bigint, - const uv_stat_t* s, - const bool second = false); - -template -class FSReqPromise final : public FSReqBase { - public: - static inline FSReqPromise* New(BindingData* binding_data, - bool use_bigint); - inline ~FSReqPromise() override; - - inline void Reject(v8::Local reject) override; - inline void Resolve(v8::Local value) override; - inline void ResolveStat(const uv_stat_t* stat) override; - inline void SetReturnValue( - const v8::FunctionCallbackInfo& args) override; - inline void MemoryInfo(MemoryTracker* tracker) const override; - - SET_MEMORY_INFO_NAME(FSReqPromise) - SET_SELF_SIZE(FSReqPromise) - - FSReqPromise(const FSReqPromise&) = delete; - FSReqPromise& operator=(const FSReqPromise&) = delete; - FSReqPromise(const FSReqPromise&&) = delete; - FSReqPromise& operator=(const FSReqPromise&&) = delete; - - private: - inline FSReqPromise(BindingData* binding_data, - v8::Local obj, - bool use_bigint); - - bool finished_ = false; - AliasedBufferT stats_field_array_; -}; - -class FSReqAfterScope final { - public: - FSReqAfterScope(FSReqBase* wrap, uv_fs_t* req); - ~FSReqAfterScope(); - void Clear(); - - bool Proceed(); - - void Reject(uv_fs_t* req); - - FSReqAfterScope(const FSReqAfterScope&) = delete; - FSReqAfterScope& operator=(const FSReqAfterScope&) = delete; - FSReqAfterScope(const FSReqAfterScope&&) = delete; - FSReqAfterScope& operator=(const FSReqAfterScope&&) = delete; - - private: - BaseObjectPtr wrap_; - uv_fs_t* req_ = nullptr; - v8::HandleScope handle_scope_; - v8::Context::Scope context_scope_; -}; - -class FileHandle; - -// A request wrap specifically for uv_fs_read()s scheduled for reading -// from a FileHandle. -class FileHandleReadWrap final : public ReqWrap { - public: - FileHandleReadWrap(FileHandle* handle, v8::Local obj); - ~FileHandleReadWrap() override; - - static inline FileHandleReadWrap* from_req(uv_fs_t* req) { - return static_cast(ReqWrap::from_req(req)); - } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(FileHandleReadWrap) - SET_SELF_SIZE(FileHandleReadWrap) - - private: - FileHandle* file_handle_; - uv_buf_t buffer_; - - friend class FileHandle; -}; - -// A wrapper for a file descriptor that will automatically close the fd when -// the object is garbage collected -class FileHandle final : public AsyncWrap, public StreamBase { - public: - enum InternalFields { - kFileHandleBaseField = StreamBase::kInternalFieldCount, - kClosingPromiseSlot, - kInternalFieldCount - }; - - static FileHandle* New(BindingData* binding_data, - int fd, - v8::Local obj = v8::Local()); - ~FileHandle() override; - - static void New(const v8::FunctionCallbackInfo& args); - - int GetFD() override { return fd_; } - - // Will asynchronously close the FD and return a Promise that will - // be resolved once closing is complete. - static void Close(const v8::FunctionCallbackInfo& args); - - // Releases ownership of the FD. - static void ReleaseFD(const v8::FunctionCallbackInfo& args); - - // StreamBase interface: - int ReadStart() override; - int ReadStop() override; - - bool IsAlive() override { return !closed_; } - bool IsClosing() override { return closing_; } - AsyncWrap* GetAsyncWrap() override { return this; } - - // In the case of file streams, shutting down corresponds to closing. - ShutdownWrap* CreateShutdownWrap(v8::Local object) override; - int DoShutdown(ShutdownWrap* req_wrap) override; - - int DoWrite(WriteWrap* w, - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle) override; - - void MemoryInfo(MemoryTracker* tracker) const override; - - SET_MEMORY_INFO_NAME(FileHandle) - SET_SELF_SIZE(FileHandle) - - FileHandle(const FileHandle&) = delete; - FileHandle& operator=(const FileHandle&) = delete; - FileHandle(const FileHandle&&) = delete; - FileHandle& operator=(const FileHandle&&) = delete; - - TransferMode GetTransferMode() const override; - std::unique_ptr TransferForMessaging() override; - - private: - class TransferData : public worker::TransferData { - public: - explicit TransferData(int fd); - ~TransferData(); - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(FileHandleTransferData) - SET_SELF_SIZE(TransferData) - - private: - int fd_; - }; - - FileHandle(BindingData* binding_data, v8::Local obj, int fd); - - // Synchronous close that emits a warning - void Close(); - void AfterClose(); - - class CloseReq final : public ReqWrap { - public: - CloseReq(Environment* env, - v8::Local obj, - v8::Local promise, - v8::Local ref); - ~CloseReq() override; - - FileHandle* file_handle(); - - void MemoryInfo(MemoryTracker* tracker) const override; - - SET_MEMORY_INFO_NAME(CloseReq) - SET_SELF_SIZE(CloseReq) - - void Resolve(); - - void Reject(v8::Local reason); - - static CloseReq* from_req(uv_fs_t* req) { - return static_cast(ReqWrap::from_req(req)); - } - - CloseReq(const CloseReq&) = delete; - CloseReq& operator=(const CloseReq&) = delete; - CloseReq(const CloseReq&&) = delete; - CloseReq& operator=(const CloseReq&&) = delete; - - private: - v8::Global promise_{}; - v8::Global ref_{}; - }; - - // Asynchronous close - v8::MaybeLocal ClosePromise(); - - int fd_; - bool closing_ = false; - bool closed_ = false; - bool reading_ = false; - int64_t read_offset_ = -1; - int64_t read_length_ = -1; - - BaseObjectPtr current_read_; - - BaseObjectPtr binding_data_; -}; - -int MKDirpSync(uv_loop_t* loop, - uv_fs_t* req, - const std::string& path, - int mode, - uv_fs_cb cb = nullptr); - -class FSReqWrapSync { - public: - FSReqWrapSync() = default; - ~FSReqWrapSync() { uv_fs_req_cleanup(&req); } - uv_fs_t req; - - FSContinuationData* continuation_data() const { - return continuation_data_.get(); - } - void set_continuation_data(std::unique_ptr data) { - continuation_data_ = std::move(data); - } - - FSReqWrapSync(const FSReqWrapSync&) = delete; - FSReqWrapSync& operator=(const FSReqWrapSync&) = delete; - - private: - std::unique_ptr continuation_data_; -}; - -// TODO(addaleax): Currently, callers check the return value and assume -// that nullptr indicates a synchronous call, rather than a failure. -// Failure conditions should be disambiguated and handled appropriately. -inline FSReqBase* GetReqWrap(const v8::FunctionCallbackInfo& args, - int index, - bool use_bigint = false); - -// Returns nullptr if the operation fails from the start. -template -inline FSReqBase* AsyncDestCall(Environment* env, FSReqBase* req_wrap, - const v8::FunctionCallbackInfo& args, - const char* syscall, const char* dest, - size_t len, enum encoding enc, uv_fs_cb after, - Func fn, Args... fn_args); - -// Returns nullptr if the operation fails from the start. -template -inline FSReqBase* AsyncCall(Environment* env, - FSReqBase* req_wrap, - const v8::FunctionCallbackInfo& args, - const char* syscall, enum encoding enc, - uv_fs_cb after, Func fn, Args... fn_args); - -// Template counterpart of SYNC_CALL, except that it only puts -// the error number and the syscall in the context instead of -// creating an error in the C++ land. -// ctx must be checked using value->IsObject() before being passed. -template -inline int SyncCall(Environment* env, v8::Local ctx, - FSReqWrapSync* req_wrap, const char* syscall, - Func fn, Args... args); - -} // namespace fs - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_FILE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_http2.h b/repo/packages/s/scriptx-legacy/include/libnode/node_http2.h deleted file mode 100644 index 5bd715da..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_http2.h +++ /dev/null @@ -1,1145 +0,0 @@ -#ifndef SRC_NODE_HTTP2_H_ -#define SRC_NODE_HTTP2_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -// FIXME(joyeecheung): nghttp2.h needs stdint.h to compile on Windows -#include -#include "nghttp2/nghttp2.h" - -#include "env.h" -#include "aliased_struct.h" -#include "node_http2_state.h" -#include "node_http_common.h" -#include "node_mem.h" -#include "node_perf.h" -#include "stream_base.h" -#include "string_bytes.h" - -#include -#include - -namespace node { -namespace http2 { - -// Constants in all caps are exported as user-facing constants -// in JavaScript. Constants using the kName pattern are internal -// only. - -// We strictly limit the number of outstanding unacknowledged PINGS a user -// may send in order to prevent abuse. The current default cap is 10. The -// user may set a different limit using a per Http2Session configuration -// option. -constexpr size_t kDefaultMaxPings = 10; - -// Also strictly limit the number of outstanding SETTINGS frames a user sends -constexpr size_t kDefaultMaxSettings = 10; - -// Default maximum total memory cap for Http2Session. -constexpr uint64_t kDefaultMaxSessionMemory = 10000000; - -// These are the standard HTTP/2 defaults as specified by the RFC -constexpr uint32_t DEFAULT_SETTINGS_HEADER_TABLE_SIZE = 4096; -constexpr uint32_t DEFAULT_SETTINGS_ENABLE_PUSH = 1; -constexpr uint32_t DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS = 0xffffffffu; -constexpr uint32_t DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE = 65535; -constexpr uint32_t DEFAULT_SETTINGS_MAX_FRAME_SIZE = 16384; -constexpr uint32_t DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE = 65535; -constexpr uint32_t DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL = 0; -constexpr uint32_t MAX_MAX_FRAME_SIZE = 16777215; -constexpr uint32_t MIN_MAX_FRAME_SIZE = DEFAULT_SETTINGS_MAX_FRAME_SIZE; -constexpr uint32_t MAX_INITIAL_WINDOW_SIZE = 2147483647; - -// Stream is not going to have any DATA frames -constexpr int STREAM_OPTION_EMPTY_PAYLOAD = 0x1; - -// Stream might have trailing headers -constexpr int STREAM_OPTION_GET_TRAILERS = 0x2; - -// Http2Stream internal states -constexpr int kStreamStateNone = 0x0; -constexpr int kStreamStateShut = 0x1; -constexpr int kStreamStateReadStart = 0x2; -constexpr int kStreamStateReadPaused = 0x4; -constexpr int kStreamStateClosed = 0x8; -constexpr int kStreamStateDestroyed = 0x10; -constexpr int kStreamStateTrailers = 0x20; - -// Http2Session internal states -constexpr int kSessionStateNone = 0x0; -constexpr int kSessionStateHasScope = 0x1; -constexpr int kSessionStateWriteScheduled = 0x2; -constexpr int kSessionStateClosed = 0x4; -constexpr int kSessionStateClosing = 0x8; -constexpr int kSessionStateSending = 0x10; -constexpr int kSessionStateWriteInProgress = 0x20; -constexpr int kSessionStateReadingStopped = 0x40; -constexpr int kSessionStateReceivePaused = 0x80; - -// The Padding Strategy determines the method by which extra padding is -// selected for HEADERS and DATA frames. These are configurable via the -// options passed in to a Http2Session object. -enum PaddingStrategy { - // No padding strategy. This is the default. - PADDING_STRATEGY_NONE, - // Attempts to ensure that the frame is 8-byte aligned - PADDING_STRATEGY_ALIGNED, - // Padding will ensure all data frames are maxFrameSize - PADDING_STRATEGY_MAX, - // Removed and turned into an alias because it is unreasonably expensive for - // very little benefit. - PADDING_STRATEGY_CALLBACK = PADDING_STRATEGY_ALIGNED -}; - -enum SessionType { - NGHTTP2_SESSION_SERVER, - NGHTTP2_SESSION_CLIENT -}; - -template -struct Nghttp2Deleter { - void operator()(T* ptr) const noexcept { fn(ptr); } -}; - -using Nghttp2OptionPointer = - std::unique_ptr>; - -using Nghttp2SessionPointer = - std::unique_ptr>; - -using Nghttp2SessionCallbacksPointer = - std::unique_ptr>; - -struct Http2HeadersTraits { - typedef nghttp2_nv nv_t; -}; - -struct Http2RcBufferPointerTraits { - typedef nghttp2_rcbuf rcbuf_t; - typedef nghttp2_vec vector_t; - - static void inc(rcbuf_t* buf) { - CHECK_NOT_NULL(buf); - nghttp2_rcbuf_incref(buf); - } - static void dec(rcbuf_t* buf) { - CHECK_NOT_NULL(buf); - nghttp2_rcbuf_decref(buf); - } - static vector_t get_vec(rcbuf_t* buf) { - CHECK_NOT_NULL(buf); - return nghttp2_rcbuf_get_buf(buf); - } - static bool is_static(const rcbuf_t* buf) { - CHECK_NOT_NULL(buf); - return nghttp2_rcbuf_is_static(buf); - } -}; - -using Http2Headers = NgHeaders; -using Http2RcBufferPointer = NgRcBufPointer; - -struct NgHttp2StreamWrite : public MemoryRetainer { - BaseObjectPtr req_wrap; - uv_buf_t buf; - - inline explicit NgHttp2StreamWrite(uv_buf_t buf_) : buf(buf_) {} - inline NgHttp2StreamWrite(BaseObjectPtr req_wrap, uv_buf_t buf_) : - req_wrap(std::move(req_wrap)), buf(buf_) {} - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(NgHttp2StreamWrite) - SET_SELF_SIZE(NgHttp2StreamWrite) -}; - -typedef uint32_t(*get_setting)(nghttp2_session* session, - nghttp2_settings_id id); - -class Http2Ping; -class Http2Session; -class Http2Settings; -class Http2Stream; -class Origins; - -// This scope should be present when any call into nghttp2 that may schedule -// data to be written to the underlying transport is made, and schedules -// such a write automatically once the scope is exited. -class Http2Scope { - public: - explicit Http2Scope(Http2Stream* stream); - explicit Http2Scope(Http2Session* session); - ~Http2Scope(); - - private: - BaseObjectPtr session_; -}; - -// The Http2Options class is used to parse the options object passed in to -// a Http2Session object and convert those into an appropriate nghttp2_option -// struct. This is the primary mechanism by which the Http2Session object is -// configured. -class Http2Options { - public: - Http2Options(Http2State* http2_state, - SessionType type); - - ~Http2Options() = default; - - nghttp2_option* operator*() const { - return options_.get(); - } - - void set_max_header_pairs(uint32_t max) { - max_header_pairs_ = max; - } - - uint32_t max_header_pairs() const { - return max_header_pairs_; - } - - void set_padding_strategy(PaddingStrategy val) { - padding_strategy_ = val; - } - - PaddingStrategy padding_strategy() const { - return padding_strategy_; - } - - void set_max_outstanding_pings(size_t max) { - max_outstanding_pings_ = max; - } - - size_t max_outstanding_pings() const { - return max_outstanding_pings_; - } - - void set_max_outstanding_settings(size_t max) { - max_outstanding_settings_ = max; - } - - size_t max_outstanding_settings() const { - return max_outstanding_settings_; - } - - void set_max_session_memory(uint64_t max) { - max_session_memory_ = max; - } - - uint64_t max_session_memory() const { - return max_session_memory_; - } - - private: - Nghttp2OptionPointer options_; - uint64_t max_session_memory_ = kDefaultMaxSessionMemory; - uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; - PaddingStrategy padding_strategy_ = PADDING_STRATEGY_NONE; - size_t max_outstanding_pings_ = kDefaultMaxPings; - size_t max_outstanding_settings_ = kDefaultMaxSettings; -}; - -struct Http2Priority : public nghttp2_priority_spec { - Http2Priority(Environment* env, - v8::Local parent, - v8::Local weight, - v8::Local exclusive); -}; - -class Http2StreamListener : public StreamListener { - public: - uv_buf_t OnStreamAlloc(size_t suggested_size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; -}; - -struct Http2HeaderTraits { - typedef Http2RcBufferPointer rcbufferpointer_t; - typedef Http2Session allocator_t; - - // HTTP/2 does not support identifying header names by token id. - // HTTP/3 will, however, so we prepare for that now. - static const char* ToHttpHeaderName(int32_t token) { return nullptr; } -}; - -using Http2Header = NgHeader; - -class Http2Stream : public AsyncWrap, - public StreamBase { - public: - static Http2Stream* New( - Http2Session* session, - int32_t id, - nghttp2_headers_category category = NGHTTP2_HCAT_HEADERS, - int options = 0); - ~Http2Stream() override; - - nghttp2_stream* operator*() const; - - nghttp2_stream* stream() const; - - Http2Session* session() { return session_.get(); } - const Http2Session* session() const { return session_.get(); } - - // Required for StreamBase - int ReadStart() override; - - // Required for StreamBase - int ReadStop() override; - - // Required for StreamBase - ShutdownWrap* CreateShutdownWrap(v8::Local object) override; - int DoShutdown(ShutdownWrap* req_wrap) override; - - bool HasWantsWrite() const override { return true; } - - // Initiate a response on this stream. - int SubmitResponse(const Http2Headers& headers, int options); - - // Submit informational headers for this stream - int SubmitInfo(const Http2Headers& headers); - - // Submit trailing headers for this stream - int SubmitTrailers(const Http2Headers& headers); - void OnTrailers(); - - // Submit a PRIORITY frame for this stream - int SubmitPriority(const Http2Priority& priority, bool silent = false); - - // Submits an RST_STREAM frame using the given code - void SubmitRstStream(const uint32_t code); - - void FlushRstStream(); - - // Submits a PUSH_PROMISE frame with this stream as the parent. - Http2Stream* SubmitPushPromise( - const Http2Headers& headers, - int32_t* ret, - int options = 0); - - - void Close(int32_t code); - - // Destroy this stream instance and free all held memory. - void Destroy(); - - bool is_destroyed() const { - return flags_ & kStreamStateDestroyed; - } - - bool is_writable() const { - return !(flags_ & kStreamStateShut); - } - - bool is_paused() const { - return flags_ & kStreamStateReadPaused; - } - - bool is_closed() const { - return flags_ & kStreamStateClosed; - } - - bool has_trailers() const { - return flags_ & kStreamStateTrailers; - } - - void set_has_trailers(bool on = true) { - if (on) - flags_ |= kStreamStateTrailers; - else - flags_ &= ~kStreamStateTrailers; - } - - void set_closed() { - flags_ |= kStreamStateClosed; - } - - void set_destroyed() { - flags_ |= kStreamStateDestroyed; - } - - void set_not_writable() { - flags_ |= kStreamStateShut; - } - - void set_reading(bool on = true) { - if (on) { - flags_ |= kStreamStateReadStart; - set_paused(false); - } else {} - } - - void set_paused(bool on = true) { - if (on) - flags_ |= kStreamStateReadPaused; - else - flags_ &= ~kStreamStateReadPaused; - } - - // Returns true if this stream is in the reading state, which occurs when - // the kStreamStateReadStart flag has been set and the - // kStreamStateReadPaused flag is *not* set. - bool is_reading() const { - return flags_ & kStreamStateReadStart && !is_paused(); - } - - // Returns the RST_STREAM code used to close this stream - int32_t code() const { return code_; } - - // Returns the stream identifier for this stream - int32_t id() const { return id_; } - - void IncrementAvailableOutboundLength(size_t amount); - void DecrementAvailableOutboundLength(size_t amount); - - bool AddHeader(nghttp2_rcbuf* name, nghttp2_rcbuf* value, uint8_t flags); - - template - void TransferHeaders(Fn&& fn) { - size_t i = 0; - for (const auto& header : current_headers_ ) - fn(header, i++); - ClearHeaders(); - } - - void ClearHeaders() { - current_headers_.clear(); - } - - size_t headers_count() const { - return current_headers_.size(); - } - - nghttp2_headers_category headers_category() const { - return current_headers_category_; - } - - void StartHeaders(nghttp2_headers_category category); - - // Required for StreamBase - bool IsAlive() override { - return true; - } - - // Required for StreamBase - bool IsClosing() override { - return false; - } - - AsyncWrap* GetAsyncWrap() override { return this; } - - int DoWrite(WriteWrap* w, uv_buf_t* bufs, size_t count, - uv_stream_t* send_handle) override; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Http2Stream) - SET_SELF_SIZE(Http2Stream) - - std::string diagnostic_name() const override; - - // JavaScript API - static void GetID(const v8::FunctionCallbackInfo& args); - static void Destroy(const v8::FunctionCallbackInfo& args); - static void Priority(const v8::FunctionCallbackInfo& args); - static void PushPromise(const v8::FunctionCallbackInfo& args); - static void RefreshState(const v8::FunctionCallbackInfo& args); - static void Info(const v8::FunctionCallbackInfo& args); - static void Trailers(const v8::FunctionCallbackInfo& args); - static void Respond(const v8::FunctionCallbackInfo& args); - static void RstStream(const v8::FunctionCallbackInfo& args); - - class Provider; - - struct Statistics { - uint64_t start_time; - uint64_t end_time; - uint64_t first_header; // Time first header was received - uint64_t first_byte; // Time first DATA frame byte was received - uint64_t first_byte_sent; // Time first DATA frame byte was sent - uint64_t sent_bytes; - uint64_t received_bytes; - uint64_t id; - }; - - Statistics statistics_ = {}; - - private: - Http2Stream(Http2Session* session, - v8::Local obj, - int32_t id, - nghttp2_headers_category category, - int options); - - void EmitStatistics(); - - BaseObjectWeakPtr session_; // The Parent HTTP/2 Session - int32_t id_ = 0; // The Stream Identifier - int32_t code_ = NGHTTP2_NO_ERROR; // The RST_STREAM code (if any) - int flags_ = kStreamStateNone; // Internal state flags - - uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; - uint32_t max_header_length_ = DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE; - - // The Current Headers block... As headers are received for this stream, - // they are temporarily stored here until the OnFrameReceived is called - // signalling the end of the HEADERS frame - nghttp2_headers_category current_headers_category_ = NGHTTP2_HCAT_HEADERS; - uint32_t current_headers_length_ = 0; // total number of octets - std::vector current_headers_; - - // This keeps track of the amount of data read from the socket while the - // socket was in paused mode. When `ReadStart()` is called (and not before - // then), we tell nghttp2 that we consumed that data to get proper - // backpressure handling. - size_t inbound_consumed_data_while_paused_ = 0; - - // Outbound Data... This is the data written by the JS layer that is - // waiting to be written out to the socket. - std::queue queue_; - size_t available_outbound_length_ = 0; - - Http2StreamListener stream_listener_; - - friend class Http2Session; -}; - -class Http2Stream::Provider { - public: - Provider(Http2Stream* stream, int options); - explicit Provider(int options); - virtual ~Provider(); - - nghttp2_data_provider* operator*() { - return !empty_ ? &provider_ : nullptr; - } - - class FD; - class Stream; - protected: - nghttp2_data_provider provider_; - - private: - bool empty_ = false; -}; - -class Http2Stream::Provider::Stream : public Http2Stream::Provider { - public: - Stream(Http2Stream* stream, int options); - explicit Stream(int options); - - static ssize_t OnRead(nghttp2_session* session, - int32_t id, - uint8_t* buf, - size_t length, - uint32_t* flags, - nghttp2_data_source* source, - void* user_data); -}; - -struct SessionJSFields { - uint8_t bitfield; - uint8_t priority_listener_count; - uint8_t frame_error_listener_count; - uint32_t max_invalid_frames = 1000; - uint32_t max_rejected_streams = 100; -}; - -// Indices for js_fields_, which serves as a way to communicate data with JS -// land fast. In particular, we store information about the number/presence -// of certain event listeners in JS, and skip calls from C++ into JS if they -// are missing. -enum SessionUint8Fields { - kBitfield = offsetof(SessionJSFields, bitfield), // See below - kSessionPriorityListenerCount = - offsetof(SessionJSFields, priority_listener_count), - kSessionFrameErrorListenerCount = - offsetof(SessionJSFields, frame_error_listener_count), - kSessionMaxInvalidFrames = offsetof(SessionJSFields, max_invalid_frames), - kSessionMaxRejectedStreams = offsetof(SessionJSFields, max_rejected_streams), - kSessionUint8FieldCount = sizeof(SessionJSFields) -}; - -enum SessionBitfieldFlags { - kSessionHasRemoteSettingsListeners, - kSessionRemoteSettingsIsUpToDate, - kSessionHasPingListeners, - kSessionHasAltsvcListeners -}; - -class Http2Session : public AsyncWrap, - public StreamListener, - public mem::NgLibMemoryManager { - public: - Http2Session(Http2State* http2_state, - v8::Local wrap, - SessionType type = NGHTTP2_SESSION_SERVER); - ~Http2Session() override; - - StreamBase* underlying_stream() { - return static_cast(stream_); - } - - void Close(uint32_t code = NGHTTP2_NO_ERROR, - bool socket_closed = false); - - void Consume(v8::Local stream); - - void Goaway(uint32_t code, int32_t lastStreamID, - const uint8_t* data, size_t len); - - void AltSvc(int32_t id, - uint8_t* origin, - size_t origin_len, - uint8_t* value, - size_t value_len); - - void Origin(const Origins& origins); - - uint8_t SendPendingData(); - - // Submits a new request. If the request is a success, assigned - // will be a pointer to the Http2Stream instance assigned. - // This only works if the session is a client session. - Http2Stream* SubmitRequest( - const Http2Priority& priority, - const Http2Headers& headers, - int32_t* ret, - int options = 0); - - SessionType type() const { return session_type_; } - - nghttp2_session* session() const { return session_.get(); } - - nghttp2_session* operator*() { return session_.get(); } - - uint32_t max_header_pairs() const { return max_header_pairs_; } - - const char* TypeName() const; - - bool is_destroyed() { - return (flags_ & kSessionStateClosed) || session_ == nullptr; - } - - void set_destroyed() { - flags_ |= kSessionStateClosed; - } - -#define IS_FLAG(name, flag) \ - bool is_##name() const { return flags_ & flag; } \ - void set_##name(bool on = true) { \ - if (on) \ - flags_ |= flag; \ - else \ - flags_ &= ~flag; \ - } - - IS_FLAG(in_scope, kSessionStateHasScope) - IS_FLAG(write_scheduled, kSessionStateWriteScheduled) - IS_FLAG(closing, kSessionStateClosing) - IS_FLAG(sending, kSessionStateSending) - IS_FLAG(write_in_progress, kSessionStateWriteInProgress) - IS_FLAG(reading_stopped, kSessionStateReadingStopped) - IS_FLAG(receive_paused, kSessionStateReceivePaused) - -#undef IS_FLAG - - // Schedule a write if nghttp2 indicates it wants to write to the socket. - void MaybeScheduleWrite(); - - // Stop reading if nghttp2 doesn't want to anymore. - void MaybeStopReading(); - - // Returns pointer to the stream, or nullptr if stream does not exist - BaseObjectPtr FindStream(int32_t id); - - bool CanAddStream(); - - // Adds a stream instance to this session - void AddStream(Http2Stream* stream); - - // Removes a stream instance from this session - BaseObjectPtr RemoveStream(int32_t id); - - // Indicates whether there currently exist outgoing buffers for this stream. - bool HasWritesOnSocketForStream(Http2Stream* stream); - - // Write data from stream_buf_ to the session. - // This will call the error callback if an error occurs. - void ConsumeHTTP2Data(); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Http2Session) - SET_SELF_SIZE(Http2Session) - - std::string diagnostic_name() const override; - - // Schedule an RstStream for after the current write finishes. - void AddPendingRstStream(int32_t stream_id) { - pending_rst_streams_.emplace_back(stream_id); - } - - bool has_pending_rststream(int32_t stream_id) { - return pending_rst_streams_.end() != - std::find(pending_rst_streams_.begin(), - pending_rst_streams_.end(), - stream_id); - } - - // Handle reads/writes from the underlying network transport. - uv_buf_t OnStreamAlloc(size_t suggested_size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; - void OnStreamAfterWrite(WriteWrap* w, int status) override; - - // Implementation for mem::NgLibMemoryManager - void CheckAllocatedSize(size_t previous_size) const; - void IncreaseAllocatedSize(size_t size); - void DecreaseAllocatedSize(size_t size); - - // The JavaScript API - static void New(const v8::FunctionCallbackInfo& args); - static void Consume(const v8::FunctionCallbackInfo& args); - static void Receive(const v8::FunctionCallbackInfo& args); - static void Destroy(const v8::FunctionCallbackInfo& args); - static void Settings(const v8::FunctionCallbackInfo& args); - static void Request(const v8::FunctionCallbackInfo& args); - static void SetNextStreamID(const v8::FunctionCallbackInfo& args); - static void SetLocalWindowSize( - const v8::FunctionCallbackInfo& args); - static void Goaway(const v8::FunctionCallbackInfo& args); - static void UpdateChunksSent(const v8::FunctionCallbackInfo& args); - static void RefreshState(const v8::FunctionCallbackInfo& args); - static void Ping(const v8::FunctionCallbackInfo& args); - static void AltSvc(const v8::FunctionCallbackInfo& args); - static void Origin(const v8::FunctionCallbackInfo& args); - - template - static void RefreshSettings(const v8::FunctionCallbackInfo& args); - - uv_loop_t* event_loop() const { - return env()->event_loop(); - } - - Http2State* http2_state() const { return http2_state_.get(); } - - BaseObjectPtr PopPing(); - bool AddPing(const uint8_t* data, v8::Local callback); - - BaseObjectPtr PopSettings(); - bool AddSettings(v8::Local callback); - - void IncrementCurrentSessionMemory(uint64_t amount) { - current_session_memory_ += amount; - } - - void DecrementCurrentSessionMemory(uint64_t amount) { - DCHECK_LE(amount, current_session_memory_); - current_session_memory_ -= amount; - } - - // Tell our custom memory allocator that this rcbuf is independent of - // this session now, and may outlive it. - void StopTrackingRcbuf(nghttp2_rcbuf* buf); - - // Returns the current session memory including memory allocated by nghttp2, - // the current outbound storage queue, and pending writes. - uint64_t current_session_memory() const { - uint64_t total = current_session_memory_ + sizeof(Http2Session); - total += current_nghttp2_memory_; - total += outgoing_storage_.size(); - return total; - } - - // Return true if current_session_memory + amount is less than the max - bool has_available_session_memory(uint64_t amount) const { - return current_session_memory() + amount <= max_session_memory_; - } - - struct Statistics { - uint64_t start_time; - uint64_t end_time; - uint64_t ping_rtt; - uint64_t data_sent; - uint64_t data_received; - uint32_t frame_count; - uint32_t frame_sent; - int32_t stream_count; - size_t max_concurrent_streams; - double stream_average_duration; - SessionType session_type; - }; - - Statistics statistics_ = {}; - - private: - void EmitStatistics(); - - // Frame Padding Strategies - ssize_t OnDWordAlignedPadding(size_t frameLength, - size_t maxPayloadLen); - ssize_t OnMaxFrameSizePadding(size_t frameLength, - size_t maxPayloadLen); - - // Frame Handler - int HandleDataFrame(const nghttp2_frame* frame); - void HandleGoawayFrame(const nghttp2_frame* frame); - void HandleHeadersFrame(const nghttp2_frame* frame); - void HandlePriorityFrame(const nghttp2_frame* frame); - void HandleSettingsFrame(const nghttp2_frame* frame); - void HandlePingFrame(const nghttp2_frame* frame); - void HandleAltSvcFrame(const nghttp2_frame* frame); - void HandleOriginFrame(const nghttp2_frame* frame); - - void DecrefHeaders(const nghttp2_frame* frame); - - // nghttp2 callbacks - static int OnBeginHeadersCallback( - nghttp2_session* session, - const nghttp2_frame* frame, - void* user_data); - static int OnHeaderCallback( - nghttp2_session* session, - const nghttp2_frame* frame, - nghttp2_rcbuf* name, - nghttp2_rcbuf* value, - uint8_t flags, - void* user_data); - static int OnFrameReceive( - nghttp2_session* session, - const nghttp2_frame* frame, - void* user_data); - static int OnFrameNotSent( - nghttp2_session* session, - const nghttp2_frame* frame, - int error_code, - void* user_data); - static int OnFrameSent( - nghttp2_session* session, - const nghttp2_frame* frame, - void* user_data); - static int OnStreamClose( - nghttp2_session* session, - int32_t id, - uint32_t code, - void* user_data); - static int OnInvalidHeader( - nghttp2_session* session, - const nghttp2_frame* frame, - nghttp2_rcbuf* name, - nghttp2_rcbuf* value, - uint8_t flags, - void* user_data); - static int OnDataChunkReceived( - nghttp2_session* session, - uint8_t flags, - int32_t id, - const uint8_t* data, - size_t len, - void* user_data); - static ssize_t OnSelectPadding( - nghttp2_session* session, - const nghttp2_frame* frame, - size_t maxPayloadLen, - void* user_data); - static int OnNghttpError( - nghttp2_session* session, - const char* message, - size_t len, - void* user_data); - static int OnSendData( - nghttp2_session* session, - nghttp2_frame* frame, - const uint8_t* framehd, - size_t length, - nghttp2_data_source* source, - void* user_data); - static int OnInvalidFrame( - nghttp2_session* session, - const nghttp2_frame* frame, - int lib_error_code, - void* user_data); - - struct Callbacks { - explicit Callbacks(bool kHasGetPaddingCallback); - - Nghttp2SessionCallbacksPointer callbacks; - }; - - /* Use callback_struct_saved[kHasGetPaddingCallback ? 1 : 0] */ - static const Callbacks callback_struct_saved[2]; - - // The underlying nghttp2_session handle - Nghttp2SessionPointer session_; - - // JS-accessible numeric fields, as indexed by SessionUint8Fields. - AliasedStruct js_fields_; - - // The session type: client or server - SessionType session_type_; - - // The maximum number of header pairs permitted for streams on this session - uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; - - // The maximum amount of memory allocated for this session - uint64_t max_session_memory_ = kDefaultMaxSessionMemory; - uint64_t current_session_memory_ = 0; - // The amount of memory allocated by nghttp2 internals - uint64_t current_nghttp2_memory_ = 0; - - // The collection of active Http2Streams associated with this session - std::unordered_map> streams_; - - int flags_ = kSessionStateNone; - - // The StreamBase instance being used for i/o - PaddingStrategy padding_strategy_ = PADDING_STRATEGY_NONE; - - // use this to allow timeout tracking during long-lasting writes - uint32_t chunks_sent_since_last_write_ = 0; - - uv_buf_t stream_buf_ = uv_buf_init(nullptr, 0); - // When processing input data, either stream_buf_ab_ or stream_buf_allocation_ - // will be set. stream_buf_ab_ is lazily created from stream_buf_allocation_. - v8::Global stream_buf_ab_; - std::unique_ptr stream_buf_allocation_; - size_t stream_buf_offset_ = 0; - // Custom error code for errors that originated inside one of the callbacks - // called by nghttp2_session_mem_recv. - const char* custom_recv_error_code_ = nullptr; - - size_t max_outstanding_pings_ = kDefaultMaxPings; - std::queue> outstanding_pings_; - - size_t max_outstanding_settings_ = kDefaultMaxSettings; - std::queue> outstanding_settings_; - - std::vector outgoing_buffers_; - std::vector outgoing_storage_; - size_t outgoing_length_ = 0; - std::vector pending_rst_streams_; - // Count streams that have been rejected while being opened. Exceeding a fixed - // limit will result in the session being destroyed, as an indication of a - // misbehaving peer. This counter is reset once new streams are being - // accepted again. - uint32_t rejected_stream_count_ = 0; - // Also use the invalid frame count as a measure for rejecting input frames. - uint32_t invalid_frame_count_ = 0; - - void PushOutgoingBuffer(NgHttp2StreamWrite&& write); - - BaseObjectPtr http2_state_; - - void CopyDataIntoOutgoing(const uint8_t* src, size_t src_length); - void ClearOutgoing(int status); - - friend class Http2Scope; - friend class Http2StreamListener; -}; - -struct Http2SessionPerformanceEntryTraits { - static constexpr performance::PerformanceEntryType kType = - performance::NODE_PERFORMANCE_ENTRY_TYPE_HTTP2; - - using Details = Http2Session::Statistics; - - static v8::MaybeLocal GetDetails( - Environment* env, - const performance::PerformanceEntry& - entry); -}; - -struct Http2StreamPerformanceEntryTraits { - static constexpr performance::PerformanceEntryType kType = - performance::NODE_PERFORMANCE_ENTRY_TYPE_HTTP2; - - using Details = Http2Stream::Statistics; - - static v8::MaybeLocal GetDetails( - Environment* env, - const performance::PerformanceEntry& - entry); -}; - -using Http2SessionPerformanceEntry = - performance::PerformanceEntry; -using Http2StreamPerformanceEntry = - performance::PerformanceEntry; - -class Http2Ping : public AsyncWrap { - public: - explicit Http2Ping( - Http2Session* session, - v8::Local obj, - v8::Local callback); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Http2Ping) - SET_SELF_SIZE(Http2Ping) - - void Send(const uint8_t* payload); - void Done(bool ack, const uint8_t* payload = nullptr); - void DetachFromSession(); - - v8::Local callback() const; - - private: - BaseObjectWeakPtr session_; - v8::Global callback_; - uint64_t startTime_; -}; - -// The Http2Settings class is used to parse the settings passed in for -// an Http2Session, converting those into an array of nghttp2_settings_entry -// structs. -class Http2Settings : public AsyncWrap { - public: - Http2Settings(Http2Session* session, - v8::Local obj, - v8::Local callback, - uint64_t start_time = uv_hrtime()); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Http2Settings) - SET_SELF_SIZE(Http2Settings) - - void Send(); - void Done(bool ack); - - v8::Local callback() const; - - // Returns a Buffer instance with the serialized SETTINGS payload - v8::Local Pack(); - - static v8::Local Pack(Http2State* state); - - // Resets the default values in the settings buffer - static void RefreshDefaults(Http2State* http2_state); - - // Update the local or remote settings for the given session - static void Update(Http2Session* session, - get_setting fn); - - private: - static size_t Init( - Http2State* http2_state, - nghttp2_settings_entry* entries); - - static v8::Local Pack( - Environment* env, - size_t count, - const nghttp2_settings_entry* entries); - - BaseObjectWeakPtr session_; - v8::Global callback_; - uint64_t startTime_; - size_t count_ = 0; - nghttp2_settings_entry entries_[IDX_SETTINGS_COUNT]; -}; - -class Origins { - public: - Origins(Environment* env, - v8::Local origin_string, - size_t origin_count); - ~Origins() = default; - - const nghttp2_origin_entry* operator*() const { - return static_cast(bs_->Data()); - } - - size_t length() const { - return count_; - } - - private: - size_t count_; - std::unique_ptr bs_; -}; - -#define HTTP2_HIDDEN_CONSTANTS(V) \ - V(NGHTTP2_HCAT_REQUEST) \ - V(NGHTTP2_HCAT_RESPONSE) \ - V(NGHTTP2_HCAT_PUSH_RESPONSE) \ - V(NGHTTP2_HCAT_HEADERS) \ - V(NGHTTP2_NV_FLAG_NONE) \ - V(NGHTTP2_NV_FLAG_NO_INDEX) \ - V(NGHTTP2_ERR_DEFERRED) \ - V(NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE) \ - V(NGHTTP2_ERR_INVALID_ARGUMENT) \ - V(NGHTTP2_ERR_STREAM_CLOSED) \ - V(NGHTTP2_ERR_NOMEM) \ - V(STREAM_OPTION_EMPTY_PAYLOAD) \ - V(STREAM_OPTION_GET_TRAILERS) - -#define HTTP2_ERROR_CODES(V) \ - V(NGHTTP2_NO_ERROR) \ - V(NGHTTP2_PROTOCOL_ERROR) \ - V(NGHTTP2_INTERNAL_ERROR) \ - V(NGHTTP2_FLOW_CONTROL_ERROR) \ - V(NGHTTP2_SETTINGS_TIMEOUT) \ - V(NGHTTP2_STREAM_CLOSED) \ - V(NGHTTP2_FRAME_SIZE_ERROR) \ - V(NGHTTP2_REFUSED_STREAM) \ - V(NGHTTP2_CANCEL) \ - V(NGHTTP2_COMPRESSION_ERROR) \ - V(NGHTTP2_CONNECT_ERROR) \ - V(NGHTTP2_ENHANCE_YOUR_CALM) \ - V(NGHTTP2_INADEQUATE_SECURITY) \ - V(NGHTTP2_HTTP_1_1_REQUIRED) \ - -#define HTTP2_CONSTANTS(V) \ - V(NGHTTP2_ERR_FRAME_SIZE_ERROR) \ - V(NGHTTP2_SESSION_SERVER) \ - V(NGHTTP2_SESSION_CLIENT) \ - V(NGHTTP2_STREAM_STATE_IDLE) \ - V(NGHTTP2_STREAM_STATE_OPEN) \ - V(NGHTTP2_STREAM_STATE_RESERVED_LOCAL) \ - V(NGHTTP2_STREAM_STATE_RESERVED_REMOTE) \ - V(NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL) \ - V(NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE) \ - V(NGHTTP2_STREAM_STATE_CLOSED) \ - V(NGHTTP2_FLAG_NONE) \ - V(NGHTTP2_FLAG_END_STREAM) \ - V(NGHTTP2_FLAG_END_HEADERS) \ - V(NGHTTP2_FLAG_ACK) \ - V(NGHTTP2_FLAG_PADDED) \ - V(NGHTTP2_FLAG_PRIORITY) \ - V(DEFAULT_SETTINGS_HEADER_TABLE_SIZE) \ - V(DEFAULT_SETTINGS_ENABLE_PUSH) \ - V(DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS) \ - V(DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE) \ - V(DEFAULT_SETTINGS_MAX_FRAME_SIZE) \ - V(DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE) \ - V(DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL) \ - V(MAX_MAX_FRAME_SIZE) \ - V(MIN_MAX_FRAME_SIZE) \ - V(MAX_INITIAL_WINDOW_SIZE) \ - V(NGHTTP2_SETTINGS_HEADER_TABLE_SIZE) \ - V(NGHTTP2_SETTINGS_ENABLE_PUSH) \ - V(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS) \ - V(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE) \ - V(NGHTTP2_SETTINGS_MAX_FRAME_SIZE) \ - V(NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE) \ - V(NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL) \ - V(PADDING_STRATEGY_NONE) \ - V(PADDING_STRATEGY_ALIGNED) \ - V(PADDING_STRATEGY_MAX) \ - V(PADDING_STRATEGY_CALLBACK) \ - HTTP2_ERROR_CODES(V) - -#define HTTP2_SETTINGS(V) \ - V(HEADER_TABLE_SIZE) \ - V(ENABLE_PUSH) \ - V(MAX_CONCURRENT_STREAMS) \ - V(INITIAL_WINDOW_SIZE) \ - V(MAX_FRAME_SIZE) \ - V(MAX_HEADER_LIST_SIZE) \ - V(ENABLE_CONNECT_PROTOCOL) \ - -} // namespace http2 -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_HTTP2_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_http2_state.h b/repo/packages/s/scriptx-legacy/include/libnode/node_http2_state.h deleted file mode 100644 index 7cf40ff1..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_http2_state.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef SRC_NODE_HTTP2_STATE_H_ -#define SRC_NODE_HTTP2_STATE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" - -struct nghttp2_rcbuf; - -namespace node { -namespace http2 { - - enum Http2SettingsIndex { - IDX_SETTINGS_HEADER_TABLE_SIZE, - IDX_SETTINGS_ENABLE_PUSH, - IDX_SETTINGS_INITIAL_WINDOW_SIZE, - IDX_SETTINGS_MAX_FRAME_SIZE, - IDX_SETTINGS_MAX_CONCURRENT_STREAMS, - IDX_SETTINGS_MAX_HEADER_LIST_SIZE, - IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL, - IDX_SETTINGS_COUNT - }; - - enum Http2SessionStateIndex { - IDX_SESSION_STATE_EFFECTIVE_LOCAL_WINDOW_SIZE, - IDX_SESSION_STATE_EFFECTIVE_RECV_DATA_LENGTH, - IDX_SESSION_STATE_NEXT_STREAM_ID, - IDX_SESSION_STATE_LOCAL_WINDOW_SIZE, - IDX_SESSION_STATE_LAST_PROC_STREAM_ID, - IDX_SESSION_STATE_REMOTE_WINDOW_SIZE, - IDX_SESSION_STATE_OUTBOUND_QUEUE_SIZE, - IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE, - IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE, - IDX_SESSION_STATE_COUNT - }; - - enum Http2StreamStateIndex { - IDX_STREAM_STATE, - IDX_STREAM_STATE_WEIGHT, - IDX_STREAM_STATE_SUM_DEPENDENCY_WEIGHT, - IDX_STREAM_STATE_LOCAL_CLOSE, - IDX_STREAM_STATE_REMOTE_CLOSE, - IDX_STREAM_STATE_LOCAL_WINDOW_SIZE, - IDX_STREAM_STATE_COUNT - }; - - enum Http2OptionsIndex { - IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE, - IDX_OPTIONS_MAX_RESERVED_REMOTE_STREAMS, - IDX_OPTIONS_MAX_SEND_HEADER_BLOCK_LENGTH, - IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS, - IDX_OPTIONS_PADDING_STRATEGY, - IDX_OPTIONS_MAX_HEADER_LIST_PAIRS, - IDX_OPTIONS_MAX_OUTSTANDING_PINGS, - IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS, - IDX_OPTIONS_MAX_SESSION_MEMORY, - IDX_OPTIONS_MAX_SETTINGS, - IDX_OPTIONS_FLAGS - }; - - enum Http2StreamStatisticsIndex { - IDX_STREAM_STATS_ID, - IDX_STREAM_STATS_TIMETOFIRSTBYTE, - IDX_STREAM_STATS_TIMETOFIRSTHEADER, - IDX_STREAM_STATS_TIMETOFIRSTBYTESENT, - IDX_STREAM_STATS_SENTBYTES, - IDX_STREAM_STATS_RECEIVEDBYTES, - IDX_STREAM_STATS_COUNT - }; - - enum Http2SessionStatisticsIndex { - IDX_SESSION_STATS_TYPE, - IDX_SESSION_STATS_PINGRTT, - IDX_SESSION_STATS_FRAMESRECEIVED, - IDX_SESSION_STATS_FRAMESSENT, - IDX_SESSION_STATS_STREAMCOUNT, - IDX_SESSION_STATS_STREAMAVERAGEDURATION, - IDX_SESSION_STATS_DATA_SENT, - IDX_SESSION_STATS_DATA_RECEIVED, - IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS, - IDX_SESSION_STATS_COUNT - }; - -class Http2State : public BaseObject { - public: - Http2State(Environment* env, v8::Local obj) - : BaseObject(env, obj), - root_buffer(env->isolate(), sizeof(http2_state_internal)), - session_state_buffer( - env->isolate(), - offsetof(http2_state_internal, session_state_buffer), - IDX_SESSION_STATE_COUNT, - root_buffer), - stream_state_buffer( - env->isolate(), - offsetof(http2_state_internal, stream_state_buffer), - IDX_STREAM_STATE_COUNT, - root_buffer), - stream_stats_buffer( - env->isolate(), - offsetof(http2_state_internal, stream_stats_buffer), - IDX_STREAM_STATS_COUNT, - root_buffer), - session_stats_buffer( - env->isolate(), - offsetof(http2_state_internal, session_stats_buffer), - IDX_SESSION_STATS_COUNT, - root_buffer), - options_buffer(env->isolate(), - offsetof(http2_state_internal, options_buffer), - IDX_OPTIONS_FLAGS + 1, - root_buffer), - settings_buffer(env->isolate(), - offsetof(http2_state_internal, settings_buffer), - IDX_SETTINGS_COUNT + 1, - root_buffer) {} - - AliasedUint8Array root_buffer; - AliasedFloat64Array session_state_buffer; - AliasedFloat64Array stream_state_buffer; - AliasedFloat64Array stream_stats_buffer; - AliasedFloat64Array session_stats_buffer; - AliasedUint32Array options_buffer; - AliasedUint32Array settings_buffer; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_SELF_SIZE(Http2State) - SET_MEMORY_INFO_NAME(Http2State) - - static constexpr FastStringKey type_name { "http2" }; - - private: - struct http2_state_internal { - // doubles first so that they are always sizeof(double)-aligned - double session_state_buffer[IDX_SESSION_STATE_COUNT]; - double stream_state_buffer[IDX_STREAM_STATE_COUNT]; - double stream_stats_buffer[IDX_STREAM_STATS_COUNT]; - double session_stats_buffer[IDX_SESSION_STATS_COUNT]; - uint32_t options_buffer[IDX_OPTIONS_FLAGS + 1]; - uint32_t settings_buffer[IDX_SETTINGS_COUNT + 1]; - }; -}; - -} // namespace http2 -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_HTTP2_STATE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_http_common-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_http_common-inl.h deleted file mode 100644 index e78a6fdd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_http_common-inl.h +++ /dev/null @@ -1,201 +0,0 @@ -#ifndef SRC_NODE_HTTP_COMMON_INL_H_ -#define SRC_NODE_HTTP_COMMON_INL_H_ - -#include "node_http_common.h" -#include "node.h" -#include "node_mem-inl.h" -#include "env-inl.h" -#include "v8.h" - -#include - -namespace node { - -template -NgHeaders::NgHeaders(Environment* env, v8::Local headers) { - v8::Local header_string = - headers->Get(env->context(), 0).ToLocalChecked(); - v8::Local header_count = - headers->Get(env->context(), 1).ToLocalChecked(); - CHECK(header_count->IsUint32()); - CHECK(header_string->IsString()); - count_ = header_count.As()->Value(); - int header_string_len = header_string.As()->Length(); - - if (count_ == 0) { - CHECK_EQ(header_string_len, 0); - return; - } - - buf_.AllocateSufficientStorage((alignof(nv_t) - 1) + - count_ * sizeof(nv_t) + - header_string_len); - - char* start = AlignUp(buf_.out(), alignof(nv_t)); - char* header_contents = start + (count_ * sizeof(nv_t)); - nv_t* const nva = reinterpret_cast(start); - - CHECK_LE(header_contents + header_string_len, *buf_ + buf_.length()); - CHECK_EQ(header_string.As()->WriteOneByte( - env->isolate(), - reinterpret_cast(header_contents), - 0, - header_string_len, - v8::String::NO_NULL_TERMINATION), - header_string_len); - - size_t n = 0; - char* p; - for (p = header_contents; p < header_contents + header_string_len; n++) { - if (n >= count_) { - static uint8_t zero = '\0'; - nva[0].name = nva[0].value = &zero; - nva[0].namelen = nva[0].valuelen = 1; - count_ = 1; - return; - } - - nva[n].name = reinterpret_cast(p); - nva[n].namelen = strlen(p); - p += nva[n].namelen + 1; - nva[n].value = reinterpret_cast(p); - nva[n].valuelen = strlen(p); - p += nva[n].valuelen + 1; - nva[n].flags = *p; - p++; - } -} - -size_t GetClientMaxHeaderPairs(size_t max_header_pairs) { - static constexpr size_t min_header_pairs = 1; - return std::max(max_header_pairs, min_header_pairs); -} - -size_t GetServerMaxHeaderPairs(size_t max_header_pairs) { - static constexpr size_t min_header_pairs = 4; - return std::max(max_header_pairs, min_header_pairs); -} - -template -std::string NgHeaderBase::ToString() const { - std::string ret = name(); - ret += " = "; - ret += value(); - return ret; -} - -template -bool NgHeader::IsZeroLength( - NgHeader::rcbuf_t* name, - NgHeader::rcbuf_t* value) { - return IsZeroLength(-1, name, value); -} - -template -bool NgHeader::IsZeroLength( - int32_t token, - NgHeader::rcbuf_t* name, - NgHeader::rcbuf_t* value) { - - if (NgHeader::rcbufferpointer_t::IsZeroLength(value)) - return true; - - const char* header_name = T::ToHttpHeaderName(token); - return header_name != nullptr || - NgHeader::rcbufferpointer_t::IsZeroLength(name); -} - -template -NgHeader::NgHeader( - Environment* env, - NgHeader::rcbuf_t* name, - NgHeader::rcbuf_t* value, - uint8_t flags) - : NgHeader(env, -1, name, value, flags) {} - -template -NgHeader::NgHeader( - Environment* env, - int32_t token, - NgHeader::rcbuf_t* name, - NgHeader::rcbuf_t* value, - uint8_t flags) : env_(env), token_(token), flags_(flags) { - if (token == -1) { - CHECK_NOT_NULL(name); - name_.reset(name, true); // Internalizable - } - CHECK_NOT_NULL(value); - name_.reset(name, true); // Internalizable - value_.reset(value); -} - -template -NgHeader::NgHeader(NgHeader&& other) noexcept - : env_(other.env_), - name_(std::move(other.name_)), - value_(std::move(other.value_)), - token_(other.token_), - flags_(other.flags_) { - other.token_ = -1; - other.flags_ = 0; - other.env_ = nullptr; -} - -template -void NgHeader::MemoryInfo(MemoryTracker* tracker) const { - tracker->TrackField("name", name_); - tracker->TrackField("value", value_); -} - -template -v8::MaybeLocal NgHeader::GetName( - NgHeader::allocator_t* allocator) const { - - // Not all instances will support using token id's for header names. - // HTTP/2 specifically does not support it. - const char* header_name = T::ToHttpHeaderName(token_); - - // If header_name is not nullptr, then it is a known header with - // a statically defined name. We can safely internalize it here. - if (header_name != nullptr) { - auto& static_str_map = env_->isolate_data()->static_str_map; - v8::Eternal eternal = static_str_map[header_name]; - if (eternal.IsEmpty()) { - v8::Local str = OneByteString(env_->isolate(), header_name); - eternal.Set(env_->isolate(), str); - return str; - } - return eternal.Get(env_->isolate()); - } - return rcbufferpointer_t::External::New(allocator, name_); -} - -template -v8::MaybeLocal NgHeader::GetValue( - NgHeader::allocator_t* allocator) const { - return rcbufferpointer_t::External::New(allocator, value_); -} - -template -std::string NgHeader::name() const { - return name_.str(); -} - -template -std::string NgHeader::value() const { - return value_.str(); -} - -template -size_t NgHeader::length() const { - return name_.len() + value_.len(); -} - -template -uint8_t NgHeader::flags() const { - return flags_; -} - -} // namespace node - -#endif // SRC_NODE_HTTP_COMMON_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_http_common.h b/repo/packages/s/scriptx-legacy/include/libnode/node_http_common.h deleted file mode 100644 index ad9f2a86..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_http_common.h +++ /dev/null @@ -1,531 +0,0 @@ -#ifndef SRC_NODE_HTTP_COMMON_H_ -#define SRC_NODE_HTTP_COMMON_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "v8.h" -#include "node_mem.h" - -#include - -namespace node { - -class Environment; - -#define MAX_MAX_HEADER_LIST_SIZE 16777215u -#define DEFAULT_MAX_HEADER_LIST_PAIRS 128u -#define DEFAULT_MAX_HEADER_LENGTH 8192 - -#define HTTP_SPECIAL_HEADERS(V) \ - V(STATUS, ":status") \ - V(METHOD, ":method") \ - V(AUTHORITY, ":authority") \ - V(SCHEME, ":scheme") \ - V(PATH, ":path") \ - V(PROTOCOL, ":protocol") - -#define HTTP_REGULAR_HEADERS(V) \ - V(ACCEPT_ENCODING, "accept-encoding") \ - V(ACCEPT_LANGUAGE, "accept-language") \ - V(ACCEPT_RANGES, "accept-ranges") \ - V(ACCEPT, "accept") \ - V(ACCESS_CONTROL_ALLOW_CREDENTIALS, "access-control-allow-credentials") \ - V(ACCESS_CONTROL_ALLOW_HEADERS, "access-control-allow-headers") \ - V(ACCESS_CONTROL_ALLOW_METHODS, "access-control-allow-methods") \ - V(ACCESS_CONTROL_ALLOW_ORIGIN, "access-control-allow-origin") \ - V(ACCESS_CONTROL_EXPOSE_HEADERS, "access-control-expose-headers") \ - V(ACCESS_CONTROL_REQUEST_HEADERS, "access-control-request-headers") \ - V(ACCESS_CONTROL_REQUEST_METHOD, "access-control-request-method") \ - V(AGE, "age") \ - V(AUTHORIZATION, "authorization") \ - V(CACHE_CONTROL, "cache-control") \ - V(CONNECTION, "connection") \ - V(CONTENT_DISPOSITION, "content-disposition") \ - V(CONTENT_ENCODING, "content-encoding") \ - V(CONTENT_LENGTH, "content-length") \ - V(CONTENT_TYPE, "content-type") \ - V(COOKIE, "cookie") \ - V(DATE, "date") \ - V(ETAG, "etag") \ - V(FORWARDED, "forwarded") \ - V(HOST, "host") \ - V(IF_MODIFIED_SINCE, "if-modified-since") \ - V(IF_NONE_MATCH, "if-none-match") \ - V(IF_RANGE, "if-range") \ - V(LAST_MODIFIED, "last-modified") \ - V(LINK, "link") \ - V(LOCATION, "location") \ - V(RANGE, "range") \ - V(REFERER, "referer") \ - V(SERVER, "server") \ - V(SET_COOKIE, "set-cookie") \ - V(STRICT_TRANSPORT_SECURITY, "strict-transport-security") \ - V(TRANSFER_ENCODING, "transfer-encoding") \ - V(TE, "te") \ - V(UPGRADE_INSECURE_REQUESTS, "upgrade-insecure-requests") \ - V(UPGRADE, "upgrade") \ - V(USER_AGENT, "user-agent") \ - V(VARY, "vary") \ - V(X_CONTENT_TYPE_OPTIONS, "x-content-type-options") \ - V(X_FRAME_OPTIONS, "x-frame-options") \ - V(KEEP_ALIVE, "keep-alive") \ - V(PROXY_CONNECTION, "proxy-connection") \ - V(X_XSS_PROTECTION, "x-xss-protection") \ - V(ALT_SVC, "alt-svc") \ - V(CONTENT_SECURITY_POLICY, "content-security-policy") \ - V(EARLY_DATA, "early-data") \ - V(EXPECT_CT, "expect-ct") \ - V(ORIGIN, "origin") \ - V(PURPOSE, "purpose") \ - V(TIMING_ALLOW_ORIGIN, "timing-allow-origin") \ - V(X_FORWARDED_FOR, "x-forwarded-for") - -#define HTTP_ADDITIONAL_HEADERS(V) \ - V(ACCEPT_CHARSET, "accept-charset") \ - V(ACCESS_CONTROL_MAX_AGE, "access-control-max-age") \ - V(ALLOW, "allow") \ - V(CONTENT_LANGUAGE, "content-language") \ - V(CONTENT_LOCATION, "content-location") \ - V(CONTENT_MD5, "content-md5") \ - V(CONTENT_RANGE, "content-range") \ - V(DNT, "dnt") \ - V(EXPECT, "expect") \ - V(EXPIRES, "expires") \ - V(FROM, "from") \ - V(IF_MATCH, "if-match") \ - V(IF_UNMODIFIED_SINCE, "if-unmodified-since") \ - V(MAX_FORWARDS, "max-forwards") \ - V(PREFER, "prefer") \ - V(PROXY_AUTHENTICATE, "proxy-authenticate") \ - V(PROXY_AUTHORIZATION, "proxy-authorization") \ - V(REFRESH, "refresh") \ - V(RETRY_AFTER, "retry-after") \ - V(TRAILER, "trailer") \ - V(TK, "tk") \ - V(VIA, "via") \ - V(WARNING, "warning") \ - V(WWW_AUTHENTICATE, "www-authenticate") \ - V(HTTP2_SETTINGS, "http2-settings") - -// Special and regular headers are handled specifically by the HTTP/2 (and -// later HTTP/3) implementation. -#define HTTP_KNOWN_HEADERS(V) \ - HTTP_SPECIAL_HEADERS(V) \ - HTTP_REGULAR_HEADERS(V) \ - HTTP_ADDITIONAL_HEADERS(V) - -enum http_known_headers { - HTTP_KNOWN_HEADER_MIN, -#define V(name, value) HTTP_HEADER_##name, - HTTP_KNOWN_HEADERS(V) -#undef V - HTTP_KNOWN_HEADER_MAX -}; - -#define HTTP_STATUS_CODES(V) \ - V(CONTINUE, 100) \ - V(SWITCHING_PROTOCOLS, 101) \ - V(PROCESSING, 102) \ - V(EARLY_HINTS, 103) \ - V(OK, 200) \ - V(CREATED, 201) \ - V(ACCEPTED, 202) \ - V(NON_AUTHORITATIVE_INFORMATION, 203) \ - V(NO_CONTENT, 204) \ - V(RESET_CONTENT, 205) \ - V(PARTIAL_CONTENT, 206) \ - V(MULTI_STATUS, 207) \ - V(ALREADY_REPORTED, 208) \ - V(IM_USED, 226) \ - V(MULTIPLE_CHOICES, 300) \ - V(MOVED_PERMANENTLY, 301) \ - V(FOUND, 302) \ - V(SEE_OTHER, 303) \ - V(NOT_MODIFIED, 304) \ - V(USE_PROXY, 305) \ - V(TEMPORARY_REDIRECT, 307) \ - V(PERMANENT_REDIRECT, 308) \ - V(BAD_REQUEST, 400) \ - V(UNAUTHORIZED, 401) \ - V(PAYMENT_REQUIRED, 402) \ - V(FORBIDDEN, 403) \ - V(NOT_FOUND, 404) \ - V(METHOD_NOT_ALLOWED, 405) \ - V(NOT_ACCEPTABLE, 406) \ - V(PROXY_AUTHENTICATION_REQUIRED, 407) \ - V(REQUEST_TIMEOUT, 408) \ - V(CONFLICT, 409) \ - V(GONE, 410) \ - V(LENGTH_REQUIRED, 411) \ - V(PRECONDITION_FAILED, 412) \ - V(PAYLOAD_TOO_LARGE, 413) \ - V(URI_TOO_LONG, 414) \ - V(UNSUPPORTED_MEDIA_TYPE, 415) \ - V(RANGE_NOT_SATISFIABLE, 416) \ - V(EXPECTATION_FAILED, 417) \ - V(TEAPOT, 418) \ - V(MISDIRECTED_REQUEST, 421) \ - V(UNPROCESSABLE_ENTITY, 422) \ - V(LOCKED, 423) \ - V(FAILED_DEPENDENCY, 424) \ - V(TOO_EARLY, 425) \ - V(UPGRADE_REQUIRED, 426) \ - V(PRECONDITION_REQUIRED, 428) \ - V(TOO_MANY_REQUESTS, 429) \ - V(REQUEST_HEADER_FIELDS_TOO_LARGE, 431) \ - V(UNAVAILABLE_FOR_LEGAL_REASONS, 451) \ - V(INTERNAL_SERVER_ERROR, 500) \ - V(NOT_IMPLEMENTED, 501) \ - V(BAD_GATEWAY, 502) \ - V(SERVICE_UNAVAILABLE, 503) \ - V(GATEWAY_TIMEOUT, 504) \ - V(HTTP_VERSION_NOT_SUPPORTED, 505) \ - V(VARIANT_ALSO_NEGOTIATES, 506) \ - V(INSUFFICIENT_STORAGE, 507) \ - V(LOOP_DETECTED, 508) \ - V(BANDWIDTH_LIMIT_EXCEEDED, 509) \ - V(NOT_EXTENDED, 510) \ - V(NETWORK_AUTHENTICATION_REQUIRED, 511) - -enum http_status_codes { -#define V(name, code) HTTP_STATUS_##name = code, - HTTP_STATUS_CODES(V) -#undef V -}; - -// Unlike the HTTP/1 implementation, the HTTP/2 implementation is not limited -// to a fixed number of known supported HTTP methods. These constants, therefore -// are provided strictly as a convenience to users and are exposed via the -// require('http2').constants object. -#define HTTP_KNOWN_METHODS(V) \ - V(ACL, "ACL") \ - V(BASELINE_CONTROL, "BASELINE-CONTROL") \ - V(BIND, "BIND") \ - V(CHECKIN, "CHECKIN") \ - V(CHECKOUT, "CHECKOUT") \ - V(CONNECT, "CONNECT") \ - V(COPY, "COPY") \ - V(DELETE, "DELETE") \ - V(GET, "GET") \ - V(HEAD, "HEAD") \ - V(LABEL, "LABEL") \ - V(LINK, "LINK") \ - V(LOCK, "LOCK") \ - V(MERGE, "MERGE") \ - V(MKACTIVITY, "MKACTIVITY") \ - V(MKCALENDAR, "MKCALENDAR") \ - V(MKCOL, "MKCOL") \ - V(MKREDIRECTREF, "MKREDIRECTREF") \ - V(MKWORKSPACE, "MKWORKSPACE") \ - V(MOVE, "MOVE") \ - V(OPTIONS, "OPTIONS") \ - V(ORDERPATCH, "ORDERPATCH") \ - V(PATCH, "PATCH") \ - V(POST, "POST") \ - V(PRI, "PRI") \ - V(PROPFIND, "PROPFIND") \ - V(PROPPATCH, "PROPPATCH") \ - V(PUT, "PUT") \ - V(REBIND, "REBIND") \ - V(REPORT, "REPORT") \ - V(SEARCH, "SEARCH") \ - V(TRACE, "TRACE") \ - V(UNBIND, "UNBIND") \ - V(UNCHECKOUT, "UNCHECKOUT") \ - V(UNLINK, "UNLINK") \ - V(UNLOCK, "UNLOCK") \ - V(UPDATE, "UPDATE") \ - V(UPDATEREDIRECTREF, "UPDATEREDIRECTREF") \ - V(VERSION_CONTROL, "VERSION-CONTROL") - -// NgHeaders takes as input a block of headers provided by the -// JavaScript side (see http2's mapToHeaders function) and -// converts it into a array of ng header structs. This is done -// generically to handle both http/2 and (in the future) http/3, -// which use nearly identical structs. The template parameter -// takes a Traits type that defines the ng header struct and -// the kNoneFlag value. See Http2HeaderTraits in node_http2.h -// for an example. -template -class NgHeaders { - public: - typedef typename T::nv_t nv_t; - inline NgHeaders(Environment* env, v8::Local headers); - ~NgHeaders() = default; - - const nv_t* operator*() const { - return reinterpret_cast(*buf_); - } - - const nv_t* data() const { - return reinterpret_cast(*buf_); - } - - size_t length() const { - return count_; - } - - private: - size_t count_; - MaybeStackBuffer buf_; -}; - -// The ng libraries use nearly identical -// reference counted structures for retaining header name and value -// information in memory until the application is done with it. -// The NgRcBufPointer is an intelligent pointer capable of working -// with either type, handling the ref counting increment and -// decrement as appropriate. The Template takes a single Traits -// type that provides the rc buffer and vec type, as well as -// implementations for multiple static functions. -// See Http2RcBufferPointerTraits in node_http2.h for an example. -template -class NgRcBufPointer : public MemoryRetainer { - public: - typedef typename T::rcbuf_t rcbuf_t; - typedef typename T::vector_t vector_t; - - NgRcBufPointer() = default; - - explicit NgRcBufPointer(rcbuf_t* buf) { - reset(buf); - } - - template - NgRcBufPointer(const NgRcBufPointer& other) { - reset(other.get()); - } - - NgRcBufPointer(const NgRcBufPointer& other) { - reset(other.get()); - } - - template - NgRcBufPointer& operator=(const NgRcBufPointer& other) { - if (other.get() == get()) return *this; - this->~NgRcBufPointer(); - return *new (this) NgRcBufPointer(other); - } - - NgRcBufPointer& operator=(const NgRcBufPointer& other) { - if (other.get() == get()) return *this; - this->~NgRcBufPointer(); - return *new (this) NgRcBufPointer(other); - } - - NgRcBufPointer(NgRcBufPointer&& other) { - this->~NgRcBufPointer(); - buf_ = other.buf_; - other.buf_ = nullptr; - } - - NgRcBufPointer& operator=(NgRcBufPointer&& other) { - this->~NgRcBufPointer(); - return *new (this) NgRcBufPointer(std::move(other)); - } - - ~NgRcBufPointer() { - reset(); - } - - // Returns the underlying ngvec for this rcbuf - uint8_t* data() const { - vector_t v = T::get_vec(buf_); - return v.base; - } - - size_t len() const { - vector_t v = T::get_vec(buf_); - return v.len; - } - - std::string str() const { - return std::string(reinterpret_cast(data()), len()); - } - - void reset(rcbuf_t* ptr = nullptr, bool internalizable = false) { - if (buf_ == ptr) - return; - - if (buf_ != nullptr) - T::dec(buf_); - - buf_ = ptr; - - if (ptr != nullptr) { - T::inc(ptr); - internalizable_ = internalizable; - } - } - - rcbuf_t* get() const { return buf_; } - rcbuf_t& operator*() const { return *get(); } - rcbuf_t* operator->() const { return buf_; } - operator bool() const { return buf_ != nullptr; } - bool IsStatic() const { return T::is_static(buf_) != 0; } - void SetInternalizable() { internalizable_ = true; } - bool IsInternalizable() const { return internalizable_; } - - static inline bool IsZeroLength(rcbuf_t* buf) { - if (buf == nullptr) - return true; - vector_t b = T::get_vec(buf); - return b.len == 0; - } - - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackFieldWithSize("buf", len(), "buf"); - } - - SET_MEMORY_INFO_NAME(NgRcBufPointer) - SET_SELF_SIZE(NgRcBufPointer) - - class External : public v8::String::ExternalOneByteStringResource { - public: - explicit External(const NgRcBufPointer& ptr) : ptr_(ptr) {} - - const char* data() const override { - return const_cast(reinterpret_cast(ptr_.data())); - } - - size_t length() const override { - return ptr_.len(); - } - - static inline - v8::MaybeLocal GetInternalizedString( - Environment* env, - const NgRcBufPointer& ptr) { - return v8::String::NewFromOneByte( - env->isolate(), - ptr.data(), - v8::NewStringType::kInternalized, - ptr.len()); - } - - template - static v8::MaybeLocal New( - Allocator* allocator, - NgRcBufPointer ptr) { - Environment* env = allocator->env(); - if (ptr.IsStatic()) { - auto& static_str_map = env->isolate_data()->static_str_map; - const char* header_name = reinterpret_cast(ptr.data()); - v8::Eternal& eternal = static_str_map[header_name]; - if (eternal.IsEmpty()) { - v8::Local str = - GetInternalizedString(env, ptr).ToLocalChecked(); - eternal.Set(env->isolate(), str); - return str; - } - return eternal.Get(env->isolate()); - } - - size_t len = ptr.len(); - - if (len == 0) { - ptr.reset(); - return v8::String::Empty(env->isolate()); - } - - if (ptr.IsInternalizable() && len < 64) { - v8::MaybeLocal ret = GetInternalizedString(env, ptr); - ptr.reset(); - return ret; - } - - allocator->StopTrackingMemory(ptr.get()); - External* h_str = new External(std::move(ptr)); - v8::MaybeLocal str = - v8::String::NewExternalOneByte(env->isolate(), h_str); - if (str.IsEmpty()) - delete h_str; - - return str; - } - - private: - NgRcBufPointer ptr_; - }; - - private: - rcbuf_t* buf_ = nullptr; - bool internalizable_ = false; -}; - -template -struct NgHeaderBase : public MemoryRetainer { - virtual v8::MaybeLocal GetName(allocator_t* allocator) const = 0; - virtual v8::MaybeLocal GetValue(allocator_t* allocator) const = 0; - virtual std::string name() const = 0; - virtual std::string value() const = 0; - virtual size_t length() const = 0; - virtual uint8_t flags() const = 0; - virtual std::string ToString() const; -}; - -// The ng libraries use nearly identical structs to represent -// received http headers. The NgHeader class wraps those in a -// consistent way and allows converting the name and value to -// v8 strings. The template is given a Traits type that provides -// the NgRcBufPointer type, the NgLibMemoryManager to use for -// memory tracking, and implementation of static utility functions. -// See Http2HeaderTraits in node_http2.h for an example. -template -class NgHeader final : public NgHeaderBase { - public: - typedef typename T::rcbufferpointer_t rcbufferpointer_t; - typedef typename T::rcbufferpointer_t::rcbuf_t rcbuf_t; - typedef typename T::allocator_t allocator_t; - - inline static bool IsZeroLength(rcbuf_t* name, rcbuf_t* value); - inline static bool IsZeroLength(int32_t token, rcbuf_t* name, rcbuf_t* value); - inline NgHeader( - Environment* env, - rcbuf_t* name, - rcbuf_t* value, - uint8_t flags); - inline NgHeader( - Environment* env, - int32_t token, - rcbuf_t* name, - rcbuf_t* value, - uint8_t flags); - inline NgHeader(NgHeader&& other) noexcept; - - // Calling GetName and GetValue will have the effect of releasing - // control over the reference counted buffer from this NgHeader - // object to the v8 string. Once the v8 string is garbage collected, - // the reference counter will be decremented. - - inline v8::MaybeLocal GetName( - allocator_t* allocator) const override; - inline v8::MaybeLocal GetValue( - allocator_t* allocator) const override; - - inline std::string name() const override; - inline std::string value() const override; - inline size_t length() const override; - inline uint8_t flags() const override; - - void MemoryInfo(MemoryTracker* tracker) const override; - - SET_MEMORY_INFO_NAME(NgHeader) - SET_SELF_SIZE(NgHeader) - - private: - Environment* env_; - rcbufferpointer_t name_; - rcbufferpointer_t value_; - int32_t token_ = -1; - uint8_t flags_ = 0; -}; - -inline size_t GetServerMaxHeaderPairs(size_t max_header_pairs); -inline size_t GetClientMaxHeaderPairs(size_t max_header_pairs); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_HTTP_COMMON_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_i18n.h b/repo/packages/s/scriptx-legacy/include/libnode/node_i18n.h deleted file mode 100644 index 1e9f13eb..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_i18n.h +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_I18N_H_ -#define SRC_NODE_I18N_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#if defined(NODE_HAVE_I18N_SUPPORT) - -#include "base_object.h" -#include "env.h" -#include "util.h" -#include "v8.h" - -#include - -#include - -namespace node { -namespace i18n { - -bool InitializeICUDirectory(const std::string& path); - -void SetDefaultTimeZone(const char* tzid); - -enum idna_mode { - // Default mode for maximum compatibility. - IDNA_DEFAULT, - // Ignore all errors in IDNA conversion, if possible. - IDNA_LENIENT, - // Enforce STD3 rules (UseSTD3ASCIIRules) and DNS length restrictions - // (VerifyDnsLength). Corresponds to `beStrict` flag in the "domain to ASCII" - // algorithm. - IDNA_STRICT -}; - -// Implements the WHATWG URL Standard "domain to ASCII" algorithm. -// https://url.spec.whatwg.org/#concept-domain-to-ascii -int32_t ToASCII(MaybeStackBuffer* buf, - const char* input, - size_t length, - enum idna_mode mode = IDNA_DEFAULT); - -// Implements the WHATWG URL Standard "domain to Unicode" algorithm. -// https://url.spec.whatwg.org/#concept-domain-to-unicode -int32_t ToUnicode(MaybeStackBuffer* buf, - const char* input, - size_t length); - -struct ConverterDeleter { - void operator()(UConverter* pointer) const { ucnv_close(pointer); } -}; -using ConverterPointer = std::unique_ptr; - -class Converter { - public: - explicit Converter(const char* name, const char* sub = nullptr); - explicit Converter(UConverter* converter, const char* sub = nullptr); - - UConverter* conv() const { return conv_.get(); } - - size_t max_char_size() const; - size_t min_char_size() const; - void reset(); - void set_subst_chars(const char* sub = nullptr); - - private: - ConverterPointer conv_; -}; - -class ConverterObject : public BaseObject, Converter { - public: - enum ConverterFlags { - CONVERTER_FLAGS_FLUSH = 0x1, - CONVERTER_FLAGS_FATAL = 0x2, - CONVERTER_FLAGS_IGNORE_BOM = 0x4, - CONVERTER_FLAGS_UNICODE = 0x8, - CONVERTER_FLAGS_BOM_SEEN = 0x10, - }; - - static void Create(const v8::FunctionCallbackInfo& args); - static void Decode(const v8::FunctionCallbackInfo& args); - static void Has(const v8::FunctionCallbackInfo& args); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(ConverterObject) - SET_SELF_SIZE(ConverterObject) - - protected: - ConverterObject(Environment* env, - v8::Local wrap, - UConverter* converter, - int flags, - const char* sub = nullptr); - - void set_bom_seen(bool seen) { - if (seen) - flags_ |= CONVERTER_FLAGS_BOM_SEEN; - else - flags_ &= ~CONVERTER_FLAGS_BOM_SEEN; - } - - bool bom_seen() const { - return (flags_ & CONVERTER_FLAGS_BOM_SEEN) == CONVERTER_FLAGS_BOM_SEEN; - } - - bool unicode() const { - return (flags_ & CONVERTER_FLAGS_UNICODE) == CONVERTER_FLAGS_UNICODE; - } - - bool ignore_bom() const { - return (flags_ & CONVERTER_FLAGS_IGNORE_BOM) == CONVERTER_FLAGS_IGNORE_BOM; - } - - private: - int flags_ = 0; -}; - -} // namespace i18n -} // namespace node - -#endif // NODE_HAVE_I18N_SUPPORT - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_I18N_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_internals.h b/repo/packages/s/scriptx-legacy/include/libnode/node_internals.h deleted file mode 100644 index d37be23c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_internals.h +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_INTERNALS_H_ -#define SRC_NODE_INTERNALS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "node.h" -#include "node_binding.h" -#include "node_mutex.h" -#include "tracing/trace_event.h" -#include "util.h" -#include "uv.h" -#include "v8.h" - -#include -#include - -#include -#include - -struct sockaddr; - -namespace node { - -namespace native_module { -class NativeModuleLoader; -} - -namespace per_process { -extern Mutex env_var_mutex; -extern uint64_t node_start_time; -} // namespace per_process - -// Forward declaration -class Environment; - -// Convert a struct sockaddr to a { address: '1.2.3.4', port: 1234 } JS object. -// Sets address and port properties on the info object and returns it. -// If |info| is omitted, a new object is returned. -v8::Local AddressToJS( - Environment* env, - const sockaddr* addr, - v8::Local info = v8::Local()); - -template -void GetSockOrPeerName(const v8::FunctionCallbackInfo& args) { - T* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, - args.Holder(), - args.GetReturnValue().Set(UV_EBADF)); - CHECK(args[0]->IsObject()); - sockaddr_storage storage; - int addrlen = sizeof(storage); - sockaddr* const addr = reinterpret_cast(&storage); - const int err = F(&wrap->handle_, addr, &addrlen); - if (err == 0) - AddressToJS(wrap->env(), addr, args[0].As()); - args.GetReturnValue().Set(err); -} - -void PrintStackTrace(v8::Isolate* isolate, v8::Local stack); -void PrintCaughtException(v8::Isolate* isolate, - v8::Local context, - const v8::TryCatch& try_catch); - -void ResetStdio(); // Safe to call more than once and from signal handlers. -#ifdef __POSIX__ -void SignalExit(int signal, siginfo_t* info, void* ucontext); -#endif - -std::string GetProcessTitle(const char* default_title); -std::string GetHumanReadableProcessName(); - -v8::Maybe InitializeContextRuntime(v8::Local context); -bool InitializePrimordials(v8::Local context); - -class NodeArrayBufferAllocator : public ArrayBufferAllocator { - public: - inline uint32_t* zero_fill_field() { return &zero_fill_field_; } - - void* Allocate(size_t size) override; // Defined in src/node.cc - void* AllocateUninitialized(size_t size) override; - void Free(void* data, size_t size) override; - void* Reallocate(void* data, size_t old_size, size_t size) override; - virtual void RegisterPointer(void* data, size_t size) { - total_mem_usage_.fetch_add(size, std::memory_order_relaxed); - } - virtual void UnregisterPointer(void* data, size_t size) { - total_mem_usage_.fetch_sub(size, std::memory_order_relaxed); - } - - NodeArrayBufferAllocator* GetImpl() final { return this; } - inline uint64_t total_mem_usage() const { - return total_mem_usage_.load(std::memory_order_relaxed); - } - - private: - uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land. - std::atomic total_mem_usage_ {0}; -}; - -class DebuggingArrayBufferAllocator final : public NodeArrayBufferAllocator { - public: - ~DebuggingArrayBufferAllocator() override; - void* Allocate(size_t size) override; - void* AllocateUninitialized(size_t size) override; - void Free(void* data, size_t size) override; - void* Reallocate(void* data, size_t old_size, size_t size) override; - void RegisterPointer(void* data, size_t size) override; - void UnregisterPointer(void* data, size_t size) override; - - private: - void RegisterPointerInternal(void* data, size_t size); - void UnregisterPointerInternal(void* data, size_t size); - Mutex mutex_; - std::unordered_map allocations_; -}; - -namespace Buffer { -v8::MaybeLocal Copy(Environment* env, const char* data, size_t len); -v8::MaybeLocal New(Environment* env, size_t size); -// Takes ownership of |data|. -v8::MaybeLocal New(Environment* env, - char* data, - size_t length, - void (*callback)(char* data, void* hint), - void* hint); -// Takes ownership of |data|. Must allocate |data| with the current Isolate's -// ArrayBuffer::Allocator(). -v8::MaybeLocal New(Environment* env, - char* data, - size_t length); -// Creates a Buffer instance over an existing ArrayBuffer. -v8::MaybeLocal New(Environment* env, - v8::Local ab, - size_t byte_offset, - size_t length); -// Construct a Buffer from a MaybeStackBuffer (and also its subclasses like -// Utf8Value and TwoByteValue). -// If |buf| is invalidated, an empty MaybeLocal is returned, and nothing is -// changed. -// If |buf| contains actual data, this method takes ownership of |buf|'s -// underlying buffer. However, |buf| itself can be reused even after this call, -// but its capacity, if increased through AllocateSufficientStorage, is not -// guaranteed to stay the same. -template -static v8::MaybeLocal New(Environment* env, - MaybeStackBuffer* buf) { - v8::MaybeLocal ret; - char* src = reinterpret_cast(buf->out()); - const size_t len_in_bytes = buf->length() * sizeof(buf->out()[0]); - - if (buf->IsAllocated()) - ret = New(env, src, len_in_bytes); - else if (!buf->IsInvalidated()) - ret = Copy(env, src, len_in_bytes); - - if (ret.IsEmpty()) - return ret; - - if (buf->IsAllocated()) - buf->Release(); - - return ret; -} -} // namespace Buffer - -v8::MaybeLocal InternalMakeCallback( - Environment* env, - v8::Local resource, - v8::Local recv, - const v8::Local callback, - int argc, - v8::Local argv[], - async_context asyncContext); - -v8::MaybeLocal MakeSyncCallback(v8::Isolate* isolate, - v8::Local recv, - v8::Local callback, - int argc, - v8::Local argv[]); - -class InternalCallbackScope { - public: - enum Flags { - kNoFlags = 0, - // Indicates whether 'before' and 'after' hooks should be skipped. - kSkipAsyncHooks = 1, - // Indicates whether nextTick and microtask queues should be skipped. - // This should only be used when there is no call into JS in this scope. - // (The HTTP parser also uses it for some weird backwards - // compatibility issues, but it shouldn't.) - kSkipTaskQueues = 2 - }; - InternalCallbackScope(Environment* env, - v8::Local object, - const async_context& asyncContext, - int flags = kNoFlags); - // Utility that can be used by AsyncWrap classes. - explicit InternalCallbackScope(AsyncWrap* async_wrap, int flags = 0); - ~InternalCallbackScope(); - void Close(); - - inline bool Failed() const { return failed_; } - inline void MarkAsFailed() { failed_ = true; } - - private: - Environment* env_; - async_context async_context_; - v8::Local object_; - bool skip_hooks_; - bool skip_task_queues_; - bool failed_ = false; - bool pushed_ids_ = false; - bool closed_ = false; -}; - -class DebugSealHandleScope { - public: - explicit inline DebugSealHandleScope(v8::Isolate* isolate = nullptr) -#ifdef DEBUG - : actual_scope_(isolate != nullptr ? isolate : v8::Isolate::GetCurrent()) -#endif - {} - - private: -#ifdef DEBUG - v8::SealHandleScope actual_scope_; -#endif -}; - -class ThreadPoolWork { - public: - explicit inline ThreadPoolWork(Environment* env) : env_(env) { - CHECK_NOT_NULL(env); - } - inline virtual ~ThreadPoolWork() = default; - - inline void ScheduleWork(); - inline int CancelWork(); - - virtual void DoThreadPoolWork() = 0; - virtual void AfterThreadPoolWork(int status) = 0; - - Environment* env() const { return env_; } - - private: - Environment* env_; - uv_work_t work_req_; -}; - -#define TRACING_CATEGORY_NODE "node" -#define TRACING_CATEGORY_NODE1(one) \ - TRACING_CATEGORY_NODE "," \ - TRACING_CATEGORY_NODE "." #one -#define TRACING_CATEGORY_NODE2(one, two) \ - TRACING_CATEGORY_NODE "," \ - TRACING_CATEGORY_NODE "." #one "," \ - TRACING_CATEGORY_NODE "." #one "." #two - -// Functions defined in node.cc that are exposed via the bootstrapper object - -#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) -#define NODE_IMPLEMENTS_POSIX_CREDENTIALS 1 -#endif // defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) - -namespace credentials { -bool SafeGetenv(const char* key, std::string* text, Environment* env = nullptr); -} // namespace credentials - -void DefineZlibConstants(v8::Local target); -v8::Isolate* NewIsolate(v8::Isolate::CreateParams* params, - uv_loop_t* event_loop, - MultiIsolatePlatform* platform); -// This overload automatically picks the right 'main_script_id' if no callback -// was provided by the embedder. -v8::MaybeLocal StartExecution(Environment* env, - StartExecutionCallback cb = nullptr); -v8::MaybeLocal GetPerContextExports(v8::Local context); -v8::MaybeLocal ExecuteBootstrapper( - Environment* env, - const char* id, - std::vector>* parameters, - std::vector>* arguments); -void MarkBootstrapComplete(const v8::FunctionCallbackInfo& args); - -struct InitializationResult { - int exit_code = 0; - std::vector args; - std::vector exec_args; - bool early_return = false; -}; - -enum InitializationSettingsFlags : uint64_t { - kDefaultInitialization = 1 << 0, - kInitializeV8 = 1 << 1, - kRunPlatformInit = 1 << 2, - kInitOpenSSL = 1 << 3 -}; - -// TODO(codebytere): eventually document and expose to embedders. -InitializationResult InitializeOncePerProcess(int argc, char** argv); -InitializationResult InitializeOncePerProcess( - int argc, - char** argv, - InitializationSettingsFlags flags, - ProcessFlags::Flags process_flags = ProcessFlags::kNoFlags); -void TearDownOncePerProcess(); -void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s); -void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s); -void SetIsolateCreateParamsForNode(v8::Isolate::CreateParams* params); - -#if HAVE_INSPECTOR -namespace profiler { -void StartProfilers(Environment* env); -} -#endif // HAVE_INSPECTOR - -#ifdef __POSIX__ -static constexpr unsigned kMaxSignal = 32; -#endif - -bool HasSignalJSHandler(int signum); - -#ifdef _WIN32 -typedef SYSTEMTIME TIME_TYPE; -#else // UNIX, OSX -typedef struct tm TIME_TYPE; -#endif - -double GetCurrentTimeInMicroseconds(); -int WriteFileSync(const char* path, uv_buf_t buf); -int WriteFileSync(v8::Isolate* isolate, - const char* path, - v8::Local string); - -class DiagnosticFilename { - public: - static void LocalTime(TIME_TYPE* tm_struct); - - inline DiagnosticFilename(Environment* env, - const char* prefix, - const char* ext); - - inline DiagnosticFilename(uint64_t thread_id, - const char* prefix, - const char* ext); - - inline const char* operator*() const; - - private: - static std::string MakeFilename( - uint64_t thread_id, - const char* prefix, - const char* ext); - - std::string filename_; -}; - -namespace heap { -bool WriteSnapshot(v8::Isolate* isolate, const char* filename); -} - -class TraceEventScope { - public: - TraceEventScope(const char* category, - const char* name, - void* id) : category_(category), name_(name), id_(id) { - TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(category_, name_, id_); - } - ~TraceEventScope() { - TRACE_EVENT_NESTABLE_ASYNC_END0(category_, name_, id_); - } - - private: - const char* category_; - const char* name_; - void* id_; -}; - -namespace heap { - -void DeleteHeapSnapshot(const v8::HeapSnapshot* snapshot); -using HeapSnapshotPointer = - DeleteFnPtr; - -BaseObjectPtr CreateHeapSnapshotStream( - Environment* env, HeapSnapshotPointer&& snapshot); -} // namespace heap - -namespace fs { -std::string Basename(const std::string& str, const std::string& extension); -} // namespace fs - -node_module napi_module_to_node_module(const napi_module* mod); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_INTERNALS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_main_instance.h b/repo/packages/s/scriptx-legacy/include/libnode/node_main_instance.h deleted file mode 100644 index 047bdca8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_main_instance.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef SRC_NODE_MAIN_INSTANCE_H_ -#define SRC_NODE_MAIN_INSTANCE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include - -#include "node.h" -#include "util.h" -#include "uv.h" -#include "v8.h" - -namespace node { - -class ExternalReferenceRegistry; -struct EnvSerializeInfo; - -// TODO(joyeecheung): align this with the Worker/WorkerThreadData class. -// We may be able to create an abstract class to reuse some of the routines. -class NodeMainInstance { - public: - // To create a main instance that does not own the isolate, - // The caller needs to do: - // - // Isolate* isolate = Isolate::Allocate(); - // platform->RegisterIsolate(isolate, loop); - // isolate->Initialize(...); - // isolate->Enter(); - // std::unique_ptr main_instance = - // NodeMainInstance::Create(isolate, loop, args, exec_args); - // - // When tearing it down: - // - // main_instance->Cleanup(); // While the isolate is entered - // isolate->Exit(); - // isolate->Dispose(); - // platform->UnregisterIsolate(isolate); - // - // After calling Dispose() the main_instance is no longer accessible. - static std::unique_ptr Create( - v8::Isolate* isolate, - uv_loop_t* event_loop, - MultiIsolatePlatform* platform, - const std::vector& args, - const std::vector& exec_args); - - void Dispose(); - - // Create a main instance that owns the isolate - NodeMainInstance( - v8::Isolate::CreateParams* params, - uv_loop_t* event_loop, - MultiIsolatePlatform* platform, - const std::vector& args, - const std::vector& exec_args, - const std::vector* per_isolate_data_indexes = nullptr); - ~NodeMainInstance(); - - // Start running the Node.js instances, return the exit code when finished. - int Run(const EnvSerializeInfo* env_info); - void Run(int* exit_code, Environment* env); - - IsolateData* isolate_data() { return isolate_data_.get(); } - - DeleteFnPtr CreateMainEnvironment( - int* exit_code, const EnvSerializeInfo* env_info); - - // If nullptr is returned, the binary is not built with embedded - // snapshot. - static const std::vector* GetIsolateDataIndices(); - static v8::StartupData* GetEmbeddedSnapshotBlob(); - static const EnvSerializeInfo* GetEnvSerializeInfo(); - static const std::vector& CollectExternalReferences(); - - static const size_t kNodeContextIndex = 0; - NodeMainInstance(const NodeMainInstance&) = delete; - NodeMainInstance& operator=(const NodeMainInstance&) = delete; - NodeMainInstance(NodeMainInstance&&) = delete; - NodeMainInstance& operator=(NodeMainInstance&&) = delete; - - private: - NodeMainInstance(v8::Isolate* isolate, - uv_loop_t* event_loop, - MultiIsolatePlatform* platform, - const std::vector& args, - const std::vector& exec_args); - - static std::unique_ptr registry_; - std::vector args_; - std::vector exec_args_; - std::unique_ptr array_buffer_allocator_; - v8::Isolate* isolate_; - MultiIsolatePlatform* platform_; - std::unique_ptr isolate_data_; - bool owns_isolate_ = false; - bool deserialize_mode_ = false; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_MAIN_INSTANCE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_mem-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_mem-inl.h deleted file mode 100644 index ad6fc45b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_mem-inl.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef SRC_NODE_MEM_INL_H_ -#define SRC_NODE_MEM_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_mem.h" -#include "node_internals.h" - -namespace node { -namespace mem { - -template -AllocatorStruct NgLibMemoryManager::MakeAllocator() { - return AllocatorStruct { - static_cast(static_cast(this)), - MallocImpl, - FreeImpl, - CallocImpl, - ReallocImpl - }; -} - -template -void* NgLibMemoryManager::ReallocImpl(void* ptr, - size_t size, - void* user_data) { - Class* manager = static_cast(user_data); - - size_t previous_size = 0; - char* original_ptr = nullptr; - - // We prepend each allocated buffer with a size_t containing the full - // size of the allocation. - if (size > 0) size += sizeof(size_t); - - if (ptr != nullptr) { - // We are free()ing or re-allocating. - original_ptr = static_cast(ptr) - sizeof(size_t); - previous_size = *reinterpret_cast(original_ptr); - // This means we called StopTracking() on this pointer before. - if (previous_size == 0) { - // Fall back to the standard Realloc() function. - char* ret = UncheckedRealloc(original_ptr, size); - if (ret != nullptr) - ret += sizeof(size_t); - return ret; - } - } - - manager->CheckAllocatedSize(previous_size); - - char* mem = UncheckedRealloc(original_ptr, size); - - if (mem != nullptr) { - // Adjust the memory info counter. - // TODO(addaleax): Avoid the double bookkeeping we do with - // current_nghttp2_memory_ + AdjustAmountOfExternalAllocatedMemory - // and provide versions of our memory allocation utilities that take an - // Environment*/Isolate* parameter and call the V8 method transparently. - const int64_t new_size = size - previous_size; - manager->IncreaseAllocatedSize(new_size); - manager->env()->isolate()->AdjustAmountOfExternalAllocatedMemory( - new_size); - *reinterpret_cast(mem) = size; - mem += sizeof(size_t); - } else if (size == 0) { - manager->DecreaseAllocatedSize(previous_size); - manager->env()->isolate()->AdjustAmountOfExternalAllocatedMemory( - -static_cast(previous_size)); - } - return mem; -} - -template -void* NgLibMemoryManager::MallocImpl(size_t size, void* user_data) { - return ReallocImpl(nullptr, size, user_data); -} - -template -void NgLibMemoryManager::FreeImpl(void* ptr, void* user_data) { - if (ptr == nullptr) return; - CHECK_NULL(ReallocImpl(ptr, 0, user_data)); -} - -template -void* NgLibMemoryManager::CallocImpl(size_t nmemb, - size_t size, - void* user_data) { - size_t real_size = MultiplyWithOverflowCheck(nmemb, size); - void* mem = MallocImpl(real_size, user_data); - if (mem != nullptr) - memset(mem, 0, real_size); - return mem; -} - -template -void NgLibMemoryManager::StopTrackingMemory(void* ptr) { - size_t* original_ptr = reinterpret_cast( - static_cast(ptr) - sizeof(size_t)); - Class* manager = static_cast(this); - manager->DecreaseAllocatedSize(*original_ptr); - manager->env()->isolate()->AdjustAmountOfExternalAllocatedMemory( - -static_cast(*original_ptr)); - *original_ptr = 0; -} - -} // namespace mem -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_MEM_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_mem.h b/repo/packages/s/scriptx-legacy/include/libnode/node_mem.h deleted file mode 100644 index 332d1cd1..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_mem.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef SRC_NODE_MEM_H_ -#define SRC_NODE_MEM_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include - -namespace node { -namespace mem { - -// nghttp2 allows custom allocators that -// follow exactly the same structure and behavior, but -// use different struct names. To allow for code re-use, -// the NgLibMemoryManager template class can be used for both. - -struct NgLibMemoryManagerBase { - virtual void StopTrackingMemory(void* ptr) = 0; -}; - -template -class NgLibMemoryManager : public NgLibMemoryManagerBase { - public: - // Class needs to provide these methods: - // void CheckAllocatedSize(size_t previous_size) const; - // void IncreaseAllocatedSize(size_t size); - // void DecreaseAllocatedSize(size_t size); - // Environment* env() const; - - AllocatorStructName MakeAllocator(); - - void StopTrackingMemory(void* ptr) override; - - private: - static void* ReallocImpl(void* ptr, size_t size, void* user_data); - static void* MallocImpl(size_t size, void* user_data); - static void FreeImpl(void* ptr, void* user_data); - static void* CallocImpl(size_t nmemb, size_t size, void* user_data); -}; - -} // namespace mem -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_MEM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_messaging.h b/repo/packages/s/scriptx-legacy/include/libnode/node_messaging.h deleted file mode 100644 index 643604e4..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_messaging.h +++ /dev/null @@ -1,373 +0,0 @@ -#ifndef SRC_NODE_MESSAGING_H_ -#define SRC_NODE_MESSAGING_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "node_mutex.h" -#include "v8.h" -#include -#include -#include -#include - -namespace node { -namespace worker { - -class MessagePortData; -class MessagePort; - -typedef MaybeStackBuffer, 8> TransferList; - -// Used to represent the in-flight structure of an object that is being -// transferred or cloned using postMessage(). -class TransferData : public MemoryRetainer { - public: - // Deserialize this object on the receiving end after a .postMessage() call. - // - `context` may not be the same as `env->context()`. This method should - // not produce JS objects coming from Contexts other than `context`. - // - `self` is a unique_ptr for the object that this is being called on. - // - The return value is treated like a `Maybe`, i.e. if `nullptr` is - // returned, any further deserialization of the message is stopped and - // control is returned to the event loop or JS as soon as possible. - virtual BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) = 0; - // FinalizeTransferWrite() is the counterpart to - // BaseObject::FinalizeTransferRead(). It is called right after the transfer - // data was created, and defaults to doing nothing. After this function, - // this object should not hold any more Isolate-specific data. - virtual v8::Maybe FinalizeTransferWrite( - v8::Local context, v8::ValueSerializer* serializer); -}; - -// Represents a single communication message. -class Message : public MemoryRetainer { - public: - // Create a Message with a specific underlying payload, in the format of the - // V8 ValueSerializer API. If `payload` is empty, this message indicates - // that the receiving message port should close itself. - explicit Message(MallocedBuffer&& payload = MallocedBuffer()); - ~Message() = default; - - Message(Message&& other) = default; - Message& operator=(Message&& other) = default; - Message& operator=(const Message&) = delete; - Message(const Message&) = delete; - - // Whether this is a message indicating that the port is to be closed. - // This is the last message to be received by a MessagePort. - bool IsCloseMessage() const; - - // Deserialize the contained JS value. May only be called once, and only - // after Serialize() has been called (e.g. by another thread). - v8::MaybeLocal Deserialize( - Environment* env, - v8::Local context, - v8::Local* port_list = nullptr); - - // Serialize a JS value, and optionally transfer objects, into this message. - // The Message object retains ownership of all transferred objects until - // deserialization. - // The source_port parameter, if provided, will make Serialize() throw a - // "DataCloneError" DOMException if source_port is found in transfer_list. - v8::Maybe Serialize(Environment* env, - v8::Local context, - v8::Local input, - const TransferList& transfer_list, - v8::Local source_port = - v8::Local()); - - // Internal method of Message that is called when a new SharedArrayBuffer - // object is encountered in the incoming value's structure. - void AddSharedArrayBuffer(std::shared_ptr backing_store); - // Internal method of Message that is called once serialization finishes - // and that transfers ownership of `data` to this message. - void AddTransferable(std::unique_ptr&& data); - // Internal method of Message that is called when a new WebAssembly.Module - // object is encountered in the incoming value's structure. - uint32_t AddWASMModule(v8::CompiledWasmModule&& mod); - - // The host objects that will be transferred, as recorded by Serialize() - // (e.g. MessagePorts). - // Used for warning user about posting the target MessagePort to itself, - // which will as a side effect destroy the communication channel. - const std::vector>& transferables() const { - return transferables_; - } - bool has_transferables() const { - return !transferables_.empty() || !array_buffers_.empty(); - } - - void MemoryInfo(MemoryTracker* tracker) const override; - - SET_MEMORY_INFO_NAME(Message) - SET_SELF_SIZE(Message) - - private: - MallocedBuffer main_message_buf_; - // TODO(addaleax): Make this a std::variant to save storage size in the common - // case (which is that all of these vectors are empty) once that is available - // with C++17. - std::vector> array_buffers_; - std::vector> shared_array_buffers_; - std::vector> transferables_; - std::vector wasm_modules_; - - friend class MessagePort; -}; - -class SiblingGroup final : public std::enable_shared_from_this { - public: - // Named SiblingGroup, Used for one-to-many BroadcastChannels. - static std::shared_ptr Get(const std::string& name); - - // Anonymous SiblingGroup, Used for one-to-one MessagePort pairs. - SiblingGroup() = default; - explicit SiblingGroup(const std::string& name); - ~SiblingGroup(); - - // Dispatches the Message to the collection of associated - // ports. If there is more than one destination port and - // the Message contains transferables, Dispatch will fail. - // Returns Just(true) if successful and the message was - // dispatched to at least one destination. Returns Just(false) - // if there were no destinations. Returns Nothing() - // if there was an error. If error is not nullptr, it will - // be set to an error message or warning message as appropriate. - v8::Maybe Dispatch( - MessagePortData* source, - std::shared_ptr message, - std::string* error = nullptr); - - void Entangle(MessagePortData* data); - void Entangle(std::initializer_list data); - void Disentangle(MessagePortData* data); - - const std::string& name() const { return name_; } - - size_t size() const { return ports_.size(); } - - private: - const std::string name_; - RwLock group_mutex_; // Protects ports_. - std::set ports_; - - static void CheckSiblingGroup(const std::string& name); - - using Map = - std::unordered_map>; - - static Mutex groups_mutex_; - static Map groups_; -}; - -// This contains all data for a `MessagePort` instance that is not tied to -// a specific Environment/Isolate/event loop, for easier transfer between those. -class MessagePortData : public TransferData { - public: - explicit MessagePortData(MessagePort* owner); - ~MessagePortData() override; - - MessagePortData(MessagePortData&& other) = delete; - MessagePortData& operator=(MessagePortData&& other) = delete; - MessagePortData(const MessagePortData& other) = delete; - MessagePortData& operator=(const MessagePortData& other) = delete; - - // Add a message to the incoming queue and notify the receiver. - // This may be called from any thread. - void AddToIncomingQueue(std::shared_ptr message); - v8::Maybe Dispatch( - std::shared_ptr message, - std::string* error = nullptr); - - // Turns `a` and `b` into siblings, i.e. connects the sending side of one - // to the receiving side of the other. This is not thread-safe. - static void Entangle(MessagePortData* a, MessagePortData* b); - - // Removes any possible sibling. This is thread-safe (it acquires both - // `sibling_mutex_` and `mutex_`), and has to be because it is called once - // the corresponding JS handle handle wants to close - // which can happen on either side of a worker. - void Disentangle(); - - void MemoryInfo(MemoryTracker* tracker) const override; - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - SET_MEMORY_INFO_NAME(MessagePortData) - SET_SELF_SIZE(MessagePortData) - - private: - // This mutex protects all fields below it, with the exception of - // sibling_. - mutable Mutex mutex_; - // TODO(addaleax): Make this a std::variant - // once that is available with C++17, because std::shared_ptr comes with - // overhead that is only necessary for BroadcastChannel. - std::deque> incoming_messages_; - MessagePort* owner_ = nullptr; - std::shared_ptr group_; - friend class MessagePort; - friend class SiblingGroup; -}; - -// A message port that receives messages from other threads, including -// the uv_async_t handle that is used to notify the current event loop of -// new incoming messages. -class MessagePort : public HandleWrap { - private: - // Create a new MessagePort. The `context` argument specifies the Context - // instance that is used for creating the values emitted from this port. - // This is called by MessagePort::New(), which is the public API used for - // creating MessagePort instances. - MessagePort(Environment* env, - v8::Local context, - v8::Local wrap); - - public: - ~MessagePort() override; - - // Create a new message port instance, optionally over an existing - // `MessagePortData` object. - static MessagePort* New(Environment* env, - v8::Local context, - std::unique_ptr data = {}, - std::shared_ptr sibling_group = {}); - - // Send a message, i.e. deliver it into the sibling's incoming queue. - // If this port is closed, or if there is no sibling, this message is - // serialized with transfers, then silently discarded. - v8::Maybe PostMessage(Environment* env, - v8::Local context, - v8::Local message, - const TransferList& transfer); - - // Start processing messages on this port as a receiving end. - void Start(); - // Stop processing messages on this port as a receiving end. - void Stop(); - - /* constructor */ - static void New(const v8::FunctionCallbackInfo& args); - /* prototype methods */ - static void PostMessage(const v8::FunctionCallbackInfo& args); - static void Start(const v8::FunctionCallbackInfo& args); - static void Stop(const v8::FunctionCallbackInfo& args); - static void CheckType(const v8::FunctionCallbackInfo& args); - static void Drain(const v8::FunctionCallbackInfo& args); - static void ReceiveMessage(const v8::FunctionCallbackInfo& args); - - /* static */ - static void MoveToContext(const v8::FunctionCallbackInfo& args); - - // Turns `a` and `b` into siblings, i.e. connects the sending side of one - // to the receiving side of the other. This is not thread-safe. - static void Entangle(MessagePort* a, MessagePort* b); - static void Entangle(MessagePort* a, MessagePortData* b); - - // Detach this port's data for transferring. After this, the MessagePortData - // is no longer associated with this handle, although it can still receive - // messages. - std::unique_ptr Detach(); - - void Close( - v8::Local close_callback = v8::Local()) override; - - // Returns true if either data_ has been freed, or if the handle is being - // closed. Equivalent to the [[Detached]] internal slot in the HTML Standard. - // - // If checking if a JavaScript MessagePort object is detached, this method - // alone is often not enough, since the backing C++ MessagePort object may - // have been deleted already. For all intents and purposes, an object with a - // NULL pointer to the C++ MessagePort object is also detached. - inline bool IsDetached() const; - - TransferMode GetTransferMode() const override; - std::unique_ptr TransferForMessaging() override; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(MessagePort) - SET_SELF_SIZE(MessagePort) - - private: - enum class MessageProcessingMode { - kNormalOperation, - kForceReadMessages - }; - - void OnClose() override; - void OnMessage(MessageProcessingMode mode); - void TriggerAsync(); - v8::MaybeLocal ReceiveMessage( - v8::Local context, - MessageProcessingMode mode, - v8::Local* port_list = nullptr); - - std::unique_ptr data_ = nullptr; - bool receiving_messages_ = false; - uv_async_t async_; - v8::Global emit_message_fn_; - - friend class MessagePortData; -}; - -// Provide a base class from which JS classes that should be transferable or -// cloneable by postMesssage() can inherit. -// See e.g. FileHandle in internal/fs/promises.js for an example. -class JSTransferable : public BaseObject { - public: - JSTransferable(Environment* env, v8::Local obj); - static void New(const v8::FunctionCallbackInfo& args); - - TransferMode GetTransferMode() const override; - std::unique_ptr TransferForMessaging() override; - std::unique_ptr CloneForMessaging() const override; - v8::Maybe>> - NestedTransferables() const override; - v8::Maybe FinalizeTransferRead( - v8::Local context, - v8::ValueDeserializer* deserializer) override; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(JSTransferable) - SET_SELF_SIZE(JSTransferable) - - private: - std::unique_ptr TransferOrClone(TransferMode mode) const; - - class Data : public TransferData { - public: - Data(std::string&& deserialize_info, v8::Global&& data); - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - v8::Maybe FinalizeTransferWrite( - v8::Local context, - v8::ValueSerializer* serializer) override; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(JSTransferableTransferData) - SET_SELF_SIZE(Data) - - private: - std::string deserialize_info_; - v8::Global data_; - }; -}; - -v8::Local GetMessagePortConstructorTemplate( - Environment* env); - -} // namespace worker -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - - -#endif // SRC_NODE_MESSAGING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_metadata.h b/repo/packages/s/scriptx-legacy/include/libnode/node_metadata.h deleted file mode 100644 index 4486d5af..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_metadata.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef SRC_NODE_METADATA_H_ -#define SRC_NODE_METADATA_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include "node_version.h" - -#if HAVE_OPENSSL -#include -#endif // HAVE_OPENSSL - -namespace node { - -// if this is a release build and no explicit base has been set -// substitute the standard release download URL -#ifndef NODE_RELEASE_URLBASE -#if NODE_VERSION_IS_RELEASE -#define NODE_RELEASE_URLBASE "https://nodejs.org/download/release/" -#endif // NODE_VERSION_IS_RELEASE -#endif // NODE_RELEASE_URLBASE - -#if defined(NODE_RELEASE_URLBASE) -#define NODE_HAS_RELEASE_URLS -#endif - -#define NODE_VERSIONS_KEYS_BASE(V) \ - V(node) \ - V(v8) \ - V(uv) \ - V(zlib) \ - V(brotli) \ - V(ares) \ - V(modules) \ - V(nghttp2) \ - V(napi) \ - V(llhttp) \ - -#if HAVE_OPENSSL -#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) -#else -#define NODE_VERSIONS_KEY_CRYPTO(V) -#endif - -#ifdef NODE_HAVE_I18N_SUPPORT -#define NODE_VERSIONS_KEY_INTL(V) \ - V(cldr) \ - V(icu) \ - V(tz) \ - V(unicode) -#else -#define NODE_VERSIONS_KEY_INTL(V) -#endif // NODE_HAVE_I18N_SUPPORT - -#ifdef OPENSSL_INFO_QUIC -#define NODE_VERSIONS_KEY_QUIC(V) \ - V(ngtcp2) \ - V(nghttp3) -#else -#define NODE_VERSIONS_KEY_QUIC(V) -#endif - -#define NODE_VERSIONS_KEYS(V) \ - NODE_VERSIONS_KEYS_BASE(V) \ - NODE_VERSIONS_KEY_CRYPTO(V) \ - NODE_VERSIONS_KEY_INTL(V) \ - NODE_VERSIONS_KEY_QUIC(V) - -class Metadata { - public: - Metadata(); - Metadata(Metadata&) = delete; - Metadata(Metadata&&) = delete; - Metadata operator=(Metadata&) = delete; - Metadata operator=(Metadata&&) = delete; - - struct Versions { - Versions(); - -#ifdef NODE_HAVE_I18N_SUPPORT - // Must be called on the main thread after - // i18n::InitializeICUDirectory() - void InitializeIntlVersions(); -#endif // NODE_HAVE_I18N_SUPPORT - -#define V(key) std::string key; - NODE_VERSIONS_KEYS(V) -#undef V - }; - - struct Release { - Release(); - - std::string name; -#if NODE_VERSION_IS_LTS - std::string lts; -#endif // NODE_VERSION_IS_LTS - -#ifdef NODE_HAS_RELEASE_URLS - std::string source_url; - std::string headers_url; -#ifdef _WIN32 - std::string lib_url; -#endif // _WIN32 -#endif // NODE_HAS_RELEASE_URLS - }; - - Versions versions; - const Release release; - const std::string arch; - const std::string platform; -}; - -// Per-process global -namespace per_process { -extern Metadata metadata; -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_METADATA_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_mutex.h b/repo/packages/s/scriptx-legacy/include/libnode/node_mutex.h deleted file mode 100644 index 69e64ba2..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_mutex.h +++ /dev/null @@ -1,323 +0,0 @@ -#ifndef SRC_NODE_MUTEX_H_ -#define SRC_NODE_MUTEX_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "util.h" -#include "uv.h" - -#include // std::shared_ptr -#include // std::forward - -namespace node { - -template class ConditionVariableBase; -template class MutexBase; -struct LibuvMutexTraits; -struct LibuvRwlockTraits; - -using ConditionVariable = ConditionVariableBase; -using Mutex = MutexBase; -using RwLock = MutexBase; - -template -class ExclusiveAccess { - public: - ExclusiveAccess() = default; - - template - explicit ExclusiveAccess(Args&&... args) - : item_(std::forward(args)...) {} - - ExclusiveAccess(const ExclusiveAccess&) = delete; - ExclusiveAccess& operator=(const ExclusiveAccess&) = delete; - - class Scoped { - public: - // ExclusiveAccess will commonly be used in conjunction with std::shared_ptr - // and without this constructor it's too easy to forget to keep a reference - // around to the shared_ptr while operating on the ExclusiveAccess object. - explicit Scoped(const std::shared_ptr& shared) - : shared_(shared) - , scoped_lock_(shared->mutex_) - , pointer_(&shared->item_) {} - - explicit Scoped(ExclusiveAccess* exclusive_access) - : shared_() - , scoped_lock_(exclusive_access->mutex_) - , pointer_(&exclusive_access->item_) {} - - T& operator*() const { return *pointer_; } - T* operator->() const { return pointer_; } - - Scoped(const Scoped&) = delete; - Scoped& operator=(const Scoped&) = delete; - - private: - std::shared_ptr shared_; - typename MutexT::ScopedLock scoped_lock_; - T* const pointer_; - }; - - private: - friend class ScopedLock; - MutexT mutex_; - T item_; -}; - -template -class MutexBase { - public: - inline MutexBase(); - inline ~MutexBase(); - inline void Lock(); - inline void Unlock(); - inline void RdLock(); - inline void RdUnlock(); - - MutexBase(const MutexBase&) = delete; - MutexBase& operator=(const MutexBase&) = delete; - - class ScopedLock; - class ScopedUnlock; - - class ScopedLock { - public: - inline explicit ScopedLock(const MutexBase& mutex); - inline explicit ScopedLock(const ScopedUnlock& scoped_unlock); - inline ~ScopedLock(); - - ScopedLock(const ScopedLock&) = delete; - ScopedLock& operator=(const ScopedLock&) = delete; - - private: - template friend class ConditionVariableBase; - friend class ScopedUnlock; - const MutexBase& mutex_; - }; - - class ScopedReadLock { - public: - inline explicit ScopedReadLock(const MutexBase& mutex); - inline ~ScopedReadLock(); - - ScopedReadLock(const ScopedReadLock&) = delete; - ScopedReadLock& operator=(const ScopedReadLock&) = delete; - - private: - template friend class ConditionVariableBase; - const MutexBase& mutex_; - }; - - using ScopedWriteLock = ScopedLock; - - class ScopedUnlock { - public: - inline explicit ScopedUnlock(const ScopedLock& scoped_lock); - inline ~ScopedUnlock(); - - ScopedUnlock(const ScopedUnlock&) = delete; - ScopedUnlock& operator=(const ScopedUnlock&) = delete; - - private: - friend class ScopedLock; - const MutexBase& mutex_; - }; - - private: - template friend class ConditionVariableBase; - mutable typename Traits::MutexT mutex_; -}; - -template -class ConditionVariableBase { - public: - using ScopedLock = typename MutexBase::ScopedLock; - - inline ConditionVariableBase(); - inline ~ConditionVariableBase(); - inline void Broadcast(const ScopedLock&); - inline void Signal(const ScopedLock&); - inline void Wait(const ScopedLock& scoped_lock); - - ConditionVariableBase(const ConditionVariableBase&) = delete; - ConditionVariableBase& operator=(const ConditionVariableBase&) = delete; - - private: - typename Traits::CondT cond_; -}; - -struct LibuvMutexTraits { - using CondT = uv_cond_t; - using MutexT = uv_mutex_t; - - static inline int cond_init(CondT* cond) { - return uv_cond_init(cond); - } - - static inline int mutex_init(MutexT* mutex) { - return uv_mutex_init(mutex); - } - - static inline void cond_broadcast(CondT* cond) { - uv_cond_broadcast(cond); - } - - static inline void cond_destroy(CondT* cond) { - uv_cond_destroy(cond); - } - - static inline void cond_signal(CondT* cond) { - uv_cond_signal(cond); - } - - static inline void cond_wait(CondT* cond, MutexT* mutex) { - uv_cond_wait(cond, mutex); - } - - static inline void mutex_destroy(MutexT* mutex) { - uv_mutex_destroy(mutex); - } - - static inline void mutex_lock(MutexT* mutex) { - uv_mutex_lock(mutex); - } - - static inline void mutex_unlock(MutexT* mutex) { - uv_mutex_unlock(mutex); - } - - static inline void mutex_rdlock(MutexT* mutex) { - uv_mutex_lock(mutex); - } - - static inline void mutex_rdunlock(MutexT* mutex) { - uv_mutex_unlock(mutex); - } -}; - -struct LibuvRwlockTraits { - using MutexT = uv_rwlock_t; - - static inline int mutex_init(MutexT* mutex) { - return uv_rwlock_init(mutex); - } - - static inline void mutex_destroy(MutexT* mutex) { - uv_rwlock_destroy(mutex); - } - - static inline void mutex_lock(MutexT* mutex) { - uv_rwlock_wrlock(mutex); - } - - static inline void mutex_unlock(MutexT* mutex) { - uv_rwlock_wrunlock(mutex); - } - - static inline void mutex_rdlock(MutexT* mutex) { - uv_rwlock_rdlock(mutex); - } - - static inline void mutex_rdunlock(MutexT* mutex) { - uv_rwlock_rdunlock(mutex); - } -}; - -template -ConditionVariableBase::ConditionVariableBase() { - CHECK_EQ(0, Traits::cond_init(&cond_)); -} - -template -ConditionVariableBase::~ConditionVariableBase() { - Traits::cond_destroy(&cond_); -} - -template -void ConditionVariableBase::Broadcast(const ScopedLock&) { - Traits::cond_broadcast(&cond_); -} - -template -void ConditionVariableBase::Signal(const ScopedLock&) { - Traits::cond_signal(&cond_); -} - -template -void ConditionVariableBase::Wait(const ScopedLock& scoped_lock) { - Traits::cond_wait(&cond_, &scoped_lock.mutex_.mutex_); -} - -template -MutexBase::MutexBase() { - CHECK_EQ(0, Traits::mutex_init(&mutex_)); -} - -template -MutexBase::~MutexBase() { - Traits::mutex_destroy(&mutex_); -} - -template -void MutexBase::Lock() { - Traits::mutex_lock(&mutex_); -} - -template -void MutexBase::Unlock() { - Traits::mutex_unlock(&mutex_); -} - -template -void MutexBase::RdLock() { - Traits::mutex_rdlock(&mutex_); -} - -template -void MutexBase::RdUnlock() { - Traits::mutex_rdunlock(&mutex_); -} - -template -MutexBase::ScopedLock::ScopedLock(const MutexBase& mutex) - : mutex_(mutex) { - Traits::mutex_lock(&mutex_.mutex_); -} - -template -MutexBase::ScopedLock::ScopedLock(const ScopedUnlock& scoped_unlock) - : MutexBase(scoped_unlock.mutex_) {} - -template -MutexBase::ScopedLock::~ScopedLock() { - Traits::mutex_unlock(&mutex_.mutex_); -} - -template -MutexBase::ScopedReadLock::ScopedReadLock(const MutexBase& mutex) - : mutex_(mutex) { - Traits::mutex_rdlock(&mutex_.mutex_); -} - -template -MutexBase::ScopedReadLock::~ScopedReadLock() { - Traits::mutex_rdunlock(&mutex_.mutex_); -} - -template -MutexBase::ScopedUnlock::ScopedUnlock(const ScopedLock& scoped_lock) - : mutex_(scoped_lock.mutex_) { - Traits::mutex_unlock(&mutex_.mutex_); -} - -template -MutexBase::ScopedUnlock::~ScopedUnlock() { - Traits::mutex_lock(&mutex_.mutex_); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_MUTEX_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_native_module.h b/repo/packages/s/scriptx-legacy/include/libnode/node_native_module.h deleted file mode 100644 index 3be3f236..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_native_module.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef SRC_NODE_NATIVE_MODULE_H_ -#define SRC_NODE_NATIVE_MODULE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include -#include -#include "node_mutex.h" -#include "node_union_bytes.h" -#include "v8.h" - -// Forward declare test fixture for `friend` declaration. -class PerProcessTest; - -namespace node { -namespace native_module { - -using NativeModuleRecordMap = std::map; -using NativeModuleCacheMap = - std::unordered_map>; - -// The native (C++) side of the NativeModule in JS land, which -// handles compilation and caching of builtin modules (NativeModule) -// and bootstrappers, whose source are bundled into the binary -// as static data. -// This class should not depend on any Environment, or depend on access to -// the its own singleton - that should be encapsulated in NativeModuleEnv -// instead. -class NativeModuleLoader { - public: - NativeModuleLoader(const NativeModuleLoader&) = delete; - NativeModuleLoader& operator=(const NativeModuleLoader&) = delete; - - private: - // Only allow access from friends. - friend class NativeModuleEnv; - friend class CodeCacheBuilder; - - NativeModuleLoader(); - static NativeModuleLoader* GetInstance(); - - // Generated by tools/js2c.py as node_javascript.cc - void LoadJavaScriptSource(); // Loads data into source_ - UnionBytes GetConfig(); // Return data for config.gypi - - bool Exists(const char* id); - bool Add(const char* id, const UnionBytes& source); - - v8::Local GetSourceObject(v8::Local context); - v8::Local GetConfigString(v8::Isolate* isolate); - std::vector GetModuleIds(); - - struct ModuleCategories { - bool is_initialized = false; - std::set can_be_required; - std::set cannot_be_required; - }; - void InitializeModuleCategories(); - const std::set& GetCannotBeRequired(); - const std::set& GetCanBeRequired(); - - bool CanBeRequired(const char* id); - bool CannotBeRequired(const char* id); - - NativeModuleCacheMap* code_cache(); - v8::ScriptCompiler::CachedData* GetCodeCache(const char* id) const; - enum class Result { kWithCache, kWithoutCache }; - v8::MaybeLocal LoadBuiltinModuleSource(v8::Isolate* isolate, - const char* id); - // If an exception is encountered (e.g. source code contains - // syntax error), the returned value is empty. - v8::MaybeLocal LookupAndCompile( - v8::Local context, - const char* id, - std::vector>* parameters, - Result* result); - v8::MaybeLocal CompileAsModule(v8::Local context, - const char* id, - Result* result); - - static NativeModuleLoader instance_; - ModuleCategories module_categories_; - NativeModuleRecordMap source_; - NativeModuleCacheMap code_cache_; - UnionBytes config_; - - // Used to synchronize access to the code cache map - Mutex code_cache_mutex_; - - friend class ::PerProcessTest; -}; -} // namespace native_module - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_NATIVE_MODULE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_native_module_env.h b/repo/packages/s/scriptx-legacy/include/libnode/node_native_module_env.h deleted file mode 100644 index 0a53771f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_native_module_env.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SRC_NODE_NATIVE_MODULE_ENV_H_ -#define SRC_NODE_NATIVE_MODULE_ENV_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_native_module.h" - -namespace node { -class Environment; -class ExternalReferenceRegistry; - -namespace native_module { - -extern const bool has_code_cache; - -class NativeModuleEnv { - public: - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - - static v8::MaybeLocal LookupAndCompile( - v8::Local context, - const char* id, - std::vector>* parameters, - Environment* optional_env); - - static v8::Local GetSourceObject(v8::Local context); - // Returns config.gypi as a JSON string - static v8::Local GetConfigString(v8::Isolate* isolate); - static bool Exists(const char* id); - static bool Add(const char* id, const UnionBytes& source); - - // Loads data into NativeModuleLoader::.instance.code_cache_ - // Generated by mkcodecache as node_code_cache.cc when - // the build is configured with --code-cache-path=.... They are noops - // in node_code_cache_stub.cc - static void InitializeCodeCache(); - - private: - static void RecordResult(const char* id, - NativeModuleLoader::Result result, - Environment* env); - static void GetModuleCategories( - v8::Local property, - const v8::PropertyCallbackInfo& info); - static void GetCacheUsage(const v8::FunctionCallbackInfo& args); - // Passing ids of builtin module source code into JS land as - // internalBinding('native_module').moduleIds - static void ModuleIdsGetter(v8::Local property, - const v8::PropertyCallbackInfo& info); - // Passing config.gypi into JS land as internalBinding('native_module').config - static void ConfigStringGetter( - v8::Local property, - const v8::PropertyCallbackInfo& info); - // Compile a specific native module as a function - static void CompileFunction(const v8::FunctionCallbackInfo& args); -}; - -} // namespace native_module - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_NATIVE_MODULE_ENV_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_object_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/node_object_wrap.h deleted file mode 100644 index cb13d843..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_object_wrap.h +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_OBJECT_WRAP_H_ -#define SRC_NODE_OBJECT_WRAP_H_ - -#include "v8.h" -#include - - -namespace node { - -class ObjectWrap { - public: - ObjectWrap() { - refs_ = 0; - } - - - virtual ~ObjectWrap() { - if (persistent().IsEmpty()) - return; - persistent().ClearWeak(); - persistent().Reset(); - } - - - template - static inline T* Unwrap(v8::Local handle) { - assert(!handle.IsEmpty()); - assert(handle->InternalFieldCount() > 0); - // Cast to ObjectWrap before casting to T. A direct cast from void - // to T won't work right when T has more than one base class. - void* ptr = handle->GetAlignedPointerFromInternalField(0); - ObjectWrap* wrap = static_cast(ptr); - return static_cast(wrap); - } - - - inline v8::Local handle() { - return handle(v8::Isolate::GetCurrent()); - } - - - inline v8::Local handle(v8::Isolate* isolate) { - return v8::Local::New(isolate, persistent()); - } - - - // NOLINTNEXTLINE(runtime/v8_persistent) - inline v8::Persistent& persistent() { - return handle_; - } - - - protected: - inline void Wrap(v8::Local handle) { - assert(persistent().IsEmpty()); - assert(handle->InternalFieldCount() > 0); - handle->SetAlignedPointerInInternalField(0, this); - persistent().Reset(v8::Isolate::GetCurrent(), handle); - MakeWeak(); - } - - - inline void MakeWeak() { - persistent().SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter); - } - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref() { - assert(!persistent().IsEmpty()); - persistent().ClearWeak(); - refs_++; - } - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistent handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref() { - assert(!persistent().IsEmpty()); - assert(!persistent().IsWeak()); - assert(refs_ > 0); - if (--refs_ == 0) - MakeWeak(); - } - - int refs_; // ro - - private: - static void WeakCallback( - const v8::WeakCallbackInfo& data) { - ObjectWrap* wrap = data.GetParameter(); - assert(wrap->refs_ == 0); - wrap->handle_.Reset(); - delete wrap; - } - - // NOLINTNEXTLINE(runtime/v8_persistent) - v8::Persistent handle_; -}; - -} // namespace node - -#endif // SRC_NODE_OBJECT_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_options-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_options-inl.h deleted file mode 100644 index 7facb22a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_options-inl.h +++ /dev/null @@ -1,477 +0,0 @@ -#ifndef SRC_NODE_OPTIONS_INL_H_ -#define SRC_NODE_OPTIONS_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include "node_options.h" -#include "util.h" - -namespace node { - -PerIsolateOptions* PerProcessOptions::get_per_isolate_options() { - return per_isolate.get(); -} - -EnvironmentOptions* PerIsolateOptions::get_per_env_options() { - return per_env.get(); -} - -namespace options_parser { - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - bool Options::* field, - OptionEnvvarSettings env_setting, - bool default_is_true) { - options_.emplace(name, - OptionInfo{kBoolean, - std::make_shared>(field), - env_setting, - help_text, - default_is_true}); -} - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - uint64_t Options::* field, - OptionEnvvarSettings env_setting) { - options_.emplace( - name, - OptionInfo{kUInteger, - std::make_shared>(field), - env_setting, - help_text}); -} - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - int64_t Options::* field, - OptionEnvvarSettings env_setting) { - options_.emplace( - name, - OptionInfo{kInteger, - std::make_shared>(field), - env_setting, - help_text}); -} - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - std::string Options::* field, - OptionEnvvarSettings env_setting) { - options_.emplace( - name, - OptionInfo{kString, - std::make_shared>(field), - env_setting, - help_text}); -} - -template -void OptionsParser::AddOption( - const char* name, - const char* help_text, - std::vector Options::* field, - OptionEnvvarSettings env_setting) { - options_.emplace(name, OptionInfo { - kStringList, - std::make_shared>>(field), - env_setting, - help_text - }); -} - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - HostPort Options::* field, - OptionEnvvarSettings env_setting) { - options_.emplace( - name, - OptionInfo{kHostPort, - std::make_shared>(field), - env_setting, - help_text}); -} - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - NoOp no_op_tag, - OptionEnvvarSettings env_setting) { - options_.emplace(name, OptionInfo{kNoOp, nullptr, env_setting, help_text}); -} - -template -void OptionsParser::AddOption(const char* name, - const char* help_text, - V8Option v8_option_tag, - OptionEnvvarSettings env_setting) { - options_.emplace(name, - OptionInfo{kV8Option, nullptr, env_setting, help_text}); -} - -template -void OptionsParser::AddAlias(const char* from, - const char* to) { - aliases_[from] = { to }; -} - -template -void OptionsParser::AddAlias(const char* from, - const std::vector& to) { - aliases_[from] = to; -} - -template -void OptionsParser::AddAlias( - const char* from, - const std::initializer_list& to) { - AddAlias(from, std::vector(to)); -} - -template -void OptionsParser::Implies(const char* from, - const char* to) { - auto it = options_.find(to); - CHECK_NE(it, options_.end()); - CHECK(it->second.type == kBoolean || it->second.type == kV8Option); - implications_.emplace( - from, Implication{it->second.type, to, it->second.field, true}); -} - -template -void OptionsParser::ImpliesNot(const char* from, - const char* to) { - auto it = options_.find(to); - CHECK_NE(it, options_.end()); - CHECK_EQ(it->second.type, kBoolean); - implications_.emplace( - from, Implication{it->second.type, to, it->second.field, false}); -} - -template -template -auto OptionsParser::Convert( - std::shared_ptr original, - ChildOptions* (Options::* get_child)()) { - // If we have a field on ChildOptions, and we want to access it from an - // Options instance, we call get_child() on the original Options and then - // access it, i.e. this class implements a kind of function chaining. - struct AdaptedField : BaseOptionField { - void* LookupImpl(Options* options) const override { - return original->LookupImpl((options->*get_child)()); - } - - AdaptedField( - std::shared_ptr original, - ChildOptions* (Options::* get_child)()) - : original(original), get_child(get_child) {} - - std::shared_ptr original; - ChildOptions* (Options::* get_child)(); - }; - - return std::shared_ptr( - new AdaptedField(original, get_child)); -} -template -template -auto OptionsParser::Convert( - typename OptionsParser::OptionInfo original, - ChildOptions* (Options::* get_child)()) { - return OptionInfo{original.type, - Convert(original.field, get_child), - original.env_setting, - original.help_text, - original.default_is_true}; -} - -template -template -auto OptionsParser::Convert( - typename OptionsParser::Implication original, - ChildOptions* (Options::* get_child)()) { - return Implication{ - original.type, - original.name, - Convert(original.target_field, get_child), - original.target_value, - }; -} - -template -template -void OptionsParser::Insert( - const OptionsParser& child_options_parser, - ChildOptions* (Options::* get_child)()) { - aliases_.insert(std::begin(child_options_parser.aliases_), - std::end(child_options_parser.aliases_)); - - for (const auto& pair : child_options_parser.options_) - options_.emplace(pair.first, Convert(pair.second, get_child)); - - for (const auto& pair : child_options_parser.implications_) - implications_.emplace(pair.first, Convert(pair.second, get_child)); -} - -inline std::string NotAllowedInEnvErr(const std::string& arg) { - return arg + " is not allowed in NODE_OPTIONS"; -} - -inline std::string RequiresArgumentErr(const std::string& arg) { - return arg + " requires an argument"; -} - -inline std::string NegationImpliesBooleanError(const std::string& arg) { - return arg + " is an invalid negation because it is not a boolean option"; -} - -// We store some of the basic information around a single Parse call inside -// this struct, to separate storage of command line arguments and their -// handling. In particular, this makes it easier to introduce 'synthetic' -// arguments that get inserted by expanding option aliases. -struct ArgsInfo { - // Generally, the idea here is that the first entry in `*underlying` stores - // the "0th" argument (the program name), then `synthetic_args` are inserted, - // followed by the remainder of `*underlying`. - std::vector* underlying; - std::vector synthetic_args; - - std::vector* exec_args; - - ArgsInfo(std::vector* args, - std::vector* exec_args) - : underlying(args), exec_args(exec_args) {} - - size_t remaining() const { - // -1 to account for the program name. - return underlying->size() - 1 + synthetic_args.size(); - } - - bool empty() const { return remaining() == 0; } - const std::string& program_name() const { return underlying->at(0); } - - std::string& first() { - return synthetic_args.empty() ? underlying->at(1) : synthetic_args.front(); - } - - std::string pop_first() { - std::string ret = std::move(first()); - if (synthetic_args.empty()) { - // Only push arguments to `exec_args` that were also originally passed - // on the command line (i.e. not generated through alias expansion). - // '--' is a special case here since its purpose is to end `exec_argv`, - // which is why we do not include it. - if (exec_args != nullptr && ret != "--") - exec_args->push_back(ret); - underlying->erase(underlying->begin() + 1); - } else { - synthetic_args.erase(synthetic_args.begin()); - } - return ret; - } -}; - -template -void OptionsParser::Parse( - std::vector* const orig_args, - std::vector* const exec_args, - std::vector* const v8_args, - Options* const options, - OptionEnvvarSettings required_env_settings, - std::vector* const errors) const { - ArgsInfo args(orig_args, exec_args); - - // The first entry is the process name. Make sure it ends up in the V8 argv, - // since V8::SetFlagsFromCommandLine() expects that to hold true for that - // array as well. - if (v8_args->empty()) - v8_args->push_back(args.program_name()); - - while (!args.empty() && errors->empty()) { - if (args.first().size() <= 1 || args.first()[0] != '-') break; - - // We know that we're either going to consume this - // argument or fail completely. - const std::string arg = args.pop_first(); - - if (arg == "--") { - if (required_env_settings == kAllowedInEnvironment) - errors->push_back(NotAllowedInEnvErr("--")); - break; - } - - // Only allow --foo=bar notation for options starting with double dashes. - // (E.g. -e=a is not allowed as shorthand for --eval=a, which would - // otherwise be the result of alias expansion.) - const std::string::size_type equals_index = - arg[0] == '-' && arg[1] == '-' ? arg.find('=') : std::string::npos; - std::string name = - equals_index == std::string::npos ? arg : arg.substr(0, equals_index); - - // Store the 'original name' of the argument. This name differs from - // 'name' in that it contains a possible '=' sign and is not affected - // by alias expansion. - std::string original_name = name; - if (equals_index != std::string::npos) - original_name += '='; - - auto missing_argument = [&]() { - errors->push_back(RequiresArgumentErr(original_name)); - }; - - // Normalize by replacing `_` with `-` in options. - for (std::string::size_type i = 2; i < name.size(); ++i) { - if (name[i] == '_') - name[i] = '-'; - } - - // Convert --no-foo to --foo and keep in mind that we're negating. - bool is_negation = false; - if (name.find("--no-") == 0) { - name.erase(2, 3); // remove no- - is_negation = true; - } - - { - auto it = aliases_.end(); - // Expand aliases: - // - If `name` can be found in `aliases_`. - // - If `name` + '=' can be found in `aliases_`. - // - If `name` + " " can be found in `aliases_`, and we have - // a subsequent argument that does not start with '-' itself. - while ((it = aliases_.find(name)) != aliases_.end() || - (equals_index != std::string::npos && - (it = aliases_.find(name + '=')) != aliases_.end()) || - (!args.empty() && - !args.first().empty() && - args.first()[0] != '-' && - (it = aliases_.find(name + " ")) != aliases_.end())) { - const std::string prev_name = std::move(name); - const std::vector& expansion = it->second; - - // Use the first entry in the expansion as the new 'name'. - name = expansion.front(); - - if (expansion.size() > 1) { - // The other arguments, if any, are going to be handled later. - args.synthetic_args.insert( - args.synthetic_args.begin(), - expansion.begin() + 1, - expansion.end()); - } - - if (name == prev_name) break; - } - } - - auto it = options_.find(name); - - if ((it == options_.end() || - it->second.env_setting == kDisallowedInEnvironment) && - required_env_settings == kAllowedInEnvironment) { - errors->push_back(NotAllowedInEnvErr(original_name)); - break; - } - - { - std::string implied_name = name; - if (is_negation) { - // Implications for negated options are defined with "--no-". - implied_name.insert(2, "no-"); - } - auto implications = implications_.equal_range(implied_name); - for (auto it = implications.first; it != implications.second; ++it) { - if (it->second.type == kV8Option) { - v8_args->push_back(it->second.name); - } else { - *it->second.target_field->template Lookup(options) = - it->second.target_value; - } - } - } - - if (it == options_.end()) { - v8_args->push_back(arg); - continue; - } - - const OptionInfo& info = it->second; - - // Some V8 options can be negated and they are validated by V8 later. - if (is_negation && info.type != kBoolean && info.type != kV8Option) { - errors->push_back(NegationImpliesBooleanError(arg)); - break; - } - - std::string value; - if (info.type != kBoolean && info.type != kNoOp && info.type != kV8Option) { - if (equals_index != std::string::npos) { - value = arg.substr(equals_index + 1); - if (value.empty()) { - missing_argument(); - break; - } - } else { - if (args.empty()) { - missing_argument(); - break; - } - - value = args.pop_first(); - - if (!value.empty() && value[0] == '-') { - missing_argument(); - break; - } else { - if (!value.empty() && value[0] == '\\' && value[1] == '-') - value = value.substr(1); // Treat \- as escaping an -. - } - } - } - - switch (info.type) { - case kBoolean: - *Lookup(info.field, options) = !is_negation; - break; - case kInteger: - *Lookup(info.field, options) = std::atoll(value.c_str()); - break; - case kUInteger: - *Lookup(info.field, options) = std::stoull(value); - break; - case kString: - *Lookup(info.field, options) = value; - break; - case kStringList: - Lookup>(info.field, options) - ->emplace_back(std::move(value)); - break; - case kHostPort: - Lookup(info.field, options) - ->Update(SplitHostPort(value, errors)); - break; - case kNoOp: - break; - case kV8Option: - v8_args->push_back(arg); - break; - default: - UNREACHABLE(); - } - } - options->CheckOptions(errors); -} - -} // namespace options_parser -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_OPTIONS_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_options.h b/repo/packages/s/scriptx-legacy/include/libnode/node_options.h deleted file mode 100644 index 40d1c026..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_options.h +++ /dev/null @@ -1,495 +0,0 @@ -#ifndef SRC_NODE_OPTIONS_H_ -#define SRC_NODE_OPTIONS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include -#include -#include "node_constants.h" -#include "node_mutex.h" -#include "util.h" - -namespace node { - -class HostPort { - public: - HostPort(const std::string& host_name, int port) - : host_name_(host_name), port_(port) {} - HostPort(const HostPort&) = default; - HostPort& operator=(const HostPort&) = default; - HostPort(HostPort&&) = default; - HostPort& operator=(HostPort&&) = default; - - void set_host(const std::string& host) { host_name_ = host; } - - void set_port(int port) { port_ = port; } - - const std::string& host() const { return host_name_; } - - int port() const { - // TODO(joyeecheung): make port a uint16_t - CHECK_GE(port_, 0); - return port_; - } - - void Update(const HostPort& other) { - if (!other.host_name_.empty()) host_name_ = other.host_name_; - if (other.port_ >= 0) port_ = other.port_; - } - - private: - std::string host_name_; - int port_; -}; - -class Options { - public: - virtual void CheckOptions(std::vector* errors) {} - virtual ~Options() = default; -}; - -struct InspectPublishUid { - bool console; - bool http; -}; - -// These options are currently essentially per-Environment, but it can be nice -// to keep them separate since they are a group of options applying to a very -// specific part of Node. It might also make more sense for them to be -// per-Isolate, rather than per-Environment. -class DebugOptions : public Options { - public: - DebugOptions() = default; - DebugOptions(const DebugOptions&) = default; - DebugOptions& operator=(const DebugOptions&) = default; - DebugOptions(DebugOptions&&) = default; - DebugOptions& operator=(DebugOptions&&) = default; - - // --inspect - bool inspector_enabled = false; - // --debug - bool deprecated_debug = false; - // --inspect-brk - bool break_first_line = false; - // --inspect-brk-node - bool break_node_first_line = false; - // --inspect-publish-uid - std::string inspect_publish_uid_string = "stderr,http"; - - InspectPublishUid inspect_publish_uid; - - enum { kDefaultInspectorPort = 9229 }; - - HostPort host_port{"127.0.0.1", kDefaultInspectorPort}; - - // Used to patch the options as if --inspect-brk is passed. - void EnableBreakFirstLine() { - inspector_enabled = true; - break_first_line = true; - } - - bool wait_for_connect() const { - return break_first_line || break_node_first_line; - } - - void CheckOptions(std::vector* errors) override; -}; - -class EnvironmentOptions : public Options { - public: - bool abort_on_uncaught_exception = false; - std::vector conditions; - std::string dns_result_order; - bool enable_source_maps = false; - bool experimental_https_modules = false; - bool experimental_fetch = false; - bool experimental_global_web_crypto = false; - std::string experimental_specifier_resolution; - bool experimental_wasm_modules = false; - bool experimental_import_meta_resolve = false; - std::string module_type; - std::string experimental_policy; - std::string experimental_policy_integrity; - bool has_policy_integrity_string = false; - bool experimental_repl_await = true; - bool experimental_vm_modules = false; - bool expose_internals = false; - bool frozen_intrinsics = false; - int64_t heap_snapshot_near_heap_limit = 0; - std::string heap_snapshot_signal; - uint64_t max_http_header_size = 16 * 1024; - bool deprecation = true; - bool force_async_hooks_checks = true; - bool allow_native_addons = true; - bool global_search_paths = true; - bool warnings = true; - bool force_context_aware = false; - bool pending_deprecation = false; - bool preserve_symlinks = false; - bool preserve_symlinks_main = false; - bool prof_process = false; -#if HAVE_INSPECTOR - std::string cpu_prof_dir; - static const uint64_t kDefaultCpuProfInterval = 1000; - uint64_t cpu_prof_interval = kDefaultCpuProfInterval; - std::string cpu_prof_name; - bool cpu_prof = false; - std::string heap_prof_dir; - std::string heap_prof_name; - static const uint64_t kDefaultHeapProfInterval = 512 * 1024; - uint64_t heap_prof_interval = kDefaultHeapProfInterval; - bool heap_prof = false; -#endif // HAVE_INSPECTOR - std::string redirect_warnings; - std::string diagnostic_dir; - bool test_udp_no_try_send = false; - bool throw_deprecation = false; - bool trace_atomics_wait = false; - bool trace_deprecation = false; - bool trace_exit = false; - bool trace_sync_io = false; - bool trace_tls = false; - bool trace_uncaught = false; - bool trace_warnings = false; - std::string unhandled_rejections; - std::string userland_loader; - bool verify_base_objects = -#ifdef DEBUG - true; -#else - false; -#endif // DEBUG - - bool syntax_check_only = false; - bool has_eval_string = false; - bool experimental_wasi = false; - std::string eval_string; - bool print_eval = false; - bool force_repl = false; - - bool insecure_http_parser = false; - - bool tls_min_v1_0 = false; - bool tls_min_v1_1 = false; - bool tls_min_v1_2 = false; - bool tls_min_v1_3 = false; - bool tls_max_v1_2 = false; - bool tls_max_v1_3 = false; - std::string tls_keylog; - - std::vector preload_modules; - - std::vector user_argv; - - inline DebugOptions* get_debug_options() { return &debug_options_; } - inline const DebugOptions& debug_options() const { return debug_options_; } - - void CheckOptions(std::vector* errors) override; - - private: - DebugOptions debug_options_; -}; - -class PerIsolateOptions : public Options { - public: - std::shared_ptr per_env { new EnvironmentOptions() }; - bool track_heap_objects = false; - bool node_snapshot = true; - bool report_uncaught_exception = false; - bool report_on_signal = false; - bool experimental_top_level_await = true; - std::string report_signal = "SIGUSR2"; - inline EnvironmentOptions* get_per_env_options(); - void CheckOptions(std::vector* errors) override; -}; - -class PerProcessOptions : public Options { - public: - // Options shouldn't be here unless they affect the entire process scope, and - // that should avoided when possible. - // - // When an option is used during process initialization, it does not need - // protection, but any use after that will likely require synchronization - // using the node::per_process::cli_options_mutex, typically: - // - // Mutex::ScopedLock lock(node::per_process::cli_options_mutex); - std::shared_ptr per_isolate { new PerIsolateOptions() }; - - std::string title; - std::string trace_event_categories; - std::string trace_event_file_pattern = "node_trace.${rotation}.log"; - int64_t v8_thread_pool_size = 4; - bool zero_fill_all_buffers = false; - bool debug_arraybuffer_allocations = false; - std::string disable_proto; - - std::vector security_reverts; - bool print_bash_completion = false; - bool print_help = false; - bool print_v8_help = false; - bool print_version = false; - -#ifdef NODE_HAVE_I18N_SUPPORT - std::string icu_data_dir; -#endif - - // Per-process because they affect singleton OpenSSL shared library state, - // or are used once during process initialization. -#if HAVE_OPENSSL - std::string openssl_config; - std::string tls_cipher_list = DEFAULT_CIPHER_LIST_CORE; - int64_t secure_heap = 0; - int64_t secure_heap_min = 2; -#ifdef NODE_OPENSSL_CERT_STORE - bool ssl_openssl_cert_store = true; -#else - bool ssl_openssl_cert_store = false; -#endif - bool use_openssl_ca = false; - bool use_bundled_ca = false; - bool enable_fips_crypto = false; - bool force_fips_crypto = false; -#endif - - // Per-process because reports can be triggered outside a known V8 context. - bool report_on_fatalerror = false; - bool report_compact = false; - std::string report_directory; - std::string report_filename; - - // TODO(addaleax): Some of these could probably be per-Environment. - std::string use_largepages = "off"; - bool trace_sigint = false; - std::vector cmdline; - - inline PerIsolateOptions* get_per_isolate_options(); - void CheckOptions(std::vector* errors) override; -}; - -// The actual options parser, as opposed to the structs containing them: - -namespace options_parser { - -HostPort SplitHostPort(const std::string& arg, - std::vector* errors); -void GetOptions(const v8::FunctionCallbackInfo& args); -std::string GetBashCompletion(); - -enum OptionType { - kNoOp, - kV8Option, - kBoolean, - kInteger, - kUInteger, - kString, - kHostPort, - kStringList, -}; - -template -class OptionsParser { - public: - virtual ~OptionsParser() = default; - - typedef Options TargetType; - - struct NoOp {}; - struct V8Option {}; - - // These methods add a single option to the parser. Optionally, it can be - // specified whether the option should be allowed from environment variable - // sources (i.e. NODE_OPTIONS). - void AddOption(const char* name, - const char* help_text, - bool Options::* field, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment, - bool default_is_true = false); - void AddOption(const char* name, - const char* help_text, - uint64_t Options::* field, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const char* name, - const char* help_text, - int64_t Options::* field, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const char* name, - const char* help_text, - std::string Options::* field, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const char* name, - const char* help_text, - std::vector Options::* field, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const char* name, - const char* help_text, - HostPort Options::* field, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const char* name, - const char* help_text, - NoOp no_op_tag, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const char* name, - const char* help_text, - V8Option v8_option_tag, - OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - - // Adds aliases. An alias can be of the form "--option-a" -> "--option-b", - // or have a more complex group expansion, like - // "--option-a" -> { "--option-b", "--harmony-foobar", "--eval", "42" } - // If `from` has the form "--option-a=", the alias will only be expanded if - // the option is presented in that form (i.e. with a '='). - // If `from` has the form "--option-a ", the alias will only be expanded - // if the option has a non-option argument (not starting with -) following it. - void AddAlias(const char* from, const char* to); - void AddAlias(const char* from, const std::vector& to); - void AddAlias(const char* from, - const std::initializer_list& to); - - // Add implications from some arbitrary option to a boolean one, either - // in a way that makes `from` set `to` to true or to false. - void Implies(const char* from, const char* to); - void ImpliesNot(const char* from, const char* to); - - // Insert options from another options parser into this one, along with - // a method that yields the target options type from this parser's options - // type. - template - void Insert(const OptionsParser& child_options_parser, - ChildOptions* (Options::* get_child)()); - - // Parse a sequence of options into an options struct, a list of - // arguments that were parsed as options, a list of unknown/JS engine options, - // and leave the remainder in the input `args` vector. - // - // For example, an `args` input of - // - // node --foo --harmony-bar --fizzle=42 -- /path/to/cow moo - // - // expands as - // - // - `args` -> { "node", "/path/to/cow", "moo" } - // - `exec_args` -> { "--foo", "--harmony-bar", "--fizzle=42" } - // - `v8_args` -> `{ "node", "--harmony-bar" } - // - `options->foo == true`, `options->fizzle == 42`. - // - // If `*error` is set, the result of the parsing should be discarded and the - // contents of any of the argument vectors should be considered undefined. - void Parse(std::vector* const args, - std::vector* const exec_args, - std::vector* const v8_args, - Options* const options, - OptionEnvvarSettings required_env_settings, - std::vector* const errors) const; - - private: - // We support the wide variety of different option types by remembering - // how to access them, given a certain `Options` struct. - - // Represents a field within `Options`. - class BaseOptionField { - public: - virtual ~BaseOptionField() = default; - virtual void* LookupImpl(Options* options) const = 0; - - template - inline T* Lookup(Options* options) const { - return static_cast(LookupImpl(options)); - } - }; - - // Represents a field of type T within `Options` that can be looked up - // as a C++ member field. - template - class SimpleOptionField : public BaseOptionField { - public: - explicit SimpleOptionField(T Options::* field) : field_(field) {} - void* LookupImpl(Options* options) const override { - return static_cast(&(options->*field_)); - } - - private: - T Options::* field_; - }; - - template - inline T* Lookup(std::shared_ptr field, - Options* options) const { - return field->template Lookup(options); - } - - // An option consists of: - // - A type. - // - A way to store/access the property value. - // - The information of whether it may occur in an env var or not. - struct OptionInfo { - OptionType type; - std::shared_ptr field; - OptionEnvvarSettings env_setting; - std::string help_text; - bool default_is_true = false; - }; - - // An implied option is composed of the information on where to store a - // specific boolean value (if another specific option is encountered). - struct Implication { - OptionType type; - std::string name; - std::shared_ptr target_field; - bool target_value; - }; - - // These are helpers that make `Insert()` support properties of other - // options structs, if we know how to access them. - template - static auto Convert( - std::shared_ptr original, - ChildOptions* (Options::* get_child)()); - template - static auto Convert( - typename OptionsParser::OptionInfo original, - ChildOptions* (Options::* get_child)()); - template - static auto Convert( - typename OptionsParser::Implication original, - ChildOptions* (Options::* get_child)()); - - std::unordered_map options_; - std::unordered_map> aliases_; - std::unordered_multimap implications_; - - template - friend class OptionsParser; - - friend void GetCLIOptions(const v8::FunctionCallbackInfo& args); - friend std::string GetBashCompletion(); -}; - -using StringVector = std::vector; -template -void Parse( - StringVector* const args, StringVector* const exec_args, - StringVector* const v8_args, OptionsType* const options, - OptionEnvvarSettings required_env_settings, StringVector* const errors); - -} // namespace options_parser - -namespace per_process { - -extern Mutex cli_options_mutex; -extern std::shared_ptr cli_options; - -} // namespace per_process - -void HandleEnvOptions(std::shared_ptr env_options); -void HandleEnvOptions(std::shared_ptr env_options, - std::function opt_getter); - -std::vector ParseNodeOptionsEnvVar( - const std::string& node_options, std::vector* errors); -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_OPTIONS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_perf.h b/repo/packages/s/scriptx-legacy/include/libnode/node_perf.h deleted file mode 100644 index b1a99171..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_perf.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef SRC_NODE_PERF_H_ -#define SRC_NODE_PERF_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object-inl.h" -#include "histogram.h" -#include "node.h" -#include "node_internals.h" -#include "node_perf_common.h" - -#include "v8.h" -#include "uv.h" - -#include - -namespace node { - -class Environment; -class ExternalReferenceRegistry; - -namespace performance { - -extern const uint64_t timeOrigin; - -inline const char* GetPerformanceMilestoneName( - PerformanceMilestone milestone) { - switch (milestone) { -#define V(name, label) case NODE_PERFORMANCE_MILESTONE_##name: return label; - NODE_PERFORMANCE_MILESTONES(V) -#undef V - default: - UNREACHABLE(); - } -} - -inline PerformanceMilestone ToPerformanceMilestoneEnum(const char* str) { -#define V(name, label) \ - if (strcmp(str, label) == 0) return NODE_PERFORMANCE_MILESTONE_##name; - NODE_PERFORMANCE_MILESTONES(V) -#undef V - return NODE_PERFORMANCE_MILESTONE_INVALID; -} - -inline const char* GetPerformanceEntryTypeName( - PerformanceEntryType type) { - switch (type) { -#define V(name, label) case NODE_PERFORMANCE_ENTRY_TYPE_##name: return label; - NODE_PERFORMANCE_ENTRY_TYPES(V) -#undef V - default: - UNREACHABLE(); - } -} - -inline PerformanceEntryType ToPerformanceEntryTypeEnum( - const char* type) { -#define V(name, label) \ - if (strcmp(type, label) == 0) return NODE_PERFORMANCE_ENTRY_TYPE_##name; - NODE_PERFORMANCE_ENTRY_TYPES(V) -#undef V - return NODE_PERFORMANCE_ENTRY_TYPE_INVALID; -} - -enum PerformanceGCKind { - NODE_PERFORMANCE_GC_MAJOR = v8::GCType::kGCTypeMarkSweepCompact, - NODE_PERFORMANCE_GC_MINOR = v8::GCType::kGCTypeScavenge, - NODE_PERFORMANCE_GC_INCREMENTAL = v8::GCType::kGCTypeIncrementalMarking, - NODE_PERFORMANCE_GC_WEAKCB = v8::GCType::kGCTypeProcessWeakCallbacks -}; - -enum PerformanceGCFlags { - NODE_PERFORMANCE_GC_FLAGS_NO = - v8::GCCallbackFlags::kNoGCCallbackFlags, - NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED = - v8::GCCallbackFlags::kGCCallbackFlagConstructRetainedObjectInfos, - NODE_PERFORMANCE_GC_FLAGS_FORCED = - v8::GCCallbackFlags::kGCCallbackFlagForced, - NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING = - v8::GCCallbackFlags::kGCCallbackFlagSynchronousPhantomCallbackProcessing, - NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE = - v8::GCCallbackFlags::kGCCallbackFlagCollectAllAvailableGarbage, - NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY = - v8::GCCallbackFlags::kGCCallbackFlagCollectAllExternalMemory, - NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE = - v8::GCCallbackFlags::kGCCallbackScheduleIdleGarbageCollection -}; - -template -struct PerformanceEntry { - using Details = typename Traits::Details; - std::string name; - double start_time; - double duration; - Details details; - - PerformanceEntry( - const std::string& name_, - double start_time_, - double duration_, - const Details& details_) - : name(name_), - start_time(start_time_), - duration(duration_), - details(details_) {} - - static v8::MaybeLocal GetDetails( - Environment* env, - const PerformanceEntry& entry) { - return Traits::GetDetails(env, entry); - } - - void Notify(Environment* env) { - v8::HandleScope handle_scope(env->isolate()); - v8::Context::Scope scope(env->context()); - AliasedUint32Array& observers = env->performance_state()->observers; - if (env->performance_entry_callback().IsEmpty() || - !observers[Traits::kType]) { - return; - } - - v8::Local detail; - if (!Traits::GetDetails(env, *this).ToLocal(&detail)) { - // TODO(@jasnell): Handle the error here - return; - } - - v8::Local argv[] = { - OneByteString(env->isolate(), name.c_str()), - OneByteString(env->isolate(), GetPerformanceEntryTypeName(Traits::kType)), - v8::Number::New(env->isolate(), start_time), - v8::Number::New(env->isolate(), duration), - detail - }; - - node::MakeSyncCallback( - env->isolate(), - env->context()->Global(), - env->performance_entry_callback(), - arraysize(argv), - argv); - } -}; - -struct GCPerformanceEntryTraits { - static constexpr PerformanceEntryType kType = - NODE_PERFORMANCE_ENTRY_TYPE_GC; - struct Details { - PerformanceGCKind kind; - PerformanceGCFlags flags; - - Details(PerformanceGCKind kind_, PerformanceGCFlags flags_) - : kind(kind_), flags(flags_) {} - }; - - static v8::MaybeLocal GetDetails( - Environment* env, - const PerformanceEntry& entry); -}; - -using GCPerformanceEntry = PerformanceEntry; - -} // namespace performance -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_PERF_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_perf_common.h b/repo/packages/s/scriptx-legacy/include/libnode/node_perf_common.h deleted file mode 100644 index 1fea2e4f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_perf_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef SRC_NODE_PERF_COMMON_H_ -#define SRC_NODE_PERF_COMMON_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" -#include "node.h" -#include "uv.h" -#include "v8.h" - -#include -#include -#include -#include - -namespace node { -namespace performance { - -#define PERFORMANCE_NOW() uv_hrtime() - -// These occur before the environment is created. Cache them -// here and add them to the milestones when the env is init'd. -extern uint64_t performance_v8_start; - -#define NODE_PERFORMANCE_MILESTONES(V) \ - V(ENVIRONMENT, "environment") \ - V(NODE_START, "nodeStart") \ - V(V8_START, "v8Start") \ - V(LOOP_START, "loopStart") \ - V(LOOP_EXIT, "loopExit") \ - V(BOOTSTRAP_COMPLETE, "bootstrapComplete") - - -#define NODE_PERFORMANCE_ENTRY_TYPES(V) \ - V(GC, "gc") \ - V(HTTP, "http") \ - V(HTTP2, "http2") - -enum PerformanceMilestone { -#define V(name, _) NODE_PERFORMANCE_MILESTONE_##name, - NODE_PERFORMANCE_MILESTONES(V) -#undef V - NODE_PERFORMANCE_MILESTONE_INVALID -}; - -enum PerformanceEntryType { -#define V(name, _) NODE_PERFORMANCE_ENTRY_TYPE_##name, - NODE_PERFORMANCE_ENTRY_TYPES(V) -#undef V - NODE_PERFORMANCE_ENTRY_TYPE_INVALID -}; - -class PerformanceState { - public: - struct SerializeInfo { - AliasedBufferIndex root; - AliasedBufferIndex milestones; - AliasedBufferIndex observers; - }; - - explicit PerformanceState(v8::Isolate* isolate, const SerializeInfo* info); - SerializeInfo Serialize(v8::Local context, - v8::SnapshotCreator* creator); - void Deserialize(v8::Local context); - friend std::ostream& operator<<(std::ostream& o, const SerializeInfo& i); - - AliasedUint8Array root; - AliasedFloat64Array milestones; - AliasedUint32Array observers; - - uint64_t performance_last_gc_start_mark = 0; - - void Mark(enum PerformanceMilestone milestone, - uint64_t ts = PERFORMANCE_NOW()); - - private: - struct performance_state_internal { - // doubles first so that they are always sizeof(double)-aligned - double milestones[NODE_PERFORMANCE_MILESTONE_INVALID]; - uint32_t observers[NODE_PERFORMANCE_ENTRY_TYPE_INVALID]; - }; -}; - -} // namespace performance -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_PERF_COMMON_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_platform.h b/repo/packages/s/scriptx-legacy/include/libnode/node_platform.h deleted file mode 100644 index a7139ebd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_platform.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef SRC_NODE_PLATFORM_H_ -#define SRC_NODE_PLATFORM_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include -#include - -#include "libplatform/libplatform.h" -#include "node.h" -#include "node_mutex.h" -#include "uv.h" - -namespace node { - -class NodePlatform; -class IsolateData; -class PerIsolatePlatformData; - -template -class TaskQueue { - public: - TaskQueue(); - ~TaskQueue() = default; - - void Push(std::unique_ptr task); - std::unique_ptr Pop(); - std::unique_ptr BlockingPop(); - std::queue> PopAll(); - void NotifyOfCompletion(); - void BlockingDrain(); - void Stop(); - - private: - Mutex lock_; - ConditionVariable tasks_available_; - ConditionVariable tasks_drained_; - int outstanding_tasks_; - bool stopped_; - std::queue> task_queue_; -}; - -struct DelayedTask { - std::unique_ptr task; - uv_timer_t timer; - double timeout; - std::shared_ptr platform_data; -}; - -// This acts as the foreground task runner for a given Isolate. -class PerIsolatePlatformData : - public IsolatePlatformDelegate, - public v8::TaskRunner, - public std::enable_shared_from_this { - public: - PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop); - ~PerIsolatePlatformData() override; - - std::shared_ptr GetForegroundTaskRunner() override; - void PostTask(std::unique_ptr task) override; - void PostIdleTask(std::unique_ptr task) override; - void PostDelayedTask(std::unique_ptr task, - double delay_in_seconds) override; - bool IdleTasksEnabled() override { return false; } - - // Non-nestable tasks are treated like regular tasks. - bool NonNestableTasksEnabled() const override { return true; } - bool NonNestableDelayedTasksEnabled() const override { return true; } - void PostNonNestableTask(std::unique_ptr task) override; - void PostNonNestableDelayedTask(std::unique_ptr task, - double delay_in_seconds) override; - - void AddShutdownCallback(void (*callback)(void*), void* data); - void Shutdown(); - - // Returns true if work was dispatched or executed. New tasks that are - // posted during flushing of the queue are postponed until the next - // flushing. - bool FlushForegroundTasksInternal(); - - const uv_loop_t* event_loop() const { return loop_; } - - private: - void DeleteFromScheduledTasks(DelayedTask* task); - void DecreaseHandleCount(); - - static void FlushTasks(uv_async_t* handle); - void RunForegroundTask(std::unique_ptr task); - static void RunForegroundTask(uv_timer_t* timer); - - struct ShutdownCallback { - void (*cb)(void*); - void* data; - }; - typedef std::vector ShutdownCbList; - ShutdownCbList shutdown_callbacks_; - // shared_ptr to self to keep this object alive during shutdown. - std::shared_ptr self_reference_; - uint32_t uv_handle_count_ = 1; // 1 = flush_tasks_ - - v8::Isolate* const isolate_; - uv_loop_t* const loop_; - uv_async_t* flush_tasks_ = nullptr; - TaskQueue foreground_tasks_; - TaskQueue foreground_delayed_tasks_; - - // Use a custom deleter because libuv needs to close the handle first. - typedef std::unique_ptr - DelayedTaskPointer; - std::vector scheduled_delayed_tasks_; -}; - -// This acts as the single worker thread task runner for all Isolates. -class WorkerThreadsTaskRunner { - public: - explicit WorkerThreadsTaskRunner(int thread_pool_size); - - void PostTask(std::unique_ptr task); - void PostDelayedTask(std::unique_ptr task, - double delay_in_seconds); - - void BlockingDrain(); - void Shutdown(); - - int NumberOfWorkerThreads() const; - - private: - TaskQueue pending_worker_tasks_; - - class DelayedTaskScheduler; - std::unique_ptr delayed_task_scheduler_; - - std::vector> threads_; -}; - -class NodePlatform : public MultiIsolatePlatform { - public: - NodePlatform(int thread_pool_size, - v8::TracingController* tracing_controller); - ~NodePlatform() override; - - void DrainTasks(v8::Isolate* isolate) override; - void Shutdown(); - - // v8::Platform implementation. - int NumberOfWorkerThreads() override; - void CallOnWorkerThread(std::unique_ptr task) override; - void CallDelayedOnWorkerThread(std::unique_ptr task, - double delay_in_seconds) override; - bool IdleTasksEnabled(v8::Isolate* isolate) override; - double MonotonicallyIncreasingTime() override; - double CurrentClockTimeMillis() override; - v8::TracingController* GetTracingController() override; - bool FlushForegroundTasks(v8::Isolate* isolate) override; - std::unique_ptr PostJob( - v8::TaskPriority priority, - std::unique_ptr job_task) override; - - void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override; - void RegisterIsolate(v8::Isolate* isolate, - IsolatePlatformDelegate* delegate) override; - - void UnregisterIsolate(v8::Isolate* isolate) override; - void AddIsolateFinishedCallback(v8::Isolate* isolate, - void (*callback)(void*), void* data) override; - - std::shared_ptr GetForegroundTaskRunner( - v8::Isolate* isolate) override; - - Platform::StackTracePrinter GetStackTracePrinter() override; - - private: - IsolatePlatformDelegate* ForIsolate(v8::Isolate* isolate); - std::shared_ptr ForNodeIsolate(v8::Isolate* isolate); - - Mutex per_isolate_mutex_; - using DelegatePair = std::pair< - IsolatePlatformDelegate*, std::shared_ptr>; - std::unordered_map per_isolate_; - - v8::TracingController* tracing_controller_; - std::shared_ptr worker_thread_task_runner_; - bool has_shut_down_ = false; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_PLATFORM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_process-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_process-inl.h deleted file mode 100644 index 21a448cf..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_process-inl.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SRC_NODE_PROCESS_INL_H_ -#define SRC_NODE_PROCESS_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_process.h" -#include "v8.h" -#include "debug_utils-inl.h" - -namespace node { - -// Call process.emitWarning(str), fmt is a snprintf() format string -template -inline v8::Maybe ProcessEmitWarning(Environment* env, - const char* fmt, - Args&&... args) { - std::string warning = SPrintF(fmt, std::forward(args)...); - - return ProcessEmitWarningGeneric(env, warning.c_str()); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_PROCESS_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_process.h b/repo/packages/s/scriptx-legacy/include/libnode/node_process.h deleted file mode 100644 index 68956cb0..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_process.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef SRC_NODE_PROCESS_H_ -#define SRC_NODE_PROCESS_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_snapshotable.h" -#include "v8-fast-api-calls.h" -#include "v8.h" - -namespace node { - -class Environment; -class MemoryTracker; -class ExternalReferenceRegistry; - -v8::MaybeLocal CreateEnvVarProxy(v8::Local context, - v8::Isolate* isolate); - -// Most of the time, it's best to use `console.error` to write -// to the process.stderr stream. However, in some cases, such as -// when debugging the stream.Writable class or the process.nextTick -// function, it is useful to bypass JavaScript entirely. -void RawDebug(const v8::FunctionCallbackInfo& args); - -v8::MaybeLocal ProcessEmit(Environment* env, - const char* event, - v8::Local message); - -v8::Maybe ProcessEmitWarningGeneric(Environment* env, - const char* warning, - const char* type = nullptr, - const char* code = nullptr); - -template -inline v8::Maybe ProcessEmitWarning(Environment* env, - const char* fmt, - Args&&... args); -v8::Maybe ProcessEmitExperimentalWarning(Environment* env, - const char* warning); -v8::Maybe ProcessEmitDeprecationWarning(Environment* env, - const char* warning, - const char* deprecation_code); - -v8::MaybeLocal CreateProcessObject(Environment* env); -void PatchProcessObject(const v8::FunctionCallbackInfo& args); - -namespace process { -class BindingData : public SnapshotableObject { - public: - void AddMethods(); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - SERIALIZABLE_OBJECT_METHODS() - static constexpr FastStringKey type_name{"node::process::BindingData"}; - static constexpr EmbedderObjectType type_int = - EmbedderObjectType::k_process_binding_data; - - BindingData(Environment* env, v8::Local object); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(BindingData) - SET_SELF_SIZE(BindingData) - - static BindingData* FromV8Value(v8::Local receiver); - static void NumberImpl(BindingData* receiver); - - static void FastNumber(v8::Local receiver) { - NumberImpl(FromV8Value(receiver)); - } - - static void SlowNumber(const v8::FunctionCallbackInfo& args); - - static void BigIntImpl(BindingData* receiver); - - static void FastBigInt(v8::Local receiver) { - BigIntImpl(FromV8Value(receiver)); - } - - static void SlowBigInt(const v8::FunctionCallbackInfo& args); - - private: - static constexpr size_t kBufferSize = - std::max(sizeof(uint64_t), sizeof(uint32_t) * 3); - v8::Global array_buffer_; - std::shared_ptr backing_store_; - - // These need to be static so that we have their addresses available to - // register as external references in the snapshot at environment creation - // time. - static v8::CFunction fast_number_; - static v8::CFunction fast_bigint_; -}; - -} // namespace process -} // namespace node -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_PROCESS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_report.h b/repo/packages/s/scriptx-legacy/include/libnode/node_report.h deleted file mode 100644 index a8292eb2..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_report.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include "node.h" -#include "node_buffer.h" -#include "uv.h" -#include "util.h" - -#ifndef _WIN32 -#include -#include -#endif - -#include - -namespace report { - -// Function declarations - functions in src/node_report.cc -std::string TriggerNodeReport(v8::Isolate* isolate, - node::Environment* env, - const char* message, - const char* trigger, - const std::string& name, - v8::Local error); -void GetNodeReport(v8::Isolate* isolate, - node::Environment* env, - const char* message, - const char* trigger, - v8::Local error, - std::ostream& out); - -// Function declarations - utility functions in src/node_report_utils.cc -void WalkHandle(uv_handle_t* h, void* arg); - -template -std::string ValueToHexString(T value) { - std::stringstream hex; - - hex << "0x" << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex << - value; - return hex.str(); -} - -// Function declarations - export functions in src/node_report_module.cc -void WriteReport(const v8::FunctionCallbackInfo& info); -void GetReport(const v8::FunctionCallbackInfo& info); - -} // namespace report diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_revert.h b/repo/packages/s/scriptx-legacy/include/libnode/node_revert.h deleted file mode 100644 index 83dcb62c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_revert.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef SRC_NODE_REVERT_H_ -#define SRC_NODE_REVERT_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node.h" - -/** - * Note that it is expected for this list to vary across specific LTS and - * Stable versions! Only CVE's whose fixes require *breaking* changes within - * a given LTS or Stable may be added to this list, and only with TSC - * consensus. - * - * For *master* this list should always be empty! - **/ -namespace node { - -#define SECURITY_REVERSIONS(XX) \ - XX(CVE_2021_44531, "CVE-2021-44531", "Cert Verif Bypass via URI SAN") \ - XX(CVE_2021_44532, "CVE-2021-44532", "Cert Verif Bypass via Str Inject") \ -// XX(CVE_2016_PEND, "CVE-2016-PEND", "Vulnerability Title") - -enum reversion { -#define V(code, ...) SECURITY_REVERT_##code, - SECURITY_REVERSIONS(V) -#undef V -}; - -namespace per_process { -extern unsigned int reverted_cve; -} - -#ifdef _MSC_VER -#pragma warning(push) -// MSVC C4065: switch statement contains 'default' but no 'case' labels -#pragma warning(disable : 4065) -#endif - -inline const char* RevertMessage(const reversion cve) { -#define V(code, label, msg) case SECURITY_REVERT_##code: return label ": " msg; - switch (cve) { - SECURITY_REVERSIONS(V) - default: - return "Unknown"; - } -#undef V -} - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -inline void Revert(const reversion cve) { - per_process::reverted_cve |= 1 << cve; - printf("SECURITY WARNING: Reverting %s\n", RevertMessage(cve)); -} - -inline void Revert(const char* cve, std::string* error) { -#define V(code, label, _) \ - if (strcmp(cve, label) == 0) return Revert(SECURITY_REVERT_##code); - SECURITY_REVERSIONS(V) -#undef V - *error = "Error: Attempt to revert an unknown CVE ["; - *error += cve; - *error += ']'; -} - -inline bool IsReverted(const reversion cve) { - return per_process::reverted_cve & (1 << cve); -} - -inline bool IsReverted(const char* cve) { -#define V(code, label, _) \ - if (strcmp(cve, label) == 0) return IsReverted(SECURITY_REVERT_##code); - SECURITY_REVERSIONS(V) - return false; -#undef V -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_REVERT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_root_certs.h b/repo/packages/s/scriptx-legacy/include/libnode/node_root_certs.h deleted file mode 100644 index 1fbec584..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_root_certs.h +++ /dev/null @@ -1,3246 +0,0 @@ -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -/* GlobalSign Root CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMC\n" -"QkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNV\n" -"BAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBa\n" -"MFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdS\n" -"b290IENBMRswGQYDVQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUA\n" -"A4IBDwAwggEKAoIBAQDaDuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtI\n" -"K+6NiY6arymAZavpxy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94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EtslQIxq/H5COEBkEveegeGTLg==\n" -"-----END CERTIFICATE-----", - -/* Entrust.net Premium 2048 Secure Server CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVz\n" -"dC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJl\n" -"Zi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0\n" -"ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4\n" -"KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0\n" -"Lm5ldDFAMD4GA1UECxQ3d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVm\n" -"LiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRl\n" -"ZDEzMDEGA1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp\n" -"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtK\n" -"TY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/EC\n" -"DNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ\n" -"/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzWnLLPKQP5L6RQstRIzgUyVYr9smRM\n" -"DuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8Aj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t2ygu\n" -"zmKiYv60iNoS6zjrIZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo\n" -"6vWrJYeKmpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu\n" -"XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3z\n" -"yZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkC\n" -"AwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1BE3wMBIGA1UdEwEB/wQIMAYB\n" -"Af8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27\n" -"TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukM\n" -"JY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhS\n" -"NzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67\n" -"G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS\n" -"R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp\n" -"-----END CERTIFICATE-----", - -/* Entrust Root Certification Authority */ -"-----BEGIN CERTIFICATE-----\n" -"MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAU\n" -"BgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMg\n" -"aW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0G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MAwGA1UdEwQFMAMBAf8wDQYJ\n" -"KoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYX\n" -"MP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P\n" -"TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQHmyW74cN\n" -"xA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VILs9R\n" -"aRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b\n" -"vZ8=\n" -"-----END CERTIFICATE-----", - -/* Starfield Class 2 CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UE\n" -"ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENs\n" -"YXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5\n" -"MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2ll\n" -"cywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRo\n" -"b3JpdHkwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N\n" -"78gDGIc/oav7PKaf8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMe\n" -"j2YcOadN+lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0\n" -"X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4Umkhyn\n" -"ArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W\n" -"93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRb\n" -"Vazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0fhvRbVazc1xDCDqmI56FspGowaDEL\n" -"MAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAw\n" -"BgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG\n" -"A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1ep\n" -"oXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D\n" -"eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJlxy16paq8\n" -"U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJDKVtH\n" -"CN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3\n" -"QBFGmh95DmK/D5fs4C8fF5Q=\n" -"-----END CERTIFICATE-----", - -/* DigiCert Assured ID Root CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYD\n" -"VQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu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VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm8KPiGxvDl7I90VUwHwYDVR0jBBgw\n" -"FoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1E\n" -"nE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDi\n" -"qw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBA\n" -"I+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls\n" -"YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQkCAUw7C29\n" -"C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=\n" -"-----END CERTIFICATE-----", - -/* DigiCert High Assurance EV Root CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYD\n" -"VQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu\n" -"Y29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2\n" -"MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERp\n" -"Z2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNl\n" -"cnQgSGlnaCBBc3N1cmFuY2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\n" -"AQoCggEBAMbM5XPm+9S75S0tMqbf5YE/yc0lSbZxKsPV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MDAwWjBMMSAwHgYDVQQL\n" -"ExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE\n" -"AxMKR2xvYmFsU2lnbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5Bngi\n" -"FvXAg7aEyiie/QV2EcWtiHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0M\n" -"K66X17YUhhB5uzsTgHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL\n" -"0gRgykmmKPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd\n" -"QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613\n" -"t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQD\n" -"AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0G\n" -"CSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7lgAJQayzE4aGKAczymvmdLm6AC2u\n" -"pArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdW\n" -"PoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0\n" -"095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJr\n" -"lAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH\n" -"WD9f\n" -"-----END CERTIFICATE-----", - -/* Autoridad de Certificacion Firmaprofesional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7vUIgtYf8/QnMFlEPVjjxOAToZ\n" -"pR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6i\n" -"SNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE4\n" -"1V4tC5h9Pmzb/CaIxw==\n" -"-----END CERTIFICATE-----", - -/* Go Daddy Root Certificate Authority - G2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNV\n" -"BAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29t\n" -"LCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAt\n" -"IEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAw\n" -"DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5\n" -"LmNvbSwgSW5jLjExMC8GA1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3Jp\n" -"dHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3\n" -"gElY6SKDE6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH\n" -"/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLI\n" -"jWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6\n" -"gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGRtDtwKj9useiciAF9n9T521Nt\n" -"YJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO\n" -"BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3\n" -"DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC\n" -"2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95\n" -"kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo\n" -"2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPOLPAvTK33\n" -"sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1\n" -"-----END CERTIFICATE-----", - -/* Starfield Root Certificate Authority - G2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNV\n" -"BAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBU\n" -"ZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRl\n" -"IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJ\n" -"BgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYD\n" -"VQQKExxTdGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQg\n" -"Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEP\n" -"ADCCAQoCggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg\n" -"nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSu\n" -"S/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhh\n" -"dM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dNdloedl40wOiWVpmKs/B/pM29\n" -"3DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbUJtQIBFnQmA4O5t78w+wfkPECAwEA\n" -"AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n\n" -"2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWU\n" -"XuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox\n" -"9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg\n" -"8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/KpL/QlwVK\n" -"vOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZc2T5\n" -"NnReJaH1ZgUufzkVqSr7UIuOhWn0\n" -"-----END CERTIFICATE-----", - -/* Starfield Services Root Certificate Authority - G2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIID7zCCAtegA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UNBMRAwDgYDVQQLDAdSb290IENBMSow\n" -"KAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3\n" -"DQEBAQUAA4IBDwAwggEKAoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bi\n" -"hSX0NXIP+FPQQeFEAcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQ\n" -"sIBct+HHK3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX\n" -"RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJb\n" -"KdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxY\n" -"A7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud\n" -"DgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG9w0BAQUFAAOCAQEAPNV3PdrfibqH\n" -"DAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqG\n" -"fczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4g\n" -"umlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKu\n" -"D8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ\n" -"YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==\n" -"-----END CERTIFICATE-----", - -/* Security Communication RootCA2 */ -"-----BEGIN CERTIFICATE-----\n" -"M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WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6\n" -"Un/10asIbvPuW/mIPX64b24D5EI=\n" -"-----END CERTIFICATE-----", - -/* Hellenic Academic and Research Institutions RootCA 2011 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNV\n" -"BAoTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4g\n" -"QXV0aG9yaXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5z\n" -"dGl0dXRpb25zIFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1Mlow\n" -"gZUxCzAJBgNVBAYTAkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFy\n" -"Y2ggSW5zdGl0dXRpb25zIENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNh\n" -"ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZI\n" -"hvcNAQEBBQADggEPADCCAQoCggEBAKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPz\n" -"dYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0a\n" -"e50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsm\n" -"LIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u8yBRQlqD75O6aRXxYp2fmTmCobd0LovU\n" -"xQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH3N6sQWRstBmbAmNtJGSPRLIl6s5d\n" -"dAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAdBgNV\n" -"HQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8MAWCAy5ncjAFggMuZXUw\n" -"BoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQub3JnMA0GCSqGSIb3\n" -"DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVtXdMiKahsog2p\n" -"6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8TqBTnbI6\n" -"nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD/md9\n" -"zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N\n" -"7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4\n" -"-----END CERTIFICATE-----", - -/* Actalis Authentication Root CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQx\n" -"DjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEn\n" -"MCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIw\n" -"MloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYD\n" -"VQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRo\n" -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E-----", - -/* DigiCert Assured ID Root G3 */ -"-----BEGIN CERTIFICATE-----\n" -"MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQG\n" -"EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t\n" -"MSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAw\n" -"WhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5j\n" -"MRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVk\n" -"IElEIFJvb3QgRzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0F\n" -"FfLvC/8QdJ+1YlJfZn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+\n" -"CW7if17QRSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/\n" -"BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBk\n" -"AjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2\n" -"U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv6pZjamVFkpUBtA==\n" -"-----END CERTIFICATE-----", - -/* DigiCert Global Root G2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYD\n" -"VQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5j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f6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe\n" -"pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTflMrY=\n" -"-----END CERTIFICATE-----", - -/* DigiCert Global Root G3 */ -"-----BEGIN CERTIFICATE-----\n" -"MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQG\n" -"EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29t\n" -"MSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0z\n" -"ODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAX\n" -"BgNVBAsTEHd3dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290\n" -"IEczMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu8\n" -"0JX28MzQC7phW1FGfp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6I\n" -"p6FrtUPOZ9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd\n" -"BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/\n" -"EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q\n" -"3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8sycX\n" -"-----END CERTIFICATE-----", - -/* DigiCert Trusted Root G4 */ -"-----BEGI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\n" -"-----END CERTIFICATE-----", - -/* USERTrust RSA Certification Authority */ -"-----BEGIN CERTIFICATE-----\n" -"MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkG\n" -"A1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4w\n" -"HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0Eg\n" -"Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5\n" -"WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl\n" -"eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJU\n" -"cnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4IC\n" -"DwAwggIKAoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B\n" -"3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTb\n" -"f6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshy\n" -"Z9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2VN3I5xI6Ta5MirdcmrS3ID3K\n" -"fyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq/nROacdrjGCT3sTHDN/hMq7MkztR\n" -"eJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+td\n" -"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i9JNlWSOrvxKJGgYhqOkbR\n" -"qZtNyWHa0V1Xahg=\n" -"-----END CERTIFICATE-----", - -/* GlobalSign ECC Root CA - R4 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UE\n" -"CxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMw\n" -"EQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEk\n" -"MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxT\n" -"aWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5\n" -"049sJQ6fLjkZHAOkrprlOQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5Rikqtlx\n" -"P6jUuc6MHaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE\n" -"FFSwe61FuOJAf/sKbvu+M8k8o4TVMAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGX\n" -"kPoUVy0D7O48027KqGx2vKLeuwIgJ6iFJzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=\n" -"-----END CERTIFICATE-----", - -/* GlobalSign ECC Root CA - R5 */ -"-----BEGIN CERTIFICATE-----\n" -"MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UE\n" -"CxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMw\n" -"EQYDVQQDEwpHbG9iYWxTaWduMB4XDT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/Zq\n" -"5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLld\n" -"RqANb/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW\n" -"2HNnh/tNf1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy\n" -"+TSrK0m1zSBi5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCj\n" -"uTaPPoIaGl6I6lD4WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeL\n" -"eG9QgkRQP2YGiqtDhFZKDyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB\n" -"4IMeDExNH08GGeL5qPQ6gqGyeUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==\n" -"-----END CERTIFICATE-----", - -/* IdenTrust Commercial Root CA 1 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYD\n" -"VQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVy\n" -"Y2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYD\n" -"VQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVy\n" -"Y2lhbCBSb290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k9\n" -"1DNG8W9RYYKyqU+PZ4ldhNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1e\n" -"hm7zCYofWjK9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88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF\n" -"5PgLZxYWxoK4Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57I\n" -"cXR5f1GJtshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA\n" -"GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXws\n" -"BOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c\n" -"-----END CERTIFICATE-----", - -/* Entrust Root Certification Authority - G2 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAU\n" -"BgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn\n" -"YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9y\n" -"aXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0\n" -"aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UE\n" -"BhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVz\n" -"dC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBm\n" -"b3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj\n" -"YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6\n" -"hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3\n" -"gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWNcCG0szLni6LVhjkCsbjSR87k\n" -"yUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKUs/Ja5CeanyTXxuzQmyWC48zCxEXF\n" -"jJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+\n" -"tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1Ud\n" -"DwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2f\n" -"kBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/\n" -"jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZRkfz6/dj\n" -"wUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDginWyT\n" -"msQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+\n" -"vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ\n" -"19xOe4pIb4tF9g==\n" -"-----END CERTIFICATE-----", - -/* Entrust Root Certification Authority - EC1 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMC\n" -"VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZ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ONTqwX3BN\n" -"XuMp8SMoclm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3\n" -"lEu6LaTaM4tMpkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVI\n" -"eVheO/jbAoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq\n" -"P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bIND\n" -"d82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXa\n" -"QHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlF\n" -"w5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbiDrW5viSP\n" -"-----END CERTIFICATE-----", - -/* Hellenic Academic and Research Institutions RootCA 2015 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNV\n" -"BAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIElu\n" -"c3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWlj\n" -"IGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIx\n" -"WhcNNDAwNjMwMTAxMTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIG\n" -"A1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0\n" -"LiBBdX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DBKg\n" -"2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6Hwb\n" -"ISHTGzrMd/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkN\n" -"aeJK9E10A/+yd+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRG\n" -"ar9KC/eaj8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh\n" -"X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZd\n" -"wJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+j\n" -"qk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoX\n" -"xdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODf\n" -"qiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9qp/UsQu0yrbYhnr68\n" -"-----END CERTIFICATE-----", - -/* Hellenic Academic and Research Institutions ECC RootCA 2015 */ -"-----BEGIN CERTIFICATE-----\n" -"MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcT\n" -"BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3Rp\n" -"dHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFu\n" -"ZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwM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ZwjrZt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGG\n" -"MB0GA1UdDgQWBBSrttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWS\n" -"oxe3jfkrBqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM\n" -"YyRIHN8wfdVoOw==\n" -"-----END CERTIFICATE-----", - -/* Amazon Root CA 4 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYD\n" -"VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4X\n" -"DTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoT\n" -"BkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAi\n" -"A2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhF\n" -"XRbb/egQbeOc4OO9X4Ri83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYD\n" -"VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc\n" -"84ZtV+WBMAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw\n" -"CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJ\n" -"ElMzrdfkviT8tQp21KW8EA==\n" -"-----END CERTIFICATE-----", - -/* TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1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duUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmcp0yJF4OuowReUoCLHhIlERnXDH19MURB\n" -"6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+fyCMgMsq2JdiyIMzkX2woloPV+g7\n" -"zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGjYzBhMB0GA1UdDgQWBBREnkj1\n" -"zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAPBgNV\n" -"HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAQEABT41XBVw\n" -"m8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u/ukZMjgDfxT2\n" -"AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11FhcCF5yWP\n" -"ldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0XsJ5F9\n" -"5yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC\n" -"jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==\n" -"-----END CERTIFICATE-----", - -/* SSL.com Root Certification Authority RSA */ -"-----BEGIN CERTIFICATE-----\n" -"MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMx\n" -"DjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9y\n" -"YXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBS\n" -"U0EwHhcNMTYwMjEyMTczOTM5WhcNN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AQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQEAwIB\n" -"hjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr\n" -"dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E\n" -"+ZUfijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52j\n" -"vATGGAslu1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3\n" -"oFRuIIhxdRjqerQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfd\n" -"SSLBv9jra6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I\n" -"H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJ\n" -"BjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh\n" -"1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpB\n" -"C8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=\n" -"-----END CERTIFICATE-----", - -/* SSL.com Root Certification Authority ECC */ -"-----BEGIN CERTIFICATE-----\n" -"MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAM\n" -"BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRp\n" -"b24xMTAvBgNVBAMMKFNTT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BgNVHSMEGDAW\n" -"gBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20ZpqJ4w\n" -"DgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1\n" -"++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkcl\n" -"f7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgY\n" -"CdcDzH2GguDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S\n" -"9ksrPJ/psEDzOFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOC\n" -"sp0FvmXtll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm\n" -"Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7\n" -"fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3\n" -"kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2K\n" -"i+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FF\n" -"Y6GsdqnC+w==\n" -"-----END CERTIFICATE-----", - -/* SSL.com EV Root Certification Authority ECC */ -"-----BEGIN CERTIFICATE-----\n" -"MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAM\n" -"BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDV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ToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLNnsAEoJFp\n" -"5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0lV7A\n" -"e46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY\n" -"BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xoc\n" -"BFymFe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl\n" -"+68KnyBr3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxC\n" -"XcPu9czc8FB10jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+\n" -"z1TIvWfspA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v\n" -"JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+L\n" -"LUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s\n" -"1gLXCmeDBVrJpBA=\n" -"-----END CERTIFICATE-----", - -/* OISTE WISeKey Global Root GC CA */ -"-----BEGIN CERTIFICATE-----\n" -"MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQG\n" -"EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRv\n" -"cnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1\n" -"MDkwOTQ4MzRaFw00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BmAjEAgFuk\n" -"fCPAlaUs3L6JbyO5o91lAFJekazInXJ0glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUl\n" -"UfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOaKaqW04MjyaR7YbPMAuhd\n" -"-----END CERTIFICATE-----", - -/* GTS Root R4 */ -"-----BEGIN CERTIFICATE-----\n" -"MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQG\n" -"EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RT\n" -"IFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJV\n" -"UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv\n" -"b3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5G\n" -"vWvVYRg1rkDdc/eJkTBa6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRl\n" -"BtHci8nHc8iMai/lxKvRHYqjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/\n" -"MB0GA1UdDgQWBBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0\n" -"CMRw3J5QdCHojXohw0+WbhXRIjVhLfoIN+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG\n" -"7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11xzPKwTdb+mciUqXWi4w==\n" -"-----END CERTIFICATE-----", - -/* UCA Global G2 Root */ -"-----BEGIN CERTIFICATE-----\n" -"MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0B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DVR0OBBYEFIHEjMz15DD/\n" -"pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj\n" -"L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg51eRfB70V\n" -"VJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0ADs0b\n" -"+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9\n" -"yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQs\n" -"nLAXc47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67Xh\n" -"J/UQqAHojhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWko\n" -"aY/X5V+tBIZkbxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsv\n" -"fEehOjPI+Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy\n" -"YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1\n" -"whnw0A==\n" -"-----END CERTIFICATE-----", - -/* UCA Extended Validation Root */ -"-----BEGIN CERTIFICATE-----\n" -"MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYD\n" -"VQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxp\n" -"ZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxM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JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h\n" -"LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29t\n" -"L2NlcnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfcc\n" -"VdV8AOItOoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pk\n" -"V5a7XdrnxIxPTGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApP\n" -"NeNgJgH60BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB\n" -"lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc\n" -"+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0O\n" -"KmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZ\n" -"byvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11IN\n" -"b9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv\n" -"0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i\n" -"2k+KYTlerj1KjL0=\n" -"-----END CERTIFICATE-----", - -/* emSign Root CA - G1 */ -"-----BEGIN CERTIFICATE-----\n" -"MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJ\n" -"TjETMBEGA1UECxMKZW1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yLcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwy\n" -"c6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGj\n" -"QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg\n" -"4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq\n" -"kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UCb6741jH/\n" -"JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB/AYm\n" -"/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5\n" -"8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvR\n" -"Cjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9\n" -"o4JFWklWatKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq\n" -"2LxndD0UF/tUSxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55\n" -"CJD2AhZkPuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE\n" -"1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3Ng\n" -"hVdJIgc=\n" -"-----END CERTIFICATE-----", - -/* Trustwave Global Certification Authority */ -"-----BEGIN CERTIFICATE-----\n" -"MIIF2jCCA8KgAwIBAgIMBf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global ECC P256 Certification Authority */ -"-----BEGIN CERTIFICATE-----\n" -"MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYDVQQGEwJV\n" -"UzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0\n" -"d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1\n" -"NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1\n" -"MTBaMIGRMQswCQYDVQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNh\n" -"Z28xITAfBgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3\n" -"YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49\n" -"AgEGCCqGSM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN\n" -"FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0P\n" -"AQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcwCgYIKoZIzj0EAwID\n" -"RwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wghDDcCIC0mA6AFvWvR9lz4ZcyG\n" -"bbOcNEhjhAnFjXca4syc4XR7\n" -"-----END CERTIFICATE-----", - -/* Trustwave Global ECC P384 Certification Authority */ -"-----BEGIN CERTIFICATE-----\n" -"MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYDVQQG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04jRYVxqEU+kw2any\n" -"lnTDUR9YSTHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw\n" -"AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQDAgGGMAoG\n" -"CCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNwSaSS6sUUiHCm0w2w\n" -"qsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygNnxS2PFOiTAZpffpskcYqSUXm\n" -"7LcT4Tps\n" -"-----END CERTIFICATE-----", -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_snapshotable.h b/repo/packages/s/scriptx-legacy/include/libnode/node_snapshotable.h deleted file mode 100644 index 1ccd9a93..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_snapshotable.h +++ /dev/null @@ -1,138 +0,0 @@ - -#ifndef SRC_NODE_SNAPSHOTABLE_H_ -#define SRC_NODE_SNAPSHOTABLE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object.h" -#include "util.h" - -namespace node { - -class Environment; -struct EnvSerializeInfo; -struct SnapshotData; - -#define SERIALIZABLE_OBJECT_TYPES(V) \ - V(fs_binding_data, fs::BindingData) \ - V(v8_binding_data, v8_utils::BindingData) \ - V(blob_binding_data, BlobBindingData) \ - V(process_binding_data, process::BindingData) - -enum class EmbedderObjectType : uint8_t { - k_default = 0, -#define V(PropertyName, NativeType) k_##PropertyName, - SERIALIZABLE_OBJECT_TYPES(V) -#undef V -}; - -// When serializing an embedder object, we'll serialize the native states -// into a chunk that can be mapped into a subclass of InternalFieldInfo, -// and pass it into the V8 callback as the payload of StartupData. -// TODO(joyeecheung): the classification of types seem to be wrong. -// We'd need a type for each field of each class of native object. -// Maybe it's fine - we'll just use the type to invoke BaseObject constructors -// and specify that the BaseObject has only one field for us to serialize. -// And for non-BaseObject embedder objects, we'll use field-wise types. -// The memory chunk looks like this: -// -// [ type ] - EmbedderObjectType (a uint8_t) -// [ length ] - a size_t -// [ ... ] - custom bytes of size |length - header size| -struct InternalFieldInfo { - EmbedderObjectType type; - size_t length; - - InternalFieldInfo() = delete; - - static InternalFieldInfo* New(EmbedderObjectType type) { - return New(type, sizeof(InternalFieldInfo)); - } - - static InternalFieldInfo* New(EmbedderObjectType type, size_t length) { - InternalFieldInfo* result = - reinterpret_cast(::operator new[](length)); - result->type = type; - result->length = length; - return result; - } - - InternalFieldInfo* Copy() const { - InternalFieldInfo* result = - reinterpret_cast(::operator new[](length)); - memcpy(result, this, length); - return result; - } - - void Delete() { ::operator delete[](this); } -}; - -// An interface for snapshotable native objects to inherit from. -// Use the SERIALIZABLE_OBJECT_METHODS() macro in the class to define -// the following methods to implement: -// -// - PrepareForSerialization(): This would be run prior to context -// serialization. Use this method to e.g. release references that -// can be re-initialized, or perform property store operations -// that needs a V8 context. -// - Serialize(): This would be called during context serialization, -// once for each embedder field of the object. -// Allocate and construct an InternalFieldInfo object that contains -// data that can be used to deserialize native states. -// - Deserialize(): This would be called after the context is -// deserialized and the object graph is complete, once for each -// embedder field of the object. Use this to restore native states -// in the object. -class SnapshotableObject : public BaseObject { - public: - SnapshotableObject(Environment* env, - v8::Local wrap, - EmbedderObjectType type = EmbedderObjectType::k_default); - const char* GetTypeNameChars() const; - - virtual void PrepareForSerialization(v8::Local context, - v8::SnapshotCreator* creator) = 0; - virtual InternalFieldInfo* Serialize(int index) = 0; - bool is_snapshotable() const override { return true; } - // We'll make sure that the type is set in the constructor - EmbedderObjectType type() { return type_; } - - private: - EmbedderObjectType type_; -}; - -#define SERIALIZABLE_OBJECT_METHODS() \ - void PrepareForSerialization(v8::Local context, \ - v8::SnapshotCreator* creator) override; \ - InternalFieldInfo* Serialize(int index) override; \ - static void Deserialize(v8::Local context, \ - v8::Local holder, \ - int index, \ - InternalFieldInfo* info); - -v8::StartupData SerializeNodeContextInternalFields(v8::Local holder, - int index, - void* env); -void DeserializeNodeInternalFields(v8::Local holder, - int index, - v8::StartupData payload, - void* env); -void SerializeBindingData(Environment* env, - v8::SnapshotCreator* creator, - EnvSerializeInfo* info); - -bool IsSnapshotableType(FastStringKey key); - -class SnapshotBuilder { - public: - static std::string Generate(const std::vector args, - const std::vector exec_args); - static void Generate(SnapshotData* out, - const std::vector args, - const std::vector exec_args); -}; -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_SNAPSHOTABLE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr-inl.h deleted file mode 100644 index 0b236159..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr-inl.h +++ /dev/null @@ -1,266 +0,0 @@ -#ifndef SRC_NODE_SOCKADDR_INL_H_ -#define SRC_NODE_SOCKADDR_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node.h" -#include "env-inl.h" -#include "node_internals.h" -#include "node_sockaddr.h" -#include "util-inl.h" -#include "memory_tracker-inl.h" - -#include - -namespace node { - -static constexpr uint32_t kLabelMask = 0xFFFFF; - -inline void hash_combine(size_t* seed) { } - -template -inline void hash_combine(size_t* seed, const T& value, Args... rest) { - *seed ^= std::hash{}(value) + 0x9e3779b9 + (*seed << 6) + (*seed >> 2); - hash_combine(seed, rest...); -} - -bool SocketAddress::is_numeric_host(const char* hostname) { - return is_numeric_host(hostname, AF_INET) || - is_numeric_host(hostname, AF_INET6); -} - -bool SocketAddress::is_numeric_host(const char* hostname, int family) { - in6_addr dst; - return inet_pton(family, hostname, &dst) == 1; -} - -int SocketAddress::GetPort(const sockaddr* addr) { - CHECK(addr->sa_family == AF_INET || addr->sa_family == AF_INET6); - return ntohs(addr->sa_family == AF_INET ? - reinterpret_cast(addr)->sin_port : - reinterpret_cast(addr)->sin6_port); -} - -int SocketAddress::GetPort(const sockaddr_storage* addr) { - return GetPort(reinterpret_cast(addr)); -} - -std::string SocketAddress::GetAddress(const sockaddr* addr) { - CHECK(addr->sa_family == AF_INET || addr->sa_family == AF_INET6); - char host[INET6_ADDRSTRLEN]; - const void* src = addr->sa_family == AF_INET ? - static_cast( - &(reinterpret_cast(addr)->sin_addr)) : - static_cast( - &(reinterpret_cast(addr)->sin6_addr)); - uv_inet_ntop(addr->sa_family, src, host, INET6_ADDRSTRLEN); - return std::string(host); -} - -std::string SocketAddress::GetAddress(const sockaddr_storage* addr) { - return GetAddress(reinterpret_cast(addr)); -} - -size_t SocketAddress::GetLength(const sockaddr* addr) { - return addr->sa_family == AF_INET ? - sizeof(sockaddr_in) : sizeof(sockaddr_in6); -} - -size_t SocketAddress::GetLength(const sockaddr_storage* addr) { - return GetLength(reinterpret_cast(addr)); -} - -SocketAddress::SocketAddress(const sockaddr* addr) { - memcpy(&address_, addr, GetLength(addr)); -} - -SocketAddress::SocketAddress(const SocketAddress& addr) { - memcpy(&address_, &addr.address_, addr.length()); -} - -SocketAddress& SocketAddress::operator=(const sockaddr* addr) { - memcpy(&address_, addr, GetLength(addr)); - return *this; -} - -SocketAddress& SocketAddress::operator=(const SocketAddress& addr) { - memcpy(&address_, &addr.address_, addr.length()); - return *this; -} - -const sockaddr& SocketAddress::operator*() const { - return *data(); -} - -const sockaddr* SocketAddress::operator->() const { - return data(); -} - -size_t SocketAddress::length() const { - return GetLength(&address_); -} - -const sockaddr* SocketAddress::data() const { - return reinterpret_cast(&address_); -} - -const uint8_t* SocketAddress::raw() const { - return reinterpret_cast(&address_); -} - -sockaddr* SocketAddress::storage() { - return reinterpret_cast(&address_); -} - -int SocketAddress::family() const { - return address_.ss_family; -} - -std::string SocketAddress::address() const { - return GetAddress(&address_); -} - -int SocketAddress::port() const { - return GetPort(&address_); -} - -uint32_t SocketAddress::flow_label() const { - if (family() != AF_INET6) - return 0; - const sockaddr_in6* in = reinterpret_cast(data()); - return in->sin6_flowinfo; -} - -void SocketAddress::set_flow_label(uint32_t label) { - if (family() != AF_INET6) - return; - CHECK_LE(label, kLabelMask); - sockaddr_in6* in = reinterpret_cast(&address_); - in->sin6_flowinfo = label; -} - -std::string SocketAddress::ToString() const { - if (family() != AF_INET && family() != AF_INET6) return ""; - return (family() == AF_INET6 ? - std::string("[") + address() + "]:" : - address() + ":") + - std::to_string(port()); -} - -void SocketAddress::Update(uint8_t* data, size_t len) { - CHECK_LE(len, sizeof(address_)); - memcpy(&address_, data, len); -} - -void SocketAddress::Update(const sockaddr* data, size_t len) { - CHECK_LE(len, sizeof(address_)); - memcpy(&address_, data, len); -} - -v8::Local SocketAddress::ToJS( - Environment* env, - v8::Local info) const { - return AddressToJS(env, data(), info); -} - -bool SocketAddress::operator==(const SocketAddress& other) const { - if (family() != other.family()) return false; - return memcmp(raw(), other.raw(), length()) == 0; -} - -bool SocketAddress::operator!=(const SocketAddress& other) const { - return !(*this == other); -} - -bool SocketAddress::operator<(const SocketAddress& other) const { - return compare(other) == CompareResult::LESS_THAN; -} - -bool SocketAddress::operator>(const SocketAddress& other) const { - return compare(other) == CompareResult::GREATER_THAN; -} - -bool SocketAddress::operator<=(const SocketAddress& other) const { - CompareResult c = compare(other); - return c == CompareResult::NOT_COMPARABLE ? false : - c <= CompareResult::SAME; -} - -bool SocketAddress::operator>=(const SocketAddress& other) const { - return compare(other) >= CompareResult::SAME; -} - -template -SocketAddressLRU::SocketAddressLRU( - size_t max_size) - : max_size_(max_size) {} - -template -typename T::Type* SocketAddressLRU::Peek( - const SocketAddress& address) const { - auto it = map_.find(address); - return it == std::end(map_) ? nullptr : &it->second->second; -} - -template -void SocketAddressLRU::CheckExpired() { - auto it = list_.rbegin(); - while (it != list_.rend()) { - if (T::CheckExpired(it->first, it->second)) { - map_.erase(it->first); - list_.pop_back(); - it = list_.rbegin(); - continue; - } else { - break; - } - } -} - -template -void SocketAddressLRU::MemoryInfo(MemoryTracker* tracker) const { - tracker->TrackFieldWithSize("list", size() * sizeof(Pair)); -} - -// If an item already exists for the given address, bump up it's -// position in the LRU list and return it. If the item does not -// exist, create it. If an item is created, check the size of the -// cache and adjust if necessary. Whether the item exists or not, -// purge expired items. -template -typename T::Type* SocketAddressLRU::Upsert( - const SocketAddress& address) { - - auto on_exit = OnScopeLeave([&]() { CheckExpired(); }); - - auto it = map_.find(address); - if (it != std::end(map_)) { - list_.splice(list_.begin(), list_, it->second); - T::Touch(it->first, &it->second->second); - return &it->second->second; - } - - list_.push_front(Pair(address, { })); - map_[address] = list_.begin(); - T::Touch(list_.begin()->first, &list_.begin()->second); - - // Drop the last item in the list if we are - // over the size limit... - if (map_.size() > max_size_) { - auto last = list_.end(); - map_.erase((--last)->first); - list_.pop_back(); - } - - return &map_[address]->second; -} - -v8::MaybeLocal SocketAddressBlockList::Rule::ToV8String( - Environment* env) { - std::string str = ToString(); - return ToV8Value(env->context(), str); -} -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#endif // SRC_NODE_SOCKADDR_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr.h b/repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr.h deleted file mode 100644 index 4cc5291c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_sockaddr.h +++ /dev/null @@ -1,405 +0,0 @@ -#ifndef SRC_NODE_SOCKADDR_H_ -#define SRC_NODE_SOCKADDR_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "memory_tracker.h" -#include "base_object.h" -#include "node.h" -#include "node_worker.h" -#include "uv.h" -#include "v8.h" - -#include -#include -#include -#include - -namespace node { - -class Environment; - -class SocketAddress : public MemoryRetainer { - public: - enum class CompareResult { - NOT_COMPARABLE = -2, - LESS_THAN, - SAME, - GREATER_THAN - }; - - struct Hash { - size_t operator()(const SocketAddress& addr) const; - }; - - inline bool operator==(const SocketAddress& other) const; - inline bool operator!=(const SocketAddress& other) const; - - inline bool operator<(const SocketAddress& other) const; - inline bool operator>(const SocketAddress& other) const; - inline bool operator<=(const SocketAddress& other) const; - inline bool operator>=(const SocketAddress& other) const; - - inline static bool is_numeric_host(const char* hostname); - inline static bool is_numeric_host(const char* hostname, int family); - - // Returns true if converting {family, host, port} to *addr succeeded. - static bool ToSockAddr( - int32_t family, - const char* host, - uint32_t port, - sockaddr_storage* addr); - - // Returns true if converting {family, host, port} to *addr succeeded. - static bool New( - int32_t family, - const char* host, - uint32_t port, - SocketAddress* addr); - - static bool New( - const char* host, - uint32_t port, - SocketAddress* addr); - - // Returns the port for an IPv4 or IPv6 address. - inline static int GetPort(const sockaddr* addr); - inline static int GetPort(const sockaddr_storage* addr); - - // Returns the numeric host as a string for an IPv4 or IPv6 address. - inline static std::string GetAddress(const sockaddr* addr); - inline static std::string GetAddress(const sockaddr_storage* addr); - - // Returns the struct length for an IPv4, IPv6 or UNIX domain. - inline static size_t GetLength(const sockaddr* addr); - inline static size_t GetLength(const sockaddr_storage* addr); - - SocketAddress() = default; - - inline explicit SocketAddress(const sockaddr* addr); - inline SocketAddress(const SocketAddress& addr); - inline SocketAddress& operator=(const sockaddr* other); - inline SocketAddress& operator=(const SocketAddress& other); - - inline const sockaddr& operator*() const; - inline const sockaddr* operator->() const; - - inline const sockaddr* data() const; - inline const uint8_t* raw() const; - inline sockaddr* storage(); - inline size_t length() const; - - inline int family() const; - inline std::string address() const; - inline int port() const; - - // Returns true if the given other SocketAddress is a match - // for this one. The addresses are a match if: - // 1. They are the same family and match identically - // 2. They are different family but match semantically ( - // for instance, an IPv4 address in IPv6 notation) - bool is_match(const SocketAddress& other) const; - - // Compares this SocketAddress to the given other SocketAddress. - CompareResult compare(const SocketAddress& other) const; - - // Returns true if this SocketAddress is within the subnet - // identified by the given network address and CIDR prefix. - bool is_in_network(const SocketAddress& network, int prefix) const; - - // If the SocketAddress is an IPv6 address, returns the - // current value of the IPv6 flow label, if set. Otherwise - // returns 0. - inline uint32_t flow_label() const; - - // If the SocketAddress is an IPv6 address, sets the - // current value of the IPv6 flow label. If not an - // IPv6 address, set_flow_label is a non-op. It - // is important to note that the flow label, - // while represented as an uint32_t, the flow - // label is strictly limited to 20 bits, and - // this will assert if any value larger than - // 20-bits is specified. - inline void set_flow_label(uint32_t label = 0); - - inline void Update(uint8_t* data, size_t len); - inline void Update(const sockaddr* data, size_t len); - - static SocketAddress FromSockName(const uv_udp_t& handle); - static SocketAddress FromSockName(const uv_tcp_t& handle); - static SocketAddress FromPeerName(const uv_udp_t& handle); - static SocketAddress FromPeerName(const uv_tcp_t& handle); - - inline v8::Local ToJS( - Environment* env, - v8::Local obj = v8::Local()) const; - - inline std::string ToString() const; - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(SocketAddress) - SET_SELF_SIZE(SocketAddress) - - template - using Map = std::unordered_map; - - private: - sockaddr_storage address_; -}; - -class SocketAddressBase : public BaseObject { - public: - static bool HasInstance(Environment* env, v8::Local value); - static v8::Local GetConstructorTemplate( - Environment* env); - static void Initialize(Environment* env, v8::Local target); - static BaseObjectPtr Create( - Environment* env, - std::shared_ptr address); - - static void New(const v8::FunctionCallbackInfo& args); - static void Detail(const v8::FunctionCallbackInfo& args); - static void LegacyDetail(const v8::FunctionCallbackInfo& args); - static void GetFlowLabel(const v8::FunctionCallbackInfo& args); - - SocketAddressBase( - Environment* env, - v8::Local wrap, - std::shared_ptr address); - - inline const std::shared_ptr& address() const { - return address_; - } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressBase) - SET_SELF_SIZE(SocketAddressBase) - - TransferMode GetTransferMode() const override { - return TransferMode::kCloneable; - } - std::unique_ptr CloneForMessaging() const override; - - class TransferData : public worker::TransferData { - public: - inline explicit TransferData(const SocketAddressBase* wrap) - : address_(wrap->address_) {} - - inline explicit TransferData(std::shared_ptr address) - : address_(std::move(address)) {} - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressBase::TransferData) - SET_SELF_SIZE(TransferData) - - private: - std::shared_ptr address_; - }; - - private: - std::shared_ptr address_; -}; - -template -class SocketAddressLRU : public MemoryRetainer { - public: - using Type = typename T::Type; - - inline explicit SocketAddressLRU(size_t max_size); - - // If the item already exists, returns a reference to - // the existing item, adjusting items position in the - // LRU. If the item does not exist, emplaces the item - // and returns the new item. - Type* Upsert(const SocketAddress& address); - - // Returns a reference to the item if it exists, or - // nullptr. The position in the LRU is not modified. - Type* Peek(const SocketAddress& address) const; - - size_t size() const { return map_.size(); } - size_t max_size() const { return max_size_; } - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressLRU) - SET_SELF_SIZE(SocketAddressLRU) - - private: - using Pair = std::pair; - using Iterator = typename std::list::iterator; - - void CheckExpired(); - - std::list list_; - SocketAddress::Map map_; - size_t max_size_; -}; - -// A BlockList is used to evaluate whether a given -// SocketAddress should be accepted for inbound or -// outbound network activity. -class SocketAddressBlockList : public MemoryRetainer { - public: - explicit SocketAddressBlockList( - std::shared_ptr parent = {}); - ~SocketAddressBlockList() = default; - - void AddSocketAddress(const std::shared_ptr& address); - - void RemoveSocketAddress(const std::shared_ptr& address); - - void AddSocketAddressRange( - const std::shared_ptr& start, - const std::shared_ptr& end); - - void AddSocketAddressMask( - const std::shared_ptr& address, - int prefix); - - bool Apply(const std::shared_ptr& address); - - size_t size() const { return rules_.size(); } - - v8::MaybeLocal ListRules(Environment* env); - - struct Rule : public MemoryRetainer { - virtual bool Apply(const std::shared_ptr& address) = 0; - inline v8::MaybeLocal ToV8String(Environment* env); - virtual std::string ToString() = 0; - }; - - struct SocketAddressRule final : Rule { - std::shared_ptr address; - - explicit SocketAddressRule(const std::shared_ptr& address); - - bool Apply(const std::shared_ptr& address) override; - std::string ToString() override; - - void MemoryInfo(node::MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressRule) - SET_SELF_SIZE(SocketAddressRule) - }; - - struct SocketAddressRangeRule final : Rule { - std::shared_ptr start; - std::shared_ptr end; - - SocketAddressRangeRule( - const std::shared_ptr& start, - const std::shared_ptr& end); - - bool Apply(const std::shared_ptr& address) override; - std::string ToString() override; - - void MemoryInfo(node::MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressRangeRule) - SET_SELF_SIZE(SocketAddressRangeRule) - }; - - struct SocketAddressMaskRule final : Rule { - std::shared_ptr network; - int prefix; - - SocketAddressMaskRule( - const std::shared_ptr& address, - int prefix); - - bool Apply(const std::shared_ptr& address) override; - std::string ToString() override; - - void MemoryInfo(node::MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressMaskRule) - SET_SELF_SIZE(SocketAddressMaskRule) - }; - - void MemoryInfo(node::MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressBlockList) - SET_SELF_SIZE(SocketAddressBlockList) - - private: - bool ListRules( - Environment* env, - std::vector>* vec); - - std::shared_ptr parent_; - std::list> rules_; - SocketAddress::Map>::iterator> address_rules_; - - Mutex mutex_; -}; - -class SocketAddressBlockListWrap : public BaseObject { - public: - static bool HasInstance(Environment* env, v8::Local value); - static v8::Local GetConstructorTemplate( - Environment* env); - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - - static BaseObjectPtr New(Environment* env); - static BaseObjectPtr New( - Environment* env, - std::shared_ptr blocklist); - - static void New(const v8::FunctionCallbackInfo& args); - static void AddAddress(const v8::FunctionCallbackInfo& args); - static void AddRange(const v8::FunctionCallbackInfo& args); - static void AddSubnet(const v8::FunctionCallbackInfo& args); - static void Check(const v8::FunctionCallbackInfo& args); - static void GetRules(const v8::FunctionCallbackInfo& args); - - SocketAddressBlockListWrap( - Environment* env, - v8::Local wrap, - std::shared_ptr blocklist = - std::make_shared()); - - void MemoryInfo(node::MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressBlockListWrap) - SET_SELF_SIZE(SocketAddressBlockListWrap) - - TransferMode GetTransferMode() const override { - return TransferMode::kCloneable; - } - std::unique_ptr CloneForMessaging() const override; - - class TransferData : public worker::TransferData { - public: - inline explicit TransferData(const SocketAddressBlockListWrap* wrap) - : blocklist_(wrap->blocklist_) {} - - inline explicit TransferData( - std::shared_ptr blocklist) - : blocklist_(std::move(blocklist)) {} - - BaseObjectPtr Deserialize( - Environment* env, - v8::Local context, - std::unique_ptr self) override; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(SocketAddressBlockListWrap::TransferData) - SET_SELF_SIZE(TransferData) - - private: - std::shared_ptr blocklist_; - }; - - private: - std::shared_ptr blocklist_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_SOCKADDR_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_stat_watcher.h b/repo/packages/s/scriptx-legacy/include/libnode/node_stat_watcher.h deleted file mode 100644 index 7efd22fd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_stat_watcher.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_STAT_WATCHER_H_ -#define SRC_NODE_STAT_WATCHER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node.h" -#include "handle_wrap.h" -#include "uv.h" -#include "v8.h" - -namespace node { -namespace fs { -class BindingData; -} - -class Environment; -class ExternalReferenceRegistry; - -class StatWatcher : public HandleWrap { - public: - static void Initialize(Environment* env, v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - protected: - StatWatcher(fs::BindingData* binding_data, - v8::Local wrap, - bool use_bigint); - - static void New(const v8::FunctionCallbackInfo& args); - static void Start(const v8::FunctionCallbackInfo& args); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(StatWatcher) - SET_SELF_SIZE(StatWatcher) - - private: - static void Callback(uv_fs_poll_t* handle, - int status, - const uv_stat_t* prev, - const uv_stat_t* curr); - - uv_fs_poll_t watcher_; - const bool use_bigint_; - BaseObjectPtr binding_data_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_STAT_WATCHER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_union_bytes.h b/repo/packages/s/scriptx-legacy/include/libnode/node_union_bytes.h deleted file mode 100644 index d296e67f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_union_bytes.h +++ /dev/null @@ -1,103 +0,0 @@ - -#ifndef SRC_NODE_UNION_BYTES_H_ -#define SRC_NODE_UNION_BYTES_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -// A union of const uint8_t* or const uint16_t* data that can be -// turned into external v8::String when given an isolate. - -#include "v8.h" - -namespace node { - -class NonOwningExternalOneByteResource - : public v8::String::ExternalOneByteStringResource { - public: - explicit NonOwningExternalOneByteResource(const uint8_t* data, size_t length) - : data_(data), length_(length) {} - ~NonOwningExternalOneByteResource() override = default; - - const char* data() const override { - return reinterpret_cast(data_); - } - size_t length() const override { return length_; } - - NonOwningExternalOneByteResource(const NonOwningExternalOneByteResource&) = - delete; - NonOwningExternalOneByteResource& operator=( - const NonOwningExternalOneByteResource&) = delete; - - private: - const uint8_t* data_; - size_t length_; -}; - -class NonOwningExternalTwoByteResource - : public v8::String::ExternalStringResource { - public: - explicit NonOwningExternalTwoByteResource(const uint16_t* data, size_t length) - : data_(data), length_(length) {} - ~NonOwningExternalTwoByteResource() override = default; - - const uint16_t* data() const override { return data_; } - size_t length() const override { return length_; } - - NonOwningExternalTwoByteResource(const NonOwningExternalTwoByteResource&) = - delete; - NonOwningExternalTwoByteResource& operator=( - const NonOwningExternalTwoByteResource&) = delete; - - private: - const uint16_t* data_; - size_t length_; -}; - -// Similar to a v8::String, but it's independent from Isolates -// and can be materialized in Isolates as external Strings -// via ToStringChecked. The data pointers are owned by the caller. -class UnionBytes { - public: - UnionBytes(const uint16_t* data, size_t length) - : one_bytes_(nullptr), two_bytes_(data), length_(length) {} - UnionBytes(const uint8_t* data, size_t length) - : one_bytes_(data), two_bytes_(nullptr), length_(length) {} - - UnionBytes(const UnionBytes&) = default; - UnionBytes& operator=(const UnionBytes&) = default; - UnionBytes(UnionBytes&&) = default; - UnionBytes& operator=(UnionBytes&&) = default; - - bool is_one_byte() const { return one_bytes_ != nullptr; } - const uint16_t* two_bytes_data() const { - CHECK_NOT_NULL(two_bytes_); - return two_bytes_; - } - const uint8_t* one_bytes_data() const { - CHECK_NOT_NULL(one_bytes_); - return one_bytes_; - } - v8::Local ToStringChecked(v8::Isolate* isolate) const { - if (is_one_byte()) { - NonOwningExternalOneByteResource* source = - new NonOwningExternalOneByteResource(one_bytes_data(), length_); - return v8::String::NewExternalOneByte(isolate, source).ToLocalChecked(); - } else { - NonOwningExternalTwoByteResource* source = - new NonOwningExternalTwoByteResource(two_bytes_data(), length_); - return v8::String::NewExternalTwoByte(isolate, source).ToLocalChecked(); - } - } - size_t length() { return length_; } - - private: - const uint8_t* one_bytes_; - const uint16_t* two_bytes_; - size_t length_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_UNION_BYTES_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_url.h b/repo/packages/s/scriptx-legacy/include/libnode/node_url.h deleted file mode 100644 index d7b9a1c3..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_url.h +++ /dev/null @@ -1,205 +0,0 @@ -#ifndef SRC_NODE_URL_H_ -#define SRC_NODE_URL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node.h" - -#include - -namespace node { -namespace url { - -#define PARSESTATES(XX) \ - XX(kSchemeStart) \ - XX(kScheme) \ - XX(kNoScheme) \ - XX(kSpecialRelativeOrAuthority) \ - XX(kPathOrAuthority) \ - XX(kRelative) \ - XX(kRelativeSlash) \ - XX(kSpecialAuthoritySlashes) \ - XX(kSpecialAuthorityIgnoreSlashes) \ - XX(kAuthority) \ - XX(kHost) \ - XX(kHostname) \ - XX(kPort) \ - XX(kFile) \ - XX(kFileSlash) \ - XX(kFileHost) \ - XX(kPathStart) \ - XX(kPath) \ - XX(kCannotBeBase) \ - XX(kQuery) \ - XX(kFragment) - -#define FLAGS(XX) \ - XX(URL_FLAGS_NONE, 0) \ - XX(URL_FLAGS_FAILED, 0x01) \ - XX(URL_FLAGS_CANNOT_BE_BASE, 0x02) \ - XX(URL_FLAGS_INVALID_PARSE_STATE, 0x04) \ - XX(URL_FLAGS_TERMINATED, 0x08) \ - XX(URL_FLAGS_SPECIAL, 0x10) \ - XX(URL_FLAGS_HAS_USERNAME, 0x20) \ - XX(URL_FLAGS_HAS_PASSWORD, 0x40) \ - XX(URL_FLAGS_HAS_HOST, 0x80) \ - XX(URL_FLAGS_HAS_PATH, 0x100) \ - XX(URL_FLAGS_HAS_QUERY, 0x200) \ - XX(URL_FLAGS_HAS_FRAGMENT, 0x400) \ - XX(URL_FLAGS_IS_DEFAULT_SCHEME_PORT, 0x800) \ - -enum url_parse_state { - kUnknownState = -1, -#define XX(name) name, - PARSESTATES(XX) -#undef XX -}; - -enum url_flags { -#define XX(name, val) name = val, - FLAGS(XX) -#undef XX -}; - -struct url_data { - int32_t flags = URL_FLAGS_NONE; - int port = -1; - std::string scheme; - std::string username; - std::string password; - std::string host; - std::string query; - std::string fragment; - std::vector path; - std::string href; -}; - -namespace table_data { -extern const char hex[1024]; -extern const uint8_t C0_CONTROL_ENCODE_SET[32]; -extern const uint8_t FRAGMENT_ENCODE_SET[32]; -extern const uint8_t PATH_ENCODE_SET[32]; -extern const uint8_t USERINFO_ENCODE_SET[32]; -extern const uint8_t QUERY_ENCODE_SET_NONSPECIAL[32]; -extern const uint8_t QUERY_ENCODE_SET_SPECIAL[32]; -} - -class URL { - public: - static void Parse(const char* input, - size_t len, - enum url_parse_state state_override, - struct url_data* url, - bool has_url, - const struct url_data* base, - bool has_base); - - static std::string SerializeURL(const url_data& url, bool exclude); - - URL(const char* input, const size_t len) { - Parse(input, len, kUnknownState, &context_, false, nullptr, false); - } - - URL(const char* input, const size_t len, const URL* base) { - if (base != nullptr) - Parse(input, len, kUnknownState, - &context_, false, - &(base->context_), true); - else - Parse(input, len, kUnknownState, &context_, false, nullptr, false); - } - - URL(const char* input, const size_t len, - const char* base, const size_t baselen) { - if (base != nullptr && baselen > 0) { - URL _base(base, baselen); - Parse(input, len, kUnknownState, - &context_, false, - &(_base.context_), true); - } else { - Parse(input, len, kUnknownState, &context_, false, nullptr, false); - } - } - - explicit URL(const std::string& input) : - URL(input.c_str(), input.length()) {} - - URL(const std::string& input, const URL* base) : - URL(input.c_str(), input.length(), base) {} - - URL(const std::string& input, const URL& base) : - URL(input.c_str(), input.length(), &base) {} - - URL(const std::string& input, const std::string& base) : - URL(input.c_str(), input.length(), base.c_str(), base.length()) {} - - int32_t flags() const { - return context_.flags; - } - - int port() const { - return context_.port; - } - - const std::string& protocol() const { - return context_.scheme; - } - - const std::string& username() const { - return context_.username; - } - - const std::string& password() const { - return context_.password; - } - - const std::string& host() const { - return context_.host; - } - - const std::string& query() const { - return context_.query; - } - - const std::string& fragment() const { - return context_.fragment; - } - - std::string path() const { - std::string ret; - for (const std::string& element : context_.path) { - ret += '/' + element; - } - return ret; - } - - std::string href() const { - return SerializeURL(context_, false); - } - - // Get the path of the file: URL in a format consumable by native file system - // APIs. Returns an empty string if something went wrong. - std::string ToFilePath() const; - // Get the file URL from native file system path. - static URL FromFilePath(const std::string& file_path); - - v8::MaybeLocal ToObject(Environment* env) const; - - URL(const URL&) = default; - URL& operator=(const URL&) = default; - URL(URL&&) = default; - URL& operator=(URL&&) = default; - - URL() : URL("") {} - - private: - url_data context_; -}; - -} // namespace url - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_URL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_v8.h b/repo/packages/s/scriptx-legacy/include/libnode/node_v8.h deleted file mode 100644 index 5de8cb3f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_v8.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef SRC_NODE_V8_H_ -#define SRC_NODE_V8_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "aliased_buffer.h" -#include "base_object.h" -#include "node_snapshotable.h" -#include "util.h" -#include "v8.h" - -namespace node { -class Environment; -struct InternalFieldInfo; - -namespace v8_utils { -class BindingData : public SnapshotableObject { - public: - BindingData(Environment* env, v8::Local obj); - - SERIALIZABLE_OBJECT_METHODS() - static constexpr FastStringKey type_name{"node::v8::BindingData"}; - static constexpr EmbedderObjectType type_int = - EmbedderObjectType::k_v8_binding_data; - - AliasedFloat64Array heap_statistics_buffer; - AliasedFloat64Array heap_space_statistics_buffer; - AliasedFloat64Array heap_code_statistics_buffer; - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_SELF_SIZE(BindingData) - SET_MEMORY_INFO_NAME(BindingData) -}; - -} // namespace v8_utils - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_V8_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_v8_platform-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_v8_platform-inl.h deleted file mode 100644 index d79dd99b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_v8_platform-inl.h +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef SRC_NODE_V8_PLATFORM_INL_H_ -#define SRC_NODE_V8_PLATFORM_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include - -#include "env-inl.h" -#include "node.h" -#include "node_metadata.h" -#include "node_platform.h" -#include "node_options.h" -#include "tracing/node_trace_writer.h" -#include "tracing/trace_event.h" -#include "tracing/traced_value.h" -#include "util.h" - -namespace node { - -// Ensures that __metadata trace events are only emitted -// when tracing is enabled. -class NodeTraceStateObserver - : public v8::TracingController::TraceStateObserver { - public: - inline void OnTraceEnabled() override { - std::string title = GetProcessTitle(""); - if (!title.empty()) { - // Only emit the metadata event if the title can be retrieved - // successfully. Ignore it otherwise. - TRACE_EVENT_METADATA1( - "__metadata", "process_name", "name", TRACE_STR_COPY(title.c_str())); - } - TRACE_EVENT_METADATA1("__metadata", - "version", - "node", - per_process::metadata.versions.node.c_str()); - TRACE_EVENT_METADATA1( - "__metadata", "thread_name", "name", "JavaScriptMainThread"); - - auto trace_process = tracing::TracedValue::Create(); - trace_process->BeginDictionary("versions"); - -#define V(key) \ - trace_process->SetString(#key, per_process::metadata.versions.key.c_str()); - - NODE_VERSIONS_KEYS(V) -#undef V - - trace_process->EndDictionary(); - - trace_process->SetString("arch", per_process::metadata.arch.c_str()); - trace_process->SetString("platform", - per_process::metadata.platform.c_str()); - - trace_process->BeginDictionary("release"); - trace_process->SetString("name", - per_process::metadata.release.name.c_str()); -#if NODE_VERSION_IS_LTS - trace_process->SetString("lts", per_process::metadata.release.lts.c_str()); -#endif - trace_process->EndDictionary(); - TRACE_EVENT_METADATA1( - "__metadata", "node", "process", std::move(trace_process)); - - // This only runs the first time tracing is enabled - controller_->RemoveTraceStateObserver(this); - } - - inline void OnTraceDisabled() override { - // Do nothing here. This should never be called because the - // observer removes itself when OnTraceEnabled() is called. - UNREACHABLE(); - } - - explicit NodeTraceStateObserver(v8::TracingController* controller) - : controller_(controller) {} - ~NodeTraceStateObserver() override = default; - - private: - v8::TracingController* controller_; -}; - -struct V8Platform { - bool initialized_ = false; - -#if NODE_USE_V8_PLATFORM - inline void Initialize(int thread_pool_size) { - CHECK(!initialized_); - initialized_ = true; - tracing_agent_ = std::make_unique(); - node::tracing::TraceEventHelper::SetAgent(tracing_agent_.get()); - node::tracing::TracingController* controller = - tracing_agent_->GetTracingController(); - trace_state_observer_ = - std::make_unique(controller); - controller->AddTraceStateObserver(trace_state_observer_.get()); - tracing_file_writer_ = tracing_agent_->DefaultHandle(); - // Only start the tracing agent if we enabled any tracing categories. - if (!per_process::cli_options->trace_event_categories.empty()) { - StartTracingAgent(); - } - // Tracing must be initialized before platform threads are created. - platform_ = new NodePlatform(thread_pool_size, controller); - v8::V8::InitializePlatform(platform_); - } - - inline void Dispose() { - if (!initialized_) - return; - initialized_ = false; - - StopTracingAgent(); - platform_->Shutdown(); - delete platform_; - platform_ = nullptr; - // Destroy tracing after the platform (and platform threads) have been - // stopped. - tracing_agent_.reset(nullptr); - trace_state_observer_.reset(nullptr); - } - - inline void DrainVMTasks(v8::Isolate* isolate) { - platform_->DrainTasks(isolate); - } - - inline void StartTracingAgent() { - // Attach a new NodeTraceWriter only if this function hasn't been called - // before. - if (tracing_file_writer_.IsDefaultHandle()) { - std::vector categories = - SplitString(per_process::cli_options->trace_event_categories, ','); - - tracing_file_writer_ = tracing_agent_->AddClient( - std::set(std::make_move_iterator(categories.begin()), - std::make_move_iterator(categories.end())), - std::unique_ptr( - new tracing::NodeTraceWriter( - per_process::cli_options->trace_event_file_pattern)), - tracing::Agent::kUseDefaultCategories); - } - } - - inline void StopTracingAgent() { tracing_file_writer_.reset(); } - - inline tracing::AgentWriterHandle* GetTracingAgentWriter() { - return &tracing_file_writer_; - } - - inline NodePlatform* Platform() { return platform_; } - - std::unique_ptr trace_state_observer_; - std::unique_ptr tracing_agent_; - tracing::AgentWriterHandle tracing_file_writer_; - NodePlatform* platform_; -#else // !NODE_USE_V8_PLATFORM - inline void Initialize(int thread_pool_size) {} - inline void Dispose() {} - inline void DrainVMTasks(v8::Isolate* isolate) {} - inline void StartTracingAgent() { - if (!per_process::cli_options->trace_event_categories.empty()) { - fprintf(stderr, - "Node compiled with NODE_USE_V8_PLATFORM=0, " - "so event tracing is not available.\n"); - } - } - inline void StopTracingAgent() {} - - inline tracing::AgentWriterHandle* GetTracingAgentWriter() { return nullptr; } - - inline NodePlatform* Platform() { return nullptr; } -#endif // !NODE_USE_V8_PLATFORM -}; - -namespace per_process { -extern struct V8Platform v8_platform; -} - -inline void StartTracingAgent() { - return per_process::v8_platform.StartTracingAgent(); -} - -inline tracing::AgentWriterHandle* GetTracingAgentWriter() { - return per_process::v8_platform.GetTracingAgentWriter(); -} - -inline void DisposePlatform() { - per_process::v8_platform.Dispose(); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_V8_PLATFORM_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_version.h b/repo/packages/s/scriptx-legacy/include/libnode/node_version.h deleted file mode 100644 index 0f1a9b52..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_version.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_VERSION_H_ -#define SRC_NODE_VERSION_H_ - -#define NODE_MAJOR_VERSION 16 -#define NODE_MINOR_VERSION 16 -#define NODE_PATCH_VERSION 0 - -#define NODE_VERSION_IS_LTS 1 -#define NODE_VERSION_LTS_CODENAME "Gallium" - -#define NODE_VERSION_IS_RELEASE 1 - -#ifndef NODE_STRINGIFY -#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) -#define NODE_STRINGIFY_HELPER(n) #n -#endif - -#ifndef NODE_RELEASE -#define NODE_RELEASE "node" -#endif - -#ifndef NODE_TAG -# if NODE_VERSION_IS_RELEASE -# define NODE_TAG "" -# else -# define NODE_TAG "-pre" -# endif -#else -// NODE_TAG is passed without quotes when rc.exe is run from msbuild -# define NODE_EXE_VERSION NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \ - NODE_STRINGIFY(NODE_MINOR_VERSION) "." \ - NODE_STRINGIFY(NODE_PATCH_VERSION) \ - NODE_STRINGIFY(NODE_TAG) -#endif - -# define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \ - NODE_STRINGIFY(NODE_MINOR_VERSION) "." \ - NODE_STRINGIFY(NODE_PATCH_VERSION) \ - NODE_TAG -#ifndef NODE_EXE_VERSION -# define NODE_EXE_VERSION NODE_VERSION_STRING -#endif - -#define NODE_VERSION "v" NODE_VERSION_STRING - - -#define NODE_VERSION_AT_LEAST(major, minor, patch) \ - (( (major) < NODE_MAJOR_VERSION) \ - || ((major) == NODE_MAJOR_VERSION && (minor) < NODE_MINOR_VERSION) \ - || ((major) == NODE_MAJOR_VERSION && \ - (minor) == NODE_MINOR_VERSION && (patch) <= NODE_PATCH_VERSION)) - -/** - * Node.js will refuse to load modules that weren't compiled against its own - * module ABI number, exposed as the process.versions.modules property. - * - * Node.js will refuse to load modules with a non-matching ABI version. The - * version number here should be changed whenever an ABI-incompatible API change - * is made in the C++ side, including in V8 or other dependencies. - * - * Node.js will not change the module version during a Major release line - * We will, at times update the version of V8 shipped in the release line - * if it can be made ABI compatible with the previous version. - * - * The registry of used NODE_MODULE_VERSION numbers is located at - * https://github.com/nodejs/node/blob/HEAD/doc/abi_version_registry.json - * Extenders, embedders and other consumers of Node.js that require ABI - * version matching should open a pull request to reserve a number in this - * registry. - */ -#define NODE_MODULE_VERSION 93 - -// The NAPI_VERSION provided by this version of the runtime. This is the version -// which the Node binary being built supports. -#define NAPI_VERSION 8 - -#endif // SRC_NODE_VERSION_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_wasi.h b/repo/packages/s/scriptx-legacy/include/libnode/node_wasi.h deleted file mode 100644 index 7a0be60a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_wasi.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef SRC_NODE_WASI_H_ -#define SRC_NODE_WASI_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "base_object.h" -#include "node_mem.h" -#include "uvwasi.h" - -namespace node { -namespace wasi { - - -class WASI : public BaseObject, - public mem::NgLibMemoryManager { - public: - WASI(Environment* env, - v8::Local object, - uvwasi_options_t* options); - static void New(const v8::FunctionCallbackInfo& args); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(WASI) - SET_SELF_SIZE(WASI) - - static void ArgsGet(const v8::FunctionCallbackInfo& args); - static void ArgsSizesGet(const v8::FunctionCallbackInfo& args); - static void ClockResGet(const v8::FunctionCallbackInfo& args); - static void ClockTimeGet(const v8::FunctionCallbackInfo& args); - static void EnvironGet(const v8::FunctionCallbackInfo& args); - static void EnvironSizesGet(const v8::FunctionCallbackInfo& args); - static void FdAdvise(const v8::FunctionCallbackInfo& args); - static void FdAllocate(const v8::FunctionCallbackInfo& args); - static void FdClose(const v8::FunctionCallbackInfo& args); - static void FdDatasync(const v8::FunctionCallbackInfo& args); - static void FdFdstatGet(const v8::FunctionCallbackInfo& args); - static void FdFdstatSetFlags(const v8::FunctionCallbackInfo& args); - static void FdFdstatSetRights( - const v8::FunctionCallbackInfo& args); - static void FdFilestatGet(const v8::FunctionCallbackInfo& args); - static void FdFilestatSetSize( - const v8::FunctionCallbackInfo& args); - static void FdFilestatSetTimes( - const v8::FunctionCallbackInfo& args); - static void FdPread(const v8::FunctionCallbackInfo& args); - static void FdPrestatGet(const v8::FunctionCallbackInfo& args); - static void FdPrestatDirName(const v8::FunctionCallbackInfo& args); - static void FdPwrite(const v8::FunctionCallbackInfo& args); - static void FdRead(const v8::FunctionCallbackInfo& args); - static void FdReaddir(const v8::FunctionCallbackInfo& args); - static void FdRenumber(const v8::FunctionCallbackInfo& args); - static void FdSeek(const v8::FunctionCallbackInfo& args); - static void FdSync(const v8::FunctionCallbackInfo& args); - static void FdTell(const v8::FunctionCallbackInfo& args); - static void FdWrite(const v8::FunctionCallbackInfo& args); - static void PathCreateDirectory( - const v8::FunctionCallbackInfo& args); - static void PathFilestatGet(const v8::FunctionCallbackInfo& args); - static void PathFilestatSetTimes( - const v8::FunctionCallbackInfo& args); - static void PathLink(const v8::FunctionCallbackInfo& args); - static void PathOpen(const v8::FunctionCallbackInfo& args); - static void PathReadlink(const v8::FunctionCallbackInfo& args); - static void PathRemoveDirectory( - const v8::FunctionCallbackInfo& args); - static void PathRename(const v8::FunctionCallbackInfo& args); - static void PathSymlink(const v8::FunctionCallbackInfo& args); - static void PathUnlinkFile(const v8::FunctionCallbackInfo& args); - static void PollOneoff(const v8::FunctionCallbackInfo& args); - static void ProcExit(const v8::FunctionCallbackInfo& args); - static void ProcRaise(const v8::FunctionCallbackInfo& args); - static void RandomGet(const v8::FunctionCallbackInfo& args); - static void SchedYield(const v8::FunctionCallbackInfo& args); - static void SockRecv(const v8::FunctionCallbackInfo& args); - static void SockSend(const v8::FunctionCallbackInfo& args); - static void SockShutdown(const v8::FunctionCallbackInfo& args); - - static void _SetMemory(const v8::FunctionCallbackInfo& args); - - // Implementation for mem::NgLibMemoryManager - void CheckAllocatedSize(size_t previous_size) const; - void IncreaseAllocatedSize(size_t size); - void DecreaseAllocatedSize(size_t size); - - private: - ~WASI() override; - inline void readUInt8(char* memory, uint8_t* value, uint32_t offset); - inline void readUInt16(char* memory, uint16_t* value, uint32_t offset); - inline void readUInt32(char* memory, uint32_t* value, uint32_t offset); - inline void readUInt64(char* memory, uint64_t* value, uint32_t offset); - inline void writeUInt8(char* memory, uint8_t value, uint32_t offset); - inline void writeUInt16(char* memory, uint16_t value, uint32_t offset); - inline void writeUInt32(char* memory, uint32_t value, uint32_t offset); - inline void writeUInt64(char* memory, uint64_t value, uint32_t offset); - uvwasi_errno_t backingStore(char** store, size_t* byte_length); - uvwasi_t uvw_; - v8::Global memory_; - uvwasi_mem_t alloc_info_; - size_t current_uvwasi_memory_ = 0; -}; - - -} // namespace wasi -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WASI_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_watchdog.h b/repo/packages/s/scriptx-legacy/include/libnode/node_watchdog.h deleted file mode 100644 index 8bccfcee..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_watchdog.h +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_WATCHDOG_H_ -#define SRC_NODE_WATCHDOG_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include "handle_wrap.h" -#include "memory_tracker-inl.h" -#include "node_mutex.h" -#include "uv.h" -#include "v8.h" - -#ifdef __POSIX__ -#include -#endif - -namespace node { - -enum class SignalPropagation { - kContinuePropagation, - kStopPropagation, -}; - -class Watchdog { - public: - explicit Watchdog(v8::Isolate* isolate, - uint64_t ms, - bool* timed_out = nullptr); - ~Watchdog(); - v8::Isolate* isolate() { return isolate_; } - - private: - static void Run(void* arg); - static void Timer(uv_timer_t* timer); - - v8::Isolate* isolate_; - uv_thread_t thread_; - uv_loop_t loop_; - uv_async_t async_; - uv_timer_t timer_; - bool* timed_out_; -}; - -class SigintWatchdogBase { - public: - virtual ~SigintWatchdogBase() = default; - virtual SignalPropagation HandleSigint() = 0; -}; - -class SigintWatchdog : public SigintWatchdogBase { - public: - explicit SigintWatchdog(v8::Isolate* isolate, - bool* received_signal = nullptr); - ~SigintWatchdog(); - v8::Isolate* isolate() { return isolate_; } - SignalPropagation HandleSigint() override; - - private: - v8::Isolate* isolate_; - bool* received_signal_; -}; - -class TraceSigintWatchdog : public HandleWrap, public SigintWatchdogBase { - public: - static void Init(Environment* env, v8::Local target); - static void New(const v8::FunctionCallbackInfo& args); - static void Start(const v8::FunctionCallbackInfo& args); - static void Stop(const v8::FunctionCallbackInfo& args); - - SignalPropagation HandleSigint() override; - - inline void MemoryInfo(node::MemoryTracker* tracker) const override { - tracker->TrackInlineField("handle_", handle_); - } - SET_MEMORY_INFO_NAME(TraceSigintWatchdog) - SET_SELF_SIZE(TraceSigintWatchdog) - - private: - enum class SignalFlags { None, FromIdle, FromInterrupt }; - - TraceSigintWatchdog(Environment* env, v8::Local object); - void HandleInterrupt(); - - bool interrupting = false; - uv_async_t handle_; - SignalFlags signal_flag_ = SignalFlags::None; -}; - -class SigintWatchdogHelper { - public: - static SigintWatchdogHelper* GetInstance() { return &instance; } - void Register(SigintWatchdogBase* watchdog); - void Unregister(SigintWatchdogBase* watchdog); - bool HasPendingSignal(); - - int Start(); - bool Stop(); - - private: - SigintWatchdogHelper(); - ~SigintWatchdogHelper(); - - static bool InformWatchdogsAboutSignal(); - static SigintWatchdogHelper instance; - - int start_stop_count_; - - Mutex mutex_; - Mutex list_mutex_; - std::vector watchdogs_; - bool has_pending_signal_; - -#ifdef __POSIX__ - pthread_t thread_; - uv_sem_t sem_; - bool has_running_thread_; - bool stopping_; - - static void* RunSigintWatchdog(void* arg); - static void HandleSignal(int signum, siginfo_t* info, void* ucontext); -#else - bool watchdog_disabled_; - static BOOL WINAPI WinCtrlCHandlerRoutine(DWORD dwCtrlType); -#endif -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WATCHDOG_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider-inl.h deleted file mode 100644 index 9238ea22..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider-inl.h +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ -#define SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_win32_etw_provider.h" -#include "node_etw_provider.h" - -namespace node { - -// From node_win32_etw_provider.cc -extern REGHANDLE node_provider; -extern EventWriteFunc event_write; -extern int events_enabled; - -#define ETW_WRITE_STRING_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, \ - data, \ - (strlen(data) + 1) * sizeof(*data)); - -#define ETW_WRITE_INT32_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(int32_t)); - -#define ETW_WRITE_INT64_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(int64_t)); - -#define ETW_WRITE_ADDRESS_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(intptr_t)); - -#define ETW_WRITE_INT16_DATA(data_descriptor, data) \ - EventDataDescCreate(data_descriptor, data, sizeof(int16_t)); - -#define ETW_WRITE_WSTRING_DATA_LENGTH(data_descriptor, data, data_len_bytes) \ - EventDataDescCreate(data_descriptor, \ - data, \ - data_len_bytes); - -#define ETW_WRITE_NET_CONNECTION(descriptors, conn) \ - ETW_WRITE_INT32_DATA(descriptors, &conn->fd); \ - ETW_WRITE_INT32_DATA(descriptors + 1, &conn->port); \ - ETW_WRITE_STRING_DATA(descriptors + 2, conn->remote); \ - ETW_WRITE_INT32_DATA(descriptors + 3, &conn->buffered); - -#define ETW_WRITE_HTTP_SERVER_REQUEST(descriptors, req) \ - ETW_WRITE_STRING_DATA(descriptors, req->url); \ - ETW_WRITE_STRING_DATA(descriptors + 1, req->method); \ - ETW_WRITE_STRING_DATA(descriptors + 2, req->forwardedFor); - -#define ETW_WRITE_HTTP_CLIENT_REQUEST(descriptors, req) \ - ETW_WRITE_STRING_DATA(descriptors, req->url); \ - ETW_WRITE_STRING_DATA(descriptors + 1, req->method); - -#define ETW_WRITE_GC(descriptors, type, flags) \ - ETW_WRITE_INT32_DATA(descriptors, &type); \ - ETW_WRITE_INT32_DATA(descriptors + 1, &flags); - -#define ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2) \ - ETW_WRITE_ADDRESS_DATA(descriptors, &addr1); \ - ETW_WRITE_ADDRESS_DATA(descriptors + 1, &addr2); - -#define ETW_WRITE_JSMETHOD_LOADUNLOAD(descriptors, \ - context, \ - startAddr, \ - size, \ - id, \ - flags, \ - rangeId, \ - sourceId, \ - line, \ - col, \ - name, \ - name_len_bytes) \ - ETW_WRITE_ADDRESS_DATA(descriptors, &context); \ - ETW_WRITE_ADDRESS_DATA(descriptors + 1, &startAddr); \ - ETW_WRITE_INT64_DATA(descriptors + 2, &size); \ - ETW_WRITE_INT32_DATA(descriptors + 3, &id); \ - ETW_WRITE_INT16_DATA(descriptors + 4, &flags); \ - ETW_WRITE_INT16_DATA(descriptors + 5, &rangeId); \ - ETW_WRITE_INT64_DATA(descriptors + 6, &sourceId); \ - ETW_WRITE_INT32_DATA(descriptors + 7, &line); \ - ETW_WRITE_INT32_DATA(descriptors + 8, &col); \ - ETW_WRITE_WSTRING_DATA_LENGTH(descriptors + 9, name, name_len_bytes); - - -#define ETW_WRITE_EVENT(eventDescriptor, dataDescriptors) \ - DWORD status = event_write(node_provider, \ - &eventDescriptor, \ - sizeof(dataDescriptors) / \ - sizeof(*dataDescriptors), \ - dataDescriptors); \ - CHECK_EQ(status, ERROR_SUCCESS); - -// NOLINTNEXTLINE (readability/null_usage) -#define NULL_NOLINT NULL - -#define ETW_WRITE_EMPTY_EVENT(eventDescriptor) \ - DWORD status = event_write(node_provider, &eventDescriptor, 0, NULL_NOLINT); \ - CHECK_EQ(status, ERROR_SUCCESS); - -void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[7]; - ETW_WRITE_HTTP_SERVER_REQUEST(descriptors, req); - ETW_WRITE_NET_CONNECTION(descriptors + 3, conn); - ETW_WRITE_EVENT(NODE_HTTP_SERVER_REQUEST_EVENT, descriptors); -} - - -void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_HTTP_SERVER_RESPONSE_EVENT, descriptors); -} - - -void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[6]; - ETW_WRITE_HTTP_CLIENT_REQUEST(descriptors, req); - ETW_WRITE_NET_CONNECTION(descriptors + 2, conn); - ETW_WRITE_EVENT(NODE_HTTP_CLIENT_REQUEST_EVENT, descriptors); -} - - -void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_HTTP_CLIENT_RESPONSE_EVENT, descriptors); -} - - -void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_NET_SERVER_CONNECTION_EVENT, descriptors); -} - - -void NODE_NET_STREAM_END(node_dtrace_connection_t* conn, - const char* remote, int port, int fd) { - EVENT_DATA_DESCRIPTOR descriptors[4]; - ETW_WRITE_NET_CONNECTION(descriptors, conn); - ETW_WRITE_EVENT(NODE_NET_STREAM_END_EVENT, descriptors); -} - - -void NODE_GC_START(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_GC(descriptors, type, flags); - ETW_WRITE_EVENT(NODE_GC_START_EVENT, descriptors); - } -} - - -void NODE_GC_DONE(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_GC(descriptors, type, flags); - ETW_WRITE_EVENT(NODE_GC_DONE_EVENT, descriptors); - } -} - - -void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2); - ETW_WRITE_EVENT(NODE_V8SYMBOL_REMOVE_EVENT, descriptors); - } -} - - -void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2) { - if (events_enabled > 0) { - EVENT_DATA_DESCRIPTOR descriptors[2]; - ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2); - ETW_WRITE_EVENT(NODE_V8SYMBOL_MOVE_EVENT, descriptors); - } -} - - -void NODE_V8SYMBOL_RESET() { - if (events_enabled > 0) { - ETW_WRITE_EMPTY_EVENT(NODE_V8SYMBOL_RESET_EVENT); - } -} - -#define SETSYMBUF(s) \ - wcscpy(symbuf, s); \ - symbol_len = arraysize(s) - 1; - -void NODE_V8SYMBOL_ADD(LPCSTR symbol, - int symbol_len, - const void* addr1, - int len) { - if (events_enabled > 0) { - wchar_t symbuf[128]; - if (symbol == nullptr) { - SETSYMBUF(L"nullptr"); - } else { - symbol_len = MultiByteToWideChar(CP_ACP, - 0, - symbol, - symbol_len, - symbuf, - 128); - if (symbol_len == 0) { - SETSYMBUF(L"Invalid"); - } else { - if (symbol_len > 127) { - symbol_len = 127; - } - symbuf[symbol_len] = L'\0'; - } - } - void* context = nullptr; - INT64 size = (INT64)len; - INT32 id = (INT32)addr1; - INT16 flags = 0; - INT16 rangeid = 1; - INT32 col = 1; - INT32 line = 1; - INT64 sourceid = 0; - EVENT_DATA_DESCRIPTOR descriptors[10]; - ETW_WRITE_JSMETHOD_LOADUNLOAD(descriptors, - context, - addr1, - size, - id, - flags, - rangeid, - sourceid, - line, - col, - symbuf, - (symbol_len + 1) * sizeof(symbuf[0])); - ETW_WRITE_EVENT(MethodLoad, descriptors); - } -} -#undef SETSYMBUF - -#undef NULL_NOLINT - - -bool NODE_HTTP_SERVER_REQUEST_ENABLED() { return events_enabled > 0; } -bool NODE_HTTP_SERVER_RESPONSE_ENABLED() { return events_enabled > 0; } -bool NODE_HTTP_CLIENT_REQUEST_ENABLED() { return events_enabled > 0; } -bool NODE_HTTP_CLIENT_RESPONSE_ENABLED() { return events_enabled > 0; } -bool NODE_NET_SERVER_CONNECTION_ENABLED() { return events_enabled > 0; } -bool NODE_NET_STREAM_END_ENABLED() { return events_enabled > 0; } -bool NODE_V8SYMBOL_ENABLED() { return events_enabled > 0; } - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider.h b/repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider.h deleted file mode 100644 index 0f84a86f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_win32_etw_provider.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_NODE_WIN32_ETW_PROVIDER_H_ -#define SRC_NODE_WIN32_ETW_PROVIDER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_dtrace.h" -#include - -namespace node { - -#if defined(_MSC_VER) -# define INLINE __forceinline -#else -# define INLINE inline -#endif - -typedef ULONG (NTAPI* EventRegisterFunc)( - LPCGUID ProviderId, - PENABLECALLBACK EnableCallback, - PVOID CallbackContext, - PREGHANDLE RegHandle -); - -typedef ULONG (NTAPI* EventUnregisterFunc)( - REGHANDLE RegHandle -); - -typedef ULONG (NTAPI* EventWriteFunc)( - REGHANDLE RegHandle, - PCEVENT_DESCRIPTOR EventDescriptor, - ULONG UserDataCount, - PEVENT_DATA_DESCRIPTOR UserData -); - -void init_etw(); -void shutdown_etw(); - -INLINE void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd); -INLINE void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, - node_dtrace_connection_t* conn, const char* remote, int port, - const char* method, const char* url, int fd); -INLINE void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_NET_STREAM_END(node_dtrace_connection_t* conn, - const char* remote, int port, int fd); -INLINE void NODE_GC_START(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate); -INLINE void NODE_GC_DONE(v8::GCType type, - v8::GCCallbackFlags flags, - v8::Isolate* isolate); -INLINE void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2); -INLINE void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2); -INLINE void NODE_V8SYMBOL_RESET(); -INLINE void NODE_V8SYMBOL_ADD(LPCSTR symbol, - int symbol_len, - const void* addr1, - int len); - -INLINE bool NODE_HTTP_SERVER_REQUEST_ENABLED(); -INLINE bool NODE_HTTP_SERVER_RESPONSE_ENABLED(); -INLINE bool NODE_HTTP_CLIENT_REQUEST_ENABLED(); -INLINE bool NODE_HTTP_CLIENT_RESPONSE_ENABLED(); -INLINE bool NODE_NET_SERVER_CONNECTION_ENABLED(); -INLINE bool NODE_NET_STREAM_END_ENABLED(); -INLINE bool NODE_V8SYMBOL_ENABLED(); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_NODE_WIN32_ETW_PROVIDER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/node_worker.h b/repo/packages/s/scriptx-legacy/include/libnode/node_worker.h deleted file mode 100644 index 077d2b83..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/node_worker.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef SRC_NODE_WORKER_H_ -#define SRC_NODE_WORKER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include "node_messaging.h" -#include "uv.h" - -namespace node { -namespace worker { - -class WorkerThreadData; - -enum ResourceLimits { - kMaxYoungGenerationSizeMb, - kMaxOldGenerationSizeMb, - kCodeRangeSizeMb, - kStackSizeMb, - kTotalResourceLimitCount -}; - -// A worker thread, as represented in its parent thread. -class Worker : public AsyncWrap { - public: - Worker(Environment* env, - v8::Local wrap, - const std::string& url, - std::shared_ptr per_isolate_opts, - std::vector&& exec_argv, - std::shared_ptr env_vars); - ~Worker() override; - - // Run the worker. This is only called from the worker thread. - void Run(); - - // Forcibly exit the thread with a specified exit code. This may be called - // from any thread. `error_code` and `error_message` can be used to create - // a custom `'error'` event before emitting `'exit'`. - void Exit(int code, - const char* error_code = nullptr, - const char* error_message = nullptr); - - // Wait for the worker thread to stop (in a blocking manner). - void JoinThread(); - - template - inline bool RequestInterrupt(Fn&& cb); - - void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(Worker) - SET_SELF_SIZE(Worker) - bool IsNotIndicativeOfMemoryLeakAtExit() const override; - - bool is_stopped() const; - - static void New(const v8::FunctionCallbackInfo& args); - static void CloneParentEnvVars( - const v8::FunctionCallbackInfo& args); - static void SetEnvVars(const v8::FunctionCallbackInfo& args); - static void StartThread(const v8::FunctionCallbackInfo& args); - static void StopThread(const v8::FunctionCallbackInfo& args); - static void Ref(const v8::FunctionCallbackInfo& args); - static void Unref(const v8::FunctionCallbackInfo& args); - static void GetResourceLimits( - const v8::FunctionCallbackInfo& args); - v8::Local GetResourceLimits(v8::Isolate* isolate) const; - static void TakeHeapSnapshot(const v8::FunctionCallbackInfo& args); - static void LoopIdleTime(const v8::FunctionCallbackInfo& args); - static void LoopStartTime(const v8::FunctionCallbackInfo& args); - - private: - bool CreateEnvMessagePort(Environment* env); - static size_t NearHeapLimit(void* data, size_t current_heap_limit, - size_t initial_heap_limit); - - std::shared_ptr per_isolate_opts_; - std::vector exec_argv_; - std::vector argv_; - - MultiIsolatePlatform* platform_; - v8::Isolate* isolate_ = nullptr; - uv_thread_t tid_; - - std::unique_ptr inspector_parent_handle_; - - // This mutex protects access to all variables listed below it. - mutable Mutex mutex_; - - bool thread_joined_ = true; - const char* custom_error_ = nullptr; - std::string custom_error_str_; - int exit_code_ = 0; - ThreadId thread_id_; - uintptr_t stack_base_ = 0; - - // Custom resource constraints: - double resource_limits_[kTotalResourceLimitCount]; - void UpdateResourceConstraints(v8::ResourceConstraints* constraints); - - // Full size of the thread's stack. - size_t stack_size_ = 4 * 1024 * 1024; - // Stack buffer size that is not available to the JS engine. - static constexpr size_t kStackBufferSize = 192 * 1024; - - std::unique_ptr child_port_data_; - std::shared_ptr env_vars_; - - // This is always kept alive because the JS object associated with the Worker - // instance refers to it via its [kPort] property. - MessagePort* parent_port_ = nullptr; - - // A raw flag that is used by creator and worker threads to - // sync up on pre-mature termination of worker - while in the - // warmup phase. Once the worker is fully warmed up, use the - // async handle of the worker's Environment for the same purpose. - bool stopped_ = true; - - bool has_ref_ = true; - uint64_t environment_flags_ = EnvironmentFlags::kNoFlags; - - // The real Environment of the worker object. It has a lesser - // lifespan than the worker object itself - comes to life - // when the worker thread creates a new Environment, and gets - // destroyed alongwith the worker thread. - Environment* env_ = nullptr; - - friend class WorkerThreadData; -}; - -template -bool Worker::RequestInterrupt(Fn&& cb) { - Mutex::ScopedLock lock(mutex_); - if (env_ == nullptr) return false; - env_->RequestInterrupt(std::move(cb)); - return true; -} - -} // namespace worker -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - - -#endif // SRC_NODE_WORKER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/pipe_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/pipe_wrap.h deleted file mode 100644 index c0722b63..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/pipe_wrap.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_PIPE_WRAP_H_ -#define SRC_PIPE_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "connection_wrap.h" - -namespace node { - -class ExternalReferenceRegistry; -class Environment; - -class PipeWrap : public ConnectionWrap { - public: - enum SocketType { - SOCKET, - SERVER, - IPC - }; - - static v8::MaybeLocal Instantiate(Environment* env, - AsyncWrap* parent, - SocketType type); - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(PipeWrap) - SET_SELF_SIZE(PipeWrap) - - private: - PipeWrap(Environment* env, - v8::Local object, - ProviderType provider, - bool ipc); - - static void New(const v8::FunctionCallbackInfo& args); - static void Bind(const v8::FunctionCallbackInfo& args); - static void Listen(const v8::FunctionCallbackInfo& args); - static void Connect(const v8::FunctionCallbackInfo& args); - static void Open(const v8::FunctionCallbackInfo& args); - -#ifdef _WIN32 - static void SetPendingInstances( - const v8::FunctionCallbackInfo& args); -#endif - static void Fchmod(const v8::FunctionCallbackInfo& args); -}; - - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_PIPE_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/req_wrap-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/req_wrap-inl.h deleted file mode 100644 index c905b605..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/req_wrap-inl.h +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef SRC_REQ_WRAP_INL_H_ -#define SRC_REQ_WRAP_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "req_wrap.h" -#include "async_wrap-inl.h" -#include "uv.h" - -namespace node { - -ReqWrapBase::ReqWrapBase(Environment* env) { - CHECK(env->has_run_bootstrapping_code()); - env->req_wrap_queue()->PushBack(this); -} - -template -ReqWrap::ReqWrap(Environment* env, - v8::Local object, - AsyncWrap::ProviderType provider) - : AsyncWrap(env, object, provider), - ReqWrapBase(env) { - Reset(); -} - -template -ReqWrap::~ReqWrap() { - CHECK_EQ(false, persistent().IsEmpty()); -} - -template -void ReqWrap::Dispatched() { - req_.data = this; -} - -template -void ReqWrap::Reset() { - original_callback_ = nullptr; - req_.data = nullptr; -} - -template -ReqWrap* ReqWrap::from_req(T* req) { - return ContainerOf(&ReqWrap::req_, req); -} - -template -void ReqWrap::Cancel() { - if (req_.data == this) // Only cancel if already dispatched. - uv_cancel(reinterpret_cast(&req_)); -} - -template -AsyncWrap* ReqWrap::GetAsyncWrap() { - return this; -} - -// Below is dark template magic designed to invoke libuv functions that -// initialize uv_req_t instances in a unified fashion, to allow easier -// tracking of active/inactive requests. - -// Invoke a generic libuv function that initializes uv_req_t instances. -// This is, unfortunately, necessary since they come in three different -// variants that can not all be invoked in the same way: -// - int uv_foo(uv_loop_t* loop, uv_req_t* request, ...); -// - int uv_foo(uv_req_t* request, ...); -// - void uv_foo(uv_req_t* request, ...); -template -struct CallLibuvFunction; - -// Detect `int uv_foo(uv_loop_t* loop, uv_req_t* request, ...);`. -template -struct CallLibuvFunction { - using T = int(*)(uv_loop_t*, ReqT*, Args...); - template - static int Call(T fn, uv_loop_t* loop, ReqT* req, PassedArgs... args) { - return fn(loop, req, args...); - } -}; - -// Detect `int uv_foo(uv_req_t* request, ...);`. -template -struct CallLibuvFunction { - using T = int(*)(ReqT*, Args...); - template - static int Call(T fn, uv_loop_t* loop, ReqT* req, PassedArgs... args) { - return fn(req, args...); - } -}; - -// Detect `void uv_foo(uv_req_t* request, ...);`. -template -struct CallLibuvFunction { - using T = void(*)(ReqT*, Args...); - template - static int Call(T fn, uv_loop_t* loop, ReqT* req, PassedArgs... args) { - fn(req, args...); - return 0; - } -}; - -// This is slightly darker magic: This template is 'applied' to each parameter -// passed to the libuv function. If the parameter type (aka `T`) is a -// function type, it is assumed that this it is the request callback, and a -// wrapper that calls the original callback is created. -// If not, the parameter is passed through verbatim. -template -struct MakeLibuvRequestCallback { - static T For(ReqWrap* req_wrap, T v) { - static_assert(!is_callable::value, - "MakeLibuvRequestCallback missed a callback"); - return v; - } -}; - -// Match the `void callback(uv_req_t*, ...);` signature that all libuv -// callbacks use. -template -struct MakeLibuvRequestCallback { - using F = void(*)(ReqT* req, Args... args); - - static void Wrapper(ReqT* req, Args... args) { - ReqWrap* req_wrap = ReqWrap::from_req(req); - req_wrap->env()->DecreaseWaitingRequestCounter(); - F original_callback = reinterpret_cast(req_wrap->original_callback_); - original_callback(req, args...); - } - - static F For(ReqWrap* req_wrap, F v) { - CHECK_NULL(req_wrap->original_callback_); - req_wrap->original_callback_ = - reinterpret_cast::callback_t>(v); - return Wrapper; - } -}; - -template -template -int ReqWrap::Dispatch(LibuvFunction fn, Args... args) { - Dispatched(); - - // This expands as: - // - // int err = fn(env()->event_loop(), req(), arg1, arg2, Wrapper, arg3, ...) - // ^ ^ ^ - // | | | - // \-- Omitted if `fn` has no | | - // first `uv_loop_t*` argument | | - // | | - // A function callback whose first argument | | - // matches the libuv request type is replaced ---/ | - // by the `Wrapper` method defined above | - // | - // Other (non-function) arguments are passed -----/ - // through verbatim - int err = CallLibuvFunction::Call( - fn, - env()->event_loop(), - req(), - MakeLibuvRequestCallback::For(this, args)...); - if (err >= 0) - env()->IncreaseWaitingRequestCounter(); - return err; -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_REQ_WRAP_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/req_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/req_wrap.h deleted file mode 100644 index 611e4382..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/req_wrap.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef SRC_REQ_WRAP_H_ -#define SRC_REQ_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "util.h" -#include "v8.h" - -namespace node { - -class Environment; - -class ReqWrapBase { - public: - explicit inline ReqWrapBase(Environment* env); - - virtual ~ReqWrapBase() = default; - - virtual void Cancel() = 0; - virtual AsyncWrap* GetAsyncWrap() = 0; - - private: - friend int GenDebugSymbols(); - friend class Environment; - - ListNode req_wrap_queue_; -}; - -template -class ReqWrap : public AsyncWrap, public ReqWrapBase { - public: - inline ReqWrap(Environment* env, - v8::Local object, - AsyncWrap::ProviderType provider); - inline ~ReqWrap() override; - // Call this after the req has been dispatched, if that did not already - // happen by using Dispatch(). - inline void Dispatched(); - // Call this after a request has finished, if re-using this object is planned. - inline void Reset(); - T* req() { return &req_; } - inline void Cancel() final; - inline AsyncWrap* GetAsyncWrap() override; - - static ReqWrap* from_req(T* req); - - template - inline int Dispatch(LibuvFunction fn, Args... args); - - private: - friend int GenDebugSymbols(); - - // Adding `friend struct MakeLibuvRequestCallback` is not enough anymore - // for some reason. Consider this private. - public: - typedef void (*callback_t)(); - callback_t original_callback_ = nullptr; - - protected: - // req_wrap_queue_ needs to be at a fixed offset from the start of the class - // because it is used by ContainerOf to calculate the address of the embedding - // ReqWrap. ContainerOf compiles down to simple, fixed pointer arithmetic. It - // is also used by src/node_postmortem_metadata.cc to calculate offsets and - // generate debug symbols for ReqWrap, which assumes that the position of - // members in memory are predictable. sizeof(req_) depends on the type of T, - // so req_wrap_queue_ would no longer be at a fixed offset if it came after - // req_. For more information please refer to - // `doc/contributing/node-postmortem-support.md` - T req_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_REQ_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/spawn_sync.h b/repo/packages/s/scriptx-legacy/include/libnode/spawn_sync.h deleted file mode 100644 index 81a2f2aa..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/spawn_sync.h +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_SPAWN_SYNC_H_ -#define SRC_SPAWN_SYNC_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node_buffer.h" -#include "uv.h" -#include "v8.h" - -namespace node { - - - -class SyncProcessOutputBuffer; -class SyncProcessStdioPipe; -class SyncProcessRunner; - - -class SyncProcessOutputBuffer { - static const unsigned int kBufferSize = 65536; - - public: - inline SyncProcessOutputBuffer() = default; - - inline void OnAlloc(size_t suggested_size, uv_buf_t* buf) const; - inline void OnRead(const uv_buf_t* buf, size_t nread); - - inline size_t Copy(char* dest) const; - - inline unsigned int available() const; - inline unsigned int used() const; - - inline SyncProcessOutputBuffer* next() const; - inline void set_next(SyncProcessOutputBuffer* next); - - private: - // Use unsigned int because that's what `uv_buf_init` takes. - mutable char data_[kBufferSize]; - unsigned int used_ = 0; - - SyncProcessOutputBuffer* next_ = nullptr; -}; - - -class SyncProcessStdioPipe { - enum Lifecycle { - kUninitialized = 0, - kInitialized, - kStarted, - kClosing, - kClosed - }; - - public: - SyncProcessStdioPipe(SyncProcessRunner* process_handler, - bool readable, - bool writable, - uv_buf_t input_buffer); - ~SyncProcessStdioPipe(); - - int Initialize(uv_loop_t* loop); - int Start(); - void Close(); - - v8::Local GetOutputAsBuffer(Environment* env) const; - - inline bool readable() const; - inline bool writable() const; - inline uv_stdio_flags uv_flags() const; - - inline uv_pipe_t* uv_pipe() const; - inline uv_stream_t* uv_stream() const; - inline uv_handle_t* uv_handle() const; - - private: - inline size_t OutputLength() const; - inline void CopyOutput(char* dest) const; - - inline void OnAlloc(size_t suggested_size, uv_buf_t* buf); - inline void OnRead(const uv_buf_t* buf, ssize_t nread); - inline void OnWriteDone(int result); - inline void OnShutdownDone(int result); - inline void OnClose(); - - inline void SetError(int error); - - static void AllocCallback(uv_handle_t* handle, - size_t suggested_size, - uv_buf_t* buf); - static void ReadCallback(uv_stream_t* stream, - ssize_t nread, - const uv_buf_t* buf); - static void WriteCallback(uv_write_t* req, int result); - static void ShutdownCallback(uv_shutdown_t* req, int result); - static void CloseCallback(uv_handle_t* handle); - - SyncProcessRunner* process_handler_; - - bool readable_; - bool writable_; - uv_buf_t input_buffer_; - - SyncProcessOutputBuffer* first_output_buffer_; - SyncProcessOutputBuffer* last_output_buffer_; - - mutable uv_pipe_t uv_pipe_; - uv_write_t write_req_; - uv_shutdown_t shutdown_req_; - - Lifecycle lifecycle_; -}; - - -class SyncProcessRunner { - enum Lifecycle { - kUninitialized = 0, - kInitialized, - kHandlesClosed - }; - - public: - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void Spawn(const v8::FunctionCallbackInfo& args); - - private: - friend class SyncProcessStdioPipe; - - explicit SyncProcessRunner(Environment* env_); - ~SyncProcessRunner(); - - inline Environment* env() const; - - v8::MaybeLocal Run(v8::Local options); - v8::Maybe TryInitializeAndRunLoop(v8::Local options); - void CloseHandlesAndDeleteLoop(); - - void CloseStdioPipes(); - void CloseKillTimer(); - - void Kill(); - void IncrementBufferSizeAndCheckOverflow(ssize_t length); - - void OnExit(int64_t exit_status, int term_signal); - void OnKillTimerTimeout(); - - int GetError(); - void SetError(int error); - void SetPipeError(int pipe_error); - - v8::Local BuildResultObject(); - v8::Local BuildOutputArray(); - - v8::Maybe ParseOptions(v8::Local js_value); - int ParseStdioOptions(v8::Local js_value); - int ParseStdioOption(int child_fd, v8::Local js_stdio_option); - - inline int AddStdioIgnore(uint32_t child_fd); - inline int AddStdioPipe(uint32_t child_fd, - bool readable, - bool writable, - uv_buf_t input_buffer); - inline int AddStdioInheritFD(uint32_t child_fd, int inherit_fd); - - static bool IsSet(v8::Local value); - v8::Maybe CopyJsString(v8::Local js_value, - const char** target); - v8::Maybe CopyJsStringArray(v8::Local js_value, - char** target); - - static void ExitCallback(uv_process_t* handle, - int64_t exit_status, - int term_signal); - static void KillTimerCallback(uv_timer_t* handle); - static void KillTimerCloseCallback(uv_handle_t* handle); - - double max_buffer_; - uint64_t timeout_; - int kill_signal_; - - uv_loop_t* uv_loop_; - - uint32_t stdio_count_; - uv_stdio_container_t* uv_stdio_containers_; - std::vector> stdio_pipes_; - bool stdio_pipes_initialized_; - - uv_process_options_t uv_process_options_; - const char* file_buffer_; - char* args_buffer_; - char* env_buffer_; - const char* cwd_buffer_; - - uv_process_t uv_process_; - bool killed_; - - size_t buffered_output_size_; - int64_t exit_status_; - int term_signal_; - - uv_timer_t uv_timer_; - bool kill_timer_initialized_; - - // Errors that happen in one of the pipe handlers are stored in the - // `pipe_error` field. They are treated as "low-priority", only to be - // reported if no more serious errors happened. - int error_; - int pipe_error_; - - Lifecycle lifecycle_; - - Environment* env_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_SPAWN_SYNC_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/stream_base-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/stream_base-inl.h deleted file mode 100644 index ef86587c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/stream_base-inl.h +++ /dev/null @@ -1,308 +0,0 @@ -#ifndef SRC_STREAM_BASE_INL_H_ -#define SRC_STREAM_BASE_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap-inl.h" -#include "base_object-inl.h" -#include "node.h" -#include "stream_base.h" -#include "v8.h" - -namespace node { - -StreamReq::StreamReq( - StreamBase* stream, - v8::Local req_wrap_obj) : stream_(stream) { - AttachToObject(req_wrap_obj); -} - -void StreamReq::AttachToObject(v8::Local req_wrap_obj) { - CHECK_EQ(req_wrap_obj->GetAlignedPointerFromInternalField( - StreamReq::kStreamReqField), - nullptr); - req_wrap_obj->SetAlignedPointerInInternalField( - StreamReq::kStreamReqField, this); -} - -StreamReq* StreamReq::FromObject(v8::Local req_wrap_obj) { - return static_cast( - req_wrap_obj->GetAlignedPointerFromInternalField( - StreamReq::kStreamReqField)); -} - -void StreamReq::Dispose() { - BaseObjectPtr destroy_me{GetAsyncWrap()}; - object()->SetAlignedPointerInInternalField( - StreamReq::kStreamReqField, nullptr); - destroy_me->Detach(); -} - -v8::Local StreamReq::object() { - return GetAsyncWrap()->object(); -} - -ShutdownWrap::ShutdownWrap( - StreamBase* stream, - v8::Local req_wrap_obj) - : StreamReq(stream, req_wrap_obj) { } - -WriteWrap::WriteWrap( - StreamBase* stream, - v8::Local req_wrap_obj) - : StreamReq(stream, req_wrap_obj) { } - -void StreamListener::PassReadErrorToPreviousListener(ssize_t nread) { - CHECK_NOT_NULL(previous_listener_); - previous_listener_->OnStreamRead(nread, uv_buf_init(nullptr, 0)); -} - -void StreamResource::PushStreamListener(StreamListener* listener) { - CHECK_NOT_NULL(listener); - CHECK_NULL(listener->stream_); - - listener->previous_listener_ = listener_; - listener->stream_ = this; - - listener_ = listener; -} - -void StreamResource::RemoveStreamListener(StreamListener* listener) { - CHECK_NOT_NULL(listener); - - StreamListener* previous; - StreamListener* current; - - // Remove from the linked list. - for (current = listener_, previous = nullptr; - /* No loop condition because we want a crash if listener is not found */ - ; previous = current, current = current->previous_listener_) { - CHECK_NOT_NULL(current); - if (current == listener) { - if (previous != nullptr) - previous->previous_listener_ = current->previous_listener_; - else - listener_ = listener->previous_listener_; - break; - } - } - - listener->stream_ = nullptr; - listener->previous_listener_ = nullptr; -} - -uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) { - DebugSealHandleScope seal_handle_scope; - return listener_->OnStreamAlloc(suggested_size); -} - -void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) { - DebugSealHandleScope seal_handle_scope; - if (nread > 0) - bytes_read_ += static_cast(nread); - listener_->OnStreamRead(nread, buf); -} - -void StreamResource::EmitAfterWrite(WriteWrap* w, int status) { - DebugSealHandleScope seal_handle_scope; - listener_->OnStreamAfterWrite(w, status); -} - -void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) { - DebugSealHandleScope seal_handle_scope; - listener_->OnStreamAfterShutdown(w, status); -} - -void StreamResource::EmitWantsWrite(size_t suggested_size) { - DebugSealHandleScope seal_handle_scope; - listener_->OnStreamWantsWrite(suggested_size); -} - -StreamBase::StreamBase(Environment* env) : env_(env) { - PushStreamListener(&default_listener_); -} - -int StreamBase::Shutdown(v8::Local req_wrap_obj) { - Environment* env = stream_env(); - - v8::HandleScope handle_scope(env->isolate()); - - if (req_wrap_obj.IsEmpty()) { - if (!env->shutdown_wrap_template() - ->NewInstance(env->context()) - .ToLocal(&req_wrap_obj)) { - return UV_EBUSY; - } - StreamReq::ResetObject(req_wrap_obj); - } - - BaseObjectPtr req_wrap_ptr; - AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(GetAsyncWrap()); - ShutdownWrap* req_wrap = CreateShutdownWrap(req_wrap_obj); - if (req_wrap != nullptr) - req_wrap_ptr.reset(req_wrap->GetAsyncWrap()); - int err = DoShutdown(req_wrap); - - if (err != 0 && req_wrap != nullptr) { - req_wrap->Dispose(); - } - - const char* msg = Error(); - if (msg != nullptr) { - if (req_wrap_obj->Set(env->context(), - env->error_string(), - OneByteString(env->isolate(), msg)).IsNothing()) { - return UV_EBUSY; - } - ClearError(); - } - - return err; -} - -StreamWriteResult StreamBase::Write( - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle, - v8::Local req_wrap_obj) { - Environment* env = stream_env(); - int err; - - size_t total_bytes = 0; - for (size_t i = 0; i < count; ++i) - total_bytes += bufs[i].len; - bytes_written_ += total_bytes; - - if (send_handle == nullptr) { - err = DoTryWrite(&bufs, &count); - if (err != 0 || count == 0) { - return StreamWriteResult { false, err, nullptr, total_bytes, {} }; - } - } - - v8::HandleScope handle_scope(env->isolate()); - - if (req_wrap_obj.IsEmpty()) { - if (!env->write_wrap_template() - ->NewInstance(env->context()) - .ToLocal(&req_wrap_obj)) { - return StreamWriteResult { false, UV_EBUSY, nullptr, 0, {} }; - } - StreamReq::ResetObject(req_wrap_obj); - } - - AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(GetAsyncWrap()); - WriteWrap* req_wrap = CreateWriteWrap(req_wrap_obj); - BaseObjectPtr req_wrap_ptr(req_wrap->GetAsyncWrap()); - - err = DoWrite(req_wrap, bufs, count, send_handle); - bool async = err == 0; - - if (!async) { - req_wrap->Dispose(); - req_wrap = nullptr; - } - - const char* msg = Error(); - if (msg != nullptr) { - if (req_wrap_obj->Set(env->context(), - env->error_string(), - OneByteString(env->isolate(), msg)).IsNothing()) { - return StreamWriteResult { false, UV_EBUSY, nullptr, 0, {} }; - } - ClearError(); - } - - return StreamWriteResult { - async, err, req_wrap, total_bytes, std::move(req_wrap_ptr) }; -} - -template -SimpleShutdownWrap::SimpleShutdownWrap( - StreamBase* stream, - v8::Local req_wrap_obj) - : ShutdownWrap(stream, req_wrap_obj), - OtherBase(stream->stream_env(), - req_wrap_obj, - AsyncWrap::PROVIDER_SHUTDOWNWRAP) { -} - -template -SimpleWriteWrap::SimpleWriteWrap( - StreamBase* stream, - v8::Local req_wrap_obj) - : WriteWrap(stream, req_wrap_obj), - OtherBase(stream->stream_env(), - req_wrap_obj, - AsyncWrap::PROVIDER_WRITEWRAP) { -} - -void StreamBase::AttachToObject(v8::Local obj) { - obj->SetAlignedPointerInInternalField( - StreamBase::kStreamBaseField, this); -} - -StreamBase* StreamBase::FromObject(v8::Local obj) { - if (obj->GetAlignedPointerFromInternalField(StreamBase::kSlot) == nullptr) - return nullptr; - - return static_cast( - obj->GetAlignedPointerFromInternalField( - StreamBase::kStreamBaseField)); -} - -WriteWrap* WriteWrap::FromObject(v8::Local req_wrap_obj) { - return static_cast(StreamReq::FromObject(req_wrap_obj)); -} - -template -WriteWrap* WriteWrap::FromObject( - const BaseObjectPtrImpl& base_obj) { - if (!base_obj) return nullptr; - return FromObject(base_obj->object()); -} - -ShutdownWrap* ShutdownWrap::FromObject(v8::Local req_wrap_obj) { - return static_cast(StreamReq::FromObject(req_wrap_obj)); -} - -template -ShutdownWrap* ShutdownWrap::FromObject( - const BaseObjectPtrImpl& base_obj) { - if (!base_obj) return nullptr; - return FromObject(base_obj->object()); -} - -void WriteWrap::SetBackingStore(std::unique_ptr bs) { - CHECK(!backing_store_); - backing_store_ = std::move(bs); -} - -void StreamReq::Done(int status, const char* error_str) { - AsyncWrap* async_wrap = GetAsyncWrap(); - Environment* env = async_wrap->env(); - if (error_str != nullptr) { - v8::HandleScope handle_scope(env->isolate()); - if (async_wrap->object()->Set( - env->context(), - env->error_string(), - OneByteString(env->isolate(), error_str)).IsNothing()) { - return; - } - } - - OnDone(status); -} - -void StreamReq::ResetObject(v8::Local obj) { - DCHECK_GT(obj->InternalFieldCount(), StreamReq::kStreamReqField); - - obj->SetAlignedPointerInInternalField(StreamReq::kSlot, nullptr); - obj->SetAlignedPointerInInternalField(StreamReq::kStreamReqField, nullptr); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STREAM_BASE_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/stream_base.h b/repo/packages/s/scriptx-legacy/include/libnode/stream_base.h deleted file mode 100644 index 75132253..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/stream_base.h +++ /dev/null @@ -1,459 +0,0 @@ -#ifndef SRC_STREAM_BASE_H_ -#define SRC_STREAM_BASE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "env.h" -#include "async_wrap.h" -#include "node.h" -#include "util.h" - -#include "v8.h" - -namespace node { - -// Forward declarations -class Environment; -class ShutdownWrap; -class WriteWrap; -class StreamBase; -class StreamResource; -class ExternalReferenceRegistry; - -struct StreamWriteResult { - bool async; - int err; - WriteWrap* wrap; - size_t bytes; - BaseObjectPtr wrap_obj; -}; - -using JSMethodFunction = void(const v8::FunctionCallbackInfo& args); - -class StreamReq { - public: - // The kSlot internal field here mirrors BaseObject::InternalFields::kSlot - // here because instances derived from StreamReq will also derive from - // BaseObject, and the slots are used for the identical purpose. - enum InternalFields { - kSlot = BaseObject::kSlot, - kStreamReqField = BaseObject::kInternalFieldCount, - kInternalFieldCount - }; - - inline explicit StreamReq( - StreamBase* stream, - v8::Local req_wrap_obj); - - virtual ~StreamReq() = default; - virtual AsyncWrap* GetAsyncWrap() = 0; - inline v8::Local object(); - - // TODO(RaisinTen): Update the return type to a Maybe, so that we can indicate - // if there is a pending exception/termination. - inline void Done(int status, const char* error_str = nullptr); - inline void Dispose(); - - StreamBase* stream() const { return stream_; } - - static inline StreamReq* FromObject(v8::Local req_wrap_obj); - - // Sets all internal fields of `req_wrap_obj` to `nullptr`. - // This is what the `WriteWrap` and `ShutdownWrap` JS constructors do, - // and what we use in C++ after creating these objects from their - // v8::ObjectTemplates, to avoid the overhead of calling the - // constructor explicitly. - static inline void ResetObject(v8::Local req_wrap_obj); - - protected: - virtual void OnDone(int status) = 0; - - inline void AttachToObject(v8::Local req_wrap_obj); - - private: - StreamBase* const stream_; -}; - -class ShutdownWrap : public StreamReq { - public: - inline ShutdownWrap( - StreamBase* stream, - v8::Local req_wrap_obj); - - static inline ShutdownWrap* FromObject(v8::Local req_wrap_obj); - template - static inline ShutdownWrap* FromObject( - const BaseObjectPtrImpl& base_obj); - - // Call stream()->EmitAfterShutdown() and dispose of this request wrap. - void OnDone(int status) override; -}; - -class WriteWrap : public StreamReq { - public: - inline void SetBackingStore(std::unique_ptr bs); - - inline WriteWrap( - StreamBase* stream, - v8::Local req_wrap_obj); - - static inline WriteWrap* FromObject(v8::Local req_wrap_obj); - template - static inline WriteWrap* FromObject( - const BaseObjectPtrImpl& base_obj); - - // Call stream()->EmitAfterWrite() and dispose of this request wrap. - void OnDone(int status) override; - - private: - std::unique_ptr backing_store_; -}; - - -// This is the generic interface for objects that control Node.js' C++ streams. -// For example, the default `EmitToJSStreamListener` emits a stream's data -// as Buffers in JS, or `TLSWrap` reads and decrypts data from a stream. -class StreamListener { - public: - virtual ~StreamListener(); - - // This is called when a stream wants to allocate memory before - // reading data into the freshly allocated buffer (i.e. it is always followed - // by a `OnStreamRead()` call). - // This memory may be statically or dynamically allocated; for example, - // a protocol parser may want to read data into a static buffer if it knows - // that all data is going to be fully handled during the next - // `OnStreamRead()` call. - // The returned buffer does not need to contain `suggested_size` bytes. - // The default implementation of this method returns a buffer that has exactly - // the suggested size and is allocated using malloc(). - // It is not valid to return a zero-length buffer from this method. - // It is not guaranteed that the corresponding `OnStreamRead()` call - // happens in the same event loop turn as this call. - virtual uv_buf_t OnStreamAlloc(size_t suggested_size) = 0; - - // `OnStreamRead()` is called when data is available on the socket and has - // been read into the buffer provided by `OnStreamAlloc()`. - // The `buf` argument is the return value of `uv_buf_t`, or may be a buffer - // with base nullptr in case of an error. - // `nread` is the number of read bytes (which is at most the buffer length), - // or, if negative, a libuv error code. - virtual void OnStreamRead(ssize_t nread, - const uv_buf_t& buf) = 0; - - // This is called once a write has finished. `status` may be 0 or, - // if negative, a libuv error code. - // By default, this is simply passed on to the previous listener - // (and raises an assertion if there is none). - virtual void OnStreamAfterWrite(WriteWrap* w, int status); - - // This is called once a shutdown has finished. `status` may be 0 or, - // if negative, a libuv error code. - // By default, this is simply passed on to the previous listener - // (and raises an assertion if there is none). - virtual void OnStreamAfterShutdown(ShutdownWrap* w, int status); - - // This is called by the stream if it determines that it wants more data - // to be written to it. Not all streams support this. - // This callback will not be called as long as there are active writes. - // It is not supported by all streams; `stream->HasWantsWrite()` returns - // true if it is supported by a stream. - virtual void OnStreamWantsWrite(size_t suggested_size) {} - - // This is called immediately before the stream is destroyed. - virtual void OnStreamDestroy() {} - - // The stream this is currently associated with, or nullptr if there is none. - StreamResource* stream() const { return stream_; } - - protected: - // Pass along a read error to the `StreamListener` instance that was active - // before this one. For example, a protocol parser does not care about read - // errors and may instead want to let the original handler - // (e.g. the JS handler) take care of the situation. - inline void PassReadErrorToPreviousListener(ssize_t nread); - - StreamResource* stream_ = nullptr; - StreamListener* previous_listener_ = nullptr; - - friend class StreamResource; -}; - - -// An (incomplete) stream listener class that calls the `.oncomplete()` -// method of the JS objects associated with the wrap objects. -class ReportWritesToJSStreamListener : public StreamListener { - public: - void OnStreamAfterWrite(WriteWrap* w, int status) override; - void OnStreamAfterShutdown(ShutdownWrap* w, int status) override; - - private: - void OnStreamAfterReqFinished(StreamReq* req_wrap, int status); -}; - - -// A default emitter that just pushes data chunks as Buffer instances to -// JS land via the handle’s .ondata method. -class EmitToJSStreamListener : public ReportWritesToJSStreamListener { - public: - uv_buf_t OnStreamAlloc(size_t suggested_size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; -}; - - -// An alternative listener that uses a custom, user-provided buffer -// for reading data. -class CustomBufferJSListener : public ReportWritesToJSStreamListener { - public: - uv_buf_t OnStreamAlloc(size_t suggested_size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; - void OnStreamDestroy() override { delete this; } - - explicit CustomBufferJSListener(uv_buf_t buffer) : buffer_(buffer) {} - - private: - uv_buf_t buffer_; -}; - - -// A generic stream, comparable to JS land’s `Duplex` streams. -// A stream is always controlled through one `StreamListener` instance. -class StreamResource { - public: - virtual ~StreamResource(); - - // These need to be implemented on the readable side of this stream: - - // Start reading from the underlying resource. This is called by the consumer - // when more data is desired. Use `EmitAlloc()` and `EmitData()` to - // pass data along to the consumer. - virtual int ReadStart() = 0; - // Stop reading from the underlying resource. This is called by the - // consumer when its buffers are full and no more data can be handled. - virtual int ReadStop() = 0; - - // These need to be implemented on the writable side of this stream: - // All of these methods may return an error code synchronously. - // In that case, the finish callback should *not* be called. - - // Perform a shutdown operation, and either call req_wrap->Done() when - // finished and return 0, return 1 for synchronous success, or - // a libuv error code for synchronous failures. - virtual int DoShutdown(ShutdownWrap* req_wrap) = 0; - // Try to write as much data as possible synchronously, and modify - // `*bufs` and `*count` accordingly. This is a no-op by default. - // Return 0 for success and a libuv error code for failures. - virtual int DoTryWrite(uv_buf_t** bufs, size_t* count); - // Initiate a write of data. If the write completes synchronously, return 0 on - // success (with bufs modified to indicate how much data was consumed) or a - // libuv error code on failure. If the write will complete asynchronously, - // return 0. When the write completes asynchronously, call req_wrap->Done() - // with 0 on success (with bufs modified to indicate how much data was - // consumed) or a libuv error code on failure. Do not call req_wrap->Done() if - // the write completes synchronously, that is, it should never be called - // before DoWrite() has returned. - virtual int DoWrite(WriteWrap* w, - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle) = 0; - - // Returns true if the stream supports the `OnStreamWantsWrite()` interface. - virtual bool HasWantsWrite() const { return false; } - - // Optionally, this may provide an error message to be used for - // failing writes. - virtual const char* Error() const; - // Clear the current error (i.e. that would be returned by Error()). - virtual void ClearError(); - - // Transfer ownership of this stream to `listener`. The previous listener - // will not receive any more callbacks while the new listener was active. - inline void PushStreamListener(StreamListener* listener); - // Remove a listener, and, if this was the currently active one, - // transfer ownership back to the previous listener. - inline void RemoveStreamListener(StreamListener* listener); - - protected: - // Call the current listener's OnStreamAlloc() method. - inline uv_buf_t EmitAlloc(size_t suggested_size); - // Call the current listener's OnStreamRead() method and update the - // stream's read byte counter. - inline void EmitRead( - ssize_t nread, - const uv_buf_t& buf = uv_buf_init(nullptr, 0)); - // Call the current listener's OnStreamAfterWrite() method. - inline void EmitAfterWrite(WriteWrap* w, int status); - // Call the current listener's OnStreamAfterShutdown() method. - inline void EmitAfterShutdown(ShutdownWrap* w, int status); - // Call the current listener's OnStreamWantsWrite() method. - inline void EmitWantsWrite(size_t suggested_size); - - StreamListener* listener_ = nullptr; - uint64_t bytes_read_ = 0; - uint64_t bytes_written_ = 0; - - friend class StreamListener; -}; - - -class StreamBase : public StreamResource { - public: - // The kSlot field here mirrors that of BaseObject::InternalFields::kSlot - // because instances deriving from StreamBase generally also derived from - // BaseObject (it's possible for it not to, however). - enum InternalFields { - kSlot = BaseObject::kSlot, - kStreamBaseField = BaseObject::kInternalFieldCount, - kOnReadFunctionField, - kInternalFieldCount - }; - - static void AddMethods(Environment* env, - v8::Local target); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - virtual bool IsAlive() = 0; - virtual bool IsClosing() = 0; - virtual bool IsIPCPipe(); - virtual int GetFD(); - - enum StreamBaseJSChecks { DONT_SKIP_NREAD_CHECKS, SKIP_NREAD_CHECKS }; - - v8::MaybeLocal CallJSOnreadMethod( - ssize_t nread, - v8::Local ab, - size_t offset = 0, - StreamBaseJSChecks checks = DONT_SKIP_NREAD_CHECKS); - - // This is named `stream_env` to avoid name clashes, because a lot of - // subclasses are also `BaseObject`s. - Environment* stream_env() const { return env_; } - - // TODO(RaisinTen): Update the return type to a Maybe, so that we can indicate - // if there is a pending exception/termination. - // Shut down the current stream. This request can use an existing - // ShutdownWrap object (that was created in JS), or a new one will be created. - // Returns 1 in case of a synchronous completion, 0 in case of asynchronous - // completion, and a libuv error case in case of synchronous failure. - inline int Shutdown( - v8::Local req_wrap_obj = v8::Local()); - - // TODO(RaisinTen): Update the return type to a Maybe, so that we can indicate - // if there is a pending exception/termination. - // Write data to the current stream. This request can use an existing - // WriteWrap object (that was created in JS), or a new one will be created. - // This will first try to write synchronously using `DoTryWrite()`, then - // asynchronously using `DoWrite()`. - // If the return value indicates a synchronous completion, no callback will - // be invoked. - inline StreamWriteResult Write( - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle = nullptr, - v8::Local req_wrap_obj = v8::Local()); - - // These can be overridden by subclasses to get more specific wrap instances. - // For example, a subclass Foo could create a FooWriteWrap or FooShutdownWrap - // (inheriting from ShutdownWrap/WriteWrap) that has extra fields, like - // an associated libuv request. - virtual ShutdownWrap* CreateShutdownWrap(v8::Local object); - virtual WriteWrap* CreateWriteWrap(v8::Local object); - - // One of these must be implemented - virtual AsyncWrap* GetAsyncWrap() = 0; - virtual v8::Local GetObject(); - - static inline StreamBase* FromObject(v8::Local obj); - - protected: - inline explicit StreamBase(Environment* env); - - // JS Methods - int ReadStartJS(const v8::FunctionCallbackInfo& args); - int ReadStopJS(const v8::FunctionCallbackInfo& args); - int Shutdown(const v8::FunctionCallbackInfo& args); - int Writev(const v8::FunctionCallbackInfo& args); - int WriteBuffer(const v8::FunctionCallbackInfo& args); - template - int WriteString(const v8::FunctionCallbackInfo& args); - int UseUserBuffer(const v8::FunctionCallbackInfo& args); - - static void GetFD(const v8::FunctionCallbackInfo& args); - static void GetExternal(const v8::FunctionCallbackInfo& args); - static void GetBytesRead(const v8::FunctionCallbackInfo& args); - static void GetBytesWritten(const v8::FunctionCallbackInfo& args); - inline void AttachToObject(v8::Local obj); - - template & args)> - static void JSMethod(const v8::FunctionCallbackInfo& args); - - // Internal, used only in StreamBase methods + env.cc. - enum StreamBaseStateFields { - kReadBytesOrError, - kArrayBufferOffset, - kBytesWritten, - kLastWriteWasAsync, - kNumStreamBaseStateFields - }; - - private: - Environment* env_; - EmitToJSStreamListener default_listener_; - - void SetWriteResult(const StreamWriteResult& res); - static void AddMethod(Environment* env, - v8::Local sig, - enum v8::PropertyAttribute attributes, - v8::Local t, - JSMethodFunction* stream_method, - v8::Local str); - - friend class WriteWrap; - friend class ShutdownWrap; - friend class Environment; // For kNumStreamBaseStateFields. -}; - - -// These are helpers for creating `ShutdownWrap`/`WriteWrap` instances. -// `OtherBase` must have a constructor that matches the `AsyncWrap` -// constructors’s (Environment*, Local, AsyncWrap::Provider) signature -// and be a subclass of `AsyncWrap`. -template -class SimpleShutdownWrap : public ShutdownWrap, public OtherBase { - public: - SimpleShutdownWrap(StreamBase* stream, - v8::Local req_wrap_obj); - - AsyncWrap* GetAsyncWrap() override { return this; } - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(SimpleShutdownWrap) - SET_SELF_SIZE(SimpleShutdownWrap) - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { - return OtherBase::IsNotIndicativeOfMemoryLeakAtExit(); - } -}; - -template -class SimpleWriteWrap : public WriteWrap, public OtherBase { - public: - SimpleWriteWrap(StreamBase* stream, - v8::Local req_wrap_obj); - - AsyncWrap* GetAsyncWrap() override { return this; } - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(SimpleWriteWrap) - SET_SELF_SIZE(SimpleWriteWrap) - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { - return OtherBase::IsNotIndicativeOfMemoryLeakAtExit(); - } -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STREAM_BASE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/stream_pipe.h b/repo/packages/s/scriptx-legacy/include/libnode/stream_pipe.h deleted file mode 100644 index f4114682..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/stream_pipe.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef SRC_STREAM_PIPE_H_ -#define SRC_STREAM_PIPE_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "stream_base.h" - -namespace node { - -class StreamPipe : public AsyncWrap { - public: - ~StreamPipe() override; - - void Unpipe(bool is_in_deletion = false); - - // TODO(RaisinTen): Just like MessagePort, add the following overload: - // static StreamPipe* New(StreamBase* source, StreamBase* sink, - // v8::Local obj); - // so that we can indicate if there is a pending exception/termination. - static void New(const v8::FunctionCallbackInfo& args); - static void Start(const v8::FunctionCallbackInfo& args); - static void Unpipe(const v8::FunctionCallbackInfo& args); - static void IsClosed(const v8::FunctionCallbackInfo& args); - static void PendingWrites(const v8::FunctionCallbackInfo& args); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(StreamPipe) - SET_SELF_SIZE(StreamPipe) - - private: - StreamPipe(StreamBase* source, StreamBase* sink, v8::Local obj); - - inline StreamBase* source(); - inline StreamBase* sink(); - - int pending_writes_ = 0; - bool is_reading_ = false; - bool is_eof_ = false; - bool is_closed_ = true; - bool sink_destroyed_ = false; - bool source_destroyed_ = false; - bool uses_wants_write_ = false; - - // Set a default value so that when we’re coming from Start(), we know - // that we don’t want to read just yet. - // This will likely need to be changed when supporting streams without - // `OnStreamWantsWrite()` support. - size_t wanted_data_ = 0; - - void ProcessData(size_t nread, std::unique_ptr bs); - - class ReadableListener : public StreamListener { - public: - uv_buf_t OnStreamAlloc(size_t suggested_size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; - void OnStreamDestroy() override; - }; - - class WritableListener : public StreamListener { - public: - uv_buf_t OnStreamAlloc(size_t suggested_size) override; - void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override; - void OnStreamAfterWrite(WriteWrap* w, int status) override; - void OnStreamAfterShutdown(ShutdownWrap* w, int status) override; - void OnStreamWantsWrite(size_t suggested_size) override; - void OnStreamDestroy() override; - }; - - ReadableListener readable_listener_; - WritableListener writable_listener_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STREAM_PIPE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/stream_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/stream_wrap.h deleted file mode 100644 index 8cbce923..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/stream_wrap.h +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_STREAM_WRAP_H_ -#define SRC_STREAM_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "stream_base.h" -#include "handle_wrap.h" -#include "v8.h" - -namespace node { - -class Environment; -class ExternalReferenceRegistry; - -class LibuvStreamWrap : public HandleWrap, public StreamBase { - public: - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - int GetFD() override; - bool IsAlive() override; - bool IsClosing() override; - bool IsIPCPipe() override; - - // JavaScript functions - int ReadStart() override; - int ReadStop() override; - - // Resource implementation - int DoShutdown(ShutdownWrap* req_wrap) override; - int DoTryWrite(uv_buf_t** bufs, size_t* count) override; - int DoWrite(WriteWrap* w, - uv_buf_t* bufs, - size_t count, - uv_stream_t* send_handle) override; - - inline uv_stream_t* stream() const { - return stream_; - } - - inline bool is_named_pipe() const { - return stream()->type == UV_NAMED_PIPE; - } - - inline bool is_named_pipe_ipc() const { - return is_named_pipe() && - reinterpret_cast(stream())->ipc != 0; - } - - inline bool is_tcp() const { - return stream()->type == UV_TCP; - } - - ShutdownWrap* CreateShutdownWrap(v8::Local object) override; - WriteWrap* CreateWriteWrap(v8::Local object) override; - - static LibuvStreamWrap* From(Environment* env, v8::Local object); - - protected: - LibuvStreamWrap(Environment* env, - v8::Local object, - uv_stream_t* stream, - AsyncWrap::ProviderType provider); - - AsyncWrap* GetAsyncWrap() override; - - static v8::Local GetConstructorTemplate( - Environment* env); - - protected: - inline void set_fd(int fd) { -#ifdef _WIN32 - fd_ = fd; -#endif - } - - - private: - static void GetWriteQueueSize( - const v8::FunctionCallbackInfo& info); - static void SetBlocking(const v8::FunctionCallbackInfo& args); - - // Callbacks for libuv - void OnUvAlloc(size_t suggested_size, uv_buf_t* buf); - // TODO(RaisinTen): Update the return type to a Maybe, so that we can indicate - // if there is a pending exception/termination. - void OnUvRead(ssize_t nread, const uv_buf_t* buf); - - static void AfterUvWrite(uv_write_t* req, int status); - static void AfterUvShutdown(uv_shutdown_t* req, int status); - - uv_stream_t* const stream_; - -#ifdef _WIN32 - // We don't always have an FD that we could look up on the stream_ - // object itself on Windows. However, for some cases, we open handles - // using FDs; In that case, we can store and provide the value. - // This became necessary because it allows to detect situations - // where multiple handles refer to the same stdio FDs (in particular, - // a possible IPC channel and a regular process.std??? stream). - int fd_ = -1; -#endif -}; - - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STREAM_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/string_bytes.h b/repo/packages/s/scriptx-legacy/include/libnode/string_bytes.h deleted file mode 100644 index 69bb828e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/string_bytes.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_STRING_BYTES_H_ -#define SRC_STRING_BYTES_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -// Decodes a v8::Local or Buffer to a raw char* - -#include "v8.h" -#include "env-inl.h" - -#include - -namespace node { - -class StringBytes { - public: - class InlineDecoder : public MaybeStackBuffer { - public: - inline v8::Maybe Decode(Environment* env, - v8::Local string, - enum encoding enc) { - size_t storage; - if (!StringBytes::StorageSize(env->isolate(), string, enc).To(&storage)) - return v8::Nothing(); - AllocateSufficientStorage(storage); - const size_t length = - StringBytes::Write(env->isolate(), out(), storage, string, enc); - - // No zero terminator is included when using this method. - SetLength(length); - return v8::Just(true); - } - - inline size_t size() const { return length(); } - }; - - // Fast, but can be 2 bytes oversized for Base64, and - // as much as triple UTF-8 strings <= 65536 chars in length - static v8::Maybe StorageSize(v8::Isolate* isolate, - v8::Local val, - enum encoding enc); - - // Precise byte count, but slightly slower for Base64 and - // very much slower for UTF-8 - static v8::Maybe Size(v8::Isolate* isolate, - v8::Local val, - enum encoding enc); - - // Write the bytes from the string or buffer into the char* - // returns the number of bytes written, which will always be - // <= buflen. Use StorageSize/Size first to know how much - // memory to allocate. - static size_t Write(v8::Isolate* isolate, - char* buf, - size_t buflen, - v8::Local val, - enum encoding enc, - int* chars_written = nullptr); - - // Take the bytes in the src, and turn it into a Buffer or String. - static v8::MaybeLocal Encode(v8::Isolate* isolate, - const char* buf, - size_t buflen, - enum encoding encoding, - v8::Local* error); - - // Warning: This reverses endianness on BE platforms, even though the - // signature using uint16_t implies that it should not. - // However, the brokenness is already public API and can't therefore - // be changed easily. - static v8::MaybeLocal Encode(v8::Isolate* isolate, - const uint16_t* buf, - size_t buflen, - v8::Local* error); - - static v8::MaybeLocal Encode(v8::Isolate* isolate, - const char* buf, - enum encoding encoding, - v8::Local* error); - - static size_t hex_encode(const char* src, - size_t slen, - char* dst, - size_t dlen); - - static std::string hex_encode(const char* src, size_t slen); - - private: - static size_t WriteUCS2(v8::Isolate* isolate, - char* buf, - size_t buflen, - v8::Local str, - int flags, - size_t* chars_written); -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STRING_BYTES_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/string_decoder-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/string_decoder-inl.h deleted file mode 100644 index e7c0abb5..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/string_decoder-inl.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SRC_STRING_DECODER_INL_H_ -#define SRC_STRING_DECODER_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "string_decoder.h" - -namespace node { - -void StringDecoder::SetEncoding(enum encoding encoding) { - state_[kBufferedBytes] = 0; - state_[kMissingBytes] = 0; - state_[kEncodingField] = encoding; -} - -enum encoding StringDecoder::Encoding() const { - return static_cast(state_[kEncodingField]); -} - -unsigned StringDecoder::BufferedBytes() const { - return state_[kBufferedBytes]; -} - -unsigned StringDecoder::MissingBytes() const { - return state_[kMissingBytes]; -} - -char* StringDecoder::IncompleteCharacterBuffer() { - return reinterpret_cast(state_ + kIncompleteCharactersStart); -} - - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STRING_DECODER_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/string_decoder.h b/repo/packages/s/scriptx-legacy/include/libnode/string_decoder.h deleted file mode 100644 index 9059eeaa..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/string_decoder.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef SRC_STRING_DECODER_H_ -#define SRC_STRING_DECODER_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "node.h" - -namespace node { - -class StringDecoder { - public: - StringDecoder() { state_[kEncodingField] = BUFFER; } - inline void SetEncoding(enum encoding encoding); - inline enum encoding Encoding() const; - - inline char* IncompleteCharacterBuffer(); - inline unsigned MissingBytes() const; - inline unsigned BufferedBytes() const; - - // Decode a string from the specified encoding. - // The value pointed to by `nread` will be modified to reflect that - // less data may have been read because it ended on an incomplete character - // and more data may have been read because a previously incomplete character - // was finished. - v8::MaybeLocal DecodeData(v8::Isolate* isolate, - const char* data, - size_t* nread); - // Flush an incomplete character. For character encodings like UTF8 this - // means printing replacement characters, buf for e.g. Base64 the returned - // string contains more data. - v8::MaybeLocal FlushData(v8::Isolate* isolate); - - enum Fields { - kIncompleteCharactersStart = 0, - kIncompleteCharactersEnd = 4, - kMissingBytes = 4, - kBufferedBytes = 5, - kEncodingField = 6, - kNumFields = 7 - }; - - private: - uint8_t state_[kNumFields] = {}; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STRING_DECODER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/string_search.h b/repo/packages/s/scriptx-legacy/include/libnode/string_search.h deleted file mode 100644 index cd9ef320..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/string_search.h +++ /dev/null @@ -1,638 +0,0 @@ -// Copyright 2011 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SRC_STRING_SEARCH_H_ -#define SRC_STRING_SEARCH_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "util.h" - -#include -#include - -namespace node { -namespace stringsearch { - -template -class Vector { - public: - Vector(T* data, size_t length, bool isForward) - : start_(data), length_(length), is_forward_(isForward) { - CHECK(length > 0 && data != nullptr); - } - - // Returns the start of the memory range. - // For vector v this is NOT necessarily &v[0], see forward(). - const T* start() const { return start_; } - - // Returns the length of the vector, in characters. - size_t length() const { return length_; } - - // Returns true if the Vector is front-to-back, false if back-to-front. - // In the latter case, v[0] corresponds to the *end* of the memory range. - bool forward() const { return is_forward_; } - - // Access individual vector elements - checks bounds in debug mode. - T& operator[](size_t index) const { - DCHECK_LT(index, length_); - return start_[is_forward_ ? index : (length_ - index - 1)]; - } - - private: - T* start_; - size_t length_; - bool is_forward_; -}; - - -//--------------------------------------------------------------------- -// String Search object. -//--------------------------------------------------------------------- - -// Class holding constants and methods that apply to all string search variants, -// independently of subject and pattern char size. -class StringSearchBase { - protected: - // Cap on the maximal shift in the Boyer-Moore implementation. By setting a - // limit, we can fix the size of tables. For a needle longer than this limit, - // search will not be optimal, since we only build tables for a suffix - // of the string, but it is a safe approximation. - static const int kBMMaxShift = 250; - - // Reduce alphabet to this size. - // One of the tables used by Boyer-Moore and Boyer-Moore-Horspool has size - // proportional to the input alphabet. We reduce the alphabet size by - // equating input characters modulo a smaller alphabet size. This gives - // a potentially less efficient searching, but is a safe approximation. - // For needles using only characters in the same Unicode 256-code point page, - // there is no search speed degradation. - static const int kLatin1AlphabetSize = 256; - static const int kUC16AlphabetSize = 256; - - // Bad-char shift table stored in the state. It's length is the alphabet size. - // For patterns below this length, the skip length of Boyer-Moore is too short - // to compensate for the algorithmic overhead compared to simple brute force. - static const int kBMMinPatternLength = 8; - - // Store for the BoyerMoore(Horspool) bad char shift table. - int bad_char_shift_table_[kUC16AlphabetSize]; - // Store for the BoyerMoore good suffix shift table. - int good_suffix_shift_table_[kBMMaxShift + 1]; - // Table used temporarily while building the BoyerMoore good suffix - // shift table. - int suffix_table_[kBMMaxShift + 1]; -}; - -template -class StringSearch : private StringSearchBase { - public: - typedef stringsearch::Vector Vector; - - explicit StringSearch(Vector pattern) - : pattern_(pattern), start_(0) { - if (pattern.length() >= kBMMaxShift) { - start_ = pattern.length() - kBMMaxShift; - } - - size_t pattern_length = pattern_.length(); - CHECK_GT(pattern_length, 0); - if (pattern_length < kBMMinPatternLength) { - if (pattern_length == 1) { - strategy_ = SearchStrategy::kSingleChar; - return; - } - strategy_ = SearchStrategy::kLinear; - return; - } - strategy_ = SearchStrategy::kInitial; - } - - size_t Search(Vector subject, size_t index) { - switch (strategy_) { - case kBoyerMooreHorspool: - return BoyerMooreHorspoolSearch(subject, index); - case kBoyerMoore: - return BoyerMooreSearch(subject, index); - case kInitial: - return InitialSearch(subject, index); - case kLinear: - return LinearSearch(subject, index); - case kSingleChar: - return SingleCharSearch(subject, index); - } - UNREACHABLE(); - } - - static inline int AlphabetSize() { - if (sizeof(Char) == 1) { - // Latin1 needle. - return kLatin1AlphabetSize; - } else { - // UC16 needle. - return kUC16AlphabetSize; - } - - static_assert(sizeof(Char) == sizeof(uint8_t) || - sizeof(Char) == sizeof(uint16_t), - "sizeof(Char) == sizeof(uint16_t) || sizeof(uint8_t)"); - } - - private: - typedef size_t (StringSearch::*SearchFunction)(Vector, size_t); - size_t SingleCharSearch(Vector subject, size_t start_index); - size_t LinearSearch(Vector subject, size_t start_index); - size_t InitialSearch(Vector subject, size_t start_index); - size_t BoyerMooreHorspoolSearch(Vector subject, size_t start_index); - size_t BoyerMooreSearch(Vector subject, size_t start_index); - - void PopulateBoyerMooreHorspoolTable(); - - void PopulateBoyerMooreTable(); - - static inline int CharOccurrence(int* bad_char_occurrence, - Char char_code) { - if (sizeof(Char) == 1) { - return bad_char_occurrence[static_cast(char_code)]; - } - // Both pattern and subject are UC16. Reduce character to equivalence class. - int equiv_class = char_code % kUC16AlphabetSize; - return bad_char_occurrence[equiv_class]; - } - - enum SearchStrategy { - kBoyerMooreHorspool, - kBoyerMoore, - kInitial, - kLinear, - kSingleChar, - }; - - // The pattern to search for. - Vector pattern_; - SearchStrategy strategy_; - // Cache value of Max(0, pattern_length() - kBMMaxShift) - size_t start_; -}; - - -template -inline T AlignDown(T value, U alignment) { - return reinterpret_cast( - (reinterpret_cast(value) & ~(alignment - 1))); -} - - -inline uint8_t GetHighestValueByte(uint16_t character) { - return std::max(static_cast(character & 0xFF), - static_cast(character >> 8)); -} - - -inline uint8_t GetHighestValueByte(uint8_t character) { return character; } - - -// Searches for a byte value in a memory buffer, back to front. -// Uses memrchr(3) on systems which support it, for speed. -// Falls back to a vanilla for loop on non-GNU systems such as Windows. -inline const void* MemrchrFill(const void* haystack, uint8_t needle, - size_t haystack_len) { -#ifdef _GNU_SOURCE - return memrchr(haystack, needle, haystack_len); -#else - const uint8_t* haystack8 = static_cast(haystack); - for (size_t i = haystack_len - 1; i != static_cast(-1); i--) { - if (haystack8[i] == needle) { - return haystack8 + i; - } - } - return nullptr; -#endif -} - - -// Finds the first occurrence of *two-byte* character pattern[0] in the string -// `subject`. Does not check that the whole pattern matches. -template -inline size_t FindFirstCharacter(Vector pattern, - Vector subject, size_t index) { - const Char pattern_first_char = pattern[0]; - const size_t max_n = (subject.length() - pattern.length() + 1); - - // For speed, search for the more `rare` of the two bytes in pattern[0] - // using memchr / memrchr (which are much faster than a simple for loop). - const uint8_t search_byte = GetHighestValueByte(pattern_first_char); - size_t pos = index; - do { - const size_t bytes_to_search = (max_n - pos) * sizeof(Char); - const void* void_pos; - if (subject.forward()) { - // Assert that bytes_to_search won't overflow - CHECK_LE(pos, max_n); - CHECK_LE(max_n - pos, SIZE_MAX / sizeof(Char)); - void_pos = memchr(subject.start() + pos, search_byte, bytes_to_search); - } else { - CHECK_LE(pos, subject.length()); - CHECK_LE(subject.length() - pos, SIZE_MAX / sizeof(Char)); - void_pos = MemrchrFill(subject.start() + pattern.length() - 1, - search_byte, - bytes_to_search); - } - const Char* char_pos = static_cast(void_pos); - if (char_pos == nullptr) - return subject.length(); - - // Then, for each match, verify that the full two bytes match pattern[0]. - char_pos = AlignDown(char_pos, sizeof(Char)); - size_t raw_pos = static_cast(char_pos - subject.start()); - pos = subject.forward() ? raw_pos : (subject.length() - raw_pos - 1); - if (subject[pos] == pattern_first_char) { - // Match found, hooray. - return pos; - } - // Search byte matched, but the other byte of pattern[0] didn't. Keep going. - } while (++pos < max_n); - - return subject.length(); -} - - -// Finds the first occurrence of the byte pattern[0] in string `subject`. -// Does not verify that the whole pattern matches. -template <> -inline size_t FindFirstCharacter(Vector pattern, - Vector subject, - size_t index) { - const uint8_t pattern_first_char = pattern[0]; - const size_t subj_len = subject.length(); - const size_t max_n = (subject.length() - pattern.length() + 1); - - const void* pos; - if (subject.forward()) { - pos = memchr(subject.start() + index, pattern_first_char, max_n - index); - } else { - pos = MemrchrFill(subject.start() + pattern.length() - 1, - pattern_first_char, - max_n - index); - } - const uint8_t* char_pos = static_cast(pos); - if (char_pos == nullptr) { - return subj_len; - } - - size_t raw_pos = static_cast(char_pos - subject.start()); - return subject.forward() ? raw_pos : (subj_len - raw_pos - 1); -} - -//--------------------------------------------------------------------- -// Single Character Pattern Search Strategy -//--------------------------------------------------------------------- - -template -size_t StringSearch::SingleCharSearch( - Vector subject, - size_t index) { - CHECK_EQ(1, pattern_.length()); - return FindFirstCharacter(pattern_, subject, index); -} - -//--------------------------------------------------------------------- -// Linear Search Strategy -//--------------------------------------------------------------------- - -// Simple linear search for short patterns. Never bails out. -template -size_t StringSearch::LinearSearch( - Vector subject, - size_t index) { - CHECK_GT(pattern_.length(), 1); - const size_t n = subject.length() - pattern_.length(); - for (size_t i = index; i <= n; i++) { - i = FindFirstCharacter(pattern_, subject, i); - if (i == subject.length()) - return subject.length(); - CHECK_LE(i, n); - - bool matches = true; - for (size_t j = 1; j < pattern_.length(); j++) { - if (pattern_[j] != subject[i + j]) { - matches = false; - break; - } - } - if (matches) { - return i; - } - } - return subject.length(); -} - -//--------------------------------------------------------------------- -// Boyer-Moore string search -//--------------------------------------------------------------------- - -template -size_t StringSearch::BoyerMooreSearch( - Vector subject, - size_t start_index) { - const size_t subject_length = subject.length(); - const size_t pattern_length = pattern_.length(); - // Only preprocess at most kBMMaxShift last characters of pattern. - size_t start = start_; - - int* bad_char_occurrence = bad_char_shift_table_; - int* good_suffix_shift = good_suffix_shift_table_ - start_; - - Char last_char = pattern_[pattern_length - 1]; - size_t index = start_index; - // Continue search from i. - while (index <= subject_length - pattern_length) { - size_t j = pattern_length - 1; - int c; - while (last_char != (c = subject[index + j])) { - int shift = j - CharOccurrence(bad_char_occurrence, c); - index += shift; - if (index > subject_length - pattern_length) { - return subject.length(); - } - } - while (pattern_[j] == (c = subject[index + j])) { - if (j == 0) { - return index; - } - j--; - } - if (j < start) { - // we have matched more than our tables allow us to be smart about. - // Fall back on BMH shift. - index += pattern_length - 1 - - CharOccurrence(bad_char_occurrence, last_char); - } else { - int gs_shift = good_suffix_shift[j + 1]; - int bc_occ = CharOccurrence(bad_char_occurrence, c); - int shift = j - bc_occ; - if (gs_shift > shift) { - shift = gs_shift; - } - index += shift; - } - } - - return subject.length(); -} - -template -void StringSearch::PopulateBoyerMooreTable() { - const size_t pattern_length = pattern_.length(); - // Only look at the last kBMMaxShift characters of pattern (from start_ - // to pattern_length). - const size_t start = start_; - const size_t length = pattern_length - start; - - // Biased tables so that we can use pattern indices as table indices, - // even if we only cover the part of the pattern from offset start. - int* shift_table = good_suffix_shift_table_ - start_; - int* suffix_table = suffix_table_ - start_; - - // Initialize table. - for (size_t i = start; i < pattern_length; i++) { - shift_table[i] = length; - } - shift_table[pattern_length] = 1; - suffix_table[pattern_length] = pattern_length + 1; - - if (pattern_length <= start) { - return; - } - - // Find suffixes. - Char last_char = pattern_[pattern_length - 1]; - size_t suffix = pattern_length + 1; - { - size_t i = pattern_length; - while (i > start) { - Char c = pattern_[i - 1]; - while (suffix <= pattern_length && c != pattern_[suffix - 1]) { - if (static_cast(shift_table[suffix]) == length) { - shift_table[suffix] = suffix - i; - } - suffix = suffix_table[suffix]; - } - suffix_table[--i] = --suffix; - if (suffix == pattern_length) { - // No suffix to extend, so we check against last_char only. - while ((i > start) && (pattern_[i - 1] != last_char)) { - if (static_cast(shift_table[pattern_length]) == length) { - shift_table[pattern_length] = pattern_length - i; - } - suffix_table[--i] = pattern_length; - } - if (i > start) { - suffix_table[--i] = --suffix; - } - } - } - } - // Build shift table using suffixes. - if (suffix < pattern_length) { - for (size_t i = start; i <= pattern_length; i++) { - if (static_cast(shift_table[i]) == length) { - shift_table[i] = suffix - start; - } - if (i == suffix) { - suffix = suffix_table[suffix]; - } - } - } -} - -//--------------------------------------------------------------------- -// Boyer-Moore-Horspool string search. -//--------------------------------------------------------------------- - -template -size_t StringSearch::BoyerMooreHorspoolSearch( - Vector subject, - size_t start_index) { - const size_t subject_length = subject.length(); - const size_t pattern_length = pattern_.length(); - int* char_occurrences = bad_char_shift_table_; - int64_t badness = -static_cast(pattern_length); - - // How bad we are doing without a good-suffix table. - Char last_char = pattern_[pattern_length - 1]; - int last_char_shift = - pattern_length - 1 - - CharOccurrence(char_occurrences, last_char); - - // Perform search - size_t index = start_index; // No matches found prior to this index. - while (index <= subject_length - pattern_length) { - size_t j = pattern_length - 1; - int subject_char; - while (last_char != (subject_char = subject[index + j])) { - int bc_occ = CharOccurrence(char_occurrences, subject_char); - int shift = j - bc_occ; - index += shift; - badness += 1 - shift; // at most zero, so badness cannot increase. - if (index > subject_length - pattern_length) { - return subject_length; - } - } - j--; - while (pattern_[j] == (subject[index + j])) { - if (j == 0) { - return index; - } - j--; - } - index += last_char_shift; - // Badness increases by the number of characters we have - // checked, and decreases by the number of characters we - // can skip by shifting. It's a measure of how we are doing - // compared to reading each character exactly once. - badness += (pattern_length - j) - last_char_shift; - if (badness > 0) { - PopulateBoyerMooreTable(); - strategy_ = SearchStrategy::kBoyerMoore; - return BoyerMooreSearch(subject, index); - } - } - return subject.length(); -} - -template -void StringSearch::PopulateBoyerMooreHorspoolTable() { - const size_t pattern_length = pattern_.length(); - - int* bad_char_occurrence = bad_char_shift_table_; - - // Only preprocess at most kBMMaxShift last characters of pattern. - const size_t start = start_; - // Run forwards to populate bad_char_table, so that *last* instance - // of character equivalence class is the one registered. - // Notice: Doesn't include the last character. - const size_t table_size = AlphabetSize(); - if (start == 0) { - // All patterns less than kBMMaxShift in length. - memset(bad_char_occurrence, -1, table_size * sizeof(*bad_char_occurrence)); - } else { - for (size_t i = 0; i < table_size; i++) { - bad_char_occurrence[i] = start - 1; - } - } - for (size_t i = start; i < pattern_length - 1; i++) { - Char c = pattern_[i]; - int bucket = (sizeof(Char) == 1) ? c : c % AlphabetSize(); - bad_char_occurrence[bucket] = i; - } -} - -//--------------------------------------------------------------------- -// Linear string search with bailout to BMH. -//--------------------------------------------------------------------- - -// Simple linear search for short patterns, which bails out if the string -// isn't found very early in the subject. Upgrades to BoyerMooreHorspool. -template -size_t StringSearch::InitialSearch( - Vector subject, - size_t index) { - const size_t pattern_length = pattern_.length(); - // Badness is a count of how much work we have done. When we have - // done enough work we decide it's probably worth switching to a better - // algorithm. - int64_t badness = -10 - (pattern_length << 2); - - // We know our pattern is at least 2 characters, we cache the first so - // the common case of the first character not matching is faster. - for (size_t i = index, n = subject.length() - pattern_length; i <= n; i++) { - badness++; - if (badness <= 0) { - i = FindFirstCharacter(pattern_, subject, i); - if (i == subject.length()) - return subject.length(); - CHECK_LE(i, n); - size_t j = 1; - do { - if (pattern_[j] != subject[i + j]) { - break; - } - j++; - } while (j < pattern_length); - if (j == pattern_length) { - return i; - } - badness += j; - } else { - PopulateBoyerMooreHorspoolTable(); - strategy_ = SearchStrategy::kBoyerMooreHorspool; - return BoyerMooreHorspoolSearch(subject, i); - } - } - return subject.length(); -} - -// Perform a single stand-alone search. -// If searching multiple times for the same pattern, a search -// object should be constructed once and the Search function then called -// for each search. -template -size_t SearchString(Vector subject, - Vector pattern, - size_t start_index) { - StringSearch search(pattern); - return search.Search(subject, start_index); -} -} // namespace stringsearch -} // namespace node - -namespace node { - -template -size_t SearchString(const Char* haystack, - size_t haystack_length, - const Char* needle, - size_t needle_length, - size_t start_index, - bool is_forward) { - if (haystack_length < needle_length) return haystack_length; - // To do a reverse search (lastIndexOf instead of indexOf) without redundant - // code, create two vectors that are reversed views into the input strings. - // For example, v_needle[0] would return the *last* character of the needle. - // So we're searching for the first instance of rev(needle) in rev(haystack) - stringsearch::Vector v_needle(needle, needle_length, is_forward); - stringsearch::Vector v_haystack( - haystack, haystack_length, is_forward); - size_t diff = haystack_length - needle_length; - size_t relative_start_index; - if (is_forward) { - relative_start_index = start_index; - } else if (diff < start_index) { - relative_start_index = 0; - } else { - relative_start_index = diff - start_index; - } - size_t pos = node::stringsearch::SearchString( - v_haystack, v_needle, relative_start_index); - if (pos == haystack_length) { - // not found - return pos; - } - return is_forward ? pos : (haystack_length - needle_length - pos); -} - -template -size_t SearchString(const char* haystack, size_t haystack_length, - const char (&needle)[N]) { - return SearchString( - reinterpret_cast(haystack), haystack_length, - reinterpret_cast(needle), N - 1, 0, true); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_STRING_SEARCH_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tcp_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/tcp_wrap.h deleted file mode 100644 index 3abf4ded..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tcp_wrap.h +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_TCP_WRAP_H_ -#define SRC_TCP_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "async_wrap.h" -#include "connection_wrap.h" - -namespace node { - -class ExternalReferenceRegistry; -class Environment; - -class TCPWrap : public ConnectionWrap { - public: - enum SocketType { - SOCKET, - SERVER - }; - - static v8::MaybeLocal Instantiate(Environment* env, - AsyncWrap* parent, - SocketType type); - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - SET_NO_MEMORY_INFO() - SET_SELF_SIZE(TCPWrap) - std::string MemoryInfoName() const override { - switch (provider_type()) { - case ProviderType::PROVIDER_TCPWRAP: - return "TCPSocketWrap"; - case ProviderType::PROVIDER_TCPSERVERWRAP: - return "TCPServerWrap"; - default: - UNREACHABLE(); - } - } - - private: - typedef uv_tcp_t HandleType; - - template - friend void GetSockOrPeerName(const v8::FunctionCallbackInfo&); - - TCPWrap(Environment* env, v8::Local object, - ProviderType provider); - - static void New(const v8::FunctionCallbackInfo& args); - static void SetNoDelay(const v8::FunctionCallbackInfo& args); - static void SetKeepAlive(const v8::FunctionCallbackInfo& args); - static void Bind(const v8::FunctionCallbackInfo& args); - static void Bind6(const v8::FunctionCallbackInfo& args); - static void Listen(const v8::FunctionCallbackInfo& args); - static void Connect(const v8::FunctionCallbackInfo& args); - static void Connect6(const v8::FunctionCallbackInfo& args); - template - static void Connect(const v8::FunctionCallbackInfo& args, - std::function uv_ip_addr); - static void Open(const v8::FunctionCallbackInfo& args); - template - static void Bind( - const v8::FunctionCallbackInfo& args, - int family, - std::function uv_ip_addr); - -#ifdef _WIN32 - static void SetSimultaneousAccepts( - const v8::FunctionCallbackInfo& args); -#endif -}; - - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_TCP_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/threadpoolwork-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/threadpoolwork-inl.h deleted file mode 100644 index 8bba988b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/threadpoolwork-inl.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_THREADPOOLWORK_INL_H_ -#define SRC_THREADPOOLWORK_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "util-inl.h" -#include "node_internals.h" - -namespace node { - -void ThreadPoolWork::ScheduleWork() { - env_->IncreaseWaitingRequestCounter(); - int status = uv_queue_work( - env_->event_loop(), - &work_req_, - [](uv_work_t* req) { - ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req); - self->DoThreadPoolWork(); - }, - [](uv_work_t* req, int status) { - ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req); - self->env_->DecreaseWaitingRequestCounter(); - self->AfterThreadPoolWork(status); - }); - CHECK_EQ(status, 0); -} - -int ThreadPoolWork::CancelWork() { - return uv_cancel(reinterpret_cast(&work_req_)); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_THREADPOOLWORK_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/timer_wrap-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/timer_wrap-inl.h deleted file mode 100644 index d60ea15a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/timer_wrap-inl.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SRC_TIMER_WRAP_INL_H_ -#define SRC_TIMER_WRAP_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "timer_wrap.h" - -#include - -#include "env.h" -#include "uv.h" - -namespace node { - -template -inline TimerWrap::TimerWrap(Environment* env, Args&&... args) - : env_(env), fn_(std::forward(args)...) { - uv_timer_init(env->event_loop(), &timer_); - timer_.data = this; -} - -template -inline TimerWrapHandle::TimerWrapHandle(Environment* env, Args&&... args) { - timer_ = new TimerWrap(env, std::forward(args)...); - env->AddCleanupHook(CleanupHook, this); -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_TIMER_WRAP_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/timer_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/timer_wrap.h deleted file mode 100644 index ac8f00f0..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/timer_wrap.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef SRC_TIMER_WRAP_H_ -#define SRC_TIMER_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "memory_tracker.h" -#include "env.h" -#include "uv.h" - -#include - -namespace node { - -// Utility class that makes working with libuv timers a bit easier. -class TimerWrap final : public MemoryRetainer { - public: - using TimerCb = std::function; - - template - explicit inline TimerWrap(Environment* env, Args&&... args); - - TimerWrap(const TimerWrap&) = delete; - - inline Environment* env() const { return env_; } - - // Stop calling the timer callback. - void Stop(); - // Render the timer unusable and delete this object. - void Close(); - - // Starts / Restarts the Timer - void Update(uint64_t interval, uint64_t repeat = 0); - - void Ref(); - void Unref(); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(TimerWrap) - SET_SELF_SIZE(TimerWrap) - - private: - static void TimerClosedCb(uv_handle_t* handle); - static void OnTimeout(uv_timer_t* timer); - ~TimerWrap() = default; - - Environment* env_; - TimerCb fn_; - uv_timer_t timer_; - - friend std::unique_ptr::deleter_type; -}; - -class TimerWrapHandle : public MemoryRetainer { - public: - template - explicit inline TimerWrapHandle(Environment* env, Args&&... args); - - TimerWrapHandle(const TimerWrapHandle&) = delete; - - ~TimerWrapHandle() { Close(); } - - void Update(uint64_t interval, uint64_t repeat = 0); - - void Ref(); - void Unref(); - - void Stop(); - void Close(); - - void MemoryInfo(node::MemoryTracker* tracker) const override; - - SET_MEMORY_INFO_NAME(TimerWrapHandle) - SET_SELF_SIZE(TimerWrapHandle) - - private: - static void CleanupHook(void* data); - - TimerWrap* timer_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_TIMER_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tracing/agent.h b/repo/packages/s/scriptx-legacy/include/libnode/tracing/agent.h deleted file mode 100644 index b542a849..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tracing/agent.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef SRC_TRACING_AGENT_H_ -#define SRC_TRACING_AGENT_H_ - -#include "libplatform/v8-tracing.h" -#include "uv.h" -#include "util.h" -#include "node_mutex.h" - -#include -#include -#include -#include - -namespace v8 { -class ConvertableToTraceFormat; -class TracingController; -} // namespace v8 - -namespace node { -namespace tracing { - -using v8::platform::tracing::TraceConfig; -using v8::platform::tracing::TraceObject; - -class Agent; - -class AsyncTraceWriter { - public: - virtual ~AsyncTraceWriter() = default; - virtual void AppendTraceEvent(TraceObject* trace_event) = 0; - virtual void Flush(bool blocking) = 0; - virtual void InitializeOnThread(uv_loop_t* loop) {} -}; - -class TracingController : public v8::platform::tracing::TracingController { - public: - TracingController() : v8::platform::tracing::TracingController() {} - - int64_t CurrentTimestampMicroseconds() override { - return uv_hrtime() / 1000; - } - void AddMetadataEvent( - const unsigned char* category_group_enabled, - const char* name, - int num_args, - const char** arg_names, - const unsigned char* arg_types, - const uint64_t* arg_values, - std::unique_ptr* convertable_values, - unsigned int flags); -}; - -class AgentWriterHandle { - public: - inline AgentWriterHandle() = default; - inline ~AgentWriterHandle() { reset(); } - - inline AgentWriterHandle(AgentWriterHandle&& other); - inline AgentWriterHandle& operator=(AgentWriterHandle&& other); - inline bool empty() const { return agent_ == nullptr; } - inline void reset(); - - inline void Enable(const std::set& categories); - inline void Disable(const std::set& categories); - - inline bool IsDefaultHandle(); - - inline Agent* agent() { return agent_; } - - inline v8::TracingController* GetTracingController(); - - AgentWriterHandle(const AgentWriterHandle& other) = delete; - AgentWriterHandle& operator=(const AgentWriterHandle& other) = delete; - - private: - inline AgentWriterHandle(Agent* agent, int id) : agent_(agent), id_(id) {} - - Agent* agent_ = nullptr; - int id_ = 0; - - friend class Agent; -}; - -class Agent { - public: - Agent(); - ~Agent(); - - TracingController* GetTracingController() { - TracingController* controller = tracing_controller_.get(); - CHECK_NOT_NULL(controller); - return controller; - } - - enum UseDefaultCategoryMode { - kUseDefaultCategories, - kIgnoreDefaultCategories - }; - - // Destroying the handle disconnects the client - AgentWriterHandle AddClient(const std::set& categories, - std::unique_ptr writer, - enum UseDefaultCategoryMode mode); - // A handle that is only used for managing the default categories - // (which can then implicitly be used through using `USE_DEFAULT_CATEGORIES` - // when adding a client later). - AgentWriterHandle DefaultHandle(); - - // Returns a comma-separated list of enabled categories. - std::string GetEnabledCategories() const; - - // Writes to all writers registered through AddClient(). - void AppendTraceEvent(TraceObject* trace_event); - - void AddMetadataEvent(std::unique_ptr event); - // Flushes all writers registered through AddClient(). - void Flush(bool blocking); - - TraceConfig* CreateTraceConfig() const; - - private: - friend class AgentWriterHandle; - - void InitializeWritersOnThread(); - - void Start(); - void StopTracing(); - void Disconnect(int client); - - void Enable(int id, const std::set& categories); - void Disable(int id, const std::set& categories); - - uv_thread_t thread_; - uv_loop_t tracing_loop_; - - bool started_ = false; - class ScopedSuspendTracing; - - // Each individual Writer has one id. - int next_writer_id_ = 1; - enum { kDefaultHandleId = -1 }; - // These maps store the original arguments to AddClient(), by id. - std::unordered_map> categories_; - std::unordered_map> writers_; - std::unique_ptr tracing_controller_; - - // Variables related to initializing per-event-loop properties of individual - // writers, such as libuv handles. - Mutex initialize_writer_mutex_; - ConditionVariable initialize_writer_condvar_; - uv_async_t initialize_writer_async_; - std::set to_be_initialized_; - - Mutex metadata_events_mutex_; - std::list> metadata_events_; -}; - -void AgentWriterHandle::reset() { - if (agent_ != nullptr) - agent_->Disconnect(id_); - agent_ = nullptr; -} - -AgentWriterHandle& AgentWriterHandle::operator=(AgentWriterHandle&& other) { - reset(); - agent_ = other.agent_; - id_ = other.id_; - other.agent_ = nullptr; - return *this; -} - -AgentWriterHandle::AgentWriterHandle(AgentWriterHandle&& other) { - *this = std::move(other); -} - -void AgentWriterHandle::Enable(const std::set& categories) { - if (agent_ != nullptr) agent_->Enable(id_, categories); -} - -void AgentWriterHandle::Disable(const std::set& categories) { - if (agent_ != nullptr) agent_->Disable(id_, categories); -} - -bool AgentWriterHandle::IsDefaultHandle() { - return agent_ != nullptr && id_ == Agent::kDefaultHandleId; -} - -inline v8::TracingController* AgentWriterHandle::GetTracingController() { - return agent_ != nullptr ? agent_->GetTracingController() : nullptr; -} - -} // namespace tracing -} // namespace node - -#endif // SRC_TRACING_AGENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_buffer.h b/repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_buffer.h deleted file mode 100644 index 18e4f43e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_buffer.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef SRC_TRACING_NODE_TRACE_BUFFER_H_ -#define SRC_TRACING_NODE_TRACE_BUFFER_H_ - -#include "tracing/agent.h" -#include "node_mutex.h" -#include "libplatform/v8-tracing.h" - -#include - -namespace node { -namespace tracing { - -using v8::platform::tracing::TraceBuffer; -using v8::platform::tracing::TraceBufferChunk; -using v8::platform::tracing::TraceObject; - -// forward declaration -class NodeTraceBuffer; - -class InternalTraceBuffer { - public: - InternalTraceBuffer(size_t max_chunks, uint32_t id, Agent* agent); - - TraceObject* AddTraceEvent(uint64_t* handle); - TraceObject* GetEventByHandle(uint64_t handle); - void Flush(bool blocking); - bool IsFull() const { - return total_chunks_ == max_chunks_ && chunks_[total_chunks_ - 1]->IsFull(); - } - bool IsFlushing() const { - return flushing_; - } - - private: - uint64_t MakeHandle(size_t chunk_index, uint32_t chunk_seq, - size_t event_index) const; - void ExtractHandle(uint64_t handle, uint32_t* buffer_id, size_t* chunk_index, - uint32_t* chunk_seq, size_t* event_index) const; - size_t Capacity() const { return max_chunks_ * TraceBufferChunk::kChunkSize; } - - Mutex mutex_; - bool flushing_; - size_t max_chunks_; - Agent* agent_; - std::vector> chunks_; - size_t total_chunks_ = 0; - uint32_t current_chunk_seq_ = 1; - uint32_t id_; -}; - -class NodeTraceBuffer : public TraceBuffer { - public: - NodeTraceBuffer(size_t max_chunks, Agent* agent, uv_loop_t* tracing_loop); - ~NodeTraceBuffer() override; - - TraceObject* AddTraceEvent(uint64_t* handle) override; - TraceObject* GetEventByHandle(uint64_t handle) override; - bool Flush() override; - - static const size_t kBufferChunks = 1024; - - private: - bool TryLoadAvailableBuffer(); - static void NonBlockingFlushSignalCb(uv_async_t* signal); - static void ExitSignalCb(uv_async_t* signal); - - uv_loop_t* tracing_loop_; - uv_async_t flush_signal_; - uv_async_t exit_signal_; - bool exited_ = false; - // Used exclusively for exit logic. - Mutex exit_mutex_; - // Used to wait until async handles have been closed. - ConditionVariable exit_cond_; - std::atomic current_buf_; - InternalTraceBuffer buffer1_; - InternalTraceBuffer buffer2_; -}; - -} // namespace tracing -} // namespace node - -#endif // SRC_TRACING_NODE_TRACE_BUFFER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_writer.h b/repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_writer.h deleted file mode 100644 index cd965d77..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tracing/node_trace_writer.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef SRC_TRACING_NODE_TRACE_WRITER_H_ -#define SRC_TRACING_NODE_TRACE_WRITER_H_ - -#include -#include - -#include "libplatform/v8-tracing.h" -#include "tracing/agent.h" -#include "uv.h" - -namespace node { -namespace tracing { - -using v8::platform::tracing::TraceObject; -using v8::platform::tracing::TraceWriter; - -class NodeTraceWriter : public AsyncTraceWriter { - public: - explicit NodeTraceWriter(const std::string& log_file_pattern); - ~NodeTraceWriter() override; - - void InitializeOnThread(uv_loop_t* loop) override; - void AppendTraceEvent(TraceObject* trace_event) override; - void Flush(bool blocking) override; - - static const int kTracesPerFile = 1 << 19; - - private: - struct WriteRequest { - std::string str; - int highest_request_id; - }; - - void AfterWrite(); - void StartWrite(uv_buf_t buf); - void OpenNewFileForStreaming(); - void WriteToFile(std::string&& str, int highest_request_id); - void WriteSuffix(); - void FlushPrivate(); - static void ExitSignalCb(uv_async_t* signal); - - uv_loop_t* tracing_loop_ = nullptr; - // Triggers callback to initiate writing the contents of stream_ to disk. - uv_async_t flush_signal_; - // Triggers callback to close async objects, ending the tracing thread. - uv_async_t exit_signal_; - // Prevents concurrent R/W on state related to serialized trace data - // before it's written to disk, namely stream_ and total_traces_ - // as well as json_trace_writer_. - Mutex stream_mutex_; - // Prevents concurrent R/W on state related to write requests. - // If both mutexes are locked, request_mutex_ has to be locked first. - Mutex request_mutex_; - // Allows blocking calls to Flush() to wait on a condition for - // trace events to be written to disk. - ConditionVariable request_cond_; - // Used to wait until async handles have been closed. - ConditionVariable exit_cond_; - int fd_ = -1; - uv_fs_t write_req_; - std::queue write_req_queue_; - int num_write_requests_ = 0; - int highest_request_id_completed_ = 0; - int total_traces_ = 0; - int file_num_ = 0; - std::string log_file_pattern_; - std::ostringstream stream_; - std::unique_ptr json_trace_writer_; - bool exited_ = false; -}; - -} // namespace tracing -} // namespace node - -#endif // SRC_TRACING_NODE_TRACE_WRITER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event.h b/repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event.h deleted file mode 100644 index be0f55a4..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event.h +++ /dev/null @@ -1,720 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SRC_TRACING_TRACE_EVENT_H_ -#define SRC_TRACING_TRACE_EVENT_H_ - -#include "v8-platform.h" -#include "tracing/agent.h" -#include "trace_event_common.h" -#include - -// This header file defines implementation details of how the trace macros in -// trace_event_common.h collect and store trace events. Anything not -// implementation-specific should go in trace_macros_common.h instead of here. - - -// The pointer returned from GetCategoryGroupEnabled() points to a -// value with zero or more of the following bits. Used in this class only. -// The TRACE_EVENT macros should only use the value as a bool. -// These values must be in sync with macro values in trace_log.h in -// chromium. -enum CategoryGroupEnabledFlags { - // Category group enabled for the recording mode. - kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0, - // Category group enabled by SetEventCallbackEnabled(). - kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2, - // Category group enabled to export events to ETW. - kEnabledForETWExport_CategoryGroupEnabledFlags = 1 << 3, -}; - -// By default, const char* argument values are assumed to have long-lived scope -// and will not be copied. Use this macro to force a const char* to be copied. -#define TRACE_STR_COPY(str) node::tracing::TraceStringWithCopy(str) - -// By default, uint64 ID argument values are not mangled with the Process ID in -// TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. -#define TRACE_ID_MANGLE(id) node::tracing::TraceID::ForceMangle(id) - -// By default, pointers are mangled with the Process ID in TRACE_EVENT_ASYNC -// macros. Use this macro to prevent Process ID mangling. -#define TRACE_ID_DONT_MANGLE(id) node::tracing::TraceID::DontMangle(id) - -// By default, trace IDs are eventually converted to a single 64-bit number. Use -// this macro to add a scope string. -#define TRACE_ID_WITH_SCOPE(scope, id) \ - trace_event_internal::TraceID::WithScope(scope, id) - -#define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \ - *INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ - (kEnabledForRecording_CategoryGroupEnabledFlags | \ - kEnabledForEventCallback_CategoryGroupEnabledFlags) - -// The following macro has no implementation, but it needs to exist since -// it gets called from scoped trace events. It cannot call UNIMPLEMENTED() -// since an empty implementation is a valid one. -#define INTERNAL_TRACE_MEMORY(category, name) - -//////////////////////////////////////////////////////////////////////////////// -// Implementation specific tracing API definitions. - -// Get a pointer to the enabled state of the given trace category. Only -// long-lived literal strings should be given as the category group. The -// returned pointer can be held permanently in a local static for example. If -// the unsigned char is non-zero, tracing is enabled. If tracing is enabled, -// TRACE_EVENT_API_ADD_TRACE_EVENT can be called. It's OK if tracing is disabled -// between the load of the tracing state and the call to -// TRACE_EVENT_API_ADD_TRACE_EVENT, because this flag only provides an early out -// for best performance when tracing is disabled. -// const uint8_t* -// TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(const char* category_group) -#define TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED \ - node::tracing::TraceEventHelper::GetCategoryGroupEnabled - -// Get the number of times traces have been recorded. This is used to implement -// the TRACE_EVENT_IS_NEW_TRACE facility. -// unsigned int TRACE_EVENT_API_GET_NUM_TRACES_RECORDED() -#define TRACE_EVENT_API_GET_NUM_TRACES_RECORDED UNIMPLEMENTED() - -// Add a trace event to the platform tracing system. -// uint64_t TRACE_EVENT_API_ADD_TRACE_EVENT( -// char phase, -// const uint8_t* category_group_enabled, -// const char* name, -// const char* scope, -// uint64_t id, -// uint64_t bind_id, -// int num_args, -// const char** arg_names, -// const uint8_t* arg_types, -// const uint64_t* arg_values, -// unsigned int flags) -#define TRACE_EVENT_API_ADD_TRACE_EVENT node::tracing::AddTraceEventImpl - -// Add a trace event to the platform tracing system. -// uint64_t TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_TIMESTAMP( -// char phase, -// const uint8_t* category_group_enabled, -// const char* name, -// const char* scope, -// uint64_t id, -// uint64_t bind_id, -// int num_args, -// const char** arg_names, -// const uint8_t* arg_types, -// const uint64_t* arg_values, -// unsigned int flags, -// int64_t timestamp) -#define TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_TIMESTAMP \ - node::tracing::AddTraceEventWithTimestampImpl - -// Set the duration field of a COMPLETE trace event. -// void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( -// const uint8_t* category_group_enabled, -// const char* name, -// uint64_t id) -#define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ - if (auto controller = \ - node::tracing::TraceEventHelper::GetTracingController()) \ - controller->UpdateTraceEventDuration - -// Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method -// on the convertable value will be called at flush time. -// TRACE_EVENT_API_ADD_METADATA_EVENT( -// const unsigned char* category_group_enabled, -// const char* event_name, -// const char* arg_name, -// std::unique_ptr arg_value) -#define TRACE_EVENT_API_ADD_METADATA_EVENT node::tracing::AddMetadataEvent - -// Defines atomic operations used internally by the tracing system. -#define TRACE_EVENT_API_ATOMIC_WORD std::atomic -#define TRACE_EVENT_API_ATOMIC_WORD_VALUE intptr_t -#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var).load() -#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var).store(value) - -//////////////////////////////////////////////////////////////////////////////// - -// Implementation detail: trace event macros create temporary variables -// to keep instrumentation overhead low. These macros give each temporary -// variable a unique name based on the line number to prevent name collisions. -#define INTERNAL_TRACE_EVENT_UID3(a, b) trace_event_unique_##a##b -#define INTERNAL_TRACE_EVENT_UID2(a, b) INTERNAL_TRACE_EVENT_UID3(a, b) -#define INTERNAL_TRACE_EVENT_UID(name_prefix) \ - INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__) - -// Implementation detail: internal macro to create static category. -// No barriers are needed, because this code is designed to operate safely -// even when the unsigned char* points to garbage data (which may be the case -// on processors without cache coherency). -// TODO(fmeawad): This implementation contradicts that we can have a different -// configuration for each isolate, -// https://code.google.com/p/v8/issues/detail?id=4563 -#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \ - category_group, atomic, category_group_enabled) \ - category_group_enabled = \ - reinterpret_cast(TRACE_EVENT_API_ATOMIC_LOAD(atomic)); \ - if (!category_group_enabled) { \ - category_group_enabled = \ - TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \ - TRACE_EVENT_API_ATOMIC_STORE( \ - atomic, reinterpret_cast( \ - category_group_enabled)); \ - } - -#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ - static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) {0}; \ - const uint8_t* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \ - category_group, INTERNAL_TRACE_EVENT_UID(atomic), \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled)); - -// Implementation detail: internal macro to create static category and add -// event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - node::tracing::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - node::tracing::kGlobalScope, node::tracing::kNoId, \ - node::tracing::kNoId, flags, ##__VA_ARGS__); \ - } \ - } while (0) - -// Implementation detail: internal macro to create static category and add begin -// event if the category is enabled. Also adds the end event when the scope -// ends. -#define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - node::tracing::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - uint64_t h = node::tracing::AddTraceEvent( \ - TRACE_EVENT_PHASE_COMPLETE, \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - node::tracing::kGlobalScope, node::tracing::kNoId, \ - node::tracing::kNoId, TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \ - INTERNAL_TRACE_EVENT_UID(tracer) \ - .Initialize(INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - h); \ - } - -#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, \ - bind_id, flow_flags, ...) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - node::tracing::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - unsigned int trace_event_flags = flow_flags; \ - node::tracing::TraceID trace_event_bind_id(bind_id, \ - &trace_event_flags); \ - uint64_t h = node::tracing::AddTraceEvent( \ - TRACE_EVENT_PHASE_COMPLETE, \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - node::tracing::kGlobalScope, node::tracing::kNoId, \ - trace_event_bind_id.raw_id(), trace_event_flags, ##__VA_ARGS__); \ - INTERNAL_TRACE_EVENT_UID(tracer) \ - .Initialize(INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - h); \ - } - -// Implementation detail: internal macro to create static category and add -// event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ - flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ - node::tracing::TraceID trace_event_trace_id(id, \ - &trace_event_flags); \ - node::tracing::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ - node::tracing::kNoId, trace_event_flags, ##__VA_ARGS__); \ - } \ - } while (0) - -// Adds a trace event with a given timestamp. -#define INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP(phase, category_group, name, \ - timestamp, flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - node::tracing::AddTraceEventWithTimestamp( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - node::tracing::kGlobalScope, node::tracing::kNoId, \ - node::tracing::kNoId, flags, timestamp, ##__VA_ARGS__); \ - } \ - } while (0) - -// Adds a trace event with a given id and timestamp. Not Implemented. -#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_AND_TIMESTAMP( \ - phase, category_group, name, id, timestamp, flags, ...) \ - UNIMPLEMENTED() - -// Adds a trace event with a given id, thread_id, and timestamp. Not -// Implemented. -#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - phase, category_group, name, id, thread_id, timestamp, flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ - node::tracing::TraceID trace_event_trace_id(id, \ - &trace_event_flags); \ - node::tracing::AddTraceEventWithTimestamp( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ - node::tracing::kNoId, trace_event_flags, timestamp, ##__VA_ARGS__);\ - } \ - } while (0) - -#define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - TRACE_EVENT_API_ADD_METADATA_EVENT( \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - ##__VA_ARGS__); \ - } \ - } while(0) - -// Enter and leave a context based on the current scope. -#define INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \ - struct INTERNAL_TRACE_EVENT_UID(ScopedContext) { \ - public: \ - INTERNAL_TRACE_EVENT_UID(ScopedContext)(uint64_t cid) : cid_(cid) { \ - TRACE_EVENT_ENTER_CONTEXT(category_group, name, cid_); \ - } \ - ~INTERNAL_TRACE_EVENT_UID(ScopedContext)() { \ - TRACE_EVENT_LEAVE_CONTEXT(category_group, name, cid_); \ - } \ - \ - private: \ - /* Local class friendly DISALLOW_COPY_AND_ASSIGN */ \ - INTERNAL_TRACE_EVENT_UID(ScopedContext) \ - (const INTERNAL_TRACE_EVENT_UID(ScopedContext)&) {} \ - void operator=(const INTERNAL_TRACE_EVENT_UID(ScopedContext)&) {} \ - uint64_t cid_; \ - }; \ - INTERNAL_TRACE_EVENT_UID(ScopedContext) \ - INTERNAL_TRACE_EVENT_UID(scoped_context)(context); - -namespace node { -namespace tracing { - -// Specify these values when the corresponding argument of AddTraceEvent is not -// used. -const int kZeroNumArgs = 0; -const decltype(nullptr) kGlobalScope = nullptr; -const uint64_t kNoId = 0; - -class TraceEventHelper { - public: - static v8::TracingController* GetTracingController(); - static void SetTracingController(v8::TracingController* controller); - - static Agent* GetAgent(); - static void SetAgent(Agent* agent); - - static inline const uint8_t* GetCategoryGroupEnabled(const char* group) { - v8::TracingController* controller = GetTracingController(); - static const uint8_t disabled = 0; - if (UNLIKELY(controller == nullptr)) return &disabled; - return controller->GetCategoryGroupEnabled(group); - } -}; - -// TraceID encapsulates an ID that can either be an integer or pointer. Pointers -// are by default mangled with the Process ID so that they are unlikely to -// collide when the same pointer is used on different processes. -class TraceID { - public: - class WithScope { - public: - WithScope(const char* scope, uint64_t raw_id) - : scope_(scope), raw_id_(raw_id) {} - uint64_t raw_id() const { return raw_id_; } - const char* scope() const { return scope_; } - - private: - const char* scope_ = nullptr; - uint64_t raw_id_; - }; - - class DontMangle { - public: - explicit DontMangle(const void* raw_id) - : raw_id_(static_cast(reinterpret_cast(raw_id))) {} - explicit DontMangle(uint64_t raw_id) : raw_id_(raw_id) {} - explicit DontMangle(unsigned int raw_id) : raw_id_(raw_id) {} - explicit DontMangle(uint16_t raw_id) : raw_id_(raw_id) {} - explicit DontMangle(unsigned char raw_id) : raw_id_(raw_id) {} - explicit DontMangle(int64_t raw_id) - : raw_id_(static_cast(raw_id)) {} - explicit DontMangle(int raw_id) : raw_id_(static_cast(raw_id)) {} - explicit DontMangle(int16_t raw_id) - : raw_id_(static_cast(raw_id)) {} - explicit DontMangle(signed char raw_id) - : raw_id_(static_cast(raw_id)) {} - explicit DontMangle(WithScope scoped_id) - : scope_(scoped_id.scope()), raw_id_(scoped_id.raw_id()) {} - const char* scope() const { return scope_; } - uint64_t raw_id() const { return raw_id_; } - - private: - const char* scope_ = nullptr; - uint64_t raw_id_; - }; - - class ForceMangle { - public: - explicit ForceMangle(uint64_t raw_id) : raw_id_(raw_id) {} - explicit ForceMangle(unsigned int raw_id) : raw_id_(raw_id) {} - explicit ForceMangle(uint16_t raw_id) : raw_id_(raw_id) {} - explicit ForceMangle(unsigned char raw_id) : raw_id_(raw_id) {} - explicit ForceMangle(int64_t raw_id) - : raw_id_(static_cast(raw_id)) {} - explicit ForceMangle(int raw_id) : raw_id_(static_cast(raw_id)) {} - explicit ForceMangle(int16_t raw_id) - : raw_id_(static_cast(raw_id)) {} - explicit ForceMangle(signed char raw_id) - : raw_id_(static_cast(raw_id)) {} - uint64_t raw_id() const { return raw_id_; } - - private: - uint64_t raw_id_; - }; - - TraceID(const void* raw_id, unsigned int* flags) - : raw_id_(static_cast(reinterpret_cast(raw_id))) { - *flags |= TRACE_EVENT_FLAG_MANGLE_ID; - } - TraceID(ForceMangle raw_id, unsigned int* flags) : raw_id_(raw_id.raw_id()) { - *flags |= TRACE_EVENT_FLAG_MANGLE_ID; - } - TraceID(DontMangle maybe_scoped_id, unsigned int* flags) - : scope_(maybe_scoped_id.scope()), raw_id_(maybe_scoped_id.raw_id()) {} - TraceID(uint64_t raw_id, unsigned int* flags) : raw_id_(raw_id) { - (void)flags; - } - TraceID(unsigned int raw_id, unsigned int* flags) : raw_id_(raw_id) { - (void)flags; - } - TraceID(uint16_t raw_id, unsigned int* flags) : raw_id_(raw_id) { - (void)flags; - } - TraceID(unsigned char raw_id, unsigned int* flags) : raw_id_(raw_id) { - (void)flags; - } - TraceID(int64_t raw_id, unsigned int* flags) - : raw_id_(static_cast(raw_id)) { - (void)flags; - } - TraceID(int raw_id, unsigned int* flags) - : raw_id_(static_cast(raw_id)) { - (void)flags; - } - TraceID(int16_t raw_id, unsigned int* flags) - : raw_id_(static_cast(raw_id)) { - (void)flags; - } - TraceID(signed char raw_id, unsigned int* flags) - : raw_id_(static_cast(raw_id)) { - (void)flags; - } - TraceID(WithScope scoped_id, unsigned int* flags) - : scope_(scoped_id.scope()), raw_id_(scoped_id.raw_id()) {} - - uint64_t raw_id() const { return raw_id_; } - const char* scope() const { return scope_; } - - private: - const char* scope_ = nullptr; - uint64_t raw_id_; -}; - -// Simple union to store various types as uint64_t. -union TraceValueUnion { - bool as_bool; - uint64_t as_uint; - int64_t as_int; - double as_double; - const void* as_pointer; - const char* as_string; -}; - -// Simple container for const char* that should be copied instead of retained. -class TraceStringWithCopy { - public: - explicit TraceStringWithCopy(const char* str) : str_(str) {} - operator const char*() const { return str_; } - - private: - const char* str_; -}; - -static inline uint64_t AddTraceEventImpl( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, unsigned int flags) { - std::unique_ptr arg_convertibles[2]; - if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) { - arg_convertibles[0].reset(reinterpret_cast( - static_cast(arg_values[0]))); - } - if (num_args > 1 && arg_types[1] == TRACE_VALUE_TYPE_CONVERTABLE) { - arg_convertibles[1].reset(reinterpret_cast( - static_cast(arg_values[1]))); - } - // DCHECK(num_args, 2); - v8::TracingController* controller = - node::tracing::TraceEventHelper::GetTracingController(); - if (controller == nullptr) return 0; - return controller->AddTraceEvent(phase, category_group_enabled, name, scope, id, - bind_id, num_args, arg_names, arg_types, - arg_values, arg_convertibles, flags); -} - -static V8_INLINE uint64_t AddTraceEventWithTimestampImpl( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, unsigned int flags, int64_t timestamp) { - std::unique_ptr arg_convertables[2]; - if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) { - arg_convertables[0].reset(reinterpret_cast( - static_cast(arg_values[0]))); - } - if (num_args > 1 && arg_types[1] == TRACE_VALUE_TYPE_CONVERTABLE) { - arg_convertables[1].reset(reinterpret_cast( - static_cast(arg_values[1]))); - } - // DCHECK_LE(num_args, 2); - v8::TracingController* controller = - node::tracing::TraceEventHelper::GetTracingController(); - if (controller == nullptr) return 0; - return controller->AddTraceEventWithTimestamp( - phase, category_group_enabled, name, scope, id, bind_id, num_args, - arg_names, arg_types, arg_values, arg_convertables, flags, timestamp); -} - -static V8_INLINE void AddMetadataEventImpl( - const uint8_t* category_group_enabled, const char* name, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, unsigned int flags) { - std::unique_ptr arg_convertibles[2]; - if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) { - arg_convertibles[0].reset(reinterpret_cast( - static_cast(arg_values[0]))); - } - if (num_args > 1 && arg_types[1] == TRACE_VALUE_TYPE_CONVERTABLE) { - arg_convertibles[1].reset(reinterpret_cast( - static_cast(arg_values[1]))); - } - node::tracing::Agent* agent = - node::tracing::TraceEventHelper::GetAgent(); - if (agent == nullptr) return; - return agent->GetTracingController()->AddMetadataEvent( - category_group_enabled, name, num_args, arg_names, arg_types, arg_values, - arg_convertibles, flags); -} - -// Define SetTraceValue for each allowed type. It stores the type and -// value in the return arguments. This allows this API to avoid declaring any -// structures so that it is portable to third_party libraries. -#define INTERNAL_DECLARE_SET_TRACE_VALUE(actual_type, union_member, \ - value_type_id) \ - static inline void SetTraceValue(actual_type arg, unsigned char* type, \ - uint64_t* value) { \ - TraceValueUnion type_value; \ - type_value.union_member = arg; \ - *type = value_type_id; \ - *value = type_value.as_uint; \ - } -// Simpler form for int types that can be safely casted. -#define INTERNAL_DECLARE_SET_TRACE_VALUE_INT(actual_type, value_type_id) \ - static inline void SetTraceValue(actual_type arg, unsigned char* type, \ - uint64_t* value) { \ - *type = value_type_id; \ - *value = static_cast(arg); \ - } - -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(uint64_t, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned int, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(uint16_t, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned char, TRACE_VALUE_TYPE_UINT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(int64_t, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(int, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(int16_t, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE_INT(signed char, TRACE_VALUE_TYPE_INT) -INTERNAL_DECLARE_SET_TRACE_VALUE(bool, as_bool, TRACE_VALUE_TYPE_BOOL) -INTERNAL_DECLARE_SET_TRACE_VALUE(double, as_double, TRACE_VALUE_TYPE_DOUBLE) -INTERNAL_DECLARE_SET_TRACE_VALUE(const void*, as_pointer, - TRACE_VALUE_TYPE_POINTER) -INTERNAL_DECLARE_SET_TRACE_VALUE(const char*, as_string, - TRACE_VALUE_TYPE_STRING) -INTERNAL_DECLARE_SET_TRACE_VALUE(const TraceStringWithCopy&, as_string, - TRACE_VALUE_TYPE_COPY_STRING) - -#undef INTERNAL_DECLARE_SET_TRACE_VALUE -#undef INTERNAL_DECLARE_SET_TRACE_VALUE_INT - -static inline void SetTraceValue(v8::ConvertableToTraceFormat* convertable_value, - unsigned char* type, uint64_t* value) { - *type = TRACE_VALUE_TYPE_CONVERTABLE; - *value = static_cast(reinterpret_cast(convertable_value)); -} - -template -static inline typename std::enable_if< - std::is_convertible::value>::type -SetTraceValue(std::unique_ptr ptr, unsigned char* type, uint64_t* value) { - SetTraceValue(ptr.release(), type, value); -} - -// These AddTraceEvent template -// function is defined here instead of in the macro, because the arg_values -// could be temporary objects, such as std::string. In order to store -// pointers to the internal c_str and pass through to the tracing API, -// the arg_values must live throughout these procedures. - -static inline uint64_t AddTraceEvent(char phase, - const uint8_t* category_group_enabled, - const char* name, const char* scope, - uint64_t id, uint64_t bind_id, - unsigned int flags) { - return TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name, - scope, id, bind_id, kZeroNumArgs, - nullptr, nullptr, nullptr, flags); -} - -template -static inline uint64_t AddTraceEvent( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags, - const char* arg1_name, ARG1_TYPE&& arg1_val) { - const int num_args = 1; - uint8_t arg_type; - uint64_t arg_value; - SetTraceValue(std::forward(arg1_val), &arg_type, &arg_value); - return TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_group_enabled, name, scope, id, bind_id, num_args, - &arg1_name, &arg_type, &arg_value, flags); -} - -template -static inline uint64_t AddTraceEvent( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags, - const char* arg1_name, ARG1_TYPE&& arg1_val, const char* arg2_name, - ARG2_TYPE&& arg2_val) { - const int num_args = 2; - const char* arg_names[2] = {arg1_name, arg2_name}; - unsigned char arg_types[2]; - uint64_t arg_values[2]; - SetTraceValue(std::forward(arg1_val), &arg_types[0], - &arg_values[0]); - SetTraceValue(std::forward(arg2_val), &arg_types[1], - &arg_values[1]); - return TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_group_enabled, name, scope, id, bind_id, num_args, - arg_names, arg_types, arg_values, flags); -} - -static V8_INLINE uint64_t AddTraceEventWithTimestamp( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags, - int64_t timestamp) { - return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_TIMESTAMP( - phase, category_group_enabled, name, scope, id, bind_id, kZeroNumArgs, - nullptr, nullptr, nullptr, flags, timestamp); -} - -template -static V8_INLINE uint64_t AddTraceEventWithTimestamp( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags, - int64_t timestamp, const char* arg1_name, ARG1_TYPE&& arg1_val) { - const int num_args = 1; - uint8_t arg_type; - uint64_t arg_value; - SetTraceValue(std::forward(arg1_val), &arg_type, &arg_value); - return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_TIMESTAMP( - phase, category_group_enabled, name, scope, id, bind_id, num_args, - &arg1_name, &arg_type, &arg_value, flags, timestamp); -} - -template -static V8_INLINE uint64_t AddTraceEventWithTimestamp( - char phase, const uint8_t* category_group_enabled, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, unsigned int flags, - int64_t timestamp, const char* arg1_name, ARG1_TYPE&& arg1_val, - const char* arg2_name, ARG2_TYPE&& arg2_val) { - const int num_args = 2; - const char* arg_names[2] = {arg1_name, arg2_name}; - unsigned char arg_types[2]; - uint64_t arg_values[2]; - SetTraceValue(std::forward(arg1_val), &arg_types[0], - &arg_values[0]); - SetTraceValue(std::forward(arg2_val), &arg_types[1], - &arg_values[1]); - return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_TIMESTAMP( - phase, category_group_enabled, name, scope, id, bind_id, num_args, - arg_names, arg_types, arg_values, flags, timestamp); -} - -template -static V8_INLINE void AddMetadataEvent( - const uint8_t* category_group_enabled, const char* name, - const char* arg1_name, ARG1_TYPE&& arg1_val) { - const int num_args = 1; - uint8_t arg_type; - uint64_t arg_value; - SetTraceValue(std::forward(arg1_val), &arg_type, &arg_value); - AddMetadataEventImpl( - category_group_enabled, name, num_args, &arg1_name, &arg_type, &arg_value, - TRACE_EVENT_FLAG_NONE); -} - -// Used by TRACE_EVENTx macros. Do not use directly. -class ScopedTracer { - public: - // Note: members of data_ intentionally left uninitialized. See Initialize. - ScopedTracer() : p_data_(nullptr) {} - - ~ScopedTracer() { - if (p_data_ && *data_.category_group_enabled) - TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( - data_.category_group_enabled, data_.name, data_.event_handle); - } - - void Initialize(const uint8_t* category_group_enabled, const char* name, - uint64_t event_handle) { - data_.category_group_enabled = category_group_enabled; - data_.name = name; - data_.event_handle = event_handle; - p_data_ = &data_; - } - - private: - // This Data struct workaround is to avoid initializing all the members - // in Data during construction of this object, since this object is always - // constructed, even when tracing is disabled. If the members of Data were - // members of this class instead, compiler warnings occur about potential - // uninitialized accesses. - struct Data { - const uint8_t* category_group_enabled; - const char* name; - uint64_t event_handle; - }; - Data* p_data_; - Data data_; -}; - -} // namespace tracing -} // namespace node - -#endif // SRC_TRACING_TRACE_EVENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event_common.h b/repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event_common.h deleted file mode 100644 index be1c68cf..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tracing/trace_event_common.h +++ /dev/null @@ -1,1109 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SRC_TRACE_EVENT_COMMON_H -#define SRC_TRACE_EVENT_COMMON_H - -// This header file defines the set of trace_event macros without specifying -// how the events actually get collected and stored. If you need to expose trace -// events to some other universe, you can copy-and-paste this file as well as -// trace_event.h, modifying the macros contained there as necessary for the -// target platform. The end result is that multiple libraries can funnel events -// through to a shared trace event collector. - -// IMPORTANT: To avoid conflicts, if you need to modify this file for a library, -// land your change in base/ first, and then copy-and-paste it. - -// Trace events are for tracking application performance and resource usage. -// Macros are provided to track: -// Begin and end of function calls -// Counters -// -// Events are issued against categories. Whereas LOG's -// categories are statically defined, TRACE categories are created -// implicitly with a string. For example: -// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent", -// TRACE_EVENT_SCOPE_THREAD) -// -// It is often the case that one trace may belong in multiple categories at the -// same time. The first argument to the trace can be a comma-separated list of -// categories, forming a category group, like: -// -// TRACE_EVENT_INSTANT0("input,views", "OnMouseOver", TRACE_EVENT_SCOPE_THREAD) -// -// We can enable/disable tracing of OnMouseOver by enabling/disabling either -// category. -// -// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope: -// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly") -// doSomethingCostly() -// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly") -// Note: our tools can't always determine the correct BEGIN/END pairs unless -// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you -// need them to be in separate scopes. -// -// A common use case is to trace entire function scopes. This -// issues a trace BEGIN and END automatically: -// void doSomethingCostly() { -// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly"); -// ... -// } -// -// Additional parameters can be associated with an event: -// void doSomethingCostly2(int howMuch) { -// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly", -// "howMuch", howMuch); -// ... -// } -// -// The trace system will automatically add to this information the -// current process id, thread id, and a timestamp in microseconds. -// -// To trace an asynchronous procedure such as an IPC send/receive, use -// ASYNC_BEGIN and ASYNC_END: -// [single threaded sender code] -// static int send_count = 0; -// ++send_count; -// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count); -// Send(new MyMessage(send_count)); -// [receive code] -// void OnMyMessage(send_count) { -// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count); -// } -// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs. -// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process. -// Pointers can be used for the ID parameter, and they will be mangled -// internally so that the same pointer on two different processes will not -// match. For example: -// class MyTracedClass { -// public: -// MyTracedClass() { -// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this); -// } -// ~MyTracedClass() { -// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this); -// } -// } -// -// Trace event also supports counters, which is a way to track a quantity -// as it varies over time. Counters are created with the following macro: -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue); -// -// Counters are process-specific. The macro itself can be issued from any -// thread, however. -// -// Sometimes, you want to track two counters at once. You can do this with two -// counter macros: -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]); -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]); -// Or you can do it with a combined macro: -// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter", -// "bytesPinned", g_myCounterValue[0], -// "bytesAllocated", g_myCounterValue[1]); -// This indicates to the tracing UI that these counters should be displayed -// in a single graph, as a summed area chart. -// -// Since counters are in a global namespace, you may want to disambiguate with a -// unique ID, by using the TRACE_COUNTER_ID* variations. -// -// By default, trace collection is compiled in, but turned off at runtime. -// Collecting trace data is the responsibility of the embedding -// application. In Chrome's case, navigating to about:tracing will turn on -// tracing and display data collected across all active processes. -// -// -// Memory scoping note: -// Tracing copies the pointers, not the string content, of the strings passed -// in for category_group, name, and arg_names. Thus, the following code will -// cause problems: -// char* str = strdup("importantName"); -// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD! -// free(str); // Trace system now has dangling pointer -// -// To avoid this issue with the |name| and |arg_name| parameters, use the -// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime overhead. -// Notes: The category must always be in a long-lived char* (i.e. static const). -// The |arg_values|, when used, are always deep copied with the _COPY -// macros. -// -// When are string argument values copied: -// const char* arg_values are only referenced by default: -// TRACE_EVENT1("category", "name", -// "arg1", "literal string is only referenced"); -// Use TRACE_STR_COPY to force copying of a const char*: -// TRACE_EVENT1("category", "name", -// "arg1", TRACE_STR_COPY("string will be copied")); -// std::string arg_values are always copied: -// TRACE_EVENT1("category", "name", -// "arg1", std::string("string will be copied")); -// -// -// Convertable notes: -// Converting a large data type to a string can be costly. To help with this, -// the trace framework provides an interface ConvertableToTraceFormat. If you -// inherit from it and implement the AppendAsTraceFormat method the trace -// framework will call back to your object to convert a trace output time. This -// means, if the category for the event is disabled, the conversion will not -// happen. -// -// class MyData : public base::trace_event::ConvertableToTraceFormat { -// public: -// MyData() {} -// void AppendAsTraceFormat(std::string* out) const override { -// out->append("{\"foo\":1}"); -// } -// MyData(const MyData&) = delete; -// MyData& operator=(const MyData&) = delete; -// -// private: -// ~MyData() override {} -// }; -// -// TRACE_EVENT1("foo", "bar", "data", -// std::unique_ptr(new MyData())); -// -// The trace framework will take ownership if the passed pointer and it will -// be free'd when the trace buffer is flushed. -// -// Note, we only do the conversion when the buffer is flushed, so the provided -// data object should not be modified after it's passed to the trace framework. -// -// -// Thread Safety: -// A thread safe singleton and mutex are used for thread safety. Category -// enabled flags are used to limit the performance impact when the system -// is not enabled. -// -// TRACE_EVENT macros first cache a pointer to a category. The categories are -// statically allocated and safe at all times, even after exit. Fetching a -// category is protected by the TraceLog::lock_. Multiple threads initializing -// the static variable is safe, as they will be serialized by the lock and -// multiple calls will return the same pointer to the category. -// -// Then the category_group_enabled flag is checked. This is a unsigned char, and -// not intended to be multithread safe. It optimizes access to AddTraceEvent -// which is threadsafe internally via TraceLog::lock_. The enabled flag may -// cause some threads to incorrectly call or skip calling AddTraceEvent near -// the time of the system being enabled or disabled. This is acceptable as -// we tolerate some data loss while the system is being enabled/disabled and -// because AddTraceEvent is threadsafe internally and checks the enabled state -// again under lock. -// -// Without the use of these static category pointers and enabled flags all -// trace points would carry a significant performance cost of acquiring a lock -// and resolving the category. - -// Check that nobody includes this file directly. Clients are supposed to -// include the surrounding "trace_event.h" of their project instead. -#if defined(TRACE_EVENT0) -#error "Another copy of this file has already been included." -#endif - -// This will mark the trace event as disabled by default. The user will need -// to explicitly enable the event. -#define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name - -// Records a pair of begin and end events called "name" for the current -// scope, with 0, 1 or 2 associated arguments. If the category is not -// enabled, then this does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT0(category_group, name) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) -#define TRACE_EVENT_WITH_FLOW0(category_group, name, bind_id, flow_flags) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ - flow_flags) -#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) -#define TRACE_EVENT_WITH_FLOW1(category_group, name, bind_id, flow_flags, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ - flow_flags, arg1_name, arg1_val) -#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_WITH_FLOW2(category_group, name, bind_id, flow_flags, \ - arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ - flow_flags, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Records a single event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_INSTANT0(category_group, name, scope) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ - TRACE_EVENT_FLAG_NONE | scope) -#define TRACE_EVENT_INSTANT1(category_group, name, scope, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ - TRACE_EVENT_FLAG_NONE | scope, arg1_name, arg1_val) -#define TRACE_EVENT_INSTANT2(category_group, name, scope, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ - TRACE_EVENT_FLAG_NONE | scope, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_INSTANT0(category_group, name, scope) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ - TRACE_EVENT_FLAG_COPY | scope) -#define TRACE_EVENT_COPY_INSTANT1(category_group, name, scope, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ - TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_INSTANT2(category_group, name, scope, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ - TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -#define TRACE_EVENT_INSTANT_WITH_TIMESTAMP0(category_group, name, scope, \ - timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_INSTANT, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE | scope) - -#define TRACE_EVENT_INSTANT_WITH_TIMESTAMP1(category_group, name, scope, \ - timestamp, arg_name, arg_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_INSTANT, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE | scope, arg_name, arg_val) - -// Records a single BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_BEGIN(category_group, name, ...) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__) -#define TRACE_EVENT_BEGIN0(category_group, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_BEGIN1(category_group, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_BEGIN2(category_group, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_BEGIN0(category_group, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_BEGIN1(category_group, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_BEGIN2(category_group, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Similar to TRACE_EVENT_BEGINx but with a custom |at| timestamp provided. -// - |id| is used to match the _BEGIN event with the _END event. -// Events are considered to match if their category_group, name and id values -// all match. |id| must either be a pointer or an integer value up to 64 bits. -// If it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -#define TRACE_EVENT_BEGIN_WITH_ID_TID_AND_TIMESTAMP0(category_group, name, id, \ - thread_id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0( \ - category_group, name, id, thread_id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP1( \ - category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP2( \ - category_group, name, id, thread_id, timestamp, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \ - arg2_val) - -// Records a single END event for "name" immediately. If the category -// is not enabled, then this does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_END(category_group, name, ...) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__) -#define TRACE_EVENT_END0(category_group, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_END1(category_group, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_END2(category_group, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_END0(category_group, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_END1(category_group, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_END2(category_group, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -#define TRACE_EVENT_MARK_WITH_TIMESTAMP0(category_group, name, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE) - -#define TRACE_EVENT_MARK_WITH_TIMESTAMP1(category_group, name, timestamp, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) - -#define TRACE_EVENT_MARK_WITH_TIMESTAMP2( \ - category_group, name, timestamp, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) - -#define TRACE_EVENT_COPY_MARK(category_group, name) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_MARK, category_group, name, \ - TRACE_EVENT_FLAG_COPY) - -#define TRACE_EVENT_COPY_MARK_WITH_TIMESTAMP(category_group, name, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_COPY) - -// Similar to TRACE_EVENT_ENDx but with a custom |at| timestamp provided. -// - |id| is used to match the _BEGIN event with the _END event. -// Events are considered to match if their category_group, name and id values -// all match. |id| must either be a pointer or an integer value up to 64 bits. -// If it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -#define TRACE_EVENT_END_WITH_ID_TID_AND_TIMESTAMP0(category_group, name, id, \ - thread_id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0( \ - category_group, name, id, thread_id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP1( \ - category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP2( \ - category_group, name, id, thread_id, timestamp, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ - timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \ - arg2_val) - -// Records the value of a counter called "name" immediately. Value -// must be representable as a 32 bit integer. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_COUNTER1(category_group, name, value) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \ - TRACE_EVENT_FLAG_NONE, "value", \ - static_cast(value)) -#define TRACE_COPY_COUNTER1(category_group, name, value) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \ - TRACE_EVENT_FLAG_COPY, "value", \ - static_cast(value)) - -// Records the values of a multi-parted counter called "name" immediately. -// The UI will treat value1 and value2 as parts of a whole, displaying their -// values as a stacked-bar chart. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_COUNTER2(category_group, name, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \ - TRACE_EVENT_FLAG_NONE, value1_name, \ - static_cast(value1_val), value2_name, \ - static_cast(value2_val)) -#define TRACE_COPY_COUNTER2(category_group, name, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \ - TRACE_EVENT_FLAG_COPY, value1_name, \ - static_cast(value1_val), value2_name, \ - static_cast(value2_val)) - -// Similar to TRACE_COUNTERx, but with a custom |timestamp| provided. -#define TRACE_COUNTER_WITH_TIMESTAMP1(category_group, name, timestamp, value) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_COUNTER, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE, "value", static_cast(value)) - -#define TRACE_COUNTER_WITH_TIMESTAMP2(category_group, name, timestamp, \ - value1_name, value1_val, value2_name, \ - value2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_COUNTER, category_group, name, timestamp, \ - TRACE_EVENT_FLAG_NONE, value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) - -// Records the value of a counter called "name" immediately. Value -// must be representable as a 32 bit integer. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either -// be a pointer or an integer value up to 64 bits. If it's a pointer, the bits -// will be xored with a hash of the process ID so that the same pointer on -// two different processes will not collide. -#define TRACE_COUNTER_ID1(category_group, name, id, value) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, "value", \ - static_cast(value)) -#define TRACE_COPY_COUNTER_ID1(category_group, name, id, value) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY, "value", \ - static_cast(value)) - -// Records the values of a multi-parted counter called "name" immediately. -// The UI will treat value1 and value2 as parts of a whole, displaying their -// values as a stacked-bar chart. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either -// be a pointer or an integer value up to 64 bits. If it's a pointer, the bits -// will be xored with a hash of the process ID so that the same pointer on -// two different processes will not collide. -#define TRACE_COUNTER_ID2(category_group, name, id, value1_name, value1_val, \ - value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, \ - value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) -#define TRACE_COPY_COUNTER_ID2(category_group, name, id, value1_name, \ - value1_val, value2_name, value2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY, \ - value1_name, static_cast(value1_val), \ - value2_name, static_cast(value2_val)) - -// TRACE_EVENT_SAMPLE_* events are injected by the sampling profiler. -#define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP0(category_group, name, \ - thread_id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ - TRACE_EVENT_FLAG_NONE) - -#define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP1( \ - category_group, name, thread_id, timestamp, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) - -#define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP2(category_group, name, \ - thread_id, timestamp, \ - arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) - -#define TRACE_EVENT_SAMPLE_WITH_ID1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_SAMPLE, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \ - arg1_val) - -// ASYNC_STEP_* APIs should be only used by legacy code. New code should -// consider using NESTABLE_ASYNC_* APIs to describe substeps within an async -// event. -// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC -// events are considered to match if their category_group, name and id values -// all match. |id| must either be a pointer or an integer value up to 64 bits. -// If it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -// -// An asynchronous operation can consist of multiple phases. The first phase is -// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the -// ASYNC_STEP_INTO or ASYNC_STEP_PAST macros. The ASYNC_STEP_INTO macro will -// annotate the block following the call. The ASYNC_STEP_PAST macro will -// annotate the block prior to the call. Note that any particular event must use -// only STEP_INTO or STEP_PAST macros; they can not mix and match. When the -// operation completes, call ASYNC_END. -// -// An ASYNC trace typically occurs on a single thread (if not, they will only be -// drawn on the thread defined in the ASYNC_BEGIN event), but all events in that -// operation must use the same |name| and |id|. Each step can have its own -// args. -#define TRACE_EVENT_ASYNC_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_ASYNC_BEGIN1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val) - -// Similar to TRACE_EVENT_ASYNC_BEGINx but with a custom |at| timestamp -// provided. -#define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, id, \ - timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( \ - category_group, name, id, timestamp, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val) -#define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP2(category_group, name, id, \ - timestamp, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, id, \ - timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY) - -// Records a single ASYNC_STEP_INTO event for |step| immediately. If the -// category is not enabled, then this does nothing. The |name| and |id| must -// match the ASYNC_BEGIN event above. The |step| param identifies this step -// within the async event. This should be called at the beginning of the next -// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any -// ASYNC_STEP_PAST events. -#define TRACE_EVENT_ASYNC_STEP_INTO0(category_group, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step) -#define TRACE_EVENT_ASYNC_STEP_INTO1(category_group, name, id, step, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ASYNC_STEP_INTO, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val) - -// Similar to TRACE_EVENT_ASYNC_STEP_INTOx but with a custom |at| timestamp -// provided. -#define TRACE_EVENT_ASYNC_STEP_INTO_WITH_TIMESTAMP0(category_group, name, id, \ - step, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_STEP_INTO, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - "step", step) - -// Records a single ASYNC_STEP_PAST event for |step| immediately. If the -// category is not enabled, then this does nothing. The |name| and |id| must -// match the ASYNC_BEGIN event above. The |step| param identifies this step -// within the async event. This should be called at the beginning of the next -// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any -// ASYNC_STEP_INTO events. -#define TRACE_EVENT_ASYNC_STEP_PAST0(category_group, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step) -#define TRACE_EVENT_ASYNC_STEP_PAST1(category_group, name, id, step, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ASYNC_STEP_PAST, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val) - -// Records a single ASYNC_END event for "name" immediately. If the category -// is not enabled, then this does nothing. -#define TRACE_EVENT_ASYNC_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_ASYNC_END1(category_group, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_ASYNC_END2(category_group, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_ASYNC_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_ASYNC_END1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_ASYNC_END2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val) - -// Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided. -#define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, name, id, \ - timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP1(category_group, name, id, \ - timestamp, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val) -#define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP2(category_group, name, id, \ - timestamp, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val, arg2_name, arg2_val) - -// NESTABLE_ASYNC_* APIs are used to describe an async operation, which can -// be nested within a NESTABLE_ASYNC event and/or have inner NESTABLE_ASYNC -// events. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - A pair of NESTABLE_ASYNC_BEGIN event and NESTABLE_ASYNC_END event is -// considered as a match if their category_group, name and id all match. -// - |id| must either be a pointer or an integer value up to 64 bits. -// If it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -// - |id| is used to match a child NESTABLE_ASYNC event with its parent -// NESTABLE_ASYNC event. Therefore, events in the same nested event tree must -// be logged using the same id and category_group. -// -// Unmatched NESTABLE_ASYNC_END event will be parsed as an event that starts -// at the first NESTABLE_ASYNC event of that id, and unmatched -// NESTABLE_ASYNC_BEGIN event will be parsed as an event that ends at the last -// NESTABLE_ASYNC event of that id. Corresponding warning messages for -// unmatched events will be shown in the analysis view. - -// Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with -// 0, 1 or 2 associated arguments. If the category is not enabled, then this -// does nothing. -#define TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) -// Records a single NESTABLE_ASYNC_END event called "name" immediately, with 0 -// or 2 associated arguments. If the category is not enabled, then this does -// nothing. -#define TRACE_EVENT_NESTABLE_ASYNC_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) -// Records a single NESTABLE_ASYNC_END event called "name" immediately, with 1 -// associated argument. If the category is not enabled, then this does nothing. -#define TRACE_EVENT_NESTABLE_ASYNC_END1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) - -// Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, -// with none, one or two associated argument. If the category is not enabled, -// then this does nothing. -#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) - -#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT1(category_group, name, id, \ - arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) - -#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2( \ - category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) - -#define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TTS2( \ - category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) -#define TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TTS2( \ - category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ - arg2_name, arg2_val) - -// Similar to TRACE_EVENT_NESTABLE_ASYNC_{BEGIN,END}x but with a custom -// |timestamp| provided. -#define TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, \ - id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_NESTABLE_ASYNC_END_WITH_TIMESTAMP0(category_group, name, \ - id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_NESTABLE_ASYNC_END_WITH_TIMESTAMP1( \ - category_group, name, id, timestamp, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - arg1_name, arg1_val) -#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT_WITH_TIMESTAMP0( \ - category_group, name, id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( \ - category_group, name, id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0( \ - category_group, name, id, timestamp) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY) - -// Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW -// events are considered to match if their category_group, name and id values -// all match. |id| must either be a pointer or an integer value up to 64 bits. -// If it's a pointer, the bits will be xored with a hash of the process ID so -// that the same pointer on two different processes will not collide. -// FLOW events are different from ASYNC events in how they are drawn by the -// tracing UI. A FLOW defines asynchronous data flow, such as posting a task -// (FLOW_BEGIN) and later executing that task (FLOW_END). Expect FLOWs to be -// drawn as lines or arrows from FLOW_BEGIN scopes to FLOW_END scopes. Similar -// to ASYNC, a FLOW can consist of multiple phases. The first phase is defined -// by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP -// macros. When the operation completes, call FLOW_END. An async operation can -// span threads and processes, but all events in that operation must use the -// same |name| and |id|. Each event can have its own args. -#define TRACE_EVENT_FLOW_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_FLOW_BEGIN1(category_group, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) -#define TRACE_EVENT_FLOW_BEGIN2(category_group, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_FLOW_BEGIN0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_FLOW_BEGIN1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_BEGIN2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_BEGIN, category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val) - -// Records a single FLOW_STEP event for |step| immediately. If the category -// is not enabled, then this does nothing. The |name| and |id| must match the -// FLOW_BEGIN event above. The |step| param identifies this step within the -// async event. This should be called at the beginning of the next phase of an -// asynchronous operation. -#define TRACE_EVENT_FLOW_STEP0(category_group, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step) -#define TRACE_EVENT_FLOW_STEP1(category_group, name, id, step, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_STEP, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val) -#define TRACE_EVENT_COPY_FLOW_STEP0(category_group, name, id, step) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ - category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, "step", step) -#define TRACE_EVENT_COPY_FLOW_STEP1(category_group, name, id, step, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_FLOW_STEP, category_group, name, id, \ - TRACE_EVENT_FLAG_COPY, "step", step, arg1_name, arg1_val) - -// Records a single FLOW_END event for "name" immediately. If the category -// is not enabled, then this does nothing. -#define TRACE_EVENT_FLOW_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, \ - TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) -#define TRACE_EVENT_FLOW_END1(category_group, name, id, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \ - arg1_val) -#define TRACE_EVENT_FLOW_END2(category_group, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \ - arg1_val, arg2_name, arg2_val) -#define TRACE_EVENT_COPY_FLOW_END0(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY) -#define TRACE_EVENT_COPY_FLOW_END1(category_group, name, id, arg1_name, \ - arg1_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY, arg1_name, \ - arg1_val) -#define TRACE_EVENT_COPY_FLOW_END2(category_group, name, id, arg1_name, \ - arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \ - name, id, TRACE_EVENT_FLAG_COPY, arg1_name, \ - arg1_val, arg2_name, arg2_val) - -// Special trace event macro to trace task execution with the location where it -// was posted from. -#define TRACE_TASK_EXECUTION(run_function, task) \ - INTERNAL_TRACE_TASK_EXECUTION(run_function, task) - -// TRACE_EVENT_METADATA* events are information related to other -// injected events, not events in their own right. -#define TRACE_EVENT_METADATA1(category_group, name, arg1_name, arg1_val) \ - INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, arg1_name, arg1_val) - -// Records a clock sync event. -#define TRACE_EVENT_CLOCK_SYNC_RECEIVER(sync_id) \ - INTERNAL_TRACE_EVENT_ADD( \ - TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \ - TRACE_EVENT_FLAG_NONE, "sync_id", sync_id) -#define TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts) \ - INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ - TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \ - issue_end_ts, TRACE_EVENT_FLAG_NONE, \ - "sync_id", sync_id, "issue_ts", issue_ts) - -// Macros to track the life time and value of arbitrary client objects. -// See also TraceTrackableObject. -#define TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) - -#define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, \ - snapshot) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ - id, TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) - -#define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( \ - category_group, name, id, timestamp, snapshot) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ - id, TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \ - "snapshot", snapshot) - -#define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE) - -// Records entering and leaving trace event contexts. |category_group| and -// |name| specify the context category and type. |context| is a -// snapshotted context object id. -#define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, context, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, context, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \ - INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) - -// Macro to specify that two trace IDs are identical. For example, -// TRACE_LINK_IDS( -// "category", "name", -// TRACE_ID_WITH_SCOPE("net::URLRequest", 0x1000), -// TRACE_ID_WITH_SCOPE("blink::ResourceFetcher::FetchRequest", 0x2000)) -// tells the trace consumer that events with ID ("net::URLRequest", 0x1000) from -// the current process have the same ID as events with ID -// ("blink::ResourceFetcher::FetchRequest", 0x2000). -#define TRACE_LINK_IDS(category_group, name, id, linked_id) \ - INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id, linked_id); - -// Macro to efficiently determine if a given category group is enabled. -#define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - *ret = true; \ - } else { \ - *ret = false; \ - } \ - } while (0) - -// Macro to explicitly warm up a given category group. This could be useful in -// cases where we want to initialize a category group before any trace events -// for that category group is reported. For example, to have a category group -// always show up in the "record categories" list for manually selecting -// settings in about://tracing. -#define TRACE_EVENT_WARMUP_CATEGORY(category_group) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) - -// Macro to efficiently determine, through polling, if a new trace has begun. -#define TRACE_EVENT_IS_NEW_TRACE(ret) \ - do { \ - static int INTERNAL_TRACE_EVENT_UID(lastRecordingNumber) = 0; \ - int num_traces_recorded = TRACE_EVENT_API_GET_NUM_TRACES_RECORDED(); \ - if (num_traces_recorded != -1 && \ - num_traces_recorded != \ - INTERNAL_TRACE_EVENT_UID(lastRecordingNumber)) { \ - INTERNAL_TRACE_EVENT_UID(lastRecordingNumber) = num_traces_recorded; \ - *ret = true; \ - } else { \ - *ret = false; \ - } \ - } while (0) - -// Notes regarding the following definitions: -// New values can be added and propagated to third party libraries, but existing -// definitions must never be changed, because third party libraries may use old -// definitions. - -// Phase indicates the nature of an event entry. E.g. part of a begin/end pair. -#define TRACE_EVENT_PHASE_BEGIN ('B') -#define TRACE_EVENT_PHASE_END ('E') -#define TRACE_EVENT_PHASE_COMPLETE ('X') -#define TRACE_EVENT_PHASE_INSTANT ('I') -#define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') -#define TRACE_EVENT_PHASE_ASYNC_STEP_INTO ('T') -#define TRACE_EVENT_PHASE_ASYNC_STEP_PAST ('p') -#define TRACE_EVENT_PHASE_ASYNC_END ('F') -#define TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN ('b') -#define TRACE_EVENT_PHASE_NESTABLE_ASYNC_END ('e') -#define TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT ('n') -#define TRACE_EVENT_PHASE_FLOW_BEGIN ('s') -#define TRACE_EVENT_PHASE_FLOW_STEP ('t') -#define TRACE_EVENT_PHASE_FLOW_END ('f') -#define TRACE_EVENT_PHASE_METADATA ('M') -#define TRACE_EVENT_PHASE_COUNTER ('C') -#define TRACE_EVENT_PHASE_SAMPLE ('P') -#define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') -#define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') -#define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') -#define TRACE_EVENT_PHASE_MEMORY_DUMP ('v') -#define TRACE_EVENT_PHASE_MARK ('R') -#define TRACE_EVENT_PHASE_CLOCK_SYNC ('c') -#define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(') -#define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')') -#define TRACE_EVENT_PHASE_LINK_IDS ('=') - -// Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. -#define TRACE_EVENT_FLAG_NONE (static_cast(0)) -#define TRACE_EVENT_FLAG_COPY (static_cast(1 << 0)) -#define TRACE_EVENT_FLAG_HAS_ID (static_cast(1 << 1)) -// TODO(crbug.com/639003): Free this bit after ID mangling is deprecated. -#define TRACE_EVENT_FLAG_MANGLE_ID (static_cast(1 << 2)) -#define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast(1 << 3)) -#define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast(1 << 4)) -#define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast(1 << 5)) -#define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast(1 << 6)) -#define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast(1 << 7)) -#define TRACE_EVENT_FLAG_FLOW_IN (static_cast(1 << 8)) -#define TRACE_EVENT_FLAG_FLOW_OUT (static_cast(1 << 9)) -#define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast(1 << 10)) -#define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast(1 << 11)) -#define TRACE_EVENT_FLAG_HAS_LOCAL_ID (static_cast(1 << 12)) -#define TRACE_EVENT_FLAG_HAS_GLOBAL_ID (static_cast(1 << 13)) - -#define TRACE_EVENT_FLAG_SCOPE_MASK \ - (static_cast(TRACE_EVENT_FLAG_SCOPE_OFFSET | \ - TRACE_EVENT_FLAG_SCOPE_EXTRA)) - -// Type values for identifying types in the TraceValue union. -#define TRACE_VALUE_TYPE_BOOL (static_cast(1)) -#define TRACE_VALUE_TYPE_UINT (static_cast(2)) -#define TRACE_VALUE_TYPE_INT (static_cast(3)) -#define TRACE_VALUE_TYPE_DOUBLE (static_cast(4)) -#define TRACE_VALUE_TYPE_POINTER (static_cast(5)) -#define TRACE_VALUE_TYPE_STRING (static_cast(6)) -#define TRACE_VALUE_TYPE_COPY_STRING (static_cast(7)) -#define TRACE_VALUE_TYPE_CONVERTABLE (static_cast(8)) - -// Enum reflecting the scope of an INSTANT event. Must fit within -// TRACE_EVENT_FLAG_SCOPE_MASK. -#define TRACE_EVENT_SCOPE_GLOBAL (static_cast(0 << 3)) -#define TRACE_EVENT_SCOPE_PROCESS (static_cast(1 << 3)) -#define TRACE_EVENT_SCOPE_THREAD (static_cast(2 << 3)) - -#define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') -#define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') -#define TRACE_EVENT_SCOPE_NAME_THREAD ('t') - -#endif // SRC_TRACE_EVENT_COMMON_H diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tracing/traced_value.h b/repo/packages/s/scriptx-legacy/include/libnode/tracing/traced_value.h deleted file mode 100644 index 93c5be79..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tracing/traced_value.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SRC_TRACING_TRACED_VALUE_H_ -#define SRC_TRACING_TRACED_VALUE_H_ - -#include "node.h" -#include "util.h" -#include "v8.h" - -#include -#include -#include - -namespace node { -namespace tracing { - -class TracedValue : public v8::ConvertableToTraceFormat { - public: - ~TracedValue() override = default; - - static std::unique_ptr Create(); - static std::unique_ptr CreateArray(); - - void EndDictionary(); - void EndArray(); - - // These methods assume that |name| is a long lived "quoted" string. - void SetInteger(const char* name, int value); - void SetDouble(const char* name, double value); - void SetBoolean(const char* name, bool value); - void SetNull(const char* name); - void SetString(const char* name, const char* value); - void SetString(const char* name, const std::string& value) { - SetString(name, value.c_str()); - } - void BeginDictionary(const char* name); - void BeginArray(const char* name); - - void AppendInteger(int); - void AppendDouble(double); - void AppendBoolean(bool); - void AppendNull(); - void AppendString(const char*); - void AppendString(const std::string& value) { AppendString(value.c_str()); } - void BeginArray(); - void BeginDictionary(); - - // ConvertableToTraceFormat implementation. - void AppendAsTraceFormat(std::string* out) const override; - - TracedValue(const TracedValue&) = delete; - TracedValue& operator=(const TracedValue&) = delete; - - private: - explicit TracedValue(bool root_is_array = false); - - void WriteComma(); - void WriteName(const char* name); - - std::string data_; - bool first_item_; - bool root_is_array_; -}; - -} // namespace tracing -} // namespace node - -#endif // SRC_TRACING_TRACED_VALUE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/tty_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/tty_wrap.h deleted file mode 100644 index 5a7863cb..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/tty_wrap.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_TTY_WRAP_H_ -#define SRC_TTY_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "uv.h" -#include "stream_wrap.h" - -namespace node { - -class Environment; -class ExternalReferenceRegistry; - -class TTYWrap : public LibuvStreamWrap { - public: - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void RegisterExternalReferences(ExternalReferenceRegistry* registry); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(TTYWrap) - SET_SELF_SIZE(TTYWrap) - - private: - TTYWrap(Environment* env, - v8::Local object, - int fd, - bool readable, - int* init_err); - - static void IsTTY(const v8::FunctionCallbackInfo& args); - static void GetWindowSize(const v8::FunctionCallbackInfo& args); - static void SetRawMode(const v8::FunctionCallbackInfo& args); - static void New(const v8::FunctionCallbackInfo& args); - - uv_tty_t handle_; -}; - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_TTY_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/udp_wrap.h b/repo/packages/s/scriptx-legacy/include/libnode/udp_wrap.h deleted file mode 100644 index 75a123d8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/udp_wrap.h +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_UDP_WRAP_H_ -#define SRC_UDP_WRAP_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "handle_wrap.h" -#include "req_wrap.h" -#include "node_sockaddr.h" -#include "uv.h" -#include "v8.h" - -namespace node { - -class UDPWrapBase; - -// A listener that can be attached to an `UDPWrapBase` object and generally -// manages its I/O activity. This is similar to `StreamListener`. -class UDPListener { - public: - virtual ~UDPListener(); - - // Called right before data is received from the socket. Must return a - // buffer suitable for reading data into, that is then passed to OnRecv. - virtual uv_buf_t OnAlloc(size_t suggested_size) = 0; - - // Called right after data is received from the socket, and includes - // information about the source address. If `nread` is negative, an error - // has occurred, and it represents a libuv error code. - virtual void OnRecv(ssize_t nread, - const uv_buf_t& buf, - const sockaddr* addr, - unsigned int flags) = 0; - - // Called when an asynchronous request for writing data is created. - // The `msg_size` value contains the total size of the data to be sent, - // but may be ignored by the implementation of this Method. - // The return value is later passed to OnSendDone. - virtual ReqWrap* CreateSendWrap(size_t msg_size) = 0; - - // Called when an asynchronous request for writing data has finished. - // If status is negative, an error has occurred, and it represents a libuv - // error code. - virtual void OnSendDone(ReqWrap* wrap, int status) = 0; - - // Optional callback that is called after the socket has been bound. - virtual void OnAfterBind() {} - - inline UDPWrapBase* udp() const { return wrap_; } - - protected: - UDPWrapBase* wrap_ = nullptr; - - friend class UDPWrapBase; -}; - -class UDPWrapBase { - public: - // While UDPWrapBase itself does not extend from HandleWrap, classes - // derived from it will (like UDPWrap) - enum InternalFields { - kUDPWrapBaseField = HandleWrap::kInternalFieldCount, - kInternalFieldCount - }; - virtual ~UDPWrapBase(); - - // Start emitting OnAlloc() + OnRecv() events on the listener. - virtual int RecvStart() = 0; - - // Stop emitting OnAlloc() + OnRecv() events on the listener. - virtual int RecvStop() = 0; - - // Send a chunk of data over this socket. This may call CreateSendWrap() - // on the listener if an async transmission is necessary. - virtual ssize_t Send(uv_buf_t* bufs, - size_t nbufs, - const sockaddr* addr) = 0; - - virtual SocketAddress GetPeerName() = 0; - virtual SocketAddress GetSockName() = 0; - - // Returns an AsyncWrap object with the same lifetime as this object. - virtual AsyncWrap* GetAsyncWrap() = 0; - - void set_listener(UDPListener* listener); - UDPListener* listener() const; - - static UDPWrapBase* FromObject(v8::Local obj); - - static void RecvStart(const v8::FunctionCallbackInfo& args); - static void RecvStop(const v8::FunctionCallbackInfo& args); - static void AddMethods(Environment* env, v8::Local t); - - private: - UDPListener* listener_ = nullptr; -}; - -class UDPWrap final : public HandleWrap, - public UDPWrapBase, - public UDPListener { - public: - enum SocketType { - SOCKET - }; - static void Initialize(v8::Local target, - v8::Local unused, - v8::Local context, - void* priv); - static void GetFD(const v8::FunctionCallbackInfo& args); - static void New(const v8::FunctionCallbackInfo& args); - static void Open(const v8::FunctionCallbackInfo& args); - static void Bind(const v8::FunctionCallbackInfo& args); - static void Connect(const v8::FunctionCallbackInfo& args); - static void Send(const v8::FunctionCallbackInfo& args); - static void Bind6(const v8::FunctionCallbackInfo& args); - static void Connect6(const v8::FunctionCallbackInfo& args); - static void Send6(const v8::FunctionCallbackInfo& args); - static void Disconnect(const v8::FunctionCallbackInfo& args); - static void AddMembership(const v8::FunctionCallbackInfo& args); - static void DropMembership(const v8::FunctionCallbackInfo& args); - static void AddSourceSpecificMembership( - const v8::FunctionCallbackInfo& args); - static void DropSourceSpecificMembership( - const v8::FunctionCallbackInfo& args); - static void SetMulticastInterface( - const v8::FunctionCallbackInfo& args); - static void SetMulticastTTL(const v8::FunctionCallbackInfo& args); - static void SetMulticastLoopback( - const v8::FunctionCallbackInfo& args); - static void SetBroadcast(const v8::FunctionCallbackInfo& args); - static void SetTTL(const v8::FunctionCallbackInfo& args); - static void BufferSize(const v8::FunctionCallbackInfo& args); - - // UDPListener implementation - uv_buf_t OnAlloc(size_t suggested_size) override; - void OnRecv(ssize_t nread, - const uv_buf_t& buf, - const sockaddr* addr, - unsigned int flags) override; - ReqWrap* CreateSendWrap(size_t msg_size) override; - void OnSendDone(ReqWrap* wrap, int status) override; - - // UDPWrapBase implementation - int RecvStart() override; - int RecvStop() override; - ssize_t Send(uv_buf_t* bufs, - size_t nbufs, - const sockaddr* addr) override; - - SocketAddress GetPeerName() override; - SocketAddress GetSockName() override; - - AsyncWrap* GetAsyncWrap() override; - - static v8::MaybeLocal Instantiate(Environment* env, - AsyncWrap* parent, - SocketType type); - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(UDPWrap) - SET_SELF_SIZE(UDPWrap) - - private: - typedef uv_udp_t HandleType; - - template - friend void GetSockOrPeerName(const v8::FunctionCallbackInfo&); - - UDPWrap(Environment* env, v8::Local object); - - static void DoBind(const v8::FunctionCallbackInfo& args, - int family); - static void DoConnect(const v8::FunctionCallbackInfo& args, - int family); - static void DoSend(const v8::FunctionCallbackInfo& args, - int family); - static void SetMembership(const v8::FunctionCallbackInfo& args, - uv_membership membership); - static void SetSourceMembership( - const v8::FunctionCallbackInfo& args, - uv_membership membership); - - static void OnAlloc(uv_handle_t* handle, - size_t suggested_size, - uv_buf_t* buf); - static void OnRecv(uv_udp_t* handle, - ssize_t nread, - const uv_buf_t* buf, - const struct sockaddr* addr, - unsigned int flags); - - uv_udp_t handle_; - - bool current_send_has_callback_; - v8::Local current_send_req_wrap_; -}; - -int sockaddr_for_family(int address_family, - const char* address, - const unsigned short port, - sockaddr_storage* addr); - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_UDP_WRAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/util-inl.h b/repo/packages/s/scriptx-legacy/include/libnode/util-inl.h deleted file mode 100644 index b860c700..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/util-inl.h +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_UTIL_INL_H_ -#define SRC_UTIL_INL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include -#include -#include -#include "util.h" - -// These are defined by or on some systems. -// To avoid warnings, undefine them before redefining them. -#ifdef BSWAP_2 -# undef BSWAP_2 -#endif -#ifdef BSWAP_4 -# undef BSWAP_4 -#endif -#ifdef BSWAP_8 -# undef BSWAP_8 -#endif - -#if defined(_MSC_VER) -#include -#define BSWAP_2(x) _byteswap_ushort(x) -#define BSWAP_4(x) _byteswap_ulong(x) -#define BSWAP_8(x) _byteswap_uint64(x) -#else -#define BSWAP_2(x) ((x) << 8) | ((x) >> 8) -#define BSWAP_4(x) \ - (((x) & 0xFF) << 24) | \ - (((x) & 0xFF00) << 8) | \ - (((x) >> 8) & 0xFF00) | \ - (((x) >> 24) & 0xFF) -#define BSWAP_8(x) \ - (((x) & 0xFF00000000000000ull) >> 56) | \ - (((x) & 0x00FF000000000000ull) >> 40) | \ - (((x) & 0x0000FF0000000000ull) >> 24) | \ - (((x) & 0x000000FF00000000ull) >> 8) | \ - (((x) & 0x00000000FF000000ull) << 8) | \ - (((x) & 0x0000000000FF0000ull) << 24) | \ - (((x) & 0x000000000000FF00ull) << 40) | \ - (((x) & 0x00000000000000FFull) << 56) -#endif - -#define CHAR_TEST(bits, name, expr) \ - template \ - bool name(const T ch) { \ - static_assert(sizeof(ch) >= (bits) / 8, \ - "Character must be wider than " #bits " bits"); \ - return (expr); \ - } - -namespace node { - -template -ListNode::ListNode() : prev_(this), next_(this) {} - -template -ListNode::~ListNode() { - Remove(); -} - -template -void ListNode::Remove() { - prev_->next_ = next_; - next_->prev_ = prev_; - prev_ = this; - next_ = this; -} - -template -bool ListNode::IsEmpty() const { - return prev_ == this; -} - -template (T::*M)> -ListHead::Iterator::Iterator(ListNode* node) : node_(node) {} - -template (T::*M)> -T* ListHead::Iterator::operator*() const { - return ContainerOf(M, node_); -} - -template (T::*M)> -const typename ListHead::Iterator& -ListHead::Iterator::operator++() { - node_ = node_->next_; - return *this; -} - -template (T::*M)> -bool ListHead::Iterator::operator!=(const Iterator& that) const { - return node_ != that.node_; -} - -template (T::*M)> -ListHead::~ListHead() { - while (IsEmpty() == false) - head_.next_->Remove(); -} - -template (T::*M)> -void ListHead::PushBack(T* element) { - ListNode* that = &(element->*M); - head_.prev_->next_ = that; - that->prev_ = head_.prev_; - that->next_ = &head_; - head_.prev_ = that; -} - -template (T::*M)> -void ListHead::PushFront(T* element) { - ListNode* that = &(element->*M); - head_.next_->prev_ = that; - that->prev_ = &head_; - that->next_ = head_.next_; - head_.next_ = that; -} - -template (T::*M)> -bool ListHead::IsEmpty() const { - return head_.IsEmpty(); -} - -template (T::*M)> -T* ListHead::PopFront() { - if (IsEmpty()) - return nullptr; - ListNode* node = head_.next_; - node->Remove(); - return ContainerOf(M, node); -} - -template (T::*M)> -typename ListHead::Iterator ListHead::begin() const { - return Iterator(head_.next_); -} - -template (T::*M)> -typename ListHead::Iterator ListHead::end() const { - return Iterator(const_cast*>(&head_)); -} - -template -constexpr uintptr_t OffsetOf(Inner Outer::*field) { - return reinterpret_cast(&(static_cast(nullptr)->*field)); -} - -template -ContainerOfHelper::ContainerOfHelper(Inner Outer::*field, - Inner* pointer) - : pointer_( - reinterpret_cast( - reinterpret_cast(pointer) - OffsetOf(field))) {} - -template -template -ContainerOfHelper::operator TypeName*() const { - return static_cast(pointer_); -} - -template -constexpr ContainerOfHelper ContainerOf(Inner Outer::*field, - Inner* pointer) { - return ContainerOfHelper(field, pointer); -} - -inline v8::Local OneByteString(v8::Isolate* isolate, - const char* data, - int length) { - return v8::String::NewFromOneByte(isolate, - reinterpret_cast(data), - v8::NewStringType::kNormal, - length).ToLocalChecked(); -} - -inline v8::Local OneByteString(v8::Isolate* isolate, - const signed char* data, - int length) { - return v8::String::NewFromOneByte(isolate, - reinterpret_cast(data), - v8::NewStringType::kNormal, - length).ToLocalChecked(); -} - -inline v8::Local OneByteString(v8::Isolate* isolate, - const unsigned char* data, - int length) { - return v8::String::NewFromOneByte( - isolate, data, v8::NewStringType::kNormal, length) - .ToLocalChecked(); -} - -void SwapBytes16(char* data, size_t nbytes) { - CHECK_EQ(nbytes % 2, 0); - -#if defined(_MSC_VER) - if (AlignUp(data, sizeof(uint16_t)) == data) { - // MSVC has no strict aliasing, and is able to highly optimize this case. - uint16_t* data16 = reinterpret_cast(data); - size_t len16 = nbytes / sizeof(*data16); - for (size_t i = 0; i < len16; i++) { - data16[i] = BSWAP_2(data16[i]); - } - return; - } -#endif - - uint16_t temp; - for (size_t i = 0; i < nbytes; i += sizeof(temp)) { - memcpy(&temp, &data[i], sizeof(temp)); - temp = BSWAP_2(temp); - memcpy(&data[i], &temp, sizeof(temp)); - } -} - -void SwapBytes32(char* data, size_t nbytes) { - CHECK_EQ(nbytes % 4, 0); - -#if defined(_MSC_VER) - // MSVC has no strict aliasing, and is able to highly optimize this case. - if (AlignUp(data, sizeof(uint32_t)) == data) { - uint32_t* data32 = reinterpret_cast(data); - size_t len32 = nbytes / sizeof(*data32); - for (size_t i = 0; i < len32; i++) { - data32[i] = BSWAP_4(data32[i]); - } - return; - } -#endif - - uint32_t temp; - for (size_t i = 0; i < nbytes; i += sizeof(temp)) { - memcpy(&temp, &data[i], sizeof(temp)); - temp = BSWAP_4(temp); - memcpy(&data[i], &temp, sizeof(temp)); - } -} - -void SwapBytes64(char* data, size_t nbytes) { - CHECK_EQ(nbytes % 8, 0); - -#if defined(_MSC_VER) - if (AlignUp(data, sizeof(uint64_t)) == data) { - // MSVC has no strict aliasing, and is able to highly optimize this case. - uint64_t* data64 = reinterpret_cast(data); - size_t len64 = nbytes / sizeof(*data64); - for (size_t i = 0; i < len64; i++) { - data64[i] = BSWAP_8(data64[i]); - } - return; - } -#endif - - uint64_t temp; - for (size_t i = 0; i < nbytes; i += sizeof(temp)) { - memcpy(&temp, &data[i], sizeof(temp)); - temp = BSWAP_8(temp); - memcpy(&data[i], &temp, sizeof(temp)); - } -} - -char ToLower(char c) { - return std::tolower(c, std::locale::classic()); -} - -std::string ToLower(const std::string& in) { - std::string out(in.size(), 0); - for (size_t i = 0; i < in.size(); ++i) - out[i] = ToLower(in[i]); - return out; -} - -char ToUpper(char c) { - return std::toupper(c, std::locale::classic()); -} - -std::string ToUpper(const std::string& in) { - std::string out(in.size(), 0); - for (size_t i = 0; i < in.size(); ++i) - out[i] = ToUpper(in[i]); - return out; -} - -bool StringEqualNoCase(const char* a, const char* b) { - while (ToLower(*a) == ToLower(*b++)) { - if (*a++ == '\0') - return true; - } - return false; -} - -bool StringEqualNoCaseN(const char* a, const char* b, size_t length) { - for (size_t i = 0; i < length; i++) { - if (ToLower(a[i]) != ToLower(b[i])) - return false; - if (a[i] == '\0') - return true; - } - return true; -} - -template -inline T MultiplyWithOverflowCheck(T a, T b) { - auto ret = a * b; - if (a != 0) - CHECK_EQ(b, ret / a); - - return ret; -} - -// These should be used in our code as opposed to the native -// versions as they abstract out some platform and or -// compiler version specific functionality. -// malloc(0) and realloc(ptr, 0) have implementation-defined behavior in -// that the standard allows them to either return a unique pointer or a -// nullptr for zero-sized allocation requests. Normalize by always using -// a nullptr. -template -T* UncheckedRealloc(T* pointer, size_t n) { - size_t full_size = MultiplyWithOverflowCheck(sizeof(T), n); - - if (full_size == 0) { - free(pointer); - return nullptr; - } - - void* allocated = realloc(pointer, full_size); - - if (UNLIKELY(allocated == nullptr)) { - // Tell V8 that memory is low and retry. - LowMemoryNotification(); - allocated = realloc(pointer, full_size); - } - - return static_cast(allocated); -} - -// As per spec realloc behaves like malloc if passed nullptr. -template -inline T* UncheckedMalloc(size_t n) { - if (n == 0) n = 1; - return UncheckedRealloc(nullptr, n); -} - -template -inline T* UncheckedCalloc(size_t n) { - if (n == 0) n = 1; - MultiplyWithOverflowCheck(sizeof(T), n); - return static_cast(calloc(n, sizeof(T))); -} - -template -inline T* Realloc(T* pointer, size_t n) { - T* ret = UncheckedRealloc(pointer, n); - CHECK_IMPLIES(n > 0, ret != nullptr); - return ret; -} - -template -inline T* Malloc(size_t n) { - T* ret = UncheckedMalloc(n); - CHECK_IMPLIES(n > 0, ret != nullptr); - return ret; -} - -template -inline T* Calloc(size_t n) { - T* ret = UncheckedCalloc(n); - CHECK_IMPLIES(n > 0, ret != nullptr); - return ret; -} - -// Shortcuts for char*. -inline char* Malloc(size_t n) { return Malloc(n); } -inline char* Calloc(size_t n) { return Calloc(n); } -inline char* UncheckedMalloc(size_t n) { return UncheckedMalloc(n); } -inline char* UncheckedCalloc(size_t n) { return UncheckedCalloc(n); } - -// This is a helper in the .cc file so including util-inl.h doesn't include more -// headers than we really need to. -void ThrowErrStringTooLong(v8::Isolate* isolate); - -v8::MaybeLocal ToV8Value(v8::Local context, - const std::string& str, - v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); - if (UNLIKELY(str.size() >= static_cast(v8::String::kMaxLength))) { - // V8 only has a TODO comment about adding an exception when the maximum - // string size is exceeded. - ThrowErrStringTooLong(isolate); - return v8::MaybeLocal(); - } - - return v8::String::NewFromUtf8( - isolate, str.data(), v8::NewStringType::kNormal, str.size()) - .FromMaybe(v8::Local()); -} - -template -v8::MaybeLocal ToV8Value(v8::Local context, - const std::vector& vec, - v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); - v8::EscapableHandleScope handle_scope(isolate); - - MaybeStackBuffer, 128> arr(vec.size()); - arr.SetLength(vec.size()); - for (size_t i = 0; i < vec.size(); ++i) { - if (!ToV8Value(context, vec[i], isolate).ToLocal(&arr[i])) - return v8::MaybeLocal(); - } - - return handle_scope.Escape(v8::Array::New(isolate, arr.out(), arr.length())); -} - -template -v8::MaybeLocal ToV8Value(v8::Local context, - const std::unordered_map& map, - v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local ret = v8::Map::New(isolate); - for (const auto& item : map) { - v8::Local first, second; - if (!ToV8Value(context, item.first, isolate).ToLocal(&first) || - !ToV8Value(context, item.second, isolate).ToLocal(&second) || - ret->Set(context, first, second).IsEmpty()) { - return v8::MaybeLocal(); - } - } - - return handle_scope.Escape(ret); -} - -template -v8::MaybeLocal ToV8Value(v8::Local context, - const T& number, - v8::Isolate* isolate) { - if (isolate == nullptr) isolate = context->GetIsolate(); - - using Limits = std::numeric_limits; - // Choose Uint32, Int32, or Double depending on range checks. - // These checks should all collapse at compile time. - if (static_cast(Limits::max()) <= - std::numeric_limits::max() && - static_cast(Limits::min()) >= - std::numeric_limits::min() && Limits::is_exact) { - return v8::Integer::NewFromUnsigned(isolate, static_cast(number)); - } - - if (static_cast(Limits::max()) <= - std::numeric_limits::max() && - static_cast(Limits::min()) >= - std::numeric_limits::min() && Limits::is_exact) { - return v8::Integer::New(isolate, static_cast(number)); - } - - return v8::Number::New(isolate, static_cast(number)); -} - -SlicedArguments::SlicedArguments( - const v8::FunctionCallbackInfo& args, size_t start) { - const size_t length = static_cast(args.Length()); - if (start >= length) return; - const size_t size = length - start; - - AllocateSufficientStorage(size); - for (size_t i = 0; i < size; ++i) - (*this)[i] = args[i + start]; -} - -template -ArrayBufferViewContents::ArrayBufferViewContents( - v8::Local value) { - CHECK(value->IsArrayBufferView()); - Read(value.As()); -} - -template -ArrayBufferViewContents::ArrayBufferViewContents( - v8::Local value) { - CHECK(value->IsArrayBufferView()); - Read(value.As()); -} - -template -ArrayBufferViewContents::ArrayBufferViewContents( - v8::Local abv) { - Read(abv); -} - -template -void ArrayBufferViewContents::Read(v8::Local abv) { - static_assert(sizeof(T) == 1, "Only supports one-byte data at the moment"); - length_ = abv->ByteLength(); - if (length_ > sizeof(stack_storage_) || abv->HasBuffer()) { - data_ = static_cast(abv->Buffer()->GetBackingStore()->Data()) + - abv->ByteOffset(); - } else { - abv->CopyContents(stack_storage_, sizeof(stack_storage_)); - data_ = stack_storage_; - } -} - -// ECMA262 20.1.2.5 -inline bool IsSafeJsInt(v8::Local v) { - if (!v->IsNumber()) return false; - double v_d = v.As()->Value(); - if (std::isnan(v_d)) return false; - if (std::isinf(v_d)) return false; - if (std::trunc(v_d) != v_d) return false; // not int - if (std::abs(v_d) <= static_cast(kMaxSafeJsInteger)) return true; - return false; -} - -constexpr size_t FastStringKey::HashImpl(const char* str) { - // Low-quality hash (djb2), but just fine for current use cases. - size_t h = 5381; - while (*str != '\0') { - h = h * 33 + *(str++); // NOLINT(readability/pointer_notation) - } - return h; -} - -constexpr size_t FastStringKey::Hash::operator()( - const FastStringKey& key) const { - return key.cached_hash_; -} - -constexpr bool FastStringKey::operator==(const FastStringKey& other) const { - const char* p1 = name_; - const char* p2 = other.name_; - if (p1 == p2) return true; - do { - if (*(p1++) != *(p2++)) return false; - } while (*p1 != '\0'); - return *p2 == '\0'; -} - -constexpr FastStringKey::FastStringKey(const char* name) - : name_(name), cached_hash_(HashImpl(name)) {} - -constexpr const char* FastStringKey::c_str() const { - return name_; -} - -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_UTIL_INL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/util.h b/repo/packages/s/scriptx-legacy/include/libnode/util.h deleted file mode 100644 index 06c67d27..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/util.h +++ /dev/null @@ -1,825 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SRC_UTIL_H_ -#define SRC_UTIL_H_ - -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#include "v8.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __GNUC__ -#define MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define MUST_USE_RESULT -#endif - -namespace node { - -// Maybe remove kPathSeparator when cpp17 is ready -#ifdef _WIN32 - constexpr char kPathSeparator = '\\'; -/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ -#define PATH_MAX_BYTES (MAX_PATH * 4) -#else - constexpr char kPathSeparator = '/'; -#define PATH_MAX_BYTES (PATH_MAX) -#endif - -// These should be used in our code as opposed to the native -// versions as they abstract out some platform and or -// compiler version specific functionality -// malloc(0) and realloc(ptr, 0) have implementation-defined behavior in -// that the standard allows them to either return a unique pointer or a -// nullptr for zero-sized allocation requests. Normalize by always using -// a nullptr. -template -inline T* UncheckedRealloc(T* pointer, size_t n); -template -inline T* UncheckedMalloc(size_t n); -template -inline T* UncheckedCalloc(size_t n); - -// Same things, but aborts immediately instead of returning nullptr when -// no memory is available. -template -inline T* Realloc(T* pointer, size_t n); -template -inline T* Malloc(size_t n); -template -inline T* Calloc(size_t n); - -inline char* Malloc(size_t n); -inline char* Calloc(size_t n); -inline char* UncheckedMalloc(size_t n); -inline char* UncheckedCalloc(size_t n); - -template -inline T MultiplyWithOverflowCheck(T a, T b); - -namespace per_process { -// Tells whether the per-process V8::Initialize() is called and -// if it is safe to call v8::Isolate::TryGetCurrent(). -extern bool v8_initialized; -} // namespace per_process - -// Used by the allocation functions when allocation fails. -// Thin wrapper around v8::Isolate::LowMemoryNotification() that checks -// whether V8 is initialized. -void LowMemoryNotification(); - -// The reason that Assert() takes a struct argument instead of individual -// const char*s is to ease instruction cache pressure in calls from CHECK. -struct AssertionInfo { - const char* file_line; // filename:line - const char* message; - const char* function; -}; -[[noreturn]] void Assert(const AssertionInfo& info); -[[noreturn]] void Abort(); -void DumpBacktrace(FILE* fp); - -// Windows 8+ does not like abort() in Release mode -#ifdef _WIN32 -#define ABORT_NO_BACKTRACE() _exit(134) -#else -#define ABORT_NO_BACKTRACE() abort() -#endif - -#define ABORT() node::Abort() - -#define ERROR_AND_ABORT(expr) \ - do { \ - /* Make sure that this struct does not end up in inline code, but */ \ - /* rather in a read-only data section when modifying this code. */ \ - static const node::AssertionInfo args = { \ - __FILE__ ":" STRINGIFY(__LINE__), #expr, PRETTY_FUNCTION_NAME \ - }; \ - node::Assert(args); \ - } while (0) - -#ifdef __GNUC__ -#define LIKELY(expr) __builtin_expect(!!(expr), 1) -#define UNLIKELY(expr) __builtin_expect(!!(expr), 0) -#define PRETTY_FUNCTION_NAME __PRETTY_FUNCTION__ -#else -#define LIKELY(expr) expr -#define UNLIKELY(expr) expr -#define PRETTY_FUNCTION_NAME "" -#endif - -#define STRINGIFY_(x) #x -#define STRINGIFY(x) STRINGIFY_(x) - -#define CHECK(expr) \ - do { \ - if (UNLIKELY(!(expr))) { \ - ERROR_AND_ABORT(expr); \ - } \ - } while (0) - -#define CHECK_EQ(a, b) CHECK((a) == (b)) -#define CHECK_GE(a, b) CHECK((a) >= (b)) -#define CHECK_GT(a, b) CHECK((a) > (b)) -#define CHECK_LE(a, b) CHECK((a) <= (b)) -#define CHECK_LT(a, b) CHECK((a) < (b)) -#define CHECK_NE(a, b) CHECK((a) != (b)) -#define CHECK_NULL(val) CHECK((val) == nullptr) -#define CHECK_NOT_NULL(val) CHECK((val) != nullptr) -#define CHECK_IMPLIES(a, b) CHECK(!(a) || (b)) - -#ifdef DEBUG - #define DCHECK(expr) CHECK(expr) - #define DCHECK_EQ(a, b) CHECK((a) == (b)) - #define DCHECK_GE(a, b) CHECK((a) >= (b)) - #define DCHECK_GT(a, b) CHECK((a) > (b)) - #define DCHECK_LE(a, b) CHECK((a) <= (b)) - #define DCHECK_LT(a, b) CHECK((a) < (b)) - #define DCHECK_NE(a, b) CHECK((a) != (b)) - #define DCHECK_NULL(val) CHECK((val) == nullptr) - #define DCHECK_NOT_NULL(val) CHECK((val) != nullptr) - #define DCHECK_IMPLIES(a, b) CHECK(!(a) || (b)) -#else - #define DCHECK(expr) - #define DCHECK_EQ(a, b) - #define DCHECK_GE(a, b) - #define DCHECK_GT(a, b) - #define DCHECK_LE(a, b) - #define DCHECK_LT(a, b) - #define DCHECK_NE(a, b) - #define DCHECK_NULL(val) - #define DCHECK_NOT_NULL(val) - #define DCHECK_IMPLIES(a, b) -#endif - - -#define UNREACHABLE(...) \ - ERROR_AND_ABORT("Unreachable code reached" __VA_OPT__(": ") __VA_ARGS__) - -// ECMA262 20.1.2.6 Number.MAX_SAFE_INTEGER (2^53-1) -constexpr int64_t kMaxSafeJsInteger = 9007199254740991; - -inline bool IsSafeJsInt(v8::Local v); - -// TAILQ-style intrusive list node. -template -class ListNode; - -// TAILQ-style intrusive list head. -template (T::*M)> -class ListHead; - -template -class ListNode { - public: - inline ListNode(); - inline ~ListNode(); - inline void Remove(); - inline bool IsEmpty() const; - - ListNode(const ListNode&) = delete; - ListNode& operator=(const ListNode&) = delete; - - private: - template (U::*M)> friend class ListHead; - friend int GenDebugSymbols(); - ListNode* prev_; - ListNode* next_; -}; - -template (T::*M)> -class ListHead { - public: - class Iterator { - public: - inline T* operator*() const; - inline const Iterator& operator++(); - inline bool operator!=(const Iterator& that) const; - - private: - friend class ListHead; - inline explicit Iterator(ListNode* node); - ListNode* node_; - }; - - inline ListHead() = default; - inline ~ListHead(); - inline void PushBack(T* element); - inline void PushFront(T* element); - inline bool IsEmpty() const; - inline T* PopFront(); - inline Iterator begin() const; - inline Iterator end() const; - - ListHead(const ListHead&) = delete; - ListHead& operator=(const ListHead&) = delete; - - private: - friend int GenDebugSymbols(); - ListNode head_; -}; - -// The helper is for doing safe downcasts from base types to derived types. -template -class ContainerOfHelper { - public: - inline ContainerOfHelper(Inner Outer::*field, Inner* pointer); - template - inline operator TypeName*() const; - private: - Outer* const pointer_; -}; - -// Calculate the address of the outer (i.e. embedding) struct from -// the interior pointer to a data member. -template -constexpr ContainerOfHelper ContainerOf(Inner Outer::*field, - Inner* pointer); - -// Convenience wrapper around v8::String::NewFromOneByte(). -inline v8::Local OneByteString(v8::Isolate* isolate, - const char* data, - int length = -1); - -// For the people that compile with -funsigned-char. -inline v8::Local OneByteString(v8::Isolate* isolate, - const signed char* data, - int length = -1); - -inline v8::Local OneByteString(v8::Isolate* isolate, - const unsigned char* data, - int length = -1); - -// Used to be a macro, hence the uppercase name. -template -inline v8::Local FIXED_ONE_BYTE_STRING( - v8::Isolate* isolate, - const char(&data)[N]) { - return OneByteString(isolate, data, N - 1); -} - -template -inline v8::Local FIXED_ONE_BYTE_STRING( - v8::Isolate* isolate, - const std::array& arr) { - return OneByteString(isolate, arr.data(), N - 1); -} - - - -// Swaps bytes in place. nbytes is the number of bytes to swap and must be a -// multiple of the word size (checked by function). -inline void SwapBytes16(char* data, size_t nbytes); -inline void SwapBytes32(char* data, size_t nbytes); -inline void SwapBytes64(char* data, size_t nbytes); - -// tolower() is locale-sensitive. Use ToLower() instead. -inline char ToLower(char c); -inline std::string ToLower(const std::string& in); - -// toupper() is locale-sensitive. Use ToUpper() instead. -inline char ToUpper(char c); -inline std::string ToUpper(const std::string& in); - -// strcasecmp() is locale-sensitive. Use StringEqualNoCase() instead. -inline bool StringEqualNoCase(const char* a, const char* b); - -// strncasecmp() is locale-sensitive. Use StringEqualNoCaseN() instead. -inline bool StringEqualNoCaseN(const char* a, const char* b, size_t length); - -template -constexpr size_t arraysize(const T (&)[N]) { - return N; -} - -template -constexpr size_t strsize(const T (&)[N]) { - return N - 1; -} - -// Allocates an array of member type T. For up to kStackStorageSize items, -// the stack is used, otherwise malloc(). -template -class MaybeStackBuffer { - public: - const T* out() const { - return buf_; - } - - T* out() { - return buf_; - } - - // operator* for compatibility with `v8::String::(Utf8)Value` - T* operator*() { - return buf_; - } - - const T* operator*() const { - return buf_; - } - - T& operator[](size_t index) { - CHECK_LT(index, length()); - return buf_[index]; - } - - const T& operator[](size_t index) const { - CHECK_LT(index, length()); - return buf_[index]; - } - - size_t length() const { - return length_; - } - - // Current maximum capacity of the buffer with which SetLength() can be used - // without first calling AllocateSufficientStorage(). - size_t capacity() const { - return capacity_; - } - - // Make sure enough space for `storage` entries is available. - // This method can be called multiple times throughout the lifetime of the - // buffer, but once this has been called Invalidate() cannot be used. - // Content of the buffer in the range [0, length()) is preserved. - void AllocateSufficientStorage(size_t storage) { - CHECK(!IsInvalidated()); - if (storage > capacity()) { - bool was_allocated = IsAllocated(); - T* allocated_ptr = was_allocated ? buf_ : nullptr; - buf_ = Realloc(allocated_ptr, storage); - capacity_ = storage; - if (!was_allocated && length_ > 0) - memcpy(buf_, buf_st_, length_ * sizeof(buf_[0])); - } - - length_ = storage; - } - - void SetLength(size_t length) { - // capacity() returns how much memory is actually available. - CHECK_LE(length, capacity()); - length_ = length; - } - - void SetLengthAndZeroTerminate(size_t length) { - // capacity() returns how much memory is actually available. - CHECK_LE(length + 1, capacity()); - SetLength(length); - - // T() is 0 for integer types, nullptr for pointers, etc. - buf_[length] = T(); - } - - // Make dereferencing this object return nullptr. - // This method can be called multiple times throughout the lifetime of the - // buffer, but once this has been called AllocateSufficientStorage() cannot - // be used. - void Invalidate() { - CHECK(!IsAllocated()); - capacity_ = 0; - length_ = 0; - buf_ = nullptr; - } - - // If the buffer is stored in the heap rather than on the stack. - bool IsAllocated() const { - return !IsInvalidated() && buf_ != buf_st_; - } - - // If Invalidate() has been called. - bool IsInvalidated() const { - return buf_ == nullptr; - } - - // Release ownership of the malloc'd buffer. - // Note: This does not free the buffer. - void Release() { - CHECK(IsAllocated()); - buf_ = buf_st_; - length_ = 0; - capacity_ = arraysize(buf_st_); - } - - MaybeStackBuffer() - : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) { - // Default to a zero-length, null-terminated buffer. - buf_[0] = T(); - } - - explicit MaybeStackBuffer(size_t storage) : MaybeStackBuffer() { - AllocateSufficientStorage(storage); - } - - ~MaybeStackBuffer() { - if (IsAllocated()) - free(buf_); - } - - private: - size_t length_; - // capacity of the malloc'ed buf_ - size_t capacity_; - T* buf_; - T buf_st_[kStackStorageSize]; -}; - -// Provides access to an ArrayBufferView's storage, either the original, -// or for small data, a copy of it. This object's lifetime is bound to the -// original ArrayBufferView's lifetime. -template -class ArrayBufferViewContents { - public: - ArrayBufferViewContents() = default; - - explicit inline ArrayBufferViewContents(v8::Local value); - explicit inline ArrayBufferViewContents(v8::Local value); - explicit inline ArrayBufferViewContents(v8::Local abv); - inline void Read(v8::Local abv); - - inline const T* data() const { return data_; } - inline size_t length() const { return length_; } - - private: - T stack_storage_[kStackStorageSize]; - T* data_ = nullptr; - size_t length_ = 0; -}; - -class Utf8Value : public MaybeStackBuffer { - public: - explicit Utf8Value(v8::Isolate* isolate, v8::Local value); - - inline std::string ToString() const { return std::string(out(), length()); } - - inline bool operator==(const char* a) const { - return strcmp(out(), a) == 0; - } -}; - -class TwoByteValue : public MaybeStackBuffer { - public: - explicit TwoByteValue(v8::Isolate* isolate, v8::Local value); -}; - -class BufferValue : public MaybeStackBuffer { - public: - explicit BufferValue(v8::Isolate* isolate, v8::Local value); - - inline std::string ToString() const { return std::string(out(), length()); } -}; - -#define SPREAD_BUFFER_ARG(val, name) \ - CHECK((val)->IsArrayBufferView()); \ - v8::Local name = (val).As(); \ - std::shared_ptr name##_bs = \ - name->Buffer()->GetBackingStore(); \ - const size_t name##_offset = name->ByteOffset(); \ - const size_t name##_length = name->ByteLength(); \ - char* const name##_data = \ - static_cast(name##_bs->Data()) + name##_offset; \ - if (name##_length > 0) \ - CHECK_NE(name##_data, nullptr); - -// Use this when a variable or parameter is unused in order to explicitly -// silence a compiler warning about that. -template inline void USE(T&&) {} - -template -struct OnScopeLeaveImpl { - Fn fn_; - bool active_; - - explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {} - ~OnScopeLeaveImpl() { if (active_) fn_(); } - - OnScopeLeaveImpl(const OnScopeLeaveImpl& other) = delete; - OnScopeLeaveImpl& operator=(const OnScopeLeaveImpl& other) = delete; - OnScopeLeaveImpl(OnScopeLeaveImpl&& other) - : fn_(std::move(other.fn_)), active_(other.active_) { - other.active_ = false; - } - OnScopeLeaveImpl& operator=(OnScopeLeaveImpl&& other) { - if (this == &other) return *this; - this->~OnScopeLeave(); - new (this)OnScopeLeaveImpl(std::move(other)); - return *this; - } -}; - -// Run a function when exiting the current scope. Used like this: -// auto on_scope_leave = OnScopeLeave([&] { -// // ... run some code ... -// }); -template -inline MUST_USE_RESULT OnScopeLeaveImpl OnScopeLeave(Fn&& fn) { - return OnScopeLeaveImpl{std::move(fn)}; -} - -// Simple RAII wrapper for contiguous data that uses malloc()/free(). -template -struct MallocedBuffer { - T* data; - size_t size; - - T* release() { - T* ret = data; - data = nullptr; - return ret; - } - - void Truncate(size_t new_size) { - CHECK(new_size <= size); - size = new_size; - } - - void Realloc(size_t new_size) { - Truncate(new_size); - data = UncheckedRealloc(data, new_size); - } - - inline bool is_empty() const { return data == nullptr; } - - MallocedBuffer() : data(nullptr), size(0) {} - explicit MallocedBuffer(size_t size) : data(Malloc(size)), size(size) {} - MallocedBuffer(T* data, size_t size) : data(data), size(size) {} - MallocedBuffer(MallocedBuffer&& other) : data(other.data), size(other.size) { - other.data = nullptr; - } - MallocedBuffer& operator=(MallocedBuffer&& other) { - this->~MallocedBuffer(); - return *new(this) MallocedBuffer(std::move(other)); - } - ~MallocedBuffer() { - free(data); - } - MallocedBuffer(const MallocedBuffer&) = delete; - MallocedBuffer& operator=(const MallocedBuffer&) = delete; -}; - -template -class NonCopyableMaybe { - public: - NonCopyableMaybe() : empty_(true) {} - explicit NonCopyableMaybe(T&& value) - : empty_(false), - value_(std::move(value)) {} - - bool IsEmpty() const { - return empty_; - } - - const T* get() const { - return empty_ ? nullptr : &value_; - } - - const T* operator->() const { - CHECK(!empty_); - return &value_; - } - - T&& Release() { - CHECK_EQ(empty_, false); - empty_ = true; - return std::move(value_); - } - - private: - bool empty_; - T value_; -}; - -// Test whether some value can be called with (). -template -struct is_callable : std::is_function { }; - -template -struct is_callable::value - >::type> : std::true_type { }; - -template -struct FunctionDeleter { - void operator()(T* pointer) const { function(pointer); } - typedef std::unique_ptr Pointer; -}; - -template -using DeleteFnPtr = typename FunctionDeleter::Pointer; - -std::vector SplitString(const std::string& in, char delim); - -inline v8::MaybeLocal ToV8Value(v8::Local context, - const std::string& str, - v8::Isolate* isolate = nullptr); -template ::is_specialized, bool>::type> -inline v8::MaybeLocal ToV8Value(v8::Local context, - const T& number, - v8::Isolate* isolate = nullptr); -template -inline v8::MaybeLocal ToV8Value(v8::Local context, - const std::vector& vec, - v8::Isolate* isolate = nullptr); -template -inline v8::MaybeLocal ToV8Value(v8::Local context, - const std::unordered_map& map, - v8::Isolate* isolate = nullptr); - -// These macros expects a `Isolate* isolate` and a `Local context` -// to be in the scope. -#define READONLY_PROPERTY(obj, name, value) \ - do { \ - obj->DefineOwnProperty( \ - context, FIXED_ONE_BYTE_STRING(isolate, name), value, v8::ReadOnly) \ - .Check(); \ - } while (0) - -#define READONLY_DONT_ENUM_PROPERTY(obj, name, var) \ - do { \ - obj->DefineOwnProperty( \ - context, \ - OneByteString(isolate, name), \ - var, \ - static_cast(v8::ReadOnly | v8::DontEnum)) \ - .Check(); \ - } while (0) - -#define READONLY_FALSE_PROPERTY(obj, name) \ - READONLY_PROPERTY(obj, name, v8::False(isolate)) - -#define READONLY_TRUE_PROPERTY(obj, name) \ - READONLY_PROPERTY(obj, name, v8::True(isolate)) - -#define READONLY_STRING_PROPERTY(obj, name, str) \ - READONLY_PROPERTY(obj, name, ToV8Value(context, str).ToLocalChecked()) - -// Variation on NODE_DEFINE_CONSTANT that sets a String value. -#define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \ - do { \ - v8::Isolate* isolate = target->GetIsolate(); \ - v8::Local constant_name = \ - v8::String::NewFromUtf8(isolate, name).ToLocalChecked(); \ - v8::Local constant_value = \ - v8::String::NewFromUtf8(isolate, constant).ToLocalChecked(); \ - v8::PropertyAttribute constant_attributes = \ - static_cast(v8::ReadOnly | v8::DontDelete); \ - target \ - ->DefineOwnProperty(isolate->GetCurrentContext(), \ - constant_name, \ - constant_value, \ - constant_attributes) \ - .Check(); \ - } while (0) - -enum Endianness { - kLittleEndian, // _Not_ LITTLE_ENDIAN, clashes with endian.h. - kBigEndian -}; - -inline enum Endianness GetEndianness() { - // Constant-folded by the compiler. - const union { - uint8_t u8[2]; - uint16_t u16; - } u = {{1, 0}}; - return u.u16 == 1 ? kLittleEndian : kBigEndian; -} - -inline bool IsLittleEndian() { - return GetEndianness() == kLittleEndian; -} - -inline bool IsBigEndian() { - return GetEndianness() == kBigEndian; -} - -// Round up a to the next highest multiple of b. -template -constexpr T RoundUp(T a, T b) { - return a % b != 0 ? a + b - (a % b) : a; -} - -// Align ptr to an `alignment`-bytes boundary. -template -constexpr T* AlignUp(T* ptr, U alignment) { - return reinterpret_cast( - RoundUp(reinterpret_cast(ptr), alignment)); -} - -class SlicedArguments : public MaybeStackBuffer> { - public: - inline explicit SlicedArguments( - const v8::FunctionCallbackInfo& args, size_t start = 0); -}; - -// Convert a v8::PersistentBase, e.g. v8::Global, to a Local, with an extra -// optimization for strong persistent handles. -class PersistentToLocal { - public: - // If persistent.IsWeak() == false, then do not call persistent.Reset() - // while the returned Local is still in scope, it will destroy the - // reference to the object. - template - static inline v8::Local Default( - v8::Isolate* isolate, - const v8::PersistentBase& persistent) { - if (persistent.IsWeak()) { - return PersistentToLocal::Weak(isolate, persistent); - } else { - return PersistentToLocal::Strong(persistent); - } - } - - // Unchecked conversion from a non-weak Persistent to Local, - // use with care! - // - // Do not call persistent.Reset() while the returned Local is still in - // scope, it will destroy the reference to the object. - template - static inline v8::Local Strong( - const v8::PersistentBase& persistent) { - DCHECK(!persistent.IsWeak()); - return *reinterpret_cast*>( - const_cast*>(&persistent)); - } - - template - static inline v8::Local Weak( - v8::Isolate* isolate, - const v8::PersistentBase& persistent) { - return v8::Local::New(isolate, persistent); - } -}; - -// Can be used as a key for std::unordered_map when lookup performance is more -// important than size and the keys are statically used to avoid redundant hash -// computations. -class FastStringKey { - public: - constexpr explicit FastStringKey(const char* name); - - struct Hash { - constexpr size_t operator()(const FastStringKey& key) const; - }; - constexpr bool operator==(const FastStringKey& other) const; - - constexpr const char* c_str() const; - - private: - static constexpr size_t HashImpl(const char* str); - - const char* name_; - size_t cached_hash_; -}; - -// Like std::static_pointer_cast but for unique_ptr with the default deleter. -template -std::unique_ptr static_unique_pointer_cast(std::unique_ptr&& ptr) { - return std::unique_ptr(static_cast(ptr.release())); -} - -#define MAYBE_FIELD_PTR(ptr, field) ptr == nullptr ? nullptr : &(ptr->field) - -// Returns a non-zero code if it fails to open or read the file, -// aborts if it fails to close the file. -int ReadFileSync(std::string* result, const char* path); -} // namespace node - -#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS - -#endif // SRC_UTIL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv.h deleted file mode 100644 index 606083c8..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv.h +++ /dev/null @@ -1,1849 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/* See https://github.com/libuv/libuv#documentation for documentation. */ - -#ifndef UV_H -#define UV_H -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED) -#error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both." -#endif - -#ifdef _WIN32 - /* Windows - set up dll import/export decorators. */ -# if defined(BUILDING_UV_SHARED) - /* Building shared library. */ -# define UV_EXTERN __declspec(dllexport) -# elif defined(USING_UV_SHARED) - /* Using shared library. */ -# define UV_EXTERN __declspec(dllimport) -# else - /* Building static library. */ -# define UV_EXTERN /* nothing */ -# endif -#elif __GNUC__ >= 4 -# define UV_EXTERN __attribute__((visibility("default"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) /* Sun Studio >= 8 */ -# define UV_EXTERN __global -#else -# define UV_EXTERN /* nothing */ -#endif - -#include "uv/errno.h" -#include "uv/version.h" -#include -#include - -#if defined(_MSC_VER) && _MSC_VER < 1600 -# include "uv/stdint-msvc2008.h" -#else -# include -#endif - -#if defined(_WIN32) -# include "uv/win.h" -#else -# include "uv/unix.h" -#endif - -/* Expand this list if necessary. */ -#define UV_ERRNO_MAP(XX) \ - XX(E2BIG, "argument list too long") \ - XX(EACCES, "permission denied") \ - XX(EADDRINUSE, "address already in use") \ - XX(EADDRNOTAVAIL, "address not available") \ - XX(EAFNOSUPPORT, "address family not supported") \ - XX(EAGAIN, "resource temporarily unavailable") \ - XX(EAI_ADDRFAMILY, "address family not supported") \ - XX(EAI_AGAIN, "temporary failure") \ - XX(EAI_BADFLAGS, "bad ai_flags value") \ - XX(EAI_BADHINTS, "invalid value for hints") \ - XX(EAI_CANCELED, "request canceled") \ - XX(EAI_FAIL, "permanent failure") \ - XX(EAI_FAMILY, "ai_family not supported") \ - XX(EAI_MEMORY, "out of memory") \ - XX(EAI_NODATA, "no address") \ - XX(EAI_NONAME, "unknown node or service") \ - XX(EAI_OVERFLOW, "argument buffer overflow") \ - XX(EAI_PROTOCOL, "resolved protocol is unknown") \ - XX(EAI_SERVICE, "service not available for socket type") \ - XX(EAI_SOCKTYPE, "socket type not supported") \ - XX(EALREADY, "connection already in progress") \ - XX(EBADF, "bad file descriptor") \ - XX(EBUSY, "resource busy or locked") \ - XX(ECANCELED, "operation canceled") \ - XX(ECHARSET, "invalid Unicode character") \ - XX(ECONNABORTED, "software caused connection abort") \ - XX(ECONNREFUSED, "connection refused") \ - XX(ECONNRESET, "connection reset by peer") \ - XX(EDESTADDRREQ, "destination address required") \ - XX(EEXIST, "file already exists") \ - XX(EFAULT, "bad address in system call argument") \ - XX(EFBIG, "file too large") \ - XX(EHOSTUNREACH, "host is unreachable") \ - XX(EINTR, "interrupted system call") \ - XX(EINVAL, "invalid argument") \ - XX(EIO, "i/o error") \ - XX(EISCONN, "socket is already connected") \ - XX(EISDIR, "illegal operation on a directory") \ - XX(ELOOP, "too many symbolic links encountered") \ - XX(EMFILE, "too many open files") \ - XX(EMSGSIZE, "message too long") \ - XX(ENAMETOOLONG, "name too long") \ - XX(ENETDOWN, "network is down") \ - XX(ENETUNREACH, "network is unreachable") \ - XX(ENFILE, "file table overflow") \ - XX(ENOBUFS, "no buffer space available") \ - XX(ENODEV, "no such device") \ - XX(ENOENT, "no such file or directory") \ - XX(ENOMEM, "not enough memory") \ - XX(ENONET, "machine is not on the network") \ - XX(ENOPROTOOPT, "protocol not available") \ - XX(ENOSPC, "no space left on device") \ - XX(ENOSYS, "function not implemented") \ - XX(ENOTCONN, "socket is not connected") \ - XX(ENOTDIR, "not a directory") \ - XX(ENOTEMPTY, "directory not empty") \ - XX(ENOTSOCK, "socket operation on non-socket") \ - XX(ENOTSUP, "operation not supported on socket") \ - XX(EOVERFLOW, "value too large for defined data type") \ - XX(EPERM, "operation not permitted") \ - XX(EPIPE, "broken pipe") \ - XX(EPROTO, "protocol error") \ - XX(EPROTONOSUPPORT, "protocol not supported") \ - XX(EPROTOTYPE, "protocol wrong type for socket") \ - XX(ERANGE, "result too large") \ - XX(EROFS, "read-only file system") \ - XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \ - XX(ESPIPE, "invalid seek") \ - XX(ESRCH, "no such process") \ - XX(ETIMEDOUT, "connection timed out") \ - XX(ETXTBSY, "text file is busy") \ - XX(EXDEV, "cross-device link not permitted") \ - XX(UNKNOWN, "unknown error") \ - XX(EOF, "end of file") \ - XX(ENXIO, "no such device or address") \ - XX(EMLINK, "too many links") \ - XX(EHOSTDOWN, "host is down") \ - XX(EREMOTEIO, "remote I/O error") \ - XX(ENOTTY, "inappropriate ioctl for device") \ - XX(EFTYPE, "inappropriate file type or format") \ - XX(EILSEQ, "illegal byte sequence") \ - XX(ESOCKTNOSUPPORT, "socket type not supported") \ - -#define UV_HANDLE_TYPE_MAP(XX) \ - XX(ASYNC, async) \ - XX(CHECK, check) \ - XX(FS_EVENT, fs_event) \ - XX(FS_POLL, fs_poll) \ - XX(HANDLE, handle) \ - XX(IDLE, idle) \ - XX(NAMED_PIPE, pipe) \ - XX(POLL, poll) \ - XX(PREPARE, prepare) \ - XX(PROCESS, process) \ - XX(STREAM, stream) \ - XX(TCP, tcp) \ - XX(TIMER, timer) \ - XX(TTY, tty) \ - XX(UDP, udp) \ - XX(SIGNAL, signal) \ - -#define UV_REQ_TYPE_MAP(XX) \ - XX(REQ, req) \ - XX(CONNECT, connect) \ - XX(WRITE, write) \ - XX(SHUTDOWN, shutdown) \ - XX(UDP_SEND, udp_send) \ - XX(FS, fs) \ - XX(WORK, work) \ - XX(GETADDRINFO, getaddrinfo) \ - XX(GETNAMEINFO, getnameinfo) \ - XX(RANDOM, random) \ - -typedef enum { -#define XX(code, _) UV_ ## code = UV__ ## code, - UV_ERRNO_MAP(XX) -#undef XX - UV_ERRNO_MAX = UV__EOF - 1 -} uv_errno_t; - -typedef enum { - UV_UNKNOWN_HANDLE = 0, -#define XX(uc, lc) UV_##uc, - UV_HANDLE_TYPE_MAP(XX) -#undef XX - UV_FILE, - UV_HANDLE_TYPE_MAX -} uv_handle_type; - -typedef enum { - UV_UNKNOWN_REQ = 0, -#define XX(uc, lc) UV_##uc, - UV_REQ_TYPE_MAP(XX) -#undef XX - UV_REQ_TYPE_PRIVATE - UV_REQ_TYPE_MAX -} uv_req_type; - - -/* Handle types. */ -typedef struct uv_loop_s uv_loop_t; -typedef struct uv_handle_s uv_handle_t; -typedef struct uv_dir_s uv_dir_t; -typedef struct uv_stream_s uv_stream_t; -typedef struct uv_tcp_s uv_tcp_t; -typedef struct uv_udp_s uv_udp_t; -typedef struct uv_pipe_s uv_pipe_t; -typedef struct uv_tty_s uv_tty_t; -typedef struct uv_poll_s uv_poll_t; -typedef struct uv_timer_s uv_timer_t; -typedef struct uv_prepare_s uv_prepare_t; -typedef struct uv_check_s uv_check_t; -typedef struct uv_idle_s uv_idle_t; -typedef struct uv_async_s uv_async_t; -typedef struct uv_process_s uv_process_t; -typedef struct uv_fs_event_s uv_fs_event_t; -typedef struct uv_fs_poll_s uv_fs_poll_t; -typedef struct uv_signal_s uv_signal_t; - -/* Request types. */ -typedef struct uv_req_s uv_req_t; -typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; -typedef struct uv_getnameinfo_s uv_getnameinfo_t; -typedef struct uv_shutdown_s uv_shutdown_t; -typedef struct uv_write_s uv_write_t; -typedef struct uv_connect_s uv_connect_t; -typedef struct uv_udp_send_s uv_udp_send_t; -typedef struct uv_fs_s uv_fs_t; -typedef struct uv_work_s uv_work_t; -typedef struct uv_random_s uv_random_t; - -/* None of the above. */ -typedef struct uv_env_item_s uv_env_item_t; -typedef struct uv_cpu_info_s uv_cpu_info_t; -typedef struct uv_interface_address_s uv_interface_address_t; -typedef struct uv_dirent_s uv_dirent_t; -typedef struct uv_passwd_s uv_passwd_t; -typedef struct uv_utsname_s uv_utsname_t; -typedef struct uv_statfs_s uv_statfs_t; - -typedef enum { - UV_LOOP_BLOCK_SIGNAL = 0, - UV_METRICS_IDLE_TIME -} uv_loop_option; - -typedef enum { - UV_RUN_DEFAULT = 0, - UV_RUN_ONCE, - UV_RUN_NOWAIT -} uv_run_mode; - - -UV_EXTERN unsigned int uv_version(void); -UV_EXTERN const char* uv_version_string(void); - -typedef void* (*uv_malloc_func)(size_t size); -typedef void* (*uv_realloc_func)(void* ptr, size_t size); -typedef void* (*uv_calloc_func)(size_t count, size_t size); -typedef void (*uv_free_func)(void* ptr); - -UV_EXTERN void uv_library_shutdown(void); - -UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, - uv_realloc_func realloc_func, - uv_calloc_func calloc_func, - uv_free_func free_func); - -UV_EXTERN uv_loop_t* uv_default_loop(void); -UV_EXTERN int uv_loop_init(uv_loop_t* loop); -UV_EXTERN int uv_loop_close(uv_loop_t* loop); -/* - * NOTE: - * This function is DEPRECATED (to be removed after 0.12), users should - * allocate the loop manually and use uv_loop_init instead. - */ -UV_EXTERN uv_loop_t* uv_loop_new(void); -/* - * NOTE: - * This function is DEPRECATED (to be removed after 0.12). Users should use - * uv_loop_close and free the memory manually instead. - */ -UV_EXTERN void uv_loop_delete(uv_loop_t*); -UV_EXTERN size_t uv_loop_size(void); -UV_EXTERN int uv_loop_alive(const uv_loop_t* loop); -UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...); -UV_EXTERN int uv_loop_fork(uv_loop_t* loop); - -UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); -UV_EXTERN void uv_stop(uv_loop_t*); - -UV_EXTERN void uv_ref(uv_handle_t*); -UV_EXTERN void uv_unref(uv_handle_t*); -UV_EXTERN int uv_has_ref(const uv_handle_t*); - -UV_EXTERN void uv_update_time(uv_loop_t*); -UV_EXTERN uint64_t uv_now(const uv_loop_t*); - -UV_EXTERN int uv_backend_fd(const uv_loop_t*); -UV_EXTERN int uv_backend_timeout(const uv_loop_t*); - -typedef void (*uv_alloc_cb)(uv_handle_t* handle, - size_t suggested_size, - uv_buf_t* buf); -typedef void (*uv_read_cb)(uv_stream_t* stream, - ssize_t nread, - const uv_buf_t* buf); -typedef void (*uv_write_cb)(uv_write_t* req, int status); -typedef void (*uv_connect_cb)(uv_connect_t* req, int status); -typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); -typedef void (*uv_connection_cb)(uv_stream_t* server, int status); -typedef void (*uv_close_cb)(uv_handle_t* handle); -typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events); -typedef void (*uv_timer_cb)(uv_timer_t* handle); -typedef void (*uv_async_cb)(uv_async_t* handle); -typedef void (*uv_prepare_cb)(uv_prepare_t* handle); -typedef void (*uv_check_cb)(uv_check_t* handle); -typedef void (*uv_idle_cb)(uv_idle_t* handle); -typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal); -typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg); -typedef void (*uv_fs_cb)(uv_fs_t* req); -typedef void (*uv_work_cb)(uv_work_t* req); -typedef void (*uv_after_work_cb)(uv_work_t* req, int status); -typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, - int status, - struct addrinfo* res); -typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, - int status, - const char* hostname, - const char* service); -typedef void (*uv_random_cb)(uv_random_t* req, - int status, - void* buf, - size_t buflen); - -typedef struct { - long tv_sec; - long tv_nsec; -} uv_timespec_t; - - -typedef struct { - uint64_t st_dev; - uint64_t st_mode; - uint64_t st_nlink; - uint64_t st_uid; - uint64_t st_gid; - uint64_t st_rdev; - uint64_t st_ino; - uint64_t st_size; - uint64_t st_blksize; - uint64_t st_blocks; - uint64_t st_flags; - uint64_t st_gen; - uv_timespec_t st_atim; - uv_timespec_t st_mtim; - uv_timespec_t st_ctim; - uv_timespec_t st_birthtim; -} uv_stat_t; - - -typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, - const char* filename, - int events, - int status); - -typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, - int status, - const uv_stat_t* prev, - const uv_stat_t* curr); - -typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum); - - -typedef enum { - UV_LEAVE_GROUP = 0, - UV_JOIN_GROUP -} uv_membership; - - -UV_EXTERN int uv_translate_sys_error(int sys_errno); - -UV_EXTERN const char* uv_strerror(int err); -UV_EXTERN char* uv_strerror_r(int err, char* buf, size_t buflen); - -UV_EXTERN const char* uv_err_name(int err); -UV_EXTERN char* uv_err_name_r(int err, char* buf, size_t buflen); - - -#define UV_REQ_FIELDS \ - /* public */ \ - void* data; \ - /* read-only */ \ - uv_req_type type; \ - /* private */ \ - void* reserved[6]; \ - UV_REQ_PRIVATE_FIELDS \ - -/* Abstract base class of all requests. */ -struct uv_req_s { - UV_REQ_FIELDS -}; - - -/* Platform-specific request types. */ -UV_PRIVATE_REQ_TYPES - - -UV_EXTERN int uv_shutdown(uv_shutdown_t* req, - uv_stream_t* handle, - uv_shutdown_cb cb); - -struct uv_shutdown_s { - UV_REQ_FIELDS - uv_stream_t* handle; - uv_shutdown_cb cb; - UV_SHUTDOWN_PRIVATE_FIELDS -}; - - -#define UV_HANDLE_FIELDS \ - /* public */ \ - void* data; \ - /* read-only */ \ - uv_loop_t* loop; \ - uv_handle_type type; \ - /* private */ \ - uv_close_cb close_cb; \ - void* handle_queue[2]; \ - union { \ - int fd; \ - void* reserved[4]; \ - } u; \ - UV_HANDLE_PRIVATE_FIELDS \ - -/* The abstract base class of all handles. */ -struct uv_handle_s { - UV_HANDLE_FIELDS -}; - -UV_EXTERN size_t uv_handle_size(uv_handle_type type); -UV_EXTERN uv_handle_type uv_handle_get_type(const uv_handle_t* handle); -UV_EXTERN const char* uv_handle_type_name(uv_handle_type type); -UV_EXTERN void* uv_handle_get_data(const uv_handle_t* handle); -UV_EXTERN uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle); -UV_EXTERN void uv_handle_set_data(uv_handle_t* handle, void* data); - -UV_EXTERN size_t uv_req_size(uv_req_type type); -UV_EXTERN void* uv_req_get_data(const uv_req_t* req); -UV_EXTERN void uv_req_set_data(uv_req_t* req, void* data); -UV_EXTERN uv_req_type uv_req_get_type(const uv_req_t* req); -UV_EXTERN const char* uv_req_type_name(uv_req_type type); - -UV_EXTERN int uv_is_active(const uv_handle_t* handle); - -UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg); - -/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */ -UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream); -UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream); - -UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb); - -UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value); -UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value); - -UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd); - -UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len); - -UV_EXTERN int uv_pipe(uv_file fds[2], int read_flags, int write_flags); -UV_EXTERN int uv_socketpair(int type, - int protocol, - uv_os_sock_t socket_vector[2], - int flags0, - int flags1); - -#define UV_STREAM_FIELDS \ - /* number of bytes queued for writing */ \ - size_t write_queue_size; \ - uv_alloc_cb alloc_cb; \ - uv_read_cb read_cb; \ - /* private */ \ - UV_STREAM_PRIVATE_FIELDS - -/* - * uv_stream_t is a subclass of uv_handle_t. - * - * uv_stream is an abstract class. - * - * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t. - */ -struct uv_stream_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS -}; - -UV_EXTERN size_t uv_stream_get_write_queue_size(const uv_stream_t* stream); - -UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb); -UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client); - -UV_EXTERN int uv_read_start(uv_stream_t*, - uv_alloc_cb alloc_cb, - uv_read_cb read_cb); -UV_EXTERN int uv_read_stop(uv_stream_t*); - -UV_EXTERN int uv_write(uv_write_t* req, - uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_write_cb cb); -UV_EXTERN int uv_write2(uv_write_t* req, - uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_stream_t* send_handle, - uv_write_cb cb); -UV_EXTERN int uv_try_write(uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs); -UV_EXTERN int uv_try_write2(uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_stream_t* send_handle); - -/* uv_write_t is a subclass of uv_req_t. */ -struct uv_write_s { - UV_REQ_FIELDS - uv_write_cb cb; - uv_stream_t* send_handle; /* TODO: make private and unix-only in v2.x. */ - uv_stream_t* handle; - UV_WRITE_PRIVATE_FIELDS -}; - - -UV_EXTERN int uv_is_readable(const uv_stream_t* handle); -UV_EXTERN int uv_is_writable(const uv_stream_t* handle); - -UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking); - -UV_EXTERN int uv_is_closing(const uv_handle_t* handle); - - -/* - * uv_tcp_t is a subclass of uv_stream_t. - * - * Represents a TCP stream or TCP server. - */ -struct uv_tcp_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_TCP_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); -UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags); -UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock); -UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); -UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, - int enable, - unsigned int delay); -UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); - -enum uv_tcp_flags { - /* Used with uv_tcp_bind, when an IPv6 address is used. */ - UV_TCP_IPV6ONLY = 1 -}; - -UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, - const struct sockaddr* addr, - unsigned int flags); -UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb); -UV_EXTERN int uv_tcp_connect(uv_connect_t* req, - uv_tcp_t* handle, - const struct sockaddr* addr, - uv_connect_cb cb); - -/* uv_connect_t is a subclass of uv_req_t. */ -struct uv_connect_s { - UV_REQ_FIELDS - uv_connect_cb cb; - uv_stream_t* handle; - UV_CONNECT_PRIVATE_FIELDS -}; - - -/* - * UDP support. - */ - -enum uv_udp_flags { - /* Disables dual stack mode. */ - UV_UDP_IPV6ONLY = 1, - /* - * Indicates message was truncated because read buffer was too small. The - * remainder was discarded by the OS. Used in uv_udp_recv_cb. - */ - UV_UDP_PARTIAL = 2, - /* - * Indicates if SO_REUSEADDR will be set when binding the handle. - * This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other - * Unix platforms, it sets the SO_REUSEADDR flag. What that means is that - * multiple threads or processes can bind to the same address without error - * (provided they all set the flag) but only the last one to bind will receive - * any traffic, in effect "stealing" the port from the previous listener. - */ - UV_UDP_REUSEADDR = 4, - /* - * Indicates that the message was received by recvmmsg, so the buffer provided - * must not be freed by the recv_cb callback. - */ - UV_UDP_MMSG_CHUNK = 8, - /* - * Indicates that the buffer provided has been fully utilized by recvmmsg and - * that it should now be freed by the recv_cb callback. When this flag is set - * in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL. - */ - UV_UDP_MMSG_FREE = 16, - /* - * Indicates if IP_RECVERR/IPV6_RECVERR will be set when binding the handle. - * This sets IP_RECVERR for IPv4 and IPV6_RECVERR for IPv6 UDP sockets on - * Linux. This stops the Linux kernel from suppressing some ICMP error - * messages and enables full ICMP error reporting for faster failover. - * This flag is no-op on platforms other than Linux. - */ - UV_UDP_LINUX_RECVERR = 32, - /* - * Indicates that recvmmsg should be used, if available. - */ - UV_UDP_RECVMMSG = 256 -}; - -typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); -typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, - ssize_t nread, - const uv_buf_t* buf, - const struct sockaddr* addr, - unsigned flags); - -/* uv_udp_t is a subclass of uv_handle_t. */ -struct uv_udp_s { - UV_HANDLE_FIELDS - /* read-only */ - /* - * Number of bytes queued for sending. This field strictly shows how much - * information is currently queued. - */ - size_t send_queue_size; - /* - * Number of send requests currently in the queue awaiting to be processed. - */ - size_t send_queue_count; - UV_UDP_PRIVATE_FIELDS -}; - -/* uv_udp_send_t is a subclass of uv_req_t. */ -struct uv_udp_send_s { - UV_REQ_FIELDS - uv_udp_t* handle; - uv_udp_send_cb cb; - UV_UDP_SEND_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); -UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags); -UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); -UV_EXTERN int uv_udp_bind(uv_udp_t* handle, - const struct sockaddr* addr, - unsigned int flags); -UV_EXTERN int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr); - -UV_EXTERN int uv_udp_getpeername(const uv_udp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, - const char* multicast_addr, - const char* interface_addr, - uv_membership membership); -UV_EXTERN int uv_udp_set_source_membership(uv_udp_t* handle, - const char* multicast_addr, - const char* interface_addr, - const char* source_addr, - uv_membership membership); -UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on); -UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl); -UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle, - const char* interface_addr); -UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on); -UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); -UV_EXTERN int uv_udp_send(uv_udp_send_t* req, - uv_udp_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - const struct sockaddr* addr, - uv_udp_send_cb send_cb); -UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - const struct sockaddr* addr); -UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, - uv_alloc_cb alloc_cb, - uv_udp_recv_cb recv_cb); -UV_EXTERN int uv_udp_using_recvmmsg(const uv_udp_t* handle); -UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); -UV_EXTERN size_t uv_udp_get_send_queue_size(const uv_udp_t* handle); -UV_EXTERN size_t uv_udp_get_send_queue_count(const uv_udp_t* handle); - - -/* - * uv_tty_t is a subclass of uv_stream_t. - * - * Representing a stream for the console. - */ -struct uv_tty_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_TTY_PRIVATE_FIELDS -}; - -typedef enum { - /* Initial/normal terminal mode */ - UV_TTY_MODE_NORMAL, - /* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */ - UV_TTY_MODE_RAW, - /* Binary-safe I/O mode for IPC (Unix-only) */ - UV_TTY_MODE_IO -} uv_tty_mode_t; - -typedef enum { - /* - * The console supports handling of virtual terminal sequences - * (Windows10 new console, ConEmu) - */ - UV_TTY_SUPPORTED, - /* The console cannot process the virtual terminal sequence. (Legacy - * console) - */ - UV_TTY_UNSUPPORTED -} uv_tty_vtermstate_t; - - -UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); -UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); -UV_EXTERN int uv_tty_reset_mode(void); -UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); -UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state); -UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state); - -#ifdef __cplusplus -extern "C++" { - -inline int uv_tty_set_mode(uv_tty_t* handle, int mode) { - return uv_tty_set_mode(handle, static_cast(mode)); -} - -} -#endif - -UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); - -/* - * uv_pipe_t is a subclass of uv_stream_t. - * - * Representing a pipe stream or pipe server. On Windows this is a Named - * Pipe. On Unix this is a Unix domain socket. - */ -struct uv_pipe_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - int ipc; /* non-zero if this pipe is used for passing handles */ - UV_PIPE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc); -UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); -UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); -UV_EXTERN void uv_pipe_connect(uv_connect_t* req, - uv_pipe_t* handle, - const char* name, - uv_connect_cb cb); -UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle, - char* buffer, - size_t* size); -UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle, - char* buffer, - size_t* size); -UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count); -UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); -UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle); -UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags); - - -struct uv_poll_s { - UV_HANDLE_FIELDS - uv_poll_cb poll_cb; - UV_POLL_PRIVATE_FIELDS -}; - -enum uv_poll_event { - UV_READABLE = 1, - UV_WRITABLE = 2, - UV_DISCONNECT = 4, - UV_PRIORITIZED = 8 -}; - -UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd); -UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop, - uv_poll_t* handle, - uv_os_sock_t socket); -UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb); -UV_EXTERN int uv_poll_stop(uv_poll_t* handle); - - -struct uv_prepare_s { - UV_HANDLE_FIELDS - UV_PREPARE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare); -UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb); -UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare); - - -struct uv_check_s { - UV_HANDLE_FIELDS - UV_CHECK_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check); -UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb); -UV_EXTERN int uv_check_stop(uv_check_t* check); - - -struct uv_idle_s { - UV_HANDLE_FIELDS - UV_IDLE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle); -UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb); -UV_EXTERN int uv_idle_stop(uv_idle_t* idle); - - -struct uv_async_s { - UV_HANDLE_FIELDS - UV_ASYNC_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_async_init(uv_loop_t*, - uv_async_t* async, - uv_async_cb async_cb); -UV_EXTERN int uv_async_send(uv_async_t* async); - - -/* - * uv_timer_t is a subclass of uv_handle_t. - * - * Used to get woken up at a specified time in the future. - */ -struct uv_timer_s { - UV_HANDLE_FIELDS - UV_TIMER_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); -UV_EXTERN int uv_timer_start(uv_timer_t* handle, - uv_timer_cb cb, - uint64_t timeout, - uint64_t repeat); -UV_EXTERN int uv_timer_stop(uv_timer_t* handle); -UV_EXTERN int uv_timer_again(uv_timer_t* handle); -UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); -UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); -UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle); - - -/* - * uv_getaddrinfo_t is a subclass of uv_req_t. - * - * Request object for uv_getaddrinfo. - */ -struct uv_getaddrinfo_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* struct addrinfo* addrinfo is marked as private, but it really isn't. */ - UV_GETADDRINFO_PRIVATE_FIELDS -}; - - -UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop, - uv_getaddrinfo_t* req, - uv_getaddrinfo_cb getaddrinfo_cb, - const char* node, - const char* service, - const struct addrinfo* hints); -UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai); - - -/* -* uv_getnameinfo_t is a subclass of uv_req_t. -* -* Request object for uv_getnameinfo. -*/ -struct uv_getnameinfo_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* host and service are marked as private, but they really aren't. */ - UV_GETNAMEINFO_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_getnameinfo(uv_loop_t* loop, - uv_getnameinfo_t* req, - uv_getnameinfo_cb getnameinfo_cb, - const struct sockaddr* addr, - int flags); - - -/* uv_spawn() options. */ -typedef enum { - UV_IGNORE = 0x00, - UV_CREATE_PIPE = 0x01, - UV_INHERIT_FD = 0x02, - UV_INHERIT_STREAM = 0x04, - - /* - * When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE - * determine the direction of flow, from the child process' perspective. Both - * flags may be specified to create a duplex data stream. - */ - UV_READABLE_PIPE = 0x10, - UV_WRITABLE_PIPE = 0x20, - - /* - * When UV_CREATE_PIPE is specified, specifying UV_NONBLOCK_PIPE opens the - * handle in non-blocking mode in the child. This may cause loss of data, - * if the child is not designed to handle to encounter this mode, - * but can also be significantly more efficient. - */ - UV_NONBLOCK_PIPE = 0x40, - UV_OVERLAPPED_PIPE = 0x40 /* old name, for compatibility */ -} uv_stdio_flags; - -typedef struct uv_stdio_container_s { - uv_stdio_flags flags; - - union { - uv_stream_t* stream; - int fd; - } data; -} uv_stdio_container_t; - -typedef struct uv_process_options_s { - uv_exit_cb exit_cb; /* Called after the process exits. */ - const char* file; /* Path to program to execute. */ - /* - * Command line arguments. args[0] should be the path to the program. On - * Windows this uses CreateProcess which concatenates the arguments into a - * string this can cause some strange errors. See the note at - * windows_verbatim_arguments. - */ - char** args; - /* - * This will be set as the environ variable in the subprocess. If this is - * NULL then the parents environ will be used. - */ - char** env; - /* - * If non-null this represents a directory the subprocess should execute - * in. Stands for current working directory. - */ - const char* cwd; - /* - * Various flags that control how uv_spawn() behaves. See the definition of - * `enum uv_process_flags` below. - */ - unsigned int flags; - /* - * The `stdio` field points to an array of uv_stdio_container_t structs that - * describe the file descriptors that will be made available to the child - * process. The convention is that stdio[0] points to stdin, fd 1 is used for - * stdout, and fd 2 is stderr. - * - * Note that on windows file descriptors greater than 2 are available to the - * child process only if the child processes uses the MSVCRT runtime. - */ - int stdio_count; - uv_stdio_container_t* stdio; - /* - * Libuv can change the child process' user/group id. This happens only when - * the appropriate bits are set in the flags fields. This is not supported on - * windows; uv_spawn() will fail and set the error to UV_ENOTSUP. - */ - uv_uid_t uid; - uv_gid_t gid; -} uv_process_options_t; - -/* - * These are the flags that can be used for the uv_process_options.flags field. - */ -enum uv_process_flags { - /* - * Set the child process' user id. The user id is supplied in the `uid` field - * of the options struct. This does not work on windows; setting this flag - * will cause uv_spawn() to fail. - */ - UV_PROCESS_SETUID = (1 << 0), - /* - * Set the child process' group id. The user id is supplied in the `gid` - * field of the options struct. This does not work on windows; setting this - * flag will cause uv_spawn() to fail. - */ - UV_PROCESS_SETGID = (1 << 1), - /* - * Do not wrap any arguments in quotes, or perform any other escaping, when - * converting the argument list into a command line string. This option is - * only meaningful on Windows systems. On Unix it is silently ignored. - */ - UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), - /* - * Spawn the child process in a detached state - this will make it a process - * group leader, and will effectively enable the child to keep running after - * the parent exits. Note that the child process will still keep the - * parent's event loop alive unless the parent process calls uv_unref() on - * the child's process handle. - */ - UV_PROCESS_DETACHED = (1 << 3), - /* - * Hide the subprocess window that would normally be created. This option is - * only meaningful on Windows systems. On Unix it is silently ignored. - */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4), - /* - * Hide the subprocess console window that would normally be created. This - * option is only meaningful on Windows systems. On Unix it is silently - * ignored. - */ - UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), - /* - * Hide the subprocess GUI window that would normally be created. This - * option is only meaningful on Windows systems. On Unix it is silently - * ignored. - */ - UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6) -}; - -/* - * uv_process_t is a subclass of uv_handle_t. - */ -struct uv_process_s { - UV_HANDLE_FIELDS - uv_exit_cb exit_cb; - int pid; - UV_PROCESS_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_spawn(uv_loop_t* loop, - uv_process_t* handle, - const uv_process_options_t* options); -UV_EXTERN int uv_process_kill(uv_process_t*, int signum); -UV_EXTERN int uv_kill(int pid, int signum); -UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*); - - -/* - * uv_work_t is a subclass of uv_req_t. - */ -struct uv_work_s { - UV_REQ_FIELDS - uv_loop_t* loop; - uv_work_cb work_cb; - uv_after_work_cb after_work_cb; - UV_WORK_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_queue_work(uv_loop_t* loop, - uv_work_t* req, - uv_work_cb work_cb, - uv_after_work_cb after_work_cb); - -UV_EXTERN int uv_cancel(uv_req_t* req); - - -struct uv_cpu_times_s { - uint64_t user; /* milliseconds */ - uint64_t nice; /* milliseconds */ - uint64_t sys; /* milliseconds */ - uint64_t idle; /* milliseconds */ - uint64_t irq; /* milliseconds */ -}; - -struct uv_cpu_info_s { - char* model; - int speed; - struct uv_cpu_times_s cpu_times; -}; - -struct uv_interface_address_s { - char* name; - char phys_addr[6]; - int is_internal; - union { - struct sockaddr_in address4; - struct sockaddr_in6 address6; - } address; - union { - struct sockaddr_in netmask4; - struct sockaddr_in6 netmask6; - } netmask; -}; - -struct uv_passwd_s { - char* username; - long uid; - long gid; - char* shell; - char* homedir; -}; - -struct uv_utsname_s { - char sysname[256]; - char release[256]; - char version[256]; - char machine[256]; - /* This struct does not contain the nodename and domainname fields present in - the utsname type. domainname is a GNU extension. Both fields are referred - to as meaningless in the docs. */ -}; - -struct uv_statfs_s { - uint64_t f_type; - uint64_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_spare[4]; -}; - -typedef enum { - UV_DIRENT_UNKNOWN, - UV_DIRENT_FILE, - UV_DIRENT_DIR, - UV_DIRENT_LINK, - UV_DIRENT_FIFO, - UV_DIRENT_SOCKET, - UV_DIRENT_CHAR, - UV_DIRENT_BLOCK -} uv_dirent_type_t; - -struct uv_dirent_s { - const char* name; - uv_dirent_type_t type; -}; - -UV_EXTERN char** uv_setup_args(int argc, char** argv); -UV_EXTERN int uv_get_process_title(char* buffer, size_t size); -UV_EXTERN int uv_set_process_title(const char* title); -UV_EXTERN int uv_resident_set_memory(size_t* rss); -UV_EXTERN int uv_uptime(double* uptime); -UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd); -UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd); - -typedef struct { - long tv_sec; - long tv_usec; -} uv_timeval_t; - -typedef struct { - int64_t tv_sec; - int32_t tv_usec; -} uv_timeval64_t; - -typedef struct { - uv_timeval_t ru_utime; /* user CPU time used */ - uv_timeval_t ru_stime; /* system CPU time used */ - uint64_t ru_maxrss; /* maximum resident set size */ - uint64_t ru_ixrss; /* integral shared memory size */ - uint64_t ru_idrss; /* integral unshared data size */ - uint64_t ru_isrss; /* integral unshared stack size */ - uint64_t ru_minflt; /* page reclaims (soft page faults) */ - uint64_t ru_majflt; /* page faults (hard page faults) */ - uint64_t ru_nswap; /* swaps */ - uint64_t ru_inblock; /* block input operations */ - uint64_t ru_oublock; /* block output operations */ - uint64_t ru_msgsnd; /* IPC messages sent */ - uint64_t ru_msgrcv; /* IPC messages received */ - uint64_t ru_nsignals; /* signals received */ - uint64_t ru_nvcsw; /* voluntary context switches */ - uint64_t ru_nivcsw; /* involuntary context switches */ -} uv_rusage_t; - -UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); - -UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); -UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); -UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); -UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); -UV_EXTERN uv_pid_t uv_os_getpid(void); -UV_EXTERN uv_pid_t uv_os_getppid(void); - -#if defined(__PASE__) -/* On IBM i PASE, the highest process priority is -10 */ -# define UV_PRIORITY_LOW 39 /* RUNPTY(99) */ -# define UV_PRIORITY_BELOW_NORMAL 15 /* RUNPTY(50) */ -# define UV_PRIORITY_NORMAL 0 /* RUNPTY(20) */ -# define UV_PRIORITY_ABOVE_NORMAL -4 /* RUNTY(12) */ -# define UV_PRIORITY_HIGH -7 /* RUNPTY(6) */ -# define UV_PRIORITY_HIGHEST -10 /* RUNPTY(1) */ -#else -# define UV_PRIORITY_LOW 19 -# define UV_PRIORITY_BELOW_NORMAL 10 -# define UV_PRIORITY_NORMAL 0 -# define UV_PRIORITY_ABOVE_NORMAL -7 -# define UV_PRIORITY_HIGH -14 -# define UV_PRIORITY_HIGHEST -20 -#endif - -UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); -UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); - -UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); -UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); - -UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, - int* count); -UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses, - int count); - -struct uv_env_item_s { - char* name; - char* value; -}; - -UV_EXTERN int uv_os_environ(uv_env_item_t** envitems, int* count); -UV_EXTERN void uv_os_free_environ(uv_env_item_t* envitems, int count); -UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size); -UV_EXTERN int uv_os_setenv(const char* name, const char* value); -UV_EXTERN int uv_os_unsetenv(const char* name); - -#ifdef MAXHOSTNAMELEN -# define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1) -#else - /* - Fallback for the maximum hostname size, including the null terminator. The - Windows gethostname() documentation states that 256 bytes will always be - large enough to hold the null-terminated hostname. - */ -# define UV_MAXHOSTNAMESIZE 256 -#endif - -UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size); - -UV_EXTERN int uv_os_uname(uv_utsname_t* buffer); - -UV_EXTERN uint64_t uv_metrics_idle_time(uv_loop_t* loop); - -typedef enum { - UV_FS_UNKNOWN = -1, - UV_FS_CUSTOM, - UV_FS_OPEN, - UV_FS_CLOSE, - UV_FS_READ, - UV_FS_WRITE, - UV_FS_SENDFILE, - UV_FS_STAT, - UV_FS_LSTAT, - UV_FS_FSTAT, - UV_FS_FTRUNCATE, - UV_FS_UTIME, - UV_FS_FUTIME, - UV_FS_ACCESS, - UV_FS_CHMOD, - UV_FS_FCHMOD, - UV_FS_FSYNC, - UV_FS_FDATASYNC, - UV_FS_UNLINK, - UV_FS_RMDIR, - UV_FS_MKDIR, - UV_FS_MKDTEMP, - UV_FS_RENAME, - UV_FS_SCANDIR, - UV_FS_LINK, - UV_FS_SYMLINK, - UV_FS_READLINK, - UV_FS_CHOWN, - UV_FS_FCHOWN, - UV_FS_REALPATH, - UV_FS_COPYFILE, - UV_FS_LCHOWN, - UV_FS_OPENDIR, - UV_FS_READDIR, - UV_FS_CLOSEDIR, - UV_FS_STATFS, - UV_FS_MKSTEMP, - UV_FS_LUTIME -} uv_fs_type; - -struct uv_dir_s { - uv_dirent_t* dirents; - size_t nentries; - void* reserved[4]; - UV_DIR_PRIVATE_FIELDS -}; - -/* uv_fs_t is a subclass of uv_req_t. */ -struct uv_fs_s { - UV_REQ_FIELDS - uv_fs_type fs_type; - uv_loop_t* loop; - uv_fs_cb cb; - ssize_t result; - void* ptr; - const char* path; - uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ - UV_FS_PRIVATE_FIELDS -}; - -UV_EXTERN uv_fs_type uv_fs_get_type(const uv_fs_t*); -UV_EXTERN ssize_t uv_fs_get_result(const uv_fs_t*); -UV_EXTERN int uv_fs_get_system_error(const uv_fs_t*); -UV_EXTERN void* uv_fs_get_ptr(const uv_fs_t*); -UV_EXTERN const char* uv_fs_get_path(const uv_fs_t*); -UV_EXTERN uv_stat_t* uv_fs_get_statbuf(uv_fs_t*); - -UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req); -UV_EXTERN int uv_fs_close(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_open(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int flags, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_read(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - const uv_buf_t bufs[], - unsigned int nbufs, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_write(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - const uv_buf_t bufs[], - unsigned int nbufs, - int64_t offset, - uv_fs_cb cb); -/* - * This flag can be used with uv_fs_copyfile() to return an error if the - * destination already exists. - */ -#define UV_FS_COPYFILE_EXCL 0x0001 - -/* - * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. - * If copy-on-write is not supported, a fallback copy mechanism is used. - */ -#define UV_FS_COPYFILE_FICLONE 0x0002 - -/* - * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. - * If copy-on-write is not supported, an error is returned. - */ -#define UV_FS_COPYFILE_FICLONE_FORCE 0x0004 - -UV_EXTERN int uv_fs_copyfile(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop, - uv_fs_t* req, - const char* tpl, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop, - uv_fs_t* req, - const char* tpl, - uv_fs_cb cb); -UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_scandir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req, - uv_dirent_t* ent); -UV_EXTERN int uv_fs_opendir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_readdir(uv_loop_t* loop, - uv_fs_t* req, - uv_dir_t* dir, - uv_fs_cb cb); -UV_EXTERN int uv_fs_closedir(uv_loop_t* loop, - uv_fs_t* req, - uv_dir_t* dir, - uv_fs_cb cb); -UV_EXTERN int uv_fs_stat(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_rename(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, - uv_fs_t* req, - uv_file out_fd, - uv_file in_fd, - int64_t in_offset, - size_t length, - uv_fs_cb cb); -UV_EXTERN int uv_fs_access(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_utime(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_futime(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lutime(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_link(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - uv_fs_cb cb); - -/* - * This flag can be used with uv_fs_symlink() on Windows to specify whether - * path argument points to a directory. - */ -#define UV_FS_SYMLINK_DIR 0x0001 - -/* - * This flag can be used with uv_fs_symlink() on Windows to specify whether - * the symlink is to be created using junction points. - */ -#define UV_FS_SYMLINK_JUNCTION 0x0002 - -UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_realpath(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_chown(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lchown(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_statfs(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); - - -enum uv_fs_event { - UV_RENAME = 1, - UV_CHANGE = 2 -}; - - -struct uv_fs_event_s { - UV_HANDLE_FIELDS - /* private */ - char* path; - UV_FS_EVENT_PRIVATE_FIELDS -}; - - -/* - * uv_fs_stat() based polling file watcher. - */ -struct uv_fs_poll_s { - UV_HANDLE_FIELDS - /* Private, don't touch. */ - void* poll_ctx; -}; - -UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); -UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle, - uv_fs_poll_cb poll_cb, - const char* path, - unsigned int interval); -UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle); -UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle, - char* buffer, - size_t* size); - - -struct uv_signal_s { - UV_HANDLE_FIELDS - uv_signal_cb signal_cb; - int signum; - UV_SIGNAL_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); -UV_EXTERN int uv_signal_start(uv_signal_t* handle, - uv_signal_cb signal_cb, - int signum); -UV_EXTERN int uv_signal_start_oneshot(uv_signal_t* handle, - uv_signal_cb signal_cb, - int signum); -UV_EXTERN int uv_signal_stop(uv_signal_t* handle); - -UV_EXTERN void uv_loadavg(double avg[3]); - - -/* - * Flags to be passed to uv_fs_event_start(). - */ -enum uv_fs_event_flags { - /* - * By default, if the fs event watcher is given a directory name, we will - * watch for all events in that directory. This flags overrides this behavior - * and makes fs_event report only changes to the directory entry itself. This - * flag does not affect individual files watched. - * This flag is currently not implemented yet on any backend. - */ - UV_FS_EVENT_WATCH_ENTRY = 1, - - /* - * By default uv_fs_event will try to use a kernel interface such as inotify - * or kqueue to detect events. This may not work on remote filesystems such - * as NFS mounts. This flag makes fs_event fall back to calling stat() on a - * regular interval. - * This flag is currently not implemented yet on any backend. - */ - UV_FS_EVENT_STAT = 2, - - /* - * By default, event watcher, when watching directory, is not registering - * (is ignoring) changes in it's subdirectories. - * This flag will override this behaviour on platforms that support it. - */ - UV_FS_EVENT_RECURSIVE = 4 -}; - - -UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle); -UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle, - uv_fs_event_cb cb, - const char* path, - unsigned int flags); -UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle); -UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle, - char* buffer, - size_t* size); - -UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); -UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); - -UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size); -UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size); -UV_EXTERN int uv_ip_name(const struct sockaddr* src, char* dst, size_t size); - -UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); -UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); - - -struct uv_random_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* private */ - int status; - void* buf; - size_t buflen; - uv_random_cb cb; - struct uv__work work_req; -}; - -UV_EXTERN int uv_random(uv_loop_t* loop, - uv_random_t* req, - void *buf, - size_t buflen, - unsigned flags, /* For future extension; must be 0. */ - uv_random_cb cb); - -#if defined(IF_NAMESIZE) -# define UV_IF_NAMESIZE (IF_NAMESIZE + 1) -#elif defined(IFNAMSIZ) -# define UV_IF_NAMESIZE (IFNAMSIZ + 1) -#else -# define UV_IF_NAMESIZE (16 + 1) -#endif - -UV_EXTERN int uv_if_indextoname(unsigned int ifindex, - char* buffer, - size_t* size); -UV_EXTERN int uv_if_indextoiid(unsigned int ifindex, - char* buffer, - size_t* size); - -UV_EXTERN int uv_exepath(char* buffer, size_t* size); - -UV_EXTERN int uv_cwd(char* buffer, size_t* size); - -UV_EXTERN int uv_chdir(const char* dir); - -UV_EXTERN uint64_t uv_get_free_memory(void); -UV_EXTERN uint64_t uv_get_total_memory(void); -UV_EXTERN uint64_t uv_get_constrained_memory(void); - -UV_EXTERN uint64_t uv_hrtime(void); -UV_EXTERN void uv_sleep(unsigned int msec); - -UV_EXTERN void uv_disable_stdio_inheritance(void); - -UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib); -UV_EXTERN void uv_dlclose(uv_lib_t* lib); -UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr); -UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib); - -UV_EXTERN int uv_mutex_init(uv_mutex_t* handle); -UV_EXTERN int uv_mutex_init_recursive(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle); -UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle); - -UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock); -UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock); -UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock); - -UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value); -UV_EXTERN void uv_sem_destroy(uv_sem_t* sem); -UV_EXTERN void uv_sem_post(uv_sem_t* sem); -UV_EXTERN void uv_sem_wait(uv_sem_t* sem); -UV_EXTERN int uv_sem_trywait(uv_sem_t* sem); - -UV_EXTERN int uv_cond_init(uv_cond_t* cond); -UV_EXTERN void uv_cond_destroy(uv_cond_t* cond); -UV_EXTERN void uv_cond_signal(uv_cond_t* cond); -UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond); - -UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count); -UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier); -UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier); - -UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex); -UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, - uint64_t timeout); - -UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void)); - -UV_EXTERN int uv_key_create(uv_key_t* key); -UV_EXTERN void uv_key_delete(uv_key_t* key); -UV_EXTERN void* uv_key_get(uv_key_t* key); -UV_EXTERN void uv_key_set(uv_key_t* key, void* value); - -UV_EXTERN int uv_gettimeofday(uv_timeval64_t* tv); - -typedef void (*uv_thread_cb)(void* arg); - -UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); - -typedef enum { - UV_THREAD_NO_FLAGS = 0x00, - UV_THREAD_HAS_STACK_SIZE = 0x01 -} uv_thread_create_flags; - -struct uv_thread_options_s { - unsigned int flags; - size_t stack_size; - /* More fields may be added at any time. */ -}; - -typedef struct uv_thread_options_s uv_thread_options_t; - -UV_EXTERN int uv_thread_create_ex(uv_thread_t* tid, - const uv_thread_options_t* params, - uv_thread_cb entry, - void* arg); -UV_EXTERN uv_thread_t uv_thread_self(void); -UV_EXTERN int uv_thread_join(uv_thread_t *tid); -UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); - -/* The presence of these unions force similar struct layout. */ -#define XX(_, name) uv_ ## name ## _t name; -union uv_any_handle { - UV_HANDLE_TYPE_MAP(XX) -}; - -union uv_any_req { - UV_REQ_TYPE_MAP(XX) -}; -#undef XX - - -struct uv_loop_s { - /* User data - use this for whatever. */ - void* data; - /* Loop reference counting. */ - unsigned int active_handles; - void* handle_queue[2]; - union { - void* unused; - unsigned int count; - } active_reqs; - /* Internal storage for future extensions. */ - void* internal_fields; - /* Internal flag to signal loop stop. */ - unsigned int stop_flag; - UV_LOOP_PRIVATE_FIELDS -}; - -UV_EXTERN void* uv_loop_get_data(const uv_loop_t*); -UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data); - -/* Don't export the private CPP symbols. */ -#undef UV_HANDLE_TYPE_PRIVATE -#undef UV_REQ_TYPE_PRIVATE -#undef UV_REQ_PRIVATE_FIELDS -#undef UV_STREAM_PRIVATE_FIELDS -#undef UV_TCP_PRIVATE_FIELDS -#undef UV_PREPARE_PRIVATE_FIELDS -#undef UV_CHECK_PRIVATE_FIELDS -#undef UV_IDLE_PRIVATE_FIELDS -#undef UV_ASYNC_PRIVATE_FIELDS -#undef UV_TIMER_PRIVATE_FIELDS -#undef UV_GETADDRINFO_PRIVATE_FIELDS -#undef UV_GETNAMEINFO_PRIVATE_FIELDS -#undef UV_FS_REQ_PRIVATE_FIELDS -#undef UV_WORK_PRIVATE_FIELDS -#undef UV_FS_EVENT_PRIVATE_FIELDS -#undef UV_SIGNAL_PRIVATE_FIELDS -#undef UV_LOOP_PRIVATE_FIELDS -#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS -#undef UV__ERR - -#ifdef __cplusplus -} -#endif -#endif /* UV_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/aix.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/aix.h deleted file mode 100644 index 7dc992fa..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/aix.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_AIX_H -#define UV_AIX_H - -#define UV_PLATFORM_LOOP_FIELDS \ - int fs_fd; \ - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - uv__io_t event_watcher; \ - char *dir_filename; \ - -#endif /* UV_AIX_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/android-ifaddrs.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/android-ifaddrs.h deleted file mode 100644 index 9cd19fec..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/android-ifaddrs.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1995, 1999 - * Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp - */ - -#ifndef _IFADDRS_H_ -#define _IFADDRS_H_ - -struct ifaddrs { - struct ifaddrs *ifa_next; - char *ifa_name; - unsigned int ifa_flags; - struct sockaddr *ifa_addr; - struct sockaddr *ifa_netmask; - struct sockaddr *ifa_dstaddr; - void *ifa_data; -}; - -/* - * This may have been defined in . Note that if is - * to be included it must be included before this header file. - */ -#ifndef ifa_broadaddr -#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ -#endif - -#include - -__BEGIN_DECLS -extern int getifaddrs(struct ifaddrs **ifap); -extern void freeifaddrs(struct ifaddrs *ifa); -__END_DECLS - -#endif diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/bsd.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/bsd.h deleted file mode 100644 index 2d72b3d7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/bsd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_BSD_H -#define UV_BSD_H - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - uv__io_t event_watcher; \ - -#define UV_IO_PRIVATE_PLATFORM_FIELDS \ - int rcount; \ - int wcount; \ - -#define UV_HAVE_KQUEUE 1 - -#endif /* UV_BSD_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/darwin.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/darwin.h deleted file mode 100644 index d2264158..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/darwin.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_DARWIN_H -#define UV_DARWIN_H - -#if defined(__APPLE__) && defined(__MACH__) -# include -# include -# include -# include -# define UV_PLATFORM_SEM_T semaphore_t -#endif - -#define UV_IO_PRIVATE_PLATFORM_FIELDS \ - int rcount; \ - int wcount; \ - -#define UV_PLATFORM_LOOP_FIELDS \ - uv_thread_t cf_thread; \ - void* _cf_reserved; \ - void* cf_state; \ - uv_mutex_t cf_mutex; \ - uv_sem_t cf_sem; \ - void* cf_signals[2]; \ - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - uv__io_t event_watcher; \ - char* realpath; \ - int realpath_len; \ - int cf_flags; \ - uv_async_t* cf_cb; \ - void* cf_events[2]; \ - void* cf_member[2]; \ - int cf_error; \ - uv_mutex_t cf_mutex; \ - -#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ - void* select; \ - -#define UV_HAVE_KQUEUE 1 - -#endif /* UV_DARWIN_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/errno.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/errno.h deleted file mode 100644 index 71906b3f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/errno.h +++ /dev/null @@ -1,460 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_ERRNO_H_ -#define UV_ERRNO_H_ - -#include -#if EDOM > 0 -# define UV__ERR(x) (-(x)) -#else -# define UV__ERR(x) (x) -#endif - -#define UV__EOF (-4095) -#define UV__UNKNOWN (-4094) - -#define UV__EAI_ADDRFAMILY (-3000) -#define UV__EAI_AGAIN (-3001) -#define UV__EAI_BADFLAGS (-3002) -#define UV__EAI_CANCELED (-3003) -#define UV__EAI_FAIL (-3004) -#define UV__EAI_FAMILY (-3005) -#define UV__EAI_MEMORY (-3006) -#define UV__EAI_NODATA (-3007) -#define UV__EAI_NONAME (-3008) -#define UV__EAI_OVERFLOW (-3009) -#define UV__EAI_SERVICE (-3010) -#define UV__EAI_SOCKTYPE (-3011) -#define UV__EAI_BADHINTS (-3013) -#define UV__EAI_PROTOCOL (-3014) - -/* Only map to the system errno on non-Windows platforms. It's apparently - * a fairly common practice for Windows programmers to redefine errno codes. - */ -#if defined(E2BIG) && !defined(_WIN32) -# define UV__E2BIG UV__ERR(E2BIG) -#else -# define UV__E2BIG (-4093) -#endif - -#if defined(EACCES) && !defined(_WIN32) -# define UV__EACCES UV__ERR(EACCES) -#else -# define UV__EACCES (-4092) -#endif - -#if defined(EADDRINUSE) && !defined(_WIN32) -# define UV__EADDRINUSE UV__ERR(EADDRINUSE) -#else -# define UV__EADDRINUSE (-4091) -#endif - -#if defined(EADDRNOTAVAIL) && !defined(_WIN32) -# define UV__EADDRNOTAVAIL UV__ERR(EADDRNOTAVAIL) -#else -# define UV__EADDRNOTAVAIL (-4090) -#endif - -#if defined(EAFNOSUPPORT) && !defined(_WIN32) -# define UV__EAFNOSUPPORT UV__ERR(EAFNOSUPPORT) -#else -# define UV__EAFNOSUPPORT (-4089) -#endif - -#if defined(EAGAIN) && !defined(_WIN32) -# define UV__EAGAIN UV__ERR(EAGAIN) -#else -# define UV__EAGAIN (-4088) -#endif - -#if defined(EALREADY) && !defined(_WIN32) -# define UV__EALREADY UV__ERR(EALREADY) -#else -# define UV__EALREADY (-4084) -#endif - -#if defined(EBADF) && !defined(_WIN32) -# define UV__EBADF UV__ERR(EBADF) -#else -# define UV__EBADF (-4083) -#endif - -#if defined(EBUSY) && !defined(_WIN32) -# define UV__EBUSY UV__ERR(EBUSY) -#else -# define UV__EBUSY (-4082) -#endif - -#if defined(ECANCELED) && !defined(_WIN32) -# define UV__ECANCELED UV__ERR(ECANCELED) -#else -# define UV__ECANCELED (-4081) -#endif - -#if defined(ECHARSET) && !defined(_WIN32) -# define UV__ECHARSET UV__ERR(ECHARSET) -#else -# define UV__ECHARSET (-4080) -#endif - -#if defined(ECONNABORTED) && !defined(_WIN32) -# define UV__ECONNABORTED UV__ERR(ECONNABORTED) -#else -# define UV__ECONNABORTED (-4079) -#endif - -#if defined(ECONNREFUSED) && !defined(_WIN32) -# define UV__ECONNREFUSED UV__ERR(ECONNREFUSED) -#else -# define UV__ECONNREFUSED (-4078) -#endif - -#if defined(ECONNRESET) && !defined(_WIN32) -# define UV__ECONNRESET UV__ERR(ECONNRESET) -#else -# define UV__ECONNRESET (-4077) -#endif - -#if defined(EDESTADDRREQ) && !defined(_WIN32) -# define UV__EDESTADDRREQ UV__ERR(EDESTADDRREQ) -#else -# define UV__EDESTADDRREQ (-4076) -#endif - -#if defined(EEXIST) && !defined(_WIN32) -# define UV__EEXIST UV__ERR(EEXIST) -#else -# define UV__EEXIST (-4075) -#endif - -#if defined(EFAULT) && !defined(_WIN32) -# define UV__EFAULT UV__ERR(EFAULT) -#else -# define UV__EFAULT (-4074) -#endif - -#if defined(EHOSTUNREACH) && !defined(_WIN32) -# define UV__EHOSTUNREACH UV__ERR(EHOSTUNREACH) -#else -# define UV__EHOSTUNREACH (-4073) -#endif - -#if defined(EINTR) && !defined(_WIN32) -# define UV__EINTR UV__ERR(EINTR) -#else -# define UV__EINTR (-4072) -#endif - -#if defined(EINVAL) && !defined(_WIN32) -# define UV__EINVAL UV__ERR(EINVAL) -#else -# define UV__EINVAL (-4071) -#endif - -#if defined(EIO) && !defined(_WIN32) -# define UV__EIO UV__ERR(EIO) -#else -# define UV__EIO (-4070) -#endif - -#if defined(EISCONN) && !defined(_WIN32) -# define UV__EISCONN UV__ERR(EISCONN) -#else -# define UV__EISCONN (-4069) -#endif - -#if defined(EISDIR) && !defined(_WIN32) -# define UV__EISDIR UV__ERR(EISDIR) -#else -# define UV__EISDIR (-4068) -#endif - -#if defined(ELOOP) && !defined(_WIN32) -# define UV__ELOOP UV__ERR(ELOOP) -#else -# define UV__ELOOP (-4067) -#endif - -#if defined(EMFILE) && !defined(_WIN32) -# define UV__EMFILE UV__ERR(EMFILE) -#else -# define UV__EMFILE (-4066) -#endif - -#if defined(EMSGSIZE) && !defined(_WIN32) -# define UV__EMSGSIZE UV__ERR(EMSGSIZE) -#else -# define UV__EMSGSIZE (-4065) -#endif - -#if defined(ENAMETOOLONG) && !defined(_WIN32) -# define UV__ENAMETOOLONG UV__ERR(ENAMETOOLONG) -#else -# define UV__ENAMETOOLONG (-4064) -#endif - -#if defined(ENETDOWN) && !defined(_WIN32) -# define UV__ENETDOWN UV__ERR(ENETDOWN) -#else -# define UV__ENETDOWN (-4063) -#endif - -#if defined(ENETUNREACH) && !defined(_WIN32) -# define UV__ENETUNREACH UV__ERR(ENETUNREACH) -#else -# define UV__ENETUNREACH (-4062) -#endif - -#if defined(ENFILE) && !defined(_WIN32) -# define UV__ENFILE UV__ERR(ENFILE) -#else -# define UV__ENFILE (-4061) -#endif - -#if defined(ENOBUFS) && !defined(_WIN32) -# define UV__ENOBUFS UV__ERR(ENOBUFS) -#else -# define UV__ENOBUFS (-4060) -#endif - -#if defined(ENODEV) && !defined(_WIN32) -# define UV__ENODEV UV__ERR(ENODEV) -#else -# define UV__ENODEV (-4059) -#endif - -#if defined(ENOENT) && !defined(_WIN32) -# define UV__ENOENT UV__ERR(ENOENT) -#else -# define UV__ENOENT (-4058) -#endif - -#if defined(ENOMEM) && !defined(_WIN32) -# define UV__ENOMEM UV__ERR(ENOMEM) -#else -# define UV__ENOMEM (-4057) -#endif - -#if defined(ENONET) && !defined(_WIN32) -# define UV__ENONET UV__ERR(ENONET) -#else -# define UV__ENONET (-4056) -#endif - -#if defined(ENOSPC) && !defined(_WIN32) -# define UV__ENOSPC UV__ERR(ENOSPC) -#else -# define UV__ENOSPC (-4055) -#endif - -#if defined(ENOSYS) && !defined(_WIN32) -# define UV__ENOSYS UV__ERR(ENOSYS) -#else -# define UV__ENOSYS (-4054) -#endif - -#if defined(ENOTCONN) && !defined(_WIN32) -# define UV__ENOTCONN UV__ERR(ENOTCONN) -#else -# define UV__ENOTCONN (-4053) -#endif - -#if defined(ENOTDIR) && !defined(_WIN32) -# define UV__ENOTDIR UV__ERR(ENOTDIR) -#else -# define UV__ENOTDIR (-4052) -#endif - -#if defined(ENOTEMPTY) && !defined(_WIN32) -# define UV__ENOTEMPTY UV__ERR(ENOTEMPTY) -#else -# define UV__ENOTEMPTY (-4051) -#endif - -#if defined(ENOTSOCK) && !defined(_WIN32) -# define UV__ENOTSOCK UV__ERR(ENOTSOCK) -#else -# define UV__ENOTSOCK (-4050) -#endif - -#if defined(ENOTSUP) && !defined(_WIN32) -# define UV__ENOTSUP UV__ERR(ENOTSUP) -#else -# define UV__ENOTSUP (-4049) -#endif - -#if defined(EPERM) && !defined(_WIN32) -# define UV__EPERM UV__ERR(EPERM) -#else -# define UV__EPERM (-4048) -#endif - -#if defined(EPIPE) && !defined(_WIN32) -# define UV__EPIPE UV__ERR(EPIPE) -#else -# define UV__EPIPE (-4047) -#endif - -#if defined(EPROTO) && !defined(_WIN32) -# define UV__EPROTO UV__ERR(EPROTO) -#else -# define UV__EPROTO (-4046) -#endif - -#if defined(EPROTONOSUPPORT) && !defined(_WIN32) -# define UV__EPROTONOSUPPORT UV__ERR(EPROTONOSUPPORT) -#else -# define UV__EPROTONOSUPPORT (-4045) -#endif - -#if defined(EPROTOTYPE) && !defined(_WIN32) -# define UV__EPROTOTYPE UV__ERR(EPROTOTYPE) -#else -# define UV__EPROTOTYPE (-4044) -#endif - -#if defined(EROFS) && !defined(_WIN32) -# define UV__EROFS UV__ERR(EROFS) -#else -# define UV__EROFS (-4043) -#endif - -#if defined(ESHUTDOWN) && !defined(_WIN32) -# define UV__ESHUTDOWN UV__ERR(ESHUTDOWN) -#else -# define UV__ESHUTDOWN (-4042) -#endif - -#if defined(ESPIPE) && !defined(_WIN32) -# define UV__ESPIPE UV__ERR(ESPIPE) -#else -# define UV__ESPIPE (-4041) -#endif - -#if defined(ESRCH) && !defined(_WIN32) -# define UV__ESRCH UV__ERR(ESRCH) -#else -# define UV__ESRCH (-4040) -#endif - -#if defined(ETIMEDOUT) && !defined(_WIN32) -# define UV__ETIMEDOUT UV__ERR(ETIMEDOUT) -#else -# define UV__ETIMEDOUT (-4039) -#endif - -#if defined(ETXTBSY) && !defined(_WIN32) -# define UV__ETXTBSY UV__ERR(ETXTBSY) -#else -# define UV__ETXTBSY (-4038) -#endif - -#if defined(EXDEV) && !defined(_WIN32) -# define UV__EXDEV UV__ERR(EXDEV) -#else -# define UV__EXDEV (-4037) -#endif - -#if defined(EFBIG) && !defined(_WIN32) -# define UV__EFBIG UV__ERR(EFBIG) -#else -# define UV__EFBIG (-4036) -#endif - -#if defined(ENOPROTOOPT) && !defined(_WIN32) -# define UV__ENOPROTOOPT UV__ERR(ENOPROTOOPT) -#else -# define UV__ENOPROTOOPT (-4035) -#endif - -#if defined(ERANGE) && !defined(_WIN32) -# define UV__ERANGE UV__ERR(ERANGE) -#else -# define UV__ERANGE (-4034) -#endif - -#if defined(ENXIO) && !defined(_WIN32) -# define UV__ENXIO UV__ERR(ENXIO) -#else -# define UV__ENXIO (-4033) -#endif - -#if defined(EMLINK) && !defined(_WIN32) -# define UV__EMLINK UV__ERR(EMLINK) -#else -# define UV__EMLINK (-4032) -#endif - -/* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is - * defined. Fortunately, its value is always 64 so it's possible albeit - * icky to hard-code it. - */ -#if defined(EHOSTDOWN) && !defined(_WIN32) -# define UV__EHOSTDOWN UV__ERR(EHOSTDOWN) -#elif defined(__APPLE__) || \ - defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__FreeBSD_kernel__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) -# define UV__EHOSTDOWN (-64) -#else -# define UV__EHOSTDOWN (-4031) -#endif - -#if defined(EREMOTEIO) && !defined(_WIN32) -# define UV__EREMOTEIO UV__ERR(EREMOTEIO) -#else -# define UV__EREMOTEIO (-4030) -#endif - -#if defined(ENOTTY) && !defined(_WIN32) -# define UV__ENOTTY UV__ERR(ENOTTY) -#else -# define UV__ENOTTY (-4029) -#endif - -#if defined(EFTYPE) && !defined(_WIN32) -# define UV__EFTYPE UV__ERR(EFTYPE) -#else -# define UV__EFTYPE (-4028) -#endif - -#if defined(EILSEQ) && !defined(_WIN32) -# define UV__EILSEQ UV__ERR(EILSEQ) -#else -# define UV__EILSEQ (-4027) -#endif - -#if defined(EOVERFLOW) && !defined(_WIN32) -# define UV__EOVERFLOW UV__ERR(EOVERFLOW) -#else -# define UV__EOVERFLOW (-4026) -#endif - -#if defined(ESOCKTNOSUPPORT) && !defined(_WIN32) -# define UV__ESOCKTNOSUPPORT UV__ERR(ESOCKTNOSUPPORT) -#else -# define UV__ESOCKTNOSUPPORT (-4025) -#endif - -#endif /* UV_ERRNO_H_ */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/linux.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/linux.h deleted file mode 100644 index 9b38405a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/linux.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_LINUX_H -#define UV_LINUX_H - -#define UV_PLATFORM_LOOP_FIELDS \ - uv__io_t inotify_read_watcher; \ - void* inotify_watchers; \ - int inotify_fd; \ - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - void* watchers[2]; \ - int wd; \ - -#endif /* UV_LINUX_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/os390.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/os390.h deleted file mode 100644 index 0267d74c..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/os390.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright libuv project contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_MVS_H -#define UV_MVS_H - -#define UV_PLATFORM_SEM_T long - -#define UV_PLATFORM_LOOP_FIELDS \ - void* ep; \ - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - char rfis_rftok[8]; \ - -#endif /* UV_MVS_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/posix.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/posix.h deleted file mode 100644 index 9a96634d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/posix.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright libuv project contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_POSIX_H -#define UV_POSIX_H - -#define UV_PLATFORM_LOOP_FIELDS \ - struct pollfd* poll_fds; \ - size_t poll_fds_used; \ - size_t poll_fds_size; \ - unsigned char poll_fds_iterating; \ - -#endif /* UV_POSIX_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/stdint-msvc2008.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/stdint-msvc2008.h deleted file mode 100644 index d02608a5..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/stdint-msvc2008.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/sunos.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/sunos.h deleted file mode 100644 index 04216642..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/sunos.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_SUNOS_H -#define UV_SUNOS_H - -#include -#include - -/* For the sake of convenience and reduced #ifdef-ery in src/unix/sunos.c, - * add the fs_event fields even when this version of SunOS doesn't support - * file watching. - */ -#define UV_PLATFORM_LOOP_FIELDS \ - uv__io_t fs_event_watcher; \ - int fs_fd; \ - -#if defined(PORT_SOURCE_FILE) - -# define UV_PLATFORM_FS_EVENT_FIELDS \ - file_obj_t fo; \ - int fd; \ - -#endif /* defined(PORT_SOURCE_FILE) */ - -#endif /* UV_SUNOS_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/threadpool.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/threadpool.h deleted file mode 100644 index 9708ebdd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/threadpool.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/* - * This file is private to libuv. It provides common functionality to both - * Windows and Unix backends. - */ - -#ifndef UV_THREADPOOL_H_ -#define UV_THREADPOOL_H_ - -struct uv__work { - void (*work)(struct uv__work *w); - void (*done)(struct uv__work *w, int status); - struct uv_loop_s* loop; - void* wq[2]; -}; - -#endif /* UV_THREADPOOL_H_ */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/tree.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/tree.h deleted file mode 100644 index 2b28835f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/tree.h +++ /dev/null @@ -1,768 +0,0 @@ -/*- - * Copyright 2002 Niels Provos - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef UV_TREE_H_ -#define UV_TREE_H_ - -#ifndef UV__UNUSED -# if __GNUC__ -# define UV__UNUSED __attribute__((unused)) -# else -# define UV__UNUSED -# endif -#endif - -/* - * This file defines data structures for different types of trees: - * splay trees and red-black trees. - * - * A splay tree is a self-organizing data structure. Every operation - * on the tree causes a splay to happen. The splay moves the requested - * node to the root of the tree and partly rebalances it. - * - * This has the benefit that request locality causes faster lookups as - * the requested nodes move to the top of the tree. On the other hand, - * every lookup causes memory writes. - * - * The Balance Theorem bounds the total access time for m operations - * and n inserts on an initially empty tree as O((m + n)lg n). The - * amortized cost for a sequence of m accesses to a splay tree is O(lg n); - * - * A red-black tree is a binary search tree with the node color as an - * extra attribute. It fulfills a set of conditions: - * - every search path from the root to a leaf consists of the - * same number of black nodes, - * - each red node (except for the root) has a black parent, - * - each leaf node is black. - * - * Every operation on a red-black tree is bounded as O(lg n). - * The maximum height of a red-black tree is 2lg (n+1). - */ - -#define SPLAY_HEAD(name, type) \ -struct name { \ - struct type *sph_root; /* root of the tree */ \ -} - -#define SPLAY_INITIALIZER(root) \ - { NULL } - -#define SPLAY_INIT(root) do { \ - (root)->sph_root = NULL; \ -} while (/*CONSTCOND*/ 0) - -#define SPLAY_ENTRY(type) \ -struct { \ - struct type *spe_left; /* left element */ \ - struct type *spe_right; /* right element */ \ -} - -#define SPLAY_LEFT(elm, field) (elm)->field.spe_left -#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right -#define SPLAY_ROOT(head) (head)->sph_root -#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL) - -/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */ -#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \ - SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ - SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ - (head)->sph_root = tmp; \ -} while (/*CONSTCOND*/ 0) - -#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ - SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ - SPLAY_LEFT(tmp, field) = (head)->sph_root; \ - (head)->sph_root = tmp; \ -} while (/*CONSTCOND*/ 0) - -#define SPLAY_LINKLEFT(head, tmp, field) do { \ - SPLAY_LEFT(tmp, field) = (head)->sph_root; \ - tmp = (head)->sph_root; \ - (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ -} while (/*CONSTCOND*/ 0) - -#define SPLAY_LINKRIGHT(head, tmp, field) do { \ - SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ - tmp = (head)->sph_root; \ - (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ -} while (/*CONSTCOND*/ 0) - -#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ - SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ - SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field); \ - SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ - SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ -} while (/*CONSTCOND*/ 0) - -/* Generates prototypes and inline functions */ - -#define SPLAY_PROTOTYPE(name, type, field, cmp) \ -void name##_SPLAY(struct name *, struct type *); \ -void name##_SPLAY_MINMAX(struct name *, int); \ -struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ -struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ - \ -/* Finds the node with the same key as elm */ \ -static __inline struct type * \ -name##_SPLAY_FIND(struct name *head, struct type *elm) \ -{ \ - if (SPLAY_EMPTY(head)) \ - return(NULL); \ - name##_SPLAY(head, elm); \ - if ((cmp)(elm, (head)->sph_root) == 0) \ - return (head->sph_root); \ - return (NULL); \ -} \ - \ -static __inline struct type * \ -name##_SPLAY_NEXT(struct name *head, struct type *elm) \ -{ \ - name##_SPLAY(head, elm); \ - if (SPLAY_RIGHT(elm, field) != NULL) { \ - elm = SPLAY_RIGHT(elm, field); \ - while (SPLAY_LEFT(elm, field) != NULL) { \ - elm = SPLAY_LEFT(elm, field); \ - } \ - } else \ - elm = NULL; \ - return (elm); \ -} \ - \ -static __inline struct type * \ -name##_SPLAY_MIN_MAX(struct name *head, int val) \ -{ \ - name##_SPLAY_MINMAX(head, val); \ - return (SPLAY_ROOT(head)); \ -} - -/* Main splay operation. - * Moves node close to the key of elm to top - */ -#define SPLAY_GENERATE(name, type, field, cmp) \ -struct type * \ -name##_SPLAY_INSERT(struct name *head, struct type *elm) \ -{ \ - if (SPLAY_EMPTY(head)) { \ - SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \ - } else { \ - int __comp; \ - name##_SPLAY(head, elm); \ - __comp = (cmp)(elm, (head)->sph_root); \ - if(__comp < 0) { \ - SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field); \ - SPLAY_RIGHT(elm, field) = (head)->sph_root; \ - SPLAY_LEFT((head)->sph_root, field) = NULL; \ - } else if (__comp > 0) { \ - SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field); \ - SPLAY_LEFT(elm, field) = (head)->sph_root; \ - SPLAY_RIGHT((head)->sph_root, field) = NULL; \ - } else \ - return ((head)->sph_root); \ - } \ - (head)->sph_root = (elm); \ - return (NULL); \ -} \ - \ -struct type * \ -name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ -{ \ - struct type *__tmp; \ - if (SPLAY_EMPTY(head)) \ - return (NULL); \ - name##_SPLAY(head, elm); \ - if ((cmp)(elm, (head)->sph_root) == 0) { \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ - (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ - } else { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ - name##_SPLAY(head, elm); \ - SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ - } \ - return (elm); \ - } \ - return (NULL); \ -} \ - \ -void \ -name##_SPLAY(struct name *head, struct type *elm) \ -{ \ - struct type __node, *__left, *__right, *__tmp; \ - int __comp; \ - \ - SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; \ - __left = __right = &__node; \ - \ - while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \ - if (__comp < 0) { \ - __tmp = SPLAY_LEFT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if ((cmp)(elm, __tmp) < 0){ \ - SPLAY_ROTATE_RIGHT(head, __tmp, field); \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL) \ - break; \ - } \ - SPLAY_LINKLEFT(head, __right, field); \ - } else if (__comp > 0) { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if ((cmp)(elm, __tmp) > 0){ \ - SPLAY_ROTATE_LEFT(head, __tmp, field); \ - if (SPLAY_RIGHT((head)->sph_root, field) == NULL) \ - break; \ - } \ - SPLAY_LINKRIGHT(head, __left, field); \ - } \ - } \ - SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ -} \ - \ -/* Splay with either the minimum or the maximum element \ - * Used to find minimum or maximum element in tree. \ - */ \ -void name##_SPLAY_MINMAX(struct name *head, int __comp) \ -{ \ - struct type __node, *__left, *__right, *__tmp; \ - \ - SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; \ - __left = __right = &__node; \ - \ - for (;;) { \ - if (__comp < 0) { \ - __tmp = SPLAY_LEFT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if (__comp < 0){ \ - SPLAY_ROTATE_RIGHT(head, __tmp, field); \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL) \ - break; \ - } \ - SPLAY_LINKLEFT(head, __right, field); \ - } else if (__comp > 0) { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if (__comp > 0) { \ - SPLAY_ROTATE_LEFT(head, __tmp, field); \ - if (SPLAY_RIGHT((head)->sph_root, field) == NULL) \ - break; \ - } \ - SPLAY_LINKRIGHT(head, __left, field); \ - } \ - } \ - SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ -} - -#define SPLAY_NEGINF -1 -#define SPLAY_INF 1 - -#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y) -#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y) -#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y) -#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y) -#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \ - : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF)) -#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \ - : name##_SPLAY_MIN_MAX(x, SPLAY_INF)) - -#define SPLAY_FOREACH(x, name, head) \ - for ((x) = SPLAY_MIN(name, head); \ - (x) != NULL; \ - (x) = SPLAY_NEXT(name, head, x)) - -/* Macros that define a red-black tree */ -#define RB_HEAD(name, type) \ -struct name { \ - struct type *rbh_root; /* root of the tree */ \ -} - -#define RB_INITIALIZER(root) \ - { NULL } - -#define RB_INIT(root) do { \ - (root)->rbh_root = NULL; \ -} while (/*CONSTCOND*/ 0) - -#define RB_BLACK 0 -#define RB_RED 1 -#define RB_ENTRY(type) \ -struct { \ - struct type *rbe_left; /* left element */ \ - struct type *rbe_right; /* right element */ \ - struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ -} - -#define RB_LEFT(elm, field) (elm)->field.rbe_left -#define RB_RIGHT(elm, field) (elm)->field.rbe_right -#define RB_PARENT(elm, field) (elm)->field.rbe_parent -#define RB_COLOR(elm, field) (elm)->field.rbe_color -#define RB_ROOT(head) (head)->rbh_root -#define RB_EMPTY(head) (RB_ROOT(head) == NULL) - -#define RB_SET(elm, parent, field) do { \ - RB_PARENT(elm, field) = parent; \ - RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ - RB_COLOR(elm, field) = RB_RED; \ -} while (/*CONSTCOND*/ 0) - -#define RB_SET_BLACKRED(black, red, field) do { \ - RB_COLOR(black, field) = RB_BLACK; \ - RB_COLOR(red, field) = RB_RED; \ -} while (/*CONSTCOND*/ 0) - -#ifndef RB_AUGMENT -#define RB_AUGMENT(x) do {} while (0) -#endif - -#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ - (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ - RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_LEFT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp, field))) \ - RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (/*CONSTCOND*/ 0) - -#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ - (tmp) = RB_LEFT(elm, field); \ - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ - RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_RIGHT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp, field))) \ - RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (/*CONSTCOND*/ 0) - -/* Generates prototypes and inline functions */ -#define RB_PROTOTYPE(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) -#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static) -#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ -attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ -attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ -attr struct type *name##_RB_REMOVE(struct name *, struct type *); \ -attr struct type *name##_RB_INSERT(struct name *, struct type *); \ -attr struct type *name##_RB_FIND(struct name *, struct type *); \ -attr struct type *name##_RB_NFIND(struct name *, struct type *); \ -attr struct type *name##_RB_NEXT(struct type *); \ -attr struct type *name##_RB_PREV(struct type *); \ -attr struct type *name##_RB_MINMAX(struct name *, int); \ - \ - -/* Main rb operation. - * Moves node close to the key of elm to top - */ -#define RB_GENERATE(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp,) -#define RB_GENERATE_STATIC(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static) -#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ -attr void \ -name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ -{ \ - struct type *parent, *gparent, *tmp; \ - while ((parent = RB_PARENT(elm, field)) != NULL && \ - RB_COLOR(parent, field) == RB_RED) { \ - gparent = RB_PARENT(parent, field); \ - if (parent == RB_LEFT(gparent, field)) { \ - tmp = RB_RIGHT(gparent, field); \ - if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field); \ - elm = gparent; \ - continue; \ - } \ - if (RB_RIGHT(parent, field) == elm) { \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - tmp = parent; \ - parent = elm; \ - elm = tmp; \ - } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_RIGHT(head, gparent, tmp, field); \ - } else { \ - tmp = RB_LEFT(gparent, field); \ - if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field); \ - elm = gparent; \ - continue; \ - } \ - if (RB_LEFT(parent, field) == elm) { \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - tmp = parent; \ - parent = elm; \ - elm = tmp; \ - } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_LEFT(head, gparent, tmp, field); \ - } \ - } \ - RB_COLOR(head->rbh_root, field) = RB_BLACK; \ -} \ - \ -attr void \ -name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, \ - struct type *elm) \ -{ \ - struct type *tmp; \ - while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \ - elm != RB_ROOT(head)) { \ - if (RB_LEFT(parent, field) == elm) { \ - tmp = RB_RIGHT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - tmp = RB_RIGHT(parent, field); \ - } \ - if ((RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ - (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ - } else { \ - if (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \ - struct type *oleft; \ - if ((oleft = RB_LEFT(tmp, field)) \ - != NULL) \ - RB_COLOR(oleft, field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_RIGHT(head, tmp, oleft, field); \ - tmp = RB_RIGHT(parent, field); \ - } \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ - RB_COLOR(parent, field) = RB_BLACK; \ - if (RB_RIGHT(tmp, field)) \ - RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - elm = RB_ROOT(head); \ - break; \ - } \ - } else { \ - tmp = RB_LEFT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - tmp = RB_LEFT(parent, field); \ - } \ - if ((RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ - (RB_RIGHT(tmp, field) == NULL || \ - RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ - } else { \ - if (RB_LEFT(tmp, field) == NULL || \ - RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \ - struct type *oright; \ - if ((oright = RB_RIGHT(tmp, field)) \ - != NULL) \ - RB_COLOR(oright, field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_LEFT(head, tmp, oright, field); \ - tmp = RB_LEFT(parent, field); \ - } \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ - RB_COLOR(parent, field) = RB_BLACK; \ - if (RB_LEFT(tmp, field)) \ - RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - elm = RB_ROOT(head); \ - break; \ - } \ - } \ - } \ - if (elm) \ - RB_COLOR(elm, field) = RB_BLACK; \ -} \ - \ -attr struct type * \ -name##_RB_REMOVE(struct name *head, struct type *elm) \ -{ \ - struct type *child, *parent, *old = elm; \ - int color; \ - if (RB_LEFT(elm, field) == NULL) \ - child = RB_RIGHT(elm, field); \ - else if (RB_RIGHT(elm, field) == NULL) \ - child = RB_LEFT(elm, field); \ - else { \ - struct type *left; \ - elm = RB_RIGHT(elm, field); \ - while ((left = RB_LEFT(elm, field)) != NULL) \ - elm = left; \ - child = RB_RIGHT(elm, field); \ - parent = RB_PARENT(elm, field); \ - color = RB_COLOR(elm, field); \ - if (child) \ - RB_PARENT(child, field) = parent; \ - if (parent) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_LEFT(parent, field) = child; \ - else \ - RB_RIGHT(parent, field) = child; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = child; \ - if (RB_PARENT(elm, field) == old) \ - parent = elm; \ - (elm)->field = (old)->field; \ - if (RB_PARENT(old, field)) { \ - if (RB_LEFT(RB_PARENT(old, field), field) == old) \ - RB_LEFT(RB_PARENT(old, field), field) = elm; \ - else \ - RB_RIGHT(RB_PARENT(old, field), field) = elm; \ - RB_AUGMENT(RB_PARENT(old, field)); \ - } else \ - RB_ROOT(head) = elm; \ - RB_PARENT(RB_LEFT(old, field), field) = elm; \ - if (RB_RIGHT(old, field)) \ - RB_PARENT(RB_RIGHT(old, field), field) = elm; \ - if (parent) { \ - left = parent; \ - do { \ - RB_AUGMENT(left); \ - } while ((left = RB_PARENT(left, field)) != NULL); \ - } \ - goto color; \ - } \ - parent = RB_PARENT(elm, field); \ - color = RB_COLOR(elm, field); \ - if (child) \ - RB_PARENT(child, field) = parent; \ - if (parent) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_LEFT(parent, field) = child; \ - else \ - RB_RIGHT(parent, field) = child; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = child; \ -color: \ - if (color == RB_BLACK) \ - name##_RB_REMOVE_COLOR(head, parent, child); \ - return (old); \ -} \ - \ -/* Inserts a node into the RB tree */ \ -attr struct type * \ -name##_RB_INSERT(struct name *head, struct type *elm) \ -{ \ - struct type *tmp; \ - struct type *parent = NULL; \ - int comp = 0; \ - tmp = RB_ROOT(head); \ - while (tmp) { \ - parent = tmp; \ - comp = (cmp)(elm, parent); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - RB_SET(elm, parent, field); \ - if (parent != NULL) { \ - if (comp < 0) \ - RB_LEFT(parent, field) = elm; \ - else \ - RB_RIGHT(parent, field) = elm; \ - RB_AUGMENT(parent); \ - } else \ - RB_ROOT(head) = elm; \ - name##_RB_INSERT_COLOR(head, elm); \ - return (NULL); \ -} \ - \ -/* Finds the node with the same key as elm */ \ -attr struct type * \ -name##_RB_FIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - int comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (NULL); \ -} \ - \ -/* Finds the first node greater than or equal to the search key */ \ -attr struct type * \ -name##_RB_NFIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *res = NULL; \ - int comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) { \ - res = tmp; \ - tmp = RB_LEFT(tmp, field); \ - } \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (res); \ -} \ - \ -/* ARGSUSED */ \ -attr struct type * \ -name##_RB_NEXT(struct type *elm) \ -{ \ - if (RB_RIGHT(elm, field)) { \ - elm = RB_RIGHT(elm, field); \ - while (RB_LEFT(elm, field)) \ - elm = RB_LEFT(elm, field); \ - } else { \ - if (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - } \ - return (elm); \ -} \ - \ -/* ARGSUSED */ \ -attr struct type * \ -name##_RB_PREV(struct type *elm) \ -{ \ - if (RB_LEFT(elm, field)) { \ - elm = RB_LEFT(elm, field); \ - while (RB_RIGHT(elm, field)) \ - elm = RB_RIGHT(elm, field); \ - } else { \ - if (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - } \ - return (elm); \ -} \ - \ -attr struct type * \ -name##_RB_MINMAX(struct name *head, int val) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *parent = NULL; \ - while (tmp) { \ - parent = tmp; \ - if (val < 0) \ - tmp = RB_LEFT(tmp, field); \ - else \ - tmp = RB_RIGHT(tmp, field); \ - } \ - return (parent); \ -} - -#define RB_NEGINF -1 -#define RB_INF 1 - -#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) -#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) -#define RB_FIND(name, x, y) name##_RB_FIND(x, y) -#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) -#define RB_NEXT(name, x, y) name##_RB_NEXT(y) -#define RB_PREV(name, x, y) name##_RB_PREV(y) -#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) -#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) - -#define RB_FOREACH(x, name, head) \ - for ((x) = RB_MIN(name, head); \ - (x) != NULL; \ - (x) = name##_RB_NEXT(x)) - -#define RB_FOREACH_FROM(x, name, y) \ - for ((x) = (y); \ - ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ - (x) = (y)) - -#define RB_FOREACH_SAFE(x, name, head, y) \ - for ((x) = RB_MIN(name, head); \ - ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ - (x) = (y)) - -#define RB_FOREACH_REVERSE(x, name, head) \ - for ((x) = RB_MAX(name, head); \ - (x) != NULL; \ - (x) = name##_RB_PREV(x)) - -#define RB_FOREACH_REVERSE_FROM(x, name, y) \ - for ((x) = (y); \ - ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ - (x) = (y)) - -#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ - for ((x) = RB_MAX(name, head); \ - ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ - (x) = (y)) - -#endif /* UV_TREE_H_ */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/unix.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/unix.h deleted file mode 100644 index ea37d787..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/unix.h +++ /dev/null @@ -1,505 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_UNIX_H -#define UV_UNIX_H - -#include -#include -#include -#include - -#include -#include -#include -#include -#include /* MAXHOSTNAMELEN on Solaris */ - -#include -#include - -#if !defined(__MVS__) -#include -#include /* MAXHOSTNAMELEN on Linux and the BSDs */ -#endif -#include -#include - -#include "uv/threadpool.h" - -#if defined(__linux__) -# include "uv/linux.h" -#elif defined (__MVS__) -# include "uv/os390.h" -#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */ -# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */ -#elif defined(_AIX) -# include "uv/aix.h" -#elif defined(__sun) -# include "uv/sunos.h" -#elif defined(__APPLE__) -# include "uv/darwin.h" -#elif defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__FreeBSD_kernel__) || \ - defined(__OpenBSD__) || \ - defined(__NetBSD__) -# include "uv/bsd.h" -#elif defined(__CYGWIN__) || \ - defined(__MSYS__) || \ - defined(__HAIKU__) || \ - defined(__QNX__) || \ - defined(__GNU__) -# include "uv/posix.h" -#endif - -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif - -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif - -#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS -# define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ -#endif - -struct uv__io_s; -struct uv_loop_s; - -typedef void (*uv__io_cb)(struct uv_loop_s* loop, - struct uv__io_s* w, - unsigned int events); -typedef struct uv__io_s uv__io_t; - -struct uv__io_s { - uv__io_cb cb; - void* pending_queue[2]; - void* watcher_queue[2]; - unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ - unsigned int events; /* Current event mask. */ - int fd; - UV_IO_PRIVATE_PLATFORM_FIELDS -}; - -#ifndef UV_PLATFORM_SEM_T -# define UV_PLATFORM_SEM_T sem_t -#endif - -#ifndef UV_PLATFORM_LOOP_FIELDS -# define UV_PLATFORM_LOOP_FIELDS /* empty */ -#endif - -#ifndef UV_PLATFORM_FS_EVENT_FIELDS -# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ -#endif - -#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS -# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ -#endif - -/* Note: May be cast to struct iovec. See writev(2). */ -typedef struct uv_buf_t { - char* base; - size_t len; -} uv_buf_t; - -typedef int uv_file; -typedef int uv_os_sock_t; -typedef int uv_os_fd_t; -typedef pid_t uv_pid_t; - -#define UV_ONCE_INIT PTHREAD_ONCE_INIT - -typedef pthread_once_t uv_once_t; -typedef pthread_t uv_thread_t; -typedef pthread_mutex_t uv_mutex_t; -typedef pthread_rwlock_t uv_rwlock_t; -typedef UV_PLATFORM_SEM_T uv_sem_t; -typedef pthread_cond_t uv_cond_t; -typedef pthread_key_t uv_key_t; - -/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ -#if defined(_AIX) || \ - defined(__OpenBSD__) || \ - !defined(PTHREAD_BARRIER_SERIAL_THREAD) -/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ -struct _uv_barrier { - uv_mutex_t mutex; - uv_cond_t cond; - unsigned threshold; - unsigned in; - unsigned out; -}; - -typedef struct { - struct _uv_barrier* b; -# if defined(PTHREAD_BARRIER_SERIAL_THREAD) - /* TODO(bnoordhuis) Remove padding in v2. */ - char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; -# endif -} uv_barrier_t; -#else -typedef pthread_barrier_t uv_barrier_t; -#endif - -/* Platform-specific definitions for uv_spawn support. */ -typedef gid_t uv_gid_t; -typedef uid_t uv_uid_t; - -typedef struct dirent uv__dirent_t; - -#define UV_DIR_PRIVATE_FIELDS \ - DIR* dir; - -#if defined(DT_UNKNOWN) -# define HAVE_DIRENT_TYPES -# if defined(DT_REG) -# define UV__DT_FILE DT_REG -# else -# define UV__DT_FILE -1 -# endif -# if defined(DT_DIR) -# define UV__DT_DIR DT_DIR -# else -# define UV__DT_DIR -2 -# endif -# if defined(DT_LNK) -# define UV__DT_LINK DT_LNK -# else -# define UV__DT_LINK -3 -# endif -# if defined(DT_FIFO) -# define UV__DT_FIFO DT_FIFO -# else -# define UV__DT_FIFO -4 -# endif -# if defined(DT_SOCK) -# define UV__DT_SOCKET DT_SOCK -# else -# define UV__DT_SOCKET -5 -# endif -# if defined(DT_CHR) -# define UV__DT_CHAR DT_CHR -# else -# define UV__DT_CHAR -6 -# endif -# if defined(DT_BLK) -# define UV__DT_BLOCK DT_BLK -# else -# define UV__DT_BLOCK -7 -# endif -#endif - -/* Platform-specific definitions for uv_dlopen support. */ -#define UV_DYNAMIC /* empty */ - -typedef struct { - void* handle; - char* errmsg; -} uv_lib_t; - -#define UV_LOOP_PRIVATE_FIELDS \ - unsigned long flags; \ - int backend_fd; \ - void* pending_queue[2]; \ - void* watcher_queue[2]; \ - uv__io_t** watchers; \ - unsigned int nwatchers; \ - unsigned int nfds; \ - void* wq[2]; \ - uv_mutex_t wq_mutex; \ - uv_async_t wq_async; \ - uv_rwlock_t cloexec_lock; \ - uv_handle_t* closing_handles; \ - void* process_handles[2]; \ - void* prepare_handles[2]; \ - void* check_handles[2]; \ - void* idle_handles[2]; \ - void* async_handles[2]; \ - void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \ - uv__io_t async_io_watcher; \ - int async_wfd; \ - struct { \ - void* min; \ - unsigned int nelts; \ - } timer_heap; \ - uint64_t timer_counter; \ - uint64_t time; \ - int signal_pipefd[2]; \ - uv__io_t signal_io_watcher; \ - uv_signal_t child_watcher; \ - int emfile_fd; \ - UV_PLATFORM_LOOP_FIELDS \ - -#define UV_REQ_TYPE_PRIVATE /* empty */ - -#define UV_REQ_PRIVATE_FIELDS /* empty */ - -#define UV_PRIVATE_REQ_TYPES /* empty */ - -#define UV_WRITE_PRIVATE_FIELDS \ - void* queue[2]; \ - unsigned int write_index; \ - uv_buf_t* bufs; \ - unsigned int nbufs; \ - int error; \ - uv_buf_t bufsml[4]; \ - -#define UV_CONNECT_PRIVATE_FIELDS \ - void* queue[2]; \ - -#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ - -#define UV_UDP_SEND_PRIVATE_FIELDS \ - void* queue[2]; \ - struct sockaddr_storage addr; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - ssize_t status; \ - uv_udp_send_cb send_cb; \ - uv_buf_t bufsml[4]; \ - -#define UV_HANDLE_PRIVATE_FIELDS \ - uv_handle_t* next_closing; \ - unsigned int flags; \ - -#define UV_STREAM_PRIVATE_FIELDS \ - uv_connect_t *connect_req; \ - uv_shutdown_t *shutdown_req; \ - uv__io_t io_watcher; \ - void* write_queue[2]; \ - void* write_completed_queue[2]; \ - uv_connection_cb connection_cb; \ - int delayed_error; \ - int accepted_fd; \ - void* queued_fds; \ - UV_STREAM_PRIVATE_PLATFORM_FIELDS \ - -#define UV_TCP_PRIVATE_FIELDS /* empty */ - -#define UV_UDP_PRIVATE_FIELDS \ - uv_alloc_cb alloc_cb; \ - uv_udp_recv_cb recv_cb; \ - uv__io_t io_watcher; \ - void* write_queue[2]; \ - void* write_completed_queue[2]; \ - -#define UV_PIPE_PRIVATE_FIELDS \ - const char* pipe_fname; /* strdup'ed */ - -#define UV_POLL_PRIVATE_FIELDS \ - uv__io_t io_watcher; - -#define UV_PREPARE_PRIVATE_FIELDS \ - uv_prepare_cb prepare_cb; \ - void* queue[2]; \ - -#define UV_CHECK_PRIVATE_FIELDS \ - uv_check_cb check_cb; \ - void* queue[2]; \ - -#define UV_IDLE_PRIVATE_FIELDS \ - uv_idle_cb idle_cb; \ - void* queue[2]; \ - -#define UV_ASYNC_PRIVATE_FIELDS \ - uv_async_cb async_cb; \ - void* queue[2]; \ - int pending; \ - -#define UV_TIMER_PRIVATE_FIELDS \ - uv_timer_cb timer_cb; \ - void* heap_node[3]; \ - uint64_t timeout; \ - uint64_t repeat; \ - uint64_t start_id; - -#define UV_GETADDRINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getaddrinfo_cb cb; \ - struct addrinfo* hints; \ - char* hostname; \ - char* service; \ - struct addrinfo* addrinfo; \ - int retcode; - -#define UV_GETNAMEINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getnameinfo_cb getnameinfo_cb; \ - struct sockaddr_storage storage; \ - int flags; \ - char host[NI_MAXHOST]; \ - char service[NI_MAXSERV]; \ - int retcode; - -#define UV_PROCESS_PRIVATE_FIELDS \ - void* queue[2]; \ - int status; \ - -#define UV_FS_PRIVATE_FIELDS \ - const char *new_path; \ - uv_file file; \ - int flags; \ - mode_t mode; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - off_t off; \ - uv_uid_t uid; \ - uv_gid_t gid; \ - double atime; \ - double mtime; \ - struct uv__work work_req; \ - uv_buf_t bufsml[4]; \ - -#define UV_WORK_PRIVATE_FIELDS \ - struct uv__work work_req; - -#define UV_TTY_PRIVATE_FIELDS \ - struct termios orig_termios; \ - int mode; - -#define UV_SIGNAL_PRIVATE_FIELDS \ - /* RB_ENTRY(uv_signal_s) tree_entry; */ \ - struct { \ - struct uv_signal_s* rbe_left; \ - struct uv_signal_s* rbe_right; \ - struct uv_signal_s* rbe_parent; \ - int rbe_color; \ - } tree_entry; \ - /* Use two counters here so we don have to fiddle with atomics. */ \ - unsigned int caught_signals; \ - unsigned int dispatched_signals; - -#define UV_FS_EVENT_PRIVATE_FIELDS \ - uv_fs_event_cb cb; \ - UV_PLATFORM_FS_EVENT_FIELDS \ - -/* fs open() flags supported on this platform: */ -#if defined(O_APPEND) -# define UV_FS_O_APPEND O_APPEND -#else -# define UV_FS_O_APPEND 0 -#endif -#if defined(O_CREAT) -# define UV_FS_O_CREAT O_CREAT -#else -# define UV_FS_O_CREAT 0 -#endif - -#if defined(__linux__) && defined(__arm__) -# define UV_FS_O_DIRECT 0x10000 -#elif defined(__linux__) && defined(__m68k__) -# define UV_FS_O_DIRECT 0x10000 -#elif defined(__linux__) && defined(__mips__) -# define UV_FS_O_DIRECT 0x08000 -#elif defined(__linux__) && defined(__powerpc__) -# define UV_FS_O_DIRECT 0x20000 -#elif defined(__linux__) && defined(__s390x__) -# define UV_FS_O_DIRECT 0x04000 -#elif defined(__linux__) && defined(__x86_64__) -# define UV_FS_O_DIRECT 0x04000 -#elif defined(O_DIRECT) -# define UV_FS_O_DIRECT O_DIRECT -#else -# define UV_FS_O_DIRECT 0 -#endif - -#if defined(O_DIRECTORY) -# define UV_FS_O_DIRECTORY O_DIRECTORY -#else -# define UV_FS_O_DIRECTORY 0 -#endif -#if defined(O_DSYNC) -# define UV_FS_O_DSYNC O_DSYNC -#else -# define UV_FS_O_DSYNC 0 -#endif -#if defined(O_EXCL) -# define UV_FS_O_EXCL O_EXCL -#else -# define UV_FS_O_EXCL 0 -#endif -#if defined(O_EXLOCK) -# define UV_FS_O_EXLOCK O_EXLOCK -#else -# define UV_FS_O_EXLOCK 0 -#endif -#if defined(O_NOATIME) -# define UV_FS_O_NOATIME O_NOATIME -#else -# define UV_FS_O_NOATIME 0 -#endif -#if defined(O_NOCTTY) -# define UV_FS_O_NOCTTY O_NOCTTY -#else -# define UV_FS_O_NOCTTY 0 -#endif -#if defined(O_NOFOLLOW) -# define UV_FS_O_NOFOLLOW O_NOFOLLOW -#else -# define UV_FS_O_NOFOLLOW 0 -#endif -#if defined(O_NONBLOCK) -# define UV_FS_O_NONBLOCK O_NONBLOCK -#else -# define UV_FS_O_NONBLOCK 0 -#endif -#if defined(O_RDONLY) -# define UV_FS_O_RDONLY O_RDONLY -#else -# define UV_FS_O_RDONLY 0 -#endif -#if defined(O_RDWR) -# define UV_FS_O_RDWR O_RDWR -#else -# define UV_FS_O_RDWR 0 -#endif -#if defined(O_SYMLINK) -# define UV_FS_O_SYMLINK O_SYMLINK -#else -# define UV_FS_O_SYMLINK 0 -#endif -#if defined(O_SYNC) -# define UV_FS_O_SYNC O_SYNC -#else -# define UV_FS_O_SYNC 0 -#endif -#if defined(O_TRUNC) -# define UV_FS_O_TRUNC O_TRUNC -#else -# define UV_FS_O_TRUNC 0 -#endif -#if defined(O_WRONLY) -# define UV_FS_O_WRONLY O_WRONLY -#else -# define UV_FS_O_WRONLY 0 -#endif - -/* fs open() flags supported on other platforms: */ -#define UV_FS_O_FILEMAP 0 -#define UV_FS_O_RANDOM 0 -#define UV_FS_O_SHORT_LIVED 0 -#define UV_FS_O_SEQUENTIAL 0 -#define UV_FS_O_TEMPORARY 0 - -#endif /* UV_UNIX_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/version.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/version.h deleted file mode 100644 index 46f46929..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/version.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_VERSION_H -#define UV_VERSION_H - - /* - * Versions with the same major number are ABI stable. API is allowed to - * evolve between minor releases, but only in a backwards compatible way. - * Make sure you update the -soname directives in configure.ac - * whenever you bump UV_VERSION_MAJOR or UV_VERSION_MINOR (but - * not UV_VERSION_PATCH.) - */ - -#define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 43 -#define UV_VERSION_PATCH 0 -#define UV_VERSION_IS_RELEASE 1 -#define UV_VERSION_SUFFIX "" - -#define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \ - (UV_VERSION_MINOR << 8) | \ - (UV_VERSION_PATCH)) - -#endif /* UV_VERSION_H */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/win.h b/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/win.h deleted file mode 100644 index 5fecf4bf..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/uv/uv/win.h +++ /dev/null @@ -1,698 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -#endif - -#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define SSIZE_MAX INTPTR_MAX -# define _SSIZE_T_ -# define _SSIZE_T_DEFINED -#endif - -#include - -#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) -typedef struct pollfd { - SOCKET fd; - short events; - short revents; -} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; -#endif - -#ifndef LOCALE_INVARIANT -# define LOCALE_INVARIANT 0x007f -#endif - -#include -// Disable the typedef in mstcpip.h of MinGW. -#define _TCP_INITIAL_RTO_PARAMETERS _TCP_INITIAL_RTO_PARAMETERS__AVOID -#define TCP_INITIAL_RTO_PARAMETERS TCP_INITIAL_RTO_PARAMETERS__AVOID -#define PTCP_INITIAL_RTO_PARAMETERS PTCP_INITIAL_RTO_PARAMETERS__AVOID -#include -#undef _TCP_INITIAL_RTO_PARAMETERS -#undef TCP_INITIAL_RTO_PARAMETERS -#undef PTCP_INITIAL_RTO_PARAMETERS -#include - -#include -#include -#include -#include - -#if defined(_MSC_VER) && _MSC_VER < 1600 -# include "uv/stdint-msvc2008.h" -#else -# include -#endif - -#include "uv/tree.h" -#include "uv/threadpool.h" - -#define MAX_PIPENAME_LEN 256 - -#ifndef S_IFLNK -# define S_IFLNK 0xA000 -#endif - -/* Additional signals supported by uv_signal and or uv_kill. The CRT defines - * the following signals already: - * - * #define SIGINT 2 - * #define SIGILL 4 - * #define SIGABRT_COMPAT 6 - * #define SIGFPE 8 - * #define SIGSEGV 11 - * #define SIGTERM 15 - * #define SIGBREAK 21 - * #define SIGABRT 22 - * - * The additional signals have values that are common on other Unix - * variants (Linux and Darwin) - */ -#define SIGHUP 1 -#define SIGKILL 9 -#define SIGWINCH 28 - -/* Redefine NSIG to take SIGWINCH into consideration */ -#if defined(NSIG) && NSIG <= SIGWINCH -# undef NSIG -#endif -#ifndef NSIG -# define NSIG SIGWINCH + 1 -#endif - -/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like - * platforms. However MinGW doesn't define it, so we do. */ -#ifndef SIGABRT_COMPAT -# define SIGABRT_COMPAT 6 -#endif - -/* - * Guids and typedefs for winsock extension functions - * Mingw32 doesn't have these :-( - */ -#ifndef WSAID_ACCEPTEX -# define WSAID_ACCEPTEX \ - {0xb5367df1, 0xcbac, 0x11cf, \ - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} - -# define WSAID_CONNECTEX \ - {0x25a207b9, 0xddf3, 0x4660, \ - {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}} - -# define WSAID_GETACCEPTEXSOCKADDRS \ - {0xb5367df2, 0xcbac, 0x11cf, \ - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} - -# define WSAID_DISCONNECTEX \ - {0x7fda2e11, 0x8630, 0x436f, \ - {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}} - -# define WSAID_TRANSMITFILE \ - {0xb5367df0, 0xcbac, 0x11cf, \ - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} - - typedef BOOL (PASCAL *LPFN_ACCEPTEX) - (SOCKET sListenSocket, - SOCKET sAcceptSocket, - PVOID lpOutputBuffer, - DWORD dwReceiveDataLength, - DWORD dwLocalAddressLength, - DWORD dwRemoteAddressLength, - LPDWORD lpdwBytesReceived, - LPOVERLAPPED lpOverlapped); - - typedef BOOL (PASCAL *LPFN_CONNECTEX) - (SOCKET s, - const struct sockaddr* name, - int namelen, - PVOID lpSendBuffer, - DWORD dwSendDataLength, - LPDWORD lpdwBytesSent, - LPOVERLAPPED lpOverlapped); - - typedef void (PASCAL *LPFN_GETACCEPTEXSOCKADDRS) - (PVOID lpOutputBuffer, - DWORD dwReceiveDataLength, - DWORD dwLocalAddressLength, - DWORD dwRemoteAddressLength, - LPSOCKADDR* LocalSockaddr, - LPINT LocalSockaddrLength, - LPSOCKADDR* RemoteSockaddr, - LPINT RemoteSockaddrLength); - - typedef BOOL (PASCAL *LPFN_DISCONNECTEX) - (SOCKET hSocket, - LPOVERLAPPED lpOverlapped, - DWORD dwFlags, - DWORD reserved); - - typedef BOOL (PASCAL *LPFN_TRANSMITFILE) - (SOCKET hSocket, - HANDLE hFile, - DWORD nNumberOfBytesToWrite, - DWORD nNumberOfBytesPerSend, - LPOVERLAPPED lpOverlapped, - LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, - DWORD dwFlags); - - typedef PVOID RTL_SRWLOCK; - typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; -#endif - -typedef int (WSAAPI* LPFN_WSARECV) - (SOCKET socket, - LPWSABUF buffers, - DWORD buffer_count, - LPDWORD bytes, - LPDWORD flags, - LPWSAOVERLAPPED overlapped, - LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); - -typedef int (WSAAPI* LPFN_WSARECVFROM) - (SOCKET socket, - LPWSABUF buffers, - DWORD buffer_count, - LPDWORD bytes, - LPDWORD flags, - struct sockaddr* addr, - LPINT addr_len, - LPWSAOVERLAPPED overlapped, - LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); - -#ifndef _NTDEF_ - typedef LONG NTSTATUS; - typedef NTSTATUS *PNTSTATUS; -#endif - -#ifndef RTL_CONDITION_VARIABLE_INIT - typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE; -#endif - -typedef struct _AFD_POLL_HANDLE_INFO { - HANDLE Handle; - ULONG Events; - NTSTATUS Status; -} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; - -typedef struct _AFD_POLL_INFO { - LARGE_INTEGER Timeout; - ULONG NumberOfHandles; - ULONG Exclusive; - AFD_POLL_HANDLE_INFO Handles[1]; -} AFD_POLL_INFO, *PAFD_POLL_INFO; - -#define UV_MSAFD_PROVIDER_COUNT 3 - - -/** - * It should be possible to cast uv_buf_t[] to WSABUF[] - * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx - */ -typedef struct uv_buf_t { - ULONG len; - char* base; -} uv_buf_t; - -typedef int uv_file; -typedef SOCKET uv_os_sock_t; -typedef HANDLE uv_os_fd_t; -typedef int uv_pid_t; - -typedef HANDLE uv_thread_t; - -typedef HANDLE uv_sem_t; - -typedef CRITICAL_SECTION uv_mutex_t; - -/* This condition variable implementation is based on the SetEvent solution - * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html - * We could not use the SignalObjectAndWait solution (section 3.4) because - * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and - * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. - */ - -typedef union { - CONDITION_VARIABLE cond_var; - struct { - unsigned int waiters_count; - CRITICAL_SECTION waiters_count_lock; - HANDLE signal_event; - HANDLE broadcast_event; - } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */ -} uv_cond_t; - -typedef union { - struct { - unsigned int num_readers_; - CRITICAL_SECTION num_readers_lock_; - HANDLE write_semaphore_; - } state_; - /* TODO: remove me in v2.x. */ - struct { - SRWLOCK unused_; - } unused1_; - /* TODO: remove me in v2.x. */ - struct { - uv_mutex_t unused1_; - uv_mutex_t unused2_; - } unused2_; -} uv_rwlock_t; - -typedef struct { - unsigned int n; - unsigned int count; - uv_mutex_t mutex; - uv_sem_t turnstile1; - uv_sem_t turnstile2; -} uv_barrier_t; - -typedef struct { - DWORD tls_index; -} uv_key_t; - -#define UV_ONCE_INIT { 0, NULL } - -typedef struct uv_once_s { - unsigned char ran; - HANDLE event; -} uv_once_t; - -/* Platform-specific definitions for uv_spawn support. */ -typedef unsigned char uv_uid_t; -typedef unsigned char uv_gid_t; - -typedef struct uv__dirent_s { - int d_type; - char d_name[1]; -} uv__dirent_t; - -#define UV_DIR_PRIVATE_FIELDS \ - HANDLE dir_handle; \ - WIN32_FIND_DATAW find_data; \ - BOOL need_find_call; - -#define HAVE_DIRENT_TYPES -#define UV__DT_DIR UV_DIRENT_DIR -#define UV__DT_FILE UV_DIRENT_FILE -#define UV__DT_LINK UV_DIRENT_LINK -#define UV__DT_FIFO UV_DIRENT_FIFO -#define UV__DT_SOCKET UV_DIRENT_SOCKET -#define UV__DT_CHAR UV_DIRENT_CHAR -#define UV__DT_BLOCK UV_DIRENT_BLOCK - -/* Platform-specific definitions for uv_dlopen support. */ -#define UV_DYNAMIC FAR WINAPI -typedef struct { - HMODULE handle; - char* errmsg; -} uv_lib_t; - -#define UV_LOOP_PRIVATE_FIELDS \ - /* The loop's I/O completion port */ \ - HANDLE iocp; \ - /* The current time according to the event loop. in msecs. */ \ - uint64_t time; \ - /* Tail of a single-linked circular queue of pending reqs. If the queue */ \ - /* is empty, tail_ is NULL. If there is only one item, */ \ - /* tail_->next_req == tail_ */ \ - uv_req_t* pending_reqs_tail; \ - /* Head of a single-linked list of closed handles */ \ - uv_handle_t* endgame_handles; \ - /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \ - void* timer_heap; \ - /* Lists of active loop (prepare / check / idle) watchers */ \ - uv_prepare_t* prepare_handles; \ - uv_check_t* check_handles; \ - uv_idle_t* idle_handles; \ - /* This pointer will refer to the prepare/check/idle handle whose */ \ - /* callback is scheduled to be called next. This is needed to allow */ \ - /* safe removal from one of the lists above while that list being */ \ - /* iterated over. */ \ - uv_prepare_t* next_prepare_handle; \ - uv_check_t* next_check_handle; \ - uv_idle_t* next_idle_handle; \ - /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \ - SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \ - /* Counter to keep track of active tcp streams */ \ - unsigned int active_tcp_streams; \ - /* Counter to keep track of active udp streams */ \ - unsigned int active_udp_streams; \ - /* Counter to started timer */ \ - uint64_t timer_counter; \ - /* Threadpool */ \ - void* wq[2]; \ - uv_mutex_t wq_mutex; \ - uv_async_t wq_async; - -#define UV_REQ_TYPE_PRIVATE \ - /* TODO: remove the req suffix */ \ - UV_ACCEPT, \ - UV_FS_EVENT_REQ, \ - UV_POLL_REQ, \ - UV_PROCESS_EXIT, \ - UV_READ, \ - UV_UDP_RECV, \ - UV_WAKEUP, \ - UV_SIGNAL_REQ, - -#define UV_REQ_PRIVATE_FIELDS \ - union { \ - /* Used by I/O operations */ \ - struct { \ - OVERLAPPED overlapped; \ - size_t queued_bytes; \ - } io; \ - } u; \ - struct uv_req_s* next_req; - -#define UV_WRITE_PRIVATE_FIELDS \ - int coalesced; \ - uv_buf_t write_buffer; \ - HANDLE event_handle; \ - HANDLE wait_handle; - -#define UV_CONNECT_PRIVATE_FIELDS \ - /* empty */ - -#define UV_SHUTDOWN_PRIVATE_FIELDS \ - /* empty */ - -#define UV_UDP_SEND_PRIVATE_FIELDS \ - /* empty */ - -#define UV_PRIVATE_REQ_TYPES \ - typedef struct uv_pipe_accept_s { \ - UV_REQ_FIELDS \ - HANDLE pipeHandle; \ - struct uv_pipe_accept_s* next_pending; \ - } uv_pipe_accept_t; \ - \ - typedef struct uv_tcp_accept_s { \ - UV_REQ_FIELDS \ - SOCKET accept_socket; \ - char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \ - HANDLE event_handle; \ - HANDLE wait_handle; \ - struct uv_tcp_accept_s* next_pending; \ - } uv_tcp_accept_t; \ - \ - typedef struct uv_read_s { \ - UV_REQ_FIELDS \ - HANDLE event_handle; \ - HANDLE wait_handle; \ - } uv_read_t; - -#define uv_stream_connection_fields \ - unsigned int write_reqs_pending; \ - uv_shutdown_t* shutdown_req; - -#define uv_stream_server_fields \ - uv_connection_cb connection_cb; - -#define UV_STREAM_PRIVATE_FIELDS \ - unsigned int reqs_pending; \ - int activecnt; \ - uv_read_t read_req; \ - union { \ - struct { uv_stream_connection_fields } conn; \ - struct { uv_stream_server_fields } serv; \ - } stream; - -#define uv_tcp_server_fields \ - uv_tcp_accept_t* accept_reqs; \ - unsigned int processed_accepts; \ - uv_tcp_accept_t* pending_accepts; \ - LPFN_ACCEPTEX func_acceptex; - -#define uv_tcp_connection_fields \ - uv_buf_t read_buffer; \ - LPFN_CONNECTEX func_connectex; - -#define UV_TCP_PRIVATE_FIELDS \ - SOCKET socket; \ - int delayed_error; \ - union { \ - struct { uv_tcp_server_fields } serv; \ - struct { uv_tcp_connection_fields } conn; \ - } tcp; - -#define UV_UDP_PRIVATE_FIELDS \ - SOCKET socket; \ - unsigned int reqs_pending; \ - int activecnt; \ - uv_req_t recv_req; \ - uv_buf_t recv_buffer; \ - struct sockaddr_storage recv_from; \ - int recv_from_len; \ - uv_udp_recv_cb recv_cb; \ - uv_alloc_cb alloc_cb; \ - LPFN_WSARECV func_wsarecv; \ - LPFN_WSARECVFROM func_wsarecvfrom; - -#define uv_pipe_server_fields \ - int pending_instances; \ - uv_pipe_accept_t* accept_reqs; \ - uv_pipe_accept_t* pending_accepts; - -#define uv_pipe_connection_fields \ - uv_timer_t* eof_timer; \ - uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ - DWORD ipc_remote_pid; \ - union { \ - uint32_t payload_remaining; \ - uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ - } ipc_data_frame; \ - void* ipc_xfer_queue[2]; \ - int ipc_xfer_queue_length; \ - uv_write_t* non_overlapped_writes_tail; \ - CRITICAL_SECTION readfile_thread_lock; \ - volatile HANDLE readfile_thread_handle; - -#define UV_PIPE_PRIVATE_FIELDS \ - HANDLE handle; \ - WCHAR* name; \ - union { \ - struct { uv_pipe_server_fields } serv; \ - struct { uv_pipe_connection_fields } conn; \ - } pipe; - -/* TODO: put the parser states in an union - TTY handles are always half-duplex - * so read-state can safely overlap write-state. */ -#define UV_TTY_PRIVATE_FIELDS \ - HANDLE handle; \ - union { \ - struct { \ - /* Used for readable TTY handles */ \ - /* TODO: remove me in v2.x. */ \ - HANDLE unused_; \ - uv_buf_t read_line_buffer; \ - HANDLE read_raw_wait; \ - /* Fields used for translating win keystrokes into vt100 characters */ \ - char last_key[8]; \ - unsigned char last_key_offset; \ - unsigned char last_key_len; \ - WCHAR last_utf16_high_surrogate; \ - INPUT_RECORD last_input_record; \ - } rd; \ - struct { \ - /* Used for writable TTY handles */ \ - /* utf8-to-utf16 conversion state */ \ - unsigned int utf8_codepoint; \ - unsigned char utf8_bytes_left; \ - /* eol conversion state */ \ - unsigned char previous_eol; \ - /* ansi parser state */ \ - unsigned short ansi_parser_state; \ - unsigned char ansi_csi_argc; \ - unsigned short ansi_csi_argv[4]; \ - COORD saved_position; \ - WORD saved_attributes; \ - } wr; \ - } tty; - -#define UV_POLL_PRIVATE_FIELDS \ - SOCKET socket; \ - /* Used in fast mode */ \ - SOCKET peer_socket; \ - AFD_POLL_INFO afd_poll_info_1; \ - AFD_POLL_INFO afd_poll_info_2; \ - /* Used in fast and slow mode. */ \ - uv_req_t poll_req_1; \ - uv_req_t poll_req_2; \ - unsigned char submitted_events_1; \ - unsigned char submitted_events_2; \ - unsigned char mask_events_1; \ - unsigned char mask_events_2; \ - unsigned char events; - -#define UV_TIMER_PRIVATE_FIELDS \ - void* heap_node[3]; \ - int unused; \ - uint64_t timeout; \ - uint64_t repeat; \ - uint64_t start_id; \ - uv_timer_cb timer_cb; - -#define UV_ASYNC_PRIVATE_FIELDS \ - struct uv_req_s async_req; \ - uv_async_cb async_cb; \ - /* char to avoid alignment issues */ \ - char volatile async_sent; - -#define UV_PREPARE_PRIVATE_FIELDS \ - uv_prepare_t* prepare_prev; \ - uv_prepare_t* prepare_next; \ - uv_prepare_cb prepare_cb; - -#define UV_CHECK_PRIVATE_FIELDS \ - uv_check_t* check_prev; \ - uv_check_t* check_next; \ - uv_check_cb check_cb; - -#define UV_IDLE_PRIVATE_FIELDS \ - uv_idle_t* idle_prev; \ - uv_idle_t* idle_next; \ - uv_idle_cb idle_cb; - -#define UV_HANDLE_PRIVATE_FIELDS \ - uv_handle_t* endgame_next; \ - unsigned int flags; - -#define UV_GETADDRINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getaddrinfo_cb getaddrinfo_cb; \ - void* alloc; \ - WCHAR* node; \ - WCHAR* service; \ - /* The addrinfoW field is used to store a pointer to the hints, and */ \ - /* later on to store the result of GetAddrInfoW. The final result will */ \ - /* be converted to struct addrinfo* and stored in the addrinfo field. */ \ - struct addrinfoW* addrinfow; \ - struct addrinfo* addrinfo; \ - int retcode; - -#define UV_GETNAMEINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getnameinfo_cb getnameinfo_cb; \ - struct sockaddr_storage storage; \ - int flags; \ - char host[NI_MAXHOST]; \ - char service[NI_MAXSERV]; \ - int retcode; - -#define UV_PROCESS_PRIVATE_FIELDS \ - struct uv_process_exit_s { \ - UV_REQ_FIELDS \ - } exit_req; \ - BYTE* child_stdio_buffer; \ - int exit_signal; \ - HANDLE wait_handle; \ - HANDLE process_handle; \ - volatile char exit_cb_pending; - -#define UV_FS_PRIVATE_FIELDS \ - struct uv__work work_req; \ - int flags; \ - DWORD sys_errno_; \ - union { \ - /* TODO: remove me in 0.9. */ \ - WCHAR* pathw; \ - int fd; \ - } file; \ - union { \ - struct { \ - int mode; \ - WCHAR* new_pathw; \ - int file_flags; \ - int fd_out; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - int64_t offset; \ - uv_buf_t bufsml[4]; \ - } info; \ - struct { \ - double atime; \ - double mtime; \ - } time; \ - } fs; - -#define UV_WORK_PRIVATE_FIELDS \ - struct uv__work work_req; - -#define UV_FS_EVENT_PRIVATE_FIELDS \ - struct uv_fs_event_req_s { \ - UV_REQ_FIELDS \ - } req; \ - HANDLE dir_handle; \ - int req_pending; \ - uv_fs_event_cb cb; \ - WCHAR* filew; \ - WCHAR* short_filew; \ - WCHAR* dirw; \ - char* buffer; - -#define UV_SIGNAL_PRIVATE_FIELDS \ - RB_ENTRY(uv_signal_s) tree_entry; \ - struct uv_req_s signal_req; \ - unsigned long pending_signum; - -#ifndef F_OK -#define F_OK 0 -#endif -#ifndef R_OK -#define R_OK 4 -#endif -#ifndef W_OK -#define W_OK 2 -#endif -#ifndef X_OK -#define X_OK 1 -#endif - -/* fs open() flags supported on this platform: */ -#define UV_FS_O_APPEND _O_APPEND -#define UV_FS_O_CREAT _O_CREAT -#define UV_FS_O_EXCL _O_EXCL -#define UV_FS_O_FILEMAP 0x20000000 -#define UV_FS_O_RANDOM _O_RANDOM -#define UV_FS_O_RDONLY _O_RDONLY -#define UV_FS_O_RDWR _O_RDWR -#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL -#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED -#define UV_FS_O_TEMPORARY _O_TEMPORARY -#define UV_FS_O_TRUNC _O_TRUNC -#define UV_FS_O_WRONLY _O_WRONLY - -/* fs open() flags supported on other platforms (or mapped on this platform): */ -#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */ -#define UV_FS_O_DIRECTORY 0 -#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */ -#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */ -#define UV_FS_O_NOATIME 0 -#define UV_FS_O_NOCTTY 0 -#define UV_FS_O_NOFOLLOW 0 -#define UV_FS_O_NONBLOCK 0 -#define UV_FS_O_SYMLINK 0 -#define UV_FS_O_SYNC 0x08000000 /* FILE_FLAG_WRITE_THROUGH */ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/APIDesign.md b/repo/packages/s/scriptx-legacy/include/libnode/v8/APIDesign.md deleted file mode 100644 index fe42c8ed..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/APIDesign.md +++ /dev/null @@ -1,72 +0,0 @@ -# The V8 public C++ API - -# Overview - -The V8 public C++ API aims to support four use cases: - -1. Enable applications that embed V8 (called the embedder) to configure and run - one or more instances of V8. -2. Expose ECMAScript-like capabilities to the embedder. -3. Enable the embedder to interact with ECMAScript by exposing API objects. -4. Provide access to the V8 debugger (inspector). - -# Configuring and running an instance of V8 - -V8 requires access to certain OS-level primitives such as the ability to -schedule work on threads, or allocate memory. - -The embedder can define how to access those primitives via the v8::Platform -interface. While V8 bundles a basic implementation, embedders are highly -encouraged to implement v8::Platform themselves. - -Currently, the v8::ArrayBuffer::Allocator is passed to the v8::Isolate factory -method, however, conceptually it should also be part of the v8::Platform since -all instances of V8 should share one allocator. - -Once the v8::Platform is configured, an v8::Isolate can be created. All -further interactions with V8 should explicitly reference the v8::Isolate they -refer to. All API methods should eventually take an v8::Isolate parameter. - -When a given instance of V8 is no longer needed, it can be destroyed by -disposing the respective v8::Isolate. If the embedder wishes to free all memory -associated with the v8::Isolate, it has to first clear all global handles -associated with that v8::Isolate. - -# ECMAScript-like capabilities - -In general, the C++ API shouldn't enable capabilities that aren't available to -scripts running in V8. Experience has shown that it's not possible to maintain -such API methods in the long term. However, capabilities also available to -scripts, i.e., ones that are defined in the ECMAScript standard are there to -stay, and we can safely expose them to embedders. - -The C++ API should also be pleasant to use, and not require learning new -paradigms. Similarly to how the API exposed to scripts aims to provide good -ergonomics, we should aim to provide a reasonable developer experience for this -API surface. - -ECMAScript makes heavy use of exceptions, however, V8's C++ code doesn't use -C++ exceptions. Therefore, all API methods that can throw exceptions should -indicate so by returning a v8::Maybe<> or v8::MaybeLocal<> result, -and by taking a v8::Local<v8::Context> parameter that indicates in which -context a possible exception should be thrown. - -# API objects - -V8 allows embedders to define special objects that expose additional -capabilities and APIs to scripts. The most prominent example is exposing the -HTML DOM in Blink. Other examples are e.g. node.js. It is less clear what kind -of capabilities we want to expose via this API surface. As a rule of thumb, we -want to expose operations as defined in the WebIDL and HTML spec: we -assume that those requirements are somewhat stable, and that they are a -superset of the requirements of other embedders including node.js. - -Ideally, the API surfaces defined in those specs hook into the ECMAScript spec -which in turn guarantees long-term stability of the API. - -# The V8 inspector - -All debugging capabilities of V8 should be exposed via the inspector protocol. -The exception to this are profiling features exposed via v8-profiler.h. -Changes to the inspector protocol need to ensure backwards compatibility and -commitment to maintain. diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/DEPS b/repo/packages/s/scriptx-legacy/include/libnode/v8/DEPS deleted file mode 100644 index 21ce3d96..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/DEPS +++ /dev/null @@ -1,10 +0,0 @@ -include_rules = [ - # v8-inspector-protocol.h depends on generated files under include/inspector. - "+inspector", - "+cppgc/common.h", - # Used by v8-cppgc.h to bridge to cppgc. - "+cppgc/custom-space.h", - "+cppgc/heap-statistics.h", - "+cppgc/internal/write-barrier.h", - "+cppgc/visitor.h", -] diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/DIR_METADATA b/repo/packages/s/scriptx-legacy/include/libnode/v8/DIR_METADATA deleted file mode 100644 index a27ea1b5..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/DIR_METADATA +++ /dev/null @@ -1,11 +0,0 @@ -# Metadata information for this directory. -# -# For more information on DIR_METADATA files, see: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md -# -# For the schema of this file, see Metadata message: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto - -monorail { - component: "Blink>JavaScript>API" -} \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/OWNERS b/repo/packages/s/scriptx-legacy/include/libnode/v8/OWNERS deleted file mode 100644 index 0222513d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/OWNERS +++ /dev/null @@ -1,20 +0,0 @@ -adamk@chromium.org -cbruni@chromium.org -leszeks@chromium.org -mlippautz@chromium.org -verwaest@chromium.org -yangguo@chromium.org - -per-file *DEPS=file:../COMMON_OWNERS -per-file v8-internal.h=file:../COMMON_OWNERS -per-file v8-inspector.h=file:../src/inspector/OWNERS -per-file v8-inspector-protocol.h=file:../src/inspector/OWNERS -per-file js_protocol.pdl=file:../src/inspector/OWNERS - -# Needed by the auto_tag builder -per-file v8-version.h=v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com - -# For branch updates: -per-file v8-version.h=file:../INFRA_OWNERS -per-file v8-version.h=hablich@chromium.org -per-file v8-version.h=vahl@chromium.org diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/DEPS b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/DEPS deleted file mode 100644 index 861d1187..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/DEPS +++ /dev/null @@ -1,8 +0,0 @@ -include_rules = [ - "-include", - "+v8config.h", - "+v8-platform.h", - "+cppgc", - "-src", - "+libplatform/libplatform.h", -] diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/OWNERS b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/OWNERS deleted file mode 100644 index 6ccabf60..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -bikineev@chromium.org -omerkatz@chromium.org \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/README.md b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/README.md deleted file mode 100644 index 3a2db6df..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# C++ Garbage Collection - -This directory provides an open-source garbage collection library for C++. - -The library is under construction, meaning that *all APIs in this directory are incomplete and considered unstable and should not be used*. \ No newline at end of file diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/allocation.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/allocation.h deleted file mode 100644 index d75f1a97..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/allocation.h +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_ALLOCATION_H_ -#define INCLUDE_CPPGC_ALLOCATION_H_ - -#include -#include -#include -#include -#include -#include - -#include "cppgc/custom-space.h" -#include "cppgc/internal/api-constants.h" -#include "cppgc/internal/gc-info.h" -#include "cppgc/type-traits.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -/** - * AllocationHandle is used to allocate garbage-collected objects. - */ -class AllocationHandle; - -namespace internal { - -class V8_EXPORT MakeGarbageCollectedTraitInternal { - protected: - static inline void MarkObjectAsFullyConstructed(const void* payload) { - // See api_constants for an explanation of the constants. - std::atomic* atomic_mutable_bitfield = - reinterpret_cast*>( - const_cast(reinterpret_cast( - reinterpret_cast(payload) - - api_constants::kFullyConstructedBitFieldOffsetFromPayload))); - atomic_mutable_bitfield->fetch_or(api_constants::kFullyConstructedBitMask, - std::memory_order_release); - } - - template - struct SpacePolicy { - static void* Allocate(AllocationHandle& handle, size_t size) { - // Custom space. - static_assert(std::is_base_of::value, - "Custom space must inherit from CustomSpaceBase."); - return MakeGarbageCollectedTraitInternal::Allocate( - handle, size, internal::GCInfoTrait::Index(), - CustomSpace::kSpaceIndex); - } - }; - - template - struct SpacePolicy { - static void* Allocate(AllocationHandle& handle, size_t size) { - // Default space. - return MakeGarbageCollectedTraitInternal::Allocate( - handle, size, internal::GCInfoTrait::Index()); - } - }; - - private: - static void* Allocate(cppgc::AllocationHandle& handle, size_t size, - GCInfoIndex index); - static void* Allocate(cppgc::AllocationHandle& handle, size_t size, - GCInfoIndex index, CustomSpaceIndex space_index); - - friend class HeapObjectHeader; -}; - -} // namespace internal - -/** - * Base trait that provides utilities for advancers users that have custom - * allocation needs (e.g., overriding size). It's expected that users override - * MakeGarbageCollectedTrait (see below) and inherit from - * MakeGarbageCollectedTraitBase and make use of the low-level primitives - * offered to allocate and construct an object. - */ -template -class MakeGarbageCollectedTraitBase - : private internal::MakeGarbageCollectedTraitInternal { - private: - static_assert(internal::IsGarbageCollectedType::value, - "T needs to be a garbage collected object"); - static_assert(!IsGarbageCollectedWithMixinTypeV || - sizeof(T) <= - internal::api_constants::kLargeObjectSizeThreshold, - "GarbageCollectedMixin may not be a large object"); - - protected: - /** - * Allocates memory for an object of type T. - * - * \param handle AllocationHandle identifying the heap to allocate the object - * on. - * \param size The size that should be reserved for the object. - * \returns the memory to construct an object of type T on. - */ - V8_INLINE static void* Allocate(AllocationHandle& handle, size_t size) { - static_assert( - std::is_base_of::value, - "U of GarbageCollected must be a base of T. Check " - "GarbageCollected base class inheritance."); - return SpacePolicy< - typename internal::GCInfoFolding< - T, typename T::ParentMostGarbageCollectedType>::ResultType, - typename SpaceTrait::Space>::Allocate(handle, size); - } - - /** - * Marks an object as fully constructed, resulting in precise handling by the - * garbage collector. - * - * \param payload The base pointer the object is allocated at. - */ - V8_INLINE static void MarkObjectAsFullyConstructed(const void* payload) { - internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed( - payload); - } -}; - -/** - * Passed to MakeGarbageCollected to specify how many bytes should be appended - * to the allocated object. - * - * Example: - * \code - * class InlinedArray final : public GarbageCollected { - * public: - * explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {} - * void Trace(Visitor*) const {} - - * size_t size; - * char* byte_array; - * }; - * - * auto* inlined_array = MakeGarbageCollectedbyte_array[i]); - * } - * \endcode - */ -struct AdditionalBytes { - constexpr explicit AdditionalBytes(size_t bytes) : value(bytes) {} - const size_t value; -}; - -/** - * Default trait class that specifies how to construct an object of type T. - * Advanced users may override how an object is constructed using the utilities - * that are provided through MakeGarbageCollectedTraitBase. - * - * Any trait overriding construction must - * - allocate through `MakeGarbageCollectedTraitBase::Allocate`; - * - mark the object as fully constructed using - * `MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed`; - */ -template -class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { - public: - template - static T* Call(AllocationHandle& handle, Args&&... args) { - void* memory = - MakeGarbageCollectedTraitBase::Allocate(handle, sizeof(T)); - T* object = ::new (memory) T(std::forward(args)...); - MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed(object); - return object; - } - - template - static T* Call(AllocationHandle& handle, AdditionalBytes additional_bytes, - Args&&... args) { - void* memory = MakeGarbageCollectedTraitBase::Allocate( - handle, sizeof(T) + additional_bytes.value); - T* object = ::new (memory) T(std::forward(args)...); - MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed(object); - return object; - } -}; - -/** - * Allows users to specify a post-construction callback for specific types. The - * callback is invoked on the instance of type T right after it has been - * constructed. This can be useful when the callback requires a - * fully-constructed object to be able to dispatch to virtual methods. - */ -template -struct PostConstructionCallbackTrait { - static void Call(T*) {} -}; - -/** - * Constructs a managed object of type T where T transitively inherits from - * GarbageCollected. - * - * \param args List of arguments with which an instance of T will be - * constructed. - * \returns an instance of type T. - */ -template -T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) { - T* object = - MakeGarbageCollectedTrait::Call(handle, std::forward(args)...); - PostConstructionCallbackTrait::Call(object); - return object; -} - -/** - * Constructs a managed object of type T where T transitively inherits from - * GarbageCollected. Created objects will have additional bytes appended to - * it. Allocated memory would suffice for `sizeof(T) + additional_bytes`. - * - * \param additional_bytes Denotes how many bytes to append to T. - * \param args List of arguments with which an instance of T will be - * constructed. - * \returns an instance of type T. - */ -template -T* MakeGarbageCollected(AllocationHandle& handle, - AdditionalBytes additional_bytes, Args&&... args) { - T* object = MakeGarbageCollectedTrait::Call(handle, additional_bytes, - std::forward(args)...); - PostConstructionCallbackTrait::Call(object); - return object; -} - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_ALLOCATION_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/common.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/common.h deleted file mode 100644 index b6dbff3d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/common.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_COMMON_H_ -#define INCLUDE_CPPGC_COMMON_H_ - -// TODO(chromium:1056170): Remove dependency on v8. -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -/** - * Indicator for the stack state of the embedder. - */ -enum class EmbedderStackState { - /** - * Stack may contain interesting heap pointers. - */ - kMayContainHeapPointers, - /** - * Stack does not contain any interesting heap pointers. - */ - kNoHeapPointers, -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_COMMON_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/cross-thread-persistent.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/cross-thread-persistent.h deleted file mode 100644 index 0a9afdcd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/cross-thread-persistent.h +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_CROSS_THREAD_PERSISTENT_H_ -#define INCLUDE_CPPGC_CROSS_THREAD_PERSISTENT_H_ - -#include - -#include "cppgc/internal/persistent-node.h" -#include "cppgc/internal/pointer-policies.h" -#include "cppgc/persistent.h" -#include "cppgc/visitor.h" - -namespace cppgc { -namespace internal { - -// Wrapper around PersistentBase that allows accessing poisoned memory when -// using ASAN. This is needed as the GC of the heap that owns the value -// of a CTP, may clear it (heap termination, weakness) while the object -// holding the CTP may be poisoned as itself may be deemed dead. -class CrossThreadPersistentBase : public PersistentBase { - public: - CrossThreadPersistentBase() = default; - explicit CrossThreadPersistentBase(const void* raw) : PersistentBase(raw) {} - - V8_CLANG_NO_SANITIZE("address") const void* GetValueFromGC() const { - return raw_; - } - - V8_CLANG_NO_SANITIZE("address") - PersistentNode* GetNodeFromGC() const { return node_; } - - V8_CLANG_NO_SANITIZE("address") - void ClearFromGC() const { - raw_ = nullptr; - node_ = nullptr; - } -}; - -template -class BasicCrossThreadPersistent final : public CrossThreadPersistentBase, - public LocationPolicy, - private WeaknessPolicy, - private CheckingPolicy { - public: - using typename WeaknessPolicy::IsStrongPersistent; - using PointeeType = T; - - ~BasicCrossThreadPersistent() { Clear(); } - - BasicCrossThreadPersistent( - const SourceLocation& loc = SourceLocation::Current()) - : LocationPolicy(loc) {} - - BasicCrossThreadPersistent( - std::nullptr_t, const SourceLocation& loc = SourceLocation::Current()) - : LocationPolicy(loc) {} - - BasicCrossThreadPersistent( - SentinelPointer s, const SourceLocation& loc = SourceLocation::Current()) - : CrossThreadPersistentBase(s), LocationPolicy(loc) {} - - BasicCrossThreadPersistent( - T* raw, const SourceLocation& loc = SourceLocation::Current()) - : CrossThreadPersistentBase(raw), LocationPolicy(loc) { - if (!IsValid(raw)) return; - PersistentRegionLock guard; - CrossThreadPersistentRegion& region = this->GetPersistentRegion(raw); - SetNode(region.AllocateNode(this, &Trace)); - this->CheckPointer(raw); - } - - class UnsafeCtorTag { - private: - UnsafeCtorTag() = default; - template - friend class BasicCrossThreadPersistent; - }; - - BasicCrossThreadPersistent( - UnsafeCtorTag, T* raw, - const SourceLocation& loc = SourceLocation::Current()) - : CrossThreadPersistentBase(raw), LocationPolicy(loc) { - if (!IsValid(raw)) return; - CrossThreadPersistentRegion& region = this->GetPersistentRegion(raw); - SetNode(region.AllocateNode(this, &Trace)); - this->CheckPointer(raw); - } - - BasicCrossThreadPersistent( - T& raw, const SourceLocation& loc = SourceLocation::Current()) - : BasicCrossThreadPersistent(&raw, loc) {} - - template ::value>> - BasicCrossThreadPersistent( - internal::BasicMember - member, - const SourceLocation& loc = SourceLocation::Current()) - : BasicCrossThreadPersistent(member.Get(), loc) {} - - BasicCrossThreadPersistent( - const BasicCrossThreadPersistent& other, - const SourceLocation& loc = SourceLocation::Current()) - : BasicCrossThreadPersistent(loc) { - // Invoke operator=. - *this = other; - } - - // Heterogeneous ctor. - template ::value>> - BasicCrossThreadPersistent( - const BasicCrossThreadPersistent& other, - const SourceLocation& loc = SourceLocation::Current()) - : BasicCrossThreadPersistent(loc) { - *this = other; - } - - BasicCrossThreadPersistent( - BasicCrossThreadPersistent&& other, - const SourceLocation& loc = SourceLocation::Current()) noexcept { - // Invoke operator=. - *this = std::move(other); - } - - BasicCrossThreadPersistent& operator=( - const BasicCrossThreadPersistent& other) { - PersistentRegionLock guard; - AssignUnsafe(other.Get()); - return *this; - } - - template ::value>> - BasicCrossThreadPersistent& operator=( - const BasicCrossThreadPersistent& other) { - PersistentRegionLock guard; - AssignUnsafe(other.Get()); - return *this; - } - - BasicCrossThreadPersistent& operator=(BasicCrossThreadPersistent&& other) { - if (this == &other) return *this; - Clear(); - PersistentRegionLock guard; - PersistentBase::operator=(std::move(other)); - LocationPolicy::operator=(std::move(other)); - if (!IsValid(GetValue())) return *this; - GetNode()->UpdateOwner(this); - other.SetValue(nullptr); - other.SetNode(nullptr); - this->CheckPointer(Get()); - return *this; - } - - BasicCrossThreadPersistent& operator=(T* other) { - Assign(other); - return *this; - } - - // Assignment from member. - template ::value>> - BasicCrossThreadPersistent& operator=( - internal::BasicMember - member) { - return operator=(member.Get()); - } - - BasicCrossThreadPersistent& operator=(std::nullptr_t) { - Clear(); - return *this; - } - - BasicCrossThreadPersistent& operator=(SentinelPointer s) { - Assign(s); - return *this; - } - - /** - * Returns a pointer to the stored object. - * - * Note: **Not thread-safe.** - * - * \returns a pointer to the stored object. - */ - // CFI cast exemption to allow passing SentinelPointer through T* and support - // heterogeneous assignments between different Member and Persistent handles - // based on their actual types. - V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const { - return static_cast(const_cast(GetValue())); - } - - /** - * Clears the stored object. - */ - void Clear() { - // Simplified version of `Assign()` to allow calling without a complete type - // `T`. - const void* old_value = GetValue(); - if (IsValid(old_value)) { - PersistentRegionLock guard; - old_value = GetValue(); - // The fast path check (IsValid()) does not acquire the lock. Reload - // the value to ensure the reference has not been cleared. - if (IsValid(old_value)) { - CrossThreadPersistentRegion& region = - this->GetPersistentRegion(old_value); - region.FreeNode(GetNode()); - SetNode(nullptr); - } else { - CPPGC_DCHECK(!GetNode()); - } - } - SetValue(nullptr); - } - - /** - * Returns a pointer to the stored object and releases it. - * - * Note: **Not thread-safe.** - * - * \returns a pointer to the stored object. - */ - T* Release() { - T* result = Get(); - Clear(); - return result; - } - - /** - * Conversio to boolean. - * - * Note: **Not thread-safe.** - * - * \returns true if an actual object has been stored and false otherwise. - */ - explicit operator bool() const { return Get(); } - - /** - * Conversion to object of type T. - * - * Note: **Not thread-safe.** - * - * \returns the object. - */ - operator T*() const { return Get(); } - - /** - * Dereferences the stored object. - * - * Note: **Not thread-safe.** - */ - T* operator->() const { return Get(); } - T& operator*() const { return *Get(); } - - template - BasicCrossThreadPersistent - To() const { - using OtherBasicCrossThreadPersistent = - BasicCrossThreadPersistent; - PersistentRegionLock guard; - return OtherBasicCrossThreadPersistent( - typename OtherBasicCrossThreadPersistent::UnsafeCtorTag(), - static_cast(Get())); - } - - template ::IsStrongPersistent::value>::type> - BasicCrossThreadPersistent - Lock() const { - return BasicCrossThreadPersistent< - U, internal::StrongCrossThreadPersistentPolicy>(*this); - } - - private: - static bool IsValid(const void* ptr) { - return ptr && ptr != kSentinelPointer; - } - - static void Trace(Visitor* v, const void* ptr) { - const auto* handle = static_cast(ptr); - v->TraceRoot(*handle, handle->Location()); - } - - void Assign(T* ptr) { - const void* old_value = GetValue(); - if (IsValid(old_value)) { - PersistentRegionLock guard; - old_value = GetValue(); - // The fast path check (IsValid()) does not acquire the lock. Reload - // the value to ensure the reference has not been cleared. - if (IsValid(old_value)) { - CrossThreadPersistentRegion& region = - this->GetPersistentRegion(old_value); - if (IsValid(ptr) && (®ion == &this->GetPersistentRegion(ptr))) { - SetValue(ptr); - this->CheckPointer(ptr); - return; - } - region.FreeNode(GetNode()); - SetNode(nullptr); - } else { - CPPGC_DCHECK(!GetNode()); - } - } - SetValue(ptr); - if (!IsValid(ptr)) return; - PersistentRegionLock guard; - SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &Trace)); - this->CheckPointer(ptr); - } - - void AssignUnsafe(T* ptr) { - PersistentRegionLock::AssertLocked(); - const void* old_value = GetValue(); - if (IsValid(old_value)) { - CrossThreadPersistentRegion& region = - this->GetPersistentRegion(old_value); - if (IsValid(ptr) && (®ion == &this->GetPersistentRegion(ptr))) { - SetValue(ptr); - this->CheckPointer(ptr); - return; - } - region.FreeNode(GetNode()); - SetNode(nullptr); - } - SetValue(ptr); - if (!IsValid(ptr)) return; - SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &Trace)); - this->CheckPointer(ptr); - } - - void ClearFromGC() const { - if (IsValid(GetValueFromGC())) { - WeaknessPolicy::GetPersistentRegion(GetValueFromGC()) - .FreeNode(GetNodeFromGC()); - CrossThreadPersistentBase::ClearFromGC(); - } - } - - // See Get() for details. - V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") - T* GetFromGC() const { - return static_cast(const_cast(GetValueFromGC())); - } - - friend class cppgc::Visitor; -}; - -template -struct IsWeak< - BasicCrossThreadPersistent> - : std::true_type {}; - -} // namespace internal - -namespace subtle { - -/** - * **DO NOT USE: Has known caveats, see below.** - * - * CrossThreadPersistent allows retaining objects from threads other than the - * thread the owning heap is operating on. - * - * Known caveats: - * - Does not protect the heap owning an object from terminating. - * - Reaching transitively through the graph is unsupported as objects may be - * moved concurrently on the thread owning the object. - */ -template -using CrossThreadPersistent = internal::BasicCrossThreadPersistent< - T, internal::StrongCrossThreadPersistentPolicy>; - -/** - * **DO NOT USE: Has known caveats, see below.** - * - * CrossThreadPersistent allows weakly retaining objects from threads other than - * the thread the owning heap is operating on. - * - * Known caveats: - * - Does not protect the heap owning an object from terminating. - * - Reaching transitively through the graph is unsupported as objects may be - * moved concurrently on the thread owning the object. - */ -template -using WeakCrossThreadPersistent = internal::BasicCrossThreadPersistent< - T, internal::WeakCrossThreadPersistentPolicy>; - -} // namespace subtle -} // namespace cppgc - -#endif // INCLUDE_CPPGC_CROSS_THREAD_PERSISTENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/custom-space.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/custom-space.h deleted file mode 100644 index 757c4fde..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/custom-space.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_CUSTOM_SPACE_H_ -#define INCLUDE_CPPGC_CUSTOM_SPACE_H_ - -#include - -namespace cppgc { - -/** - * Index identifying a custom space. - */ -struct CustomSpaceIndex { - constexpr CustomSpaceIndex(size_t value) : value(value) {} // NOLINT - size_t value; -}; - -/** - * Top-level base class for custom spaces. Users must inherit from CustomSpace - * below. - */ -class CustomSpaceBase { - public: - virtual ~CustomSpaceBase() = default; - virtual CustomSpaceIndex GetCustomSpaceIndex() const = 0; - virtual bool IsCompactable() const = 0; -}; - -/** - * Base class custom spaces should directly inherit from. The class inheriting - * from `CustomSpace` must define `kSpaceIndex` as unique space index. These - * indices need for form a sequence starting at 0. - * - * Example: - * \code - * class CustomSpace1 : public CustomSpace { - * public: - * static constexpr CustomSpaceIndex kSpaceIndex = 0; - * }; - * class CustomSpace2 : public CustomSpace { - * public: - * static constexpr CustomSpaceIndex kSpaceIndex = 1; - * }; - * \endcode - */ -template -class CustomSpace : public CustomSpaceBase { - public: - /** - * Compaction is only supported on spaces that manually manage slots - * recording. - */ - static constexpr bool kSupportsCompaction = false; - - CustomSpaceIndex GetCustomSpaceIndex() const final { - return ConcreteCustomSpace::kSpaceIndex; - } - bool IsCompactable() const final { - return ConcreteCustomSpace::kSupportsCompaction; - } -}; - -/** - * User-overridable trait that allows pinning types to custom spaces. - */ -template -struct SpaceTrait { - using Space = void; -}; - -namespace internal { - -template -struct IsAllocatedOnCompactableSpaceImpl { - static constexpr bool value = CustomSpace::kSupportsCompaction; -}; - -template <> -struct IsAllocatedOnCompactableSpaceImpl { - // Non-custom spaces are by default not compactable. - static constexpr bool value = false; -}; - -template -struct IsAllocatedOnCompactableSpace { - public: - static constexpr bool value = - IsAllocatedOnCompactableSpaceImpl::Space>::value; -}; - -} // namespace internal - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_CUSTOM_SPACE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/default-platform.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/default-platform.h deleted file mode 100644 index 2ccdeddd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/default-platform.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_DEFAULT_PLATFORM_H_ -#define INCLUDE_CPPGC_DEFAULT_PLATFORM_H_ - -#include -#include - -#include "cppgc/platform.h" -#include "libplatform/libplatform.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -/** - * Platform provided by cppgc. Uses V8's DefaultPlatform provided by - * libplatform internally. Exception: `GetForegroundTaskRunner()`, see below. - */ -class V8_EXPORT DefaultPlatform : public Platform { - public: - /** - * Use this method instead of 'cppgc::InitializeProcess' when using - * 'cppgc::DefaultPlatform'. 'cppgc::DefaultPlatform::InitializeProcess' - * will initialize cppgc and v8 if needed (for non-standalone builds). - * - * \param platform DefaultPlatform instance used to initialize cppgc/v8. - */ - static void InitializeProcess(DefaultPlatform* platform); - - using IdleTaskSupport = v8::platform::IdleTaskSupport; - explicit DefaultPlatform( - int thread_pool_size = 0, - IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled, - std::unique_ptr tracing_controller = {}) - : v8_platform_(v8::platform::NewDefaultPlatform( - thread_pool_size, idle_task_support, - v8::platform::InProcessStackDumping::kDisabled, - std::move(tracing_controller))) {} - - cppgc::PageAllocator* GetPageAllocator() override { - return v8_platform_->GetPageAllocator(); - } - - double MonotonicallyIncreasingTime() override { - return v8_platform_->MonotonicallyIncreasingTime(); - } - - std::shared_ptr GetForegroundTaskRunner() override { - // V8's default platform creates a new task runner when passed the - // `v8::Isolate` pointer the first time. For non-default platforms this will - // require getting the appropriate task runner. - return v8_platform_->GetForegroundTaskRunner(kNoIsolate); - } - - std::unique_ptr PostJob( - cppgc::TaskPriority priority, - std::unique_ptr job_task) override { - return v8_platform_->PostJob(priority, std::move(job_task)); - } - - TracingController* GetTracingController() override { - return v8_platform_->GetTracingController(); - } - - protected: - static constexpr v8::Isolate* kNoIsolate = nullptr; - - std::unique_ptr v8_platform_; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_DEFAULT_PLATFORM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/ephemeron-pair.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/ephemeron-pair.h deleted file mode 100644 index e16cf1f0..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/ephemeron-pair.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_EPHEMERON_PAIR_H_ -#define INCLUDE_CPPGC_EPHEMERON_PAIR_H_ - -#include "cppgc/liveness-broker.h" -#include "cppgc/member.h" - -namespace cppgc { - -/** - * An ephemeron pair is used to conditionally retain an object. - * The `value` will be kept alive only if the `key` is alive. - */ -template -struct EphemeronPair { - EphemeronPair(K* k, V* v) : key(k), value(v) {} - WeakMember key; - Member value; - - void ClearValueIfKeyIsDead(const LivenessBroker& broker) { - if (!broker.IsHeapObjectAlive(key)) value = nullptr; - } -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_EPHEMERON_PAIR_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/explicit-management.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/explicit-management.h deleted file mode 100644 index cdb6af48..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/explicit-management.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_EXPLICIT_MANAGEMENT_H_ -#define INCLUDE_CPPGC_EXPLICIT_MANAGEMENT_H_ - -#include - -#include "cppgc/allocation.h" -#include "cppgc/internal/logging.h" -#include "cppgc/type-traits.h" - -namespace cppgc { - -class HeapHandle; - -namespace internal { - -V8_EXPORT void FreeUnreferencedObject(HeapHandle&, void*); -V8_EXPORT bool Resize(void*, size_t); - -} // namespace internal - -namespace subtle { - -/** - * Informs the garbage collector that `object` can be immediately reclaimed. The - * destructor may not be invoked immediately but only on next garbage - * collection. - * - * It is up to the embedder to guarantee that no other object holds a reference - * to `object` after calling `FreeUnreferencedObject()`. In case such a - * reference exists, it's use results in a use-after-free. - * - * To aid in using the API, `FreeUnreferencedObject()` may be called from - * destructors on objects that would be reclaimed in the same garbage collection - * cycle. - * - * \param heap_handle The corresponding heap. - * \param object Reference to an object that is of type `GarbageCollected` and - * should be immediately reclaimed. - */ -template -void FreeUnreferencedObject(HeapHandle& heap_handle, T& object) { - static_assert(IsGarbageCollectedTypeV, - "Object must be of type GarbageCollected."); - internal::FreeUnreferencedObject(heap_handle, &object); -} - -/** - * Tries to resize `object` of type `T` with additional bytes on top of - * sizeof(T). Resizing is only useful with trailing inlined storage, see e.g. - * `MakeGarbageCollected(AllocationHandle&, AdditionalBytes)`. - * - * `Resize()` performs growing or shrinking as needed and may skip the operation - * for internal reasons, see return value. - * - * It is up to the embedder to guarantee that in case of shrinking a larger - * object down, the reclaimed area is not used anymore. Any subsequent use - * results in a use-after-free. - * - * The `object` must be live when calling `Resize()`. - * - * \param object Reference to an object that is of type `GarbageCollected` and - * should be resized. - * \param additional_bytes Bytes in addition to sizeof(T) that the object should - * provide. - * \returns true when the operation was successful and the result can be relied - * on, and false otherwise. - */ -template -bool Resize(T& object, AdditionalBytes additional_bytes) { - static_assert(IsGarbageCollectedTypeV, - "Object must be of type GarbageCollected."); - return internal::Resize(&object, sizeof(T) + additional_bytes.value); -} - -} // namespace subtle -} // namespace cppgc - -#endif // INCLUDE_CPPGC_EXPLICIT_MANAGEMENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/garbage-collected.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/garbage-collected.h deleted file mode 100644 index a3839e1b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/garbage-collected.h +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_GARBAGE_COLLECTED_H_ -#define INCLUDE_CPPGC_GARBAGE_COLLECTED_H_ - -#include - -#include "cppgc/internal/api-constants.h" -#include "cppgc/platform.h" -#include "cppgc/trace-trait.h" -#include "cppgc/type-traits.h" - -namespace cppgc { - -class Visitor; - -namespace internal { - -class GarbageCollectedBase { - public: - // Must use MakeGarbageCollected. - void* operator new(size_t) = delete; - void* operator new[](size_t) = delete; - // The garbage collector is taking care of reclaiming the object. Also, - // virtual destructor requires an unambiguous, accessible 'operator delete'. - void operator delete(void*) { -#ifdef V8_ENABLE_CHECKS - internal::Abort(); -#endif // V8_ENABLE_CHECKS - } - void operator delete[](void*) = delete; - - protected: - GarbageCollectedBase() = default; -}; - -} // namespace internal - -/** - * Base class for managed objects. Only descendent types of `GarbageCollected` - * can be constructed using `MakeGarbageCollected()`. Must be inherited from as - * left-most base class. - * - * Types inheriting from GarbageCollected must provide a method of - * signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed - * pointers to the visitor and delegates to garbage-collected base classes. - * The method must be virtual if the type is not directly a child of - * GarbageCollected and marked as final. - * - * \code - * // Example using final class. - * class FinalType final : public GarbageCollected { - * public: - * void Trace(cppgc::Visitor* visitor) const { - * // Dispatch using visitor->Trace(...); - * } - * }; - * - * // Example using non-final base class. - * class NonFinalBase : public GarbageCollected { - * public: - * virtual void Trace(cppgc::Visitor*) const {} - * }; - * - * class FinalChild final : public NonFinalBase { - * public: - * void Trace(cppgc::Visitor* visitor) const final { - * // Dispatch using visitor->Trace(...); - * NonFinalBase::Trace(visitor); - * } - * }; - * \endcode - */ -template -class GarbageCollected : public internal::GarbageCollectedBase { - public: - using IsGarbageCollectedTypeMarker = void; - using ParentMostGarbageCollectedType = T; - - protected: - GarbageCollected() = default; -}; - -/** - * Base class for managed mixin objects. Such objects cannot be constructed - * directly but must be mixed into the inheritance hierarchy of a - * GarbageCollected object. - * - * Types inheriting from GarbageCollectedMixin must override a virtual method - * of signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed - * pointers to the visitor and delegates to base classes. - * - * \code - * class Mixin : public GarbageCollectedMixin { - * public: - * void Trace(cppgc::Visitor* visitor) const override { - * // Dispatch using visitor->Trace(...); - * } - * }; - * \endcode - */ -class GarbageCollectedMixin : public internal::GarbageCollectedBase { - public: - using IsGarbageCollectedMixinTypeMarker = void; - - /** - * This Trace method must be overriden by objects inheriting from - * GarbageCollectedMixin. - */ - virtual void Trace(cppgc::Visitor*) const {} -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_GARBAGE_COLLECTED_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-consistency.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-consistency.h deleted file mode 100644 index 8e603d5d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-consistency.h +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_HEAP_CONSISTENCY_H_ -#define INCLUDE_CPPGC_HEAP_CONSISTENCY_H_ - -#include - -#include "cppgc/internal/write-barrier.h" -#include "cppgc/macros.h" -#include "cppgc/trace-trait.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class HeapHandle; - -namespace subtle { - -/** - * **DO NOT USE: Use the appropriate managed types.** - * - * Consistency helpers that aid in maintaining a consistent internal state of - * the garbage collector. - */ -class HeapConsistency final { - public: - using WriteBarrierParams = internal::WriteBarrier::Params; - using WriteBarrierType = internal::WriteBarrier::Type; - - /** - * Gets the required write barrier type for a specific write. - * - * \param slot Slot containing the pointer to the object. The slot itself - * must reside in an object that has been allocated using - * `MakeGarbageCollected()`. - * \param value The pointer to the object. May be an interior pointer to an - * interface of the actual object. - * \param params Parameters that may be used for actual write barrier calls. - * Only filled if return value indicates that a write barrier is needed. The - * contents of the `params` are an implementation detail. - * \returns whether a write barrier is needed and which barrier to invoke. - */ - static V8_INLINE WriteBarrierType GetWriteBarrierType( - const void* slot, const void* value, WriteBarrierParams& params) { - return internal::WriteBarrier::GetWriteBarrierType(slot, value, params); - } - - /** - * Gets the required write barrier type for a specific write. - * - * \param slot Slot to some part of an object. The object must not necessarily - have been allocated using `MakeGarbageCollected()` but can also live - off-heap or on stack. - * \param params Parameters that may be used for actual write barrier calls. - * Only filled if return value indicates that a write barrier is needed. The - * contents of the `params` are an implementation detail. - * \param callback Callback returning the corresponding heap handle. The - * callback is only invoked if the heap cannot otherwise be figured out. The - * callback must not allocate. - * \returns whether a write barrier is needed and which barrier to invoke. - */ - template - static V8_INLINE WriteBarrierType - GetWriteBarrierType(const void* slot, WriteBarrierParams& params, - HeapHandleCallback callback) { - return internal::WriteBarrier::GetWriteBarrierType(slot, params, callback); - } - - /** - * Gets the required write barrier type for a specific write. - * This version is meant to be used in conjunction with with a marking write - * barrier barrier which doesn't consider the slot. - * - * \param value The pointer to the object. May be an interior pointer to an - * interface of the actual object. - * \param params Parameters that may be used for actual write barrier calls. - * Only filled if return value indicates that a write barrier is needed. The - * contents of the `params` are an implementation detail. - * \returns whether a write barrier is needed and which barrier to invoke. - */ - static V8_INLINE WriteBarrierType - GetWriteBarrierType(const void* value, WriteBarrierParams& params) { - return internal::WriteBarrier::GetWriteBarrierType(value, params); - } - - /** - * Conservative Dijkstra-style write barrier that processes an object if it - * has not yet been processed. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param object The pointer to the object. May be an interior pointer to a - * an interface of the actual object. - */ - static V8_INLINE void DijkstraWriteBarrier(const WriteBarrierParams& params, - const void* object) { - internal::WriteBarrier::DijkstraMarkingBarrier(params, object); - } - - /** - * Conservative Dijkstra-style write barrier that processes a range of - * elements if they have not yet been processed. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param first_element Pointer to the first element that should be processed. - * The slot itself must reside in an object that has been allocated using - * `MakeGarbageCollected()`. - * \param element_size Size of the element in bytes. - * \param number_of_elements Number of elements that should be processed, - * starting with `first_element`. - * \param trace_callback The trace callback that should be invoked for each - * element if necessary. - */ - static V8_INLINE void DijkstraWriteBarrierRange( - const WriteBarrierParams& params, const void* first_element, - size_t element_size, size_t number_of_elements, - TraceCallback trace_callback) { - internal::WriteBarrier::DijkstraMarkingBarrierRange( - params, first_element, element_size, number_of_elements, - trace_callback); - } - - /** - * Steele-style write barrier that re-processes an object if it has already - * been processed. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param object The pointer to the object which must point to an object that - * has been allocated using `MakeGarbageCollected()`. Interior pointers are - * not supported. - */ - static V8_INLINE void SteeleWriteBarrier(const WriteBarrierParams& params, - const void* object) { - internal::WriteBarrier::SteeleMarkingBarrier(params, object); - } - - /** - * Generational barrier for maintaining consistency when running with multiple - * generations. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param slot Slot containing the pointer to the object. The slot itself - * must reside in an object that has been allocated using - * `MakeGarbageCollected()`. - */ - static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params, - const void* slot) { - internal::WriteBarrier::GenerationalBarrier(params, slot); - } - - private: - HeapConsistency() = delete; -}; - -/** - * Disallows garbage collection finalizations. Any garbage collection triggers - * result in a crash when in this scope. - * - * Note that the garbage collector already covers paths that can lead to garbage - * collections, so user code does not require checking - * `IsGarbageCollectionAllowed()` before allocations. - */ -class V8_EXPORT V8_NODISCARD DisallowGarbageCollectionScope final { - CPPGC_STACK_ALLOCATED(); - - public: - /** - * \returns whether garbage collections are currently allowed. - */ - static bool IsGarbageCollectionAllowed(HeapHandle& heap_handle); - - /** - * Enters a disallow garbage collection scope. Must be paired with `Leave()`. - * Prefer a scope instance of `DisallowGarbageCollectionScope`. - * - * \param heap_handle The corresponding heap. - */ - static void Enter(HeapHandle& heap_handle); - - /** - * Leaves a disallow garbage collection scope. Must be paired with `Enter()`. - * Prefer a scope instance of `DisallowGarbageCollectionScope`. - * - * \param heap_handle The corresponding heap. - */ - static void Leave(HeapHandle& heap_handle); - - /** - * Constructs a scoped object that automatically enters and leaves a disallow - * garbage collection scope based on its lifetime. - * - * \param heap_handle The corresponding heap. - */ - explicit DisallowGarbageCollectionScope(HeapHandle& heap_handle); - ~DisallowGarbageCollectionScope(); - - DisallowGarbageCollectionScope(const DisallowGarbageCollectionScope&) = - delete; - DisallowGarbageCollectionScope& operator=( - const DisallowGarbageCollectionScope&) = delete; - - private: - HeapHandle& heap_handle_; -}; - -/** - * Avoids invoking garbage collection finalizations. Already running garbage - * collection phase are unaffected by this scope. - * - * Should only be used temporarily as the scope has an impact on memory usage - * and follow up garbage collections. - */ -class V8_EXPORT V8_NODISCARD NoGarbageCollectionScope final { - CPPGC_STACK_ALLOCATED(); - - public: - /** - * Enters a no garbage collection scope. Must be paired with `Leave()`. Prefer - * a scope instance of `NoGarbageCollectionScope`. - * - * \param heap_handle The corresponding heap. - */ - static void Enter(HeapHandle& heap_handle); - - /** - * Leaves a no garbage collection scope. Must be paired with `Enter()`. Prefer - * a scope instance of `NoGarbageCollectionScope`. - * - * \param heap_handle The corresponding heap. - */ - static void Leave(HeapHandle& heap_handle); - - /** - * Constructs a scoped object that automatically enters and leaves a no - * garbage collection scope based on its lifetime. - * - * \param heap_handle The corresponding heap. - */ - explicit NoGarbageCollectionScope(HeapHandle& heap_handle); - ~NoGarbageCollectionScope(); - - NoGarbageCollectionScope(const NoGarbageCollectionScope&) = delete; - NoGarbageCollectionScope& operator=(const NoGarbageCollectionScope&) = delete; - - private: - HeapHandle& heap_handle_; -}; - -} // namespace subtle -} // namespace cppgc - -#endif // INCLUDE_CPPGC_HEAP_CONSISTENCY_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-state.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-state.h deleted file mode 100644 index 3fd6b54a..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-state.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_HEAP_STATE_H_ -#define INCLUDE_CPPGC_HEAP_STATE_H_ - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class HeapHandle; - -namespace subtle { - -/** - * Helpers to peek into heap-internal state. - */ -class V8_EXPORT HeapState final { - public: - /** - * Returns whether the garbage collector is marking. This API is experimental - * and is expected to be removed in future. - * - * \param heap_handle The corresponding heap. - * \returns true if the garbage collector is currently marking, and false - * otherwise. - */ - static bool IsMarking(const HeapHandle& heap_handle); - - /* - * Returns whether the garbage collector is sweeping. This API is experimental - * and is expected to be removed in future. - * - * \param heap_handle The corresponding heap. - * \returns true if the garbage collector is currently sweeping, and false - * otherwise. - */ - static bool IsSweeping(const HeapHandle& heap_handle); - - /** - * Returns whether the garbage collector is in the atomic pause, i.e., the - * mutator is stopped from running. This API is experimental and is expected - * to be removed in future. - * - * \param heap_handle The corresponding heap. - * \returns true if the garbage collector is currently in the atomic pause, - * and false otherwise. - */ - static bool IsInAtomicPause(const HeapHandle& heap_handle); - - /** - * Returns whether the last garbage collection was finalized conservatively - * (i.e., with a non-empty stack). This API is experimental and is expected to - * be removed in future. - * - * \param heap_handle The corresponding heap. - * \returns true if the last garbage collection was finalized conservatively, - * and false otherwise. - */ - static bool PreviousGCWasConservative(const HeapHandle& heap_handle); - - private: - HeapState() = delete; -}; - -} // namespace subtle -} // namespace cppgc - -#endif // INCLUDE_CPPGC_HEAP_STATE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-statistics.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-statistics.h deleted file mode 100644 index 8e626596..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap-statistics.h +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2021 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_ -#define INCLUDE_CPPGC_HEAP_STATISTICS_H_ - -#include -#include -#include -#include - -namespace cppgc { - -/** - * `HeapStatistics` contains memory consumption and utilization statistics for a - * cppgc heap. - */ -struct HeapStatistics final { - /** - * Specifies the detail level of the heap statistics. Brief statistics contain - * only the top-level allocated and used memory statistics for the entire - * heap. Detailed statistics also contain a break down per space and page, as - * well as freelist statistics and object type histograms. Note that used - * memory reported by brief statistics and detailed statistics might differ - * slightly. - */ - enum DetailLevel : uint8_t { - kBrief, - kDetailed, - }; - - /** - * Object statistics for a single type. - */ - struct ObjectStatsEntry { - /** - * Number of allocated bytes. - */ - size_t allocated_bytes; - /** - * Number of allocated objects. - */ - size_t object_count; - }; - - /** - * Page granularity statistics. For each page the statistics record the - * allocated memory size and overall used memory size for the page. - */ - struct PageStatistics { - /** Overall committed amount of memory for the page. */ - size_t committed_size_bytes = 0; - /** Resident amount of memory held by the page. */ - size_t resident_size_bytes = 0; - /** Amount of memory actually used on the page. */ - size_t used_size_bytes = 0; - /** Statistics for object allocated on the page. Filled only when - * NameProvider::HideInternalNames() is false. */ - std::vector object_statistics; - }; - - /** - * Statistics of the freelist (used only in non-large object spaces). For - * each bucket in the freelist the statistics record the bucket size, the - * number of freelist entries in the bucket, and the overall allocated memory - * consumed by these freelist entries. - */ - struct FreeListStatistics { - /** bucket sizes in the freelist. */ - std::vector bucket_size; - /** number of freelist entries per bucket. */ - std::vector free_count; - /** memory size consumed by freelist entries per size. */ - std::vector free_size; - }; - - /** - * Space granularity statistics. For each space the statistics record the - * space name, the amount of allocated memory and overall used memory for the - * space. The statistics also contain statistics for each of the space's - * pages, its freelist and the objects allocated on the space. - */ - struct SpaceStatistics { - /** The space name */ - std::string name; - /** Overall committed amount of memory for the heap. */ - size_t committed_size_bytes = 0; - /** Resident amount of memory held by the heap. */ - size_t resident_size_bytes = 0; - /** Amount of memory actually used on the space. */ - size_t used_size_bytes = 0; - /** Statistics for each of the pages in the space. */ - std::vector page_stats; - /** Statistics for the freelist of the space. */ - FreeListStatistics free_list_stats; - }; - - /** Overall committed amount of memory for the heap. */ - size_t committed_size_bytes = 0; - /** Resident amount of memory help by the heap. */ - size_t resident_size_bytes = 0; - /** Amount of memory actually used on the heap. */ - size_t used_size_bytes = 0; - /** Detail level of this HeapStatistics. */ - DetailLevel detail_level; - - /** Statistics for each of the spaces in the heap. Filled only when - * `detail_level` is `DetailLevel::kDetailed`. */ - std::vector space_stats; - - /** - * Vector of `cppgc::GarbageCollected` type names. - */ - std::vector type_names; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_HEAP_STATISTICS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap.h deleted file mode 100644 index 136c4fb4..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/heap.h +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_HEAP_H_ -#define INCLUDE_CPPGC_HEAP_H_ - -#include -#include -#include -#include - -#include "cppgc/common.h" -#include "cppgc/custom-space.h" -#include "cppgc/platform.h" -#include "v8config.h" // NOLINT(build/include_directory) - -/** - * cppgc - A C++ garbage collection library. - */ -namespace cppgc { - -class AllocationHandle; - -/** - * Implementation details of cppgc. Those details are considered internal and - * may change at any point in time without notice. Users should never rely on - * the contents of this namespace. - */ -namespace internal { -class Heap; -} // namespace internal - -/** - * Used for additional heap APIs. - */ -class HeapHandle; - -class V8_EXPORT Heap { - public: - /** - * Specifies the stack state the embedder is in. - */ - using StackState = EmbedderStackState; - - /** - * Specifies whether conservative stack scanning is supported. - */ - enum class StackSupport : uint8_t { - /** - * Conservative stack scan is supported. - */ - kSupportsConservativeStackScan, - /** - * Conservative stack scan is not supported. Embedders may use this option - * when using custom infrastructure that is unsupported by the library. - */ - kNoConservativeStackScan, - }; - - /** - * Specifies supported marking types - */ - enum class MarkingType : uint8_t { - /** - * Atomic stop-the-world marking. This option does not require any write - * barriers but is the most intrusive in terms of jank. - */ - kAtomic, - /** - * Incremental marking, i.e. interleave marking is the rest of the - * application on the same thread. - */ - kIncremental, - /** - * Incremental and concurrent marking. - */ - kIncrementalAndConcurrent - }; - - /** - * Specifies supported sweeping types - */ - enum class SweepingType : uint8_t { - /** - * Atomic stop-the-world sweeping. All of sweeping is performed at once. - */ - kAtomic, - /** - * Incremental and concurrent sweeping. Sweeping is split and interleaved - * with the rest of the application. - */ - kIncrementalAndConcurrent - }; - - /** - * Constraints for a Heap setup. - */ - struct ResourceConstraints { - /** - * Allows the heap to grow to some initial size in bytes before triggering - * garbage collections. This is useful when it is known that applications - * need a certain minimum heap to run to avoid repeatedly invoking the - * garbage collector when growing the heap. - */ - size_t initial_heap_size_bytes = 0; - }; - - /** - * Options specifying Heap properties (e.g. custom spaces) when initializing a - * heap through `Heap::Create()`. - */ - struct HeapOptions { - /** - * Creates reasonable defaults for instantiating a Heap. - * - * \returns the HeapOptions that can be passed to `Heap::Create()`. - */ - static HeapOptions Default() { return {}; } - - /** - * Custom spaces added to heap are required to have indices forming a - * numbered sequence starting at 0, i.e., their `kSpaceIndex` must - * correspond to the index they reside in the vector. - */ - std::vector> custom_spaces; - - /** - * Specifies whether conservative stack scan is supported. When conservative - * stack scan is not supported, the collector may try to invoke - * garbage collections using non-nestable task, which are guaranteed to have - * no interesting stack, through the provided Platform. If such tasks are - * not supported by the Platform, the embedder must take care of invoking - * the GC through `ForceGarbageCollectionSlow()`. - */ - StackSupport stack_support = StackSupport::kSupportsConservativeStackScan; - - /** - * Specifies which types of marking are supported by the heap. - */ - MarkingType marking_support = MarkingType::kIncrementalAndConcurrent; - - /** - * Specifies which types of sweeping are supported by the heap. - */ - SweepingType sweeping_support = SweepingType::kIncrementalAndConcurrent; - - /** - * Resource constraints specifying various properties that the internal - * GC scheduler follows. - */ - ResourceConstraints resource_constraints; - }; - - /** - * Creates a new heap that can be used for object allocation. - * - * \param platform implemented and provided by the embedder. - * \param options HeapOptions specifying various properties for the Heap. - * \returns a new Heap instance. - */ - static std::unique_ptr Create( - std::shared_ptr platform, - HeapOptions options = HeapOptions::Default()); - - virtual ~Heap() = default; - - /** - * Forces garbage collection. - * - * \param source String specifying the source (or caller) triggering a - * forced garbage collection. - * \param reason String specifying the reason for the forced garbage - * collection. - * \param stack_state The embedder stack state, see StackState. - */ - void ForceGarbageCollectionSlow( - const char* source, const char* reason, - StackState stack_state = StackState::kMayContainHeapPointers); - - /** - * \returns the opaque handle for allocating objects using - * `MakeGarbageCollected()`. - */ - AllocationHandle& GetAllocationHandle(); - - /** - * \returns the opaque heap handle which may be used to refer to this heap in - * other APIs. Valid as long as the underlying `Heap` is alive. - */ - HeapHandle& GetHeapHandle(); - - private: - Heap() = default; - - friend class internal::Heap; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_HEAP_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/api-constants.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/api-constants.h deleted file mode 100644 index 7253a470..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/api-constants.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ -#define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ - -#include -#include - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -// Embedders should not rely on this code! - -// Internal constants to avoid exposing internal types on the API surface. -namespace api_constants { - -constexpr size_t kKB = 1024; -constexpr size_t kMB = kKB * 1024; -constexpr size_t kGB = kMB * 1024; - -// Offset of the uint16_t bitfield from the payload contaning the -// in-construction bit. This is subtracted from the payload pointer to get -// to the right bitfield. -static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload = - 2 * sizeof(uint16_t); -// Mask for in-construction bit. -static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1}; - -static constexpr size_t kPageSize = size_t{1} << 17; - -static constexpr size_t kLargeObjectSizeThreshold = kPageSize / 2; - -#if defined(CPPGC_CAGED_HEAP) -constexpr size_t kCagedHeapReservationSize = static_cast(4) * kGB; -constexpr size_t kCagedHeapReservationAlignment = kCagedHeapReservationSize; -#endif - -} // namespace api_constants - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/atomic-entry-flag.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/atomic-entry-flag.h deleted file mode 100644 index 5a7d3b8f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/atomic-entry-flag.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_ATOMIC_ENTRY_FLAG_H_ -#define INCLUDE_CPPGC_INTERNAL_ATOMIC_ENTRY_FLAG_H_ - -#include - -namespace cppgc { -namespace internal { - -// A flag which provides a fast check whether a scope may be entered on the -// current thread, without needing to access thread-local storage or mutex. Can -// have false positives (i.e., spuriously report that it might be entered), so -// it is expected that this will be used in tandem with a precise check that the -// scope is in fact entered on that thread. -// -// Example: -// g_frobnicating_flag.MightBeEntered() && -// ThreadLocalFrobnicator().IsFrobnicating() -// -// Relaxed atomic operations are sufficient, since: -// - all accesses remain atomic -// - each thread must observe its own operations in order -// - no thread ever exits the flag more times than it enters (if used correctly) -// And so if a thread observes zero, it must be because it has observed an equal -// number of exits as entries. -class AtomicEntryFlag final { - public: - void Enter() { entries_.fetch_add(1, std::memory_order_relaxed); } - void Exit() { entries_.fetch_sub(1, std::memory_order_relaxed); } - - // Returns false only if the current thread is not between a call to Enter - // and a call to Exit. Returns true if this thread or another thread may - // currently be in the scope guarded by this flag. - bool MightBeEntered() const { - return entries_.load(std::memory_order_relaxed) != 0; - } - - private: - std::atomic_int entries_{0}; -}; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_ATOMIC_ENTRY_FLAG_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/caged-heap-local-data.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/caged-heap-local-data.h deleted file mode 100644 index 1fa60b69..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/caged-heap-local-data.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_ -#define INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_ - -#include - -#include "cppgc/internal/api-constants.h" -#include "cppgc/internal/logging.h" -#include "cppgc/platform.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -class HeapBase; - -#if defined(CPPGC_YOUNG_GENERATION) - -// AgeTable contains entries that correspond to 4KB memory regions. Each entry -// can be in one of three states: kOld, kYoung or kUnknown. -class AgeTable final { - static constexpr size_t kGranularityBits = 12; // 4KiB per byte. - - public: - enum class Age : uint8_t { kOld, kYoung, kUnknown }; - - static constexpr size_t kEntrySizeInBytes = 1 << kGranularityBits; - - Age& operator[](uintptr_t offset) { return table_[entry(offset)]; } - Age operator[](uintptr_t offset) const { return table_[entry(offset)]; } - - void Reset(PageAllocator* allocator); - - private: - static constexpr size_t kAgeTableSize = - api_constants::kCagedHeapReservationSize >> kGranularityBits; - - size_t entry(uintptr_t offset) const { - const size_t entry = offset >> kGranularityBits; - CPPGC_DCHECK(table_.size() > entry); - return entry; - } - - std::array table_; -}; - -static_assert(sizeof(AgeTable) == 1 * api_constants::kMB, - "Size of AgeTable is 1MB"); - -#endif // CPPGC_YOUNG_GENERATION - -struct CagedHeapLocalData final { - explicit CagedHeapLocalData(HeapBase* heap_base) : heap_base(heap_base) {} - - bool is_incremental_marking_in_progress = false; - HeapBase* heap_base = nullptr; -#if defined(CPPGC_YOUNG_GENERATION) - AgeTable age_table; -#endif -}; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/compiler-specific.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/compiler-specific.h deleted file mode 100644 index 595b6398..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/compiler-specific.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ -#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ - -namespace cppgc { - -#if defined(__has_attribute) -#define CPPGC_HAS_ATTRIBUTE(FEATURE) __has_attribute(FEATURE) -#else -#define CPPGC_HAS_ATTRIBUTE(FEATURE) 0 -#endif - -#if defined(__has_cpp_attribute) -#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE) -#else -#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) 0 -#endif - -// [[no_unique_address]] comes in C++20 but supported in clang with -std >= -// c++11. -#if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address) -#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]] -#else -#define CPPGC_NO_UNIQUE_ADDRESS -#endif - -#if CPPGC_HAS_ATTRIBUTE(unused) -#define CPPGC_UNUSED __attribute__((unused)) -#else -#define CPPGC_UNUSED -#endif - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/finalizer-trait.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/finalizer-trait.h deleted file mode 100644 index a9512659..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/finalizer-trait.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_ -#define INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_ - -#include - -#include "cppgc/type-traits.h" - -namespace cppgc { -namespace internal { - -using FinalizationCallback = void (*)(void*); - -template -struct HasFinalizeGarbageCollectedObject : std::false_type {}; - -template -struct HasFinalizeGarbageCollectedObject< - T, void_t().FinalizeGarbageCollectedObject())>> - : std::true_type {}; - -// The FinalizerTraitImpl specifies how to finalize objects. -template -struct FinalizerTraitImpl; - -template -struct FinalizerTraitImpl { - private: - // Dispatch to custom FinalizeGarbageCollectedObject(). - struct Custom { - static void Call(void* obj) { - static_cast(obj)->FinalizeGarbageCollectedObject(); - } - }; - - // Dispatch to regular destructor. - struct Destructor { - static void Call(void* obj) { static_cast(obj)->~T(); } - }; - - using FinalizeImpl = - std::conditional_t::value, Custom, - Destructor>; - - public: - static void Finalize(void* obj) { - static_assert(sizeof(T), "T must be fully defined"); - FinalizeImpl::Call(obj); - } -}; - -template -struct FinalizerTraitImpl { - static void Finalize(void* obj) { - static_assert(sizeof(T), "T must be fully defined"); - } -}; - -// The FinalizerTrait is used to determine if a type requires finalization and -// what finalization means. -template -struct FinalizerTrait { - private: - // Object has a finalizer if it has - // - a custom FinalizeGarbageCollectedObject method, or - // - a destructor. - static constexpr bool kNonTrivialFinalizer = - internal::HasFinalizeGarbageCollectedObject::value || - !std::is_trivially_destructible::type>::value; - - static void Finalize(void* obj) { - internal::FinalizerTraitImpl::Finalize(obj); - } - - public: - // The callback used to finalize an object of type T. - static constexpr FinalizationCallback kCallback = - kNonTrivialFinalizer ? Finalize : nullptr; -}; - -template -constexpr FinalizationCallback FinalizerTrait::kCallback; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/gc-info.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/gc-info.h deleted file mode 100644 index 0830b194..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/gc-info.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ -#define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ - -#include -#include -#include - -#include "cppgc/internal/finalizer-trait.h" -#include "cppgc/internal/name-trait.h" -#include "cppgc/trace-trait.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -using GCInfoIndex = uint16_t; - -// Acquires a new GC info object and returns the index. In addition, also -// updates `registered_index` atomically. -V8_EXPORT GCInfoIndex -EnsureGCInfoIndex(std::atomic& registered_index, - FinalizationCallback, TraceCallback, NameCallback, bool); - -// Fold types based on finalizer behavior. Note that finalizer characteristics -// align with trace behavior, i.e., destructors are virtual when trace methods -// are and vice versa. -template -struct GCInfoFolding { - static constexpr bool kHasVirtualDestructorAtBase = - std::has_virtual_destructor::value; - static constexpr bool kBothTypesAreTriviallyDestructible = - std::is_trivially_destructible::value && - std::is_trivially_destructible::value; - static constexpr bool kHasCustomFinalizerDispatchAtBase = - internal::HasFinalizeGarbageCollectedObject< - ParentMostGarbageCollectedType>::value; -#ifdef CPPGC_SUPPORTS_OBJECT_NAMES - static constexpr bool kWantsDetailedObjectNames = true; -#else // !CPPGC_SUPPORTS_OBJECT_NAMES - static constexpr bool kWantsDetailedObjectNames = false; -#endif // !CPPGC_SUPPORTS_OBJECT_NAMES - - // Folding would regresses name resolution when deriving names from C++ - // class names as it would just folds a name to the base class name. - using ResultType = std::conditional_t<(kHasVirtualDestructorAtBase || - kBothTypesAreTriviallyDestructible || - kHasCustomFinalizerDispatchAtBase) && - !kWantsDetailedObjectNames, - ParentMostGarbageCollectedType, T>; -}; - -// Trait determines how the garbage collector treats objects wrt. to traversing, -// finalization, and naming. -template -struct GCInfoTrait final { - static GCInfoIndex Index() { - static_assert(sizeof(T), "T must be fully defined"); - static std::atomic - registered_index; // Uses zero initialization. - const GCInfoIndex index = registered_index.load(std::memory_order_acquire); - return index ? index - : EnsureGCInfoIndex( - registered_index, FinalizerTrait::kCallback, - TraceTrait::Trace, NameTrait::GetName, - std::is_polymorphic::value); - } -}; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/logging.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/logging.h deleted file mode 100644 index 79beaef7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/logging.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_LOGGING_H_ -#define INCLUDE_CPPGC_INTERNAL_LOGGING_H_ - -#include "cppgc/source-location.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -void V8_EXPORT DCheckImpl(const char*, - const SourceLocation& = SourceLocation::Current()); -[[noreturn]] void V8_EXPORT -FatalImpl(const char*, const SourceLocation& = SourceLocation::Current()); - -// Used to ignore -Wunused-variable. -template -struct EatParams {}; - -#if DEBUG -#define CPPGC_DCHECK_MSG(condition, message) \ - do { \ - if (V8_UNLIKELY(!(condition))) { \ - ::cppgc::internal::DCheckImpl(message); \ - } \ - } while (false) -#else -#define CPPGC_DCHECK_MSG(condition, message) \ - (static_cast(::cppgc::internal::EatParams(condition), message)>{})) -#endif - -#define CPPGC_DCHECK(condition) CPPGC_DCHECK_MSG(condition, #condition) - -#define CPPGC_CHECK_MSG(condition, message) \ - do { \ - if (V8_UNLIKELY(!(condition))) { \ - ::cppgc::internal::FatalImpl(message); \ - } \ - } while (false) - -#define CPPGC_CHECK(condition) CPPGC_CHECK_MSG(condition, #condition) - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_LOGGING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/name-trait.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/name-trait.h deleted file mode 100644 index 2e2da1ea..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/name-trait.h +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_ -#define INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_ - -#include - -#include "cppgc/name-provider.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -#if CPPGC_SUPPORTS_OBJECT_NAMES && defined(__clang__) -#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 1 - -// Provides constexpr c-string storage for a name of fixed |Size| characters. -// Automatically appends terminating 0 byte. -template -struct NameBuffer { - char name[Size + 1]{}; - - static constexpr NameBuffer FromCString(const char* str) { - NameBuffer result; - for (size_t i = 0; i < Size; ++i) result.name[i] = str[i]; - result.name[Size] = 0; - return result; - } -}; - -template -const char* GetTypename() { - static constexpr char kSelfPrefix[] = - "const char *cppgc::internal::GetTypename() [T ="; - static_assert(__builtin_strncmp(__PRETTY_FUNCTION__, kSelfPrefix, - sizeof(kSelfPrefix) - 1) == 0, - "The prefix must match"); - static constexpr const char* kTypenameStart = - __PRETTY_FUNCTION__ + sizeof(kSelfPrefix); - static constexpr size_t kTypenameSize = - __builtin_strlen(__PRETTY_FUNCTION__) - sizeof(kSelfPrefix) - 1; - // NameBuffer is an indirection that is needed to make sure that only a - // substring of __PRETTY_FUNCTION__ gets materialized in the binary. - static constexpr auto buffer = - NameBuffer::FromCString(kTypenameStart); - return buffer.name; -} - -#else -#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 0 -#endif - -struct HeapObjectName { - const char* value; - bool name_was_hidden; -}; - -class V8_EXPORT NameTraitBase { - protected: - static HeapObjectName GetNameFromTypeSignature(const char*); -}; - -// Trait that specifies how the garbage collector retrieves the name for a -// given object. -template -class NameTrait final : public NameTraitBase { - public: - static HeapObjectName GetName(const void* obj) { - return GetNameFor(static_cast(obj)); - } - - private: - static HeapObjectName GetNameFor(const NameProvider* name_provider) { - return {name_provider->GetHumanReadableName(), false}; - } - - static HeapObjectName GetNameFor(...) { -#if CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME - return {GetTypename(), false}; -#elif CPPGC_SUPPORTS_OBJECT_NAMES - -#if defined(V8_CC_GNU) -#define PRETTY_FUNCTION_VALUE __PRETTY_FUNCTION__ -#elif defined(V8_CC_MSVC) -#define PRETTY_FUNCTION_VALUE __FUNCSIG__ -#else -#define PRETTY_FUNCTION_VALUE nullptr -#endif - - static const HeapObjectName leaky_name = - GetNameFromTypeSignature(PRETTY_FUNCTION_VALUE); - return {leaky_name, false}; - -#undef PRETTY_FUNCTION_VALUE - -#else // !CPPGC_SUPPORTS_OBJECT_NAMES - return {NameProvider::kHiddenName, true}; -#endif // !CPPGC_SUPPORTS_OBJECT_NAMES - } -}; - -using NameCallback = HeapObjectName (*)(const void*); - -} // namespace internal -} // namespace cppgc - -#undef CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME - -#endif // INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/persistent-node.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/persistent-node.h deleted file mode 100644 index b5dba476..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/persistent-node.h +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_ -#define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_ - -#include -#include -#include - -#include "cppgc/internal/logging.h" -#include "cppgc/trace-trait.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class Visitor; - -namespace internal { - -class CrossThreadPersistentRegion; - -// PersistentNode represents a variant of two states: -// 1) traceable node with a back pointer to the Persistent object; -// 2) freelist entry. -class PersistentNode final { - public: - PersistentNode() = default; - - PersistentNode(const PersistentNode&) = delete; - PersistentNode& operator=(const PersistentNode&) = delete; - - void InitializeAsUsedNode(void* owner, TraceCallback trace) { - CPPGC_DCHECK(trace); - owner_ = owner; - trace_ = trace; - } - - void InitializeAsFreeNode(PersistentNode* next) { - next_ = next; - trace_ = nullptr; - } - - void UpdateOwner(void* owner) { - CPPGC_DCHECK(IsUsed()); - owner_ = owner; - } - - PersistentNode* FreeListNext() const { - CPPGC_DCHECK(!IsUsed()); - return next_; - } - - void Trace(Visitor* visitor) const { - CPPGC_DCHECK(IsUsed()); - trace_(visitor, owner_); - } - - bool IsUsed() const { return trace_; } - - void* owner() const { - CPPGC_DCHECK(IsUsed()); - return owner_; - } - - private: - // PersistentNode acts as a designated union: - // If trace_ != nullptr, owner_ points to the corresponding Persistent handle. - // Otherwise, next_ points to the next freed PersistentNode. - union { - void* owner_ = nullptr; - PersistentNode* next_; - }; - TraceCallback trace_ = nullptr; -}; - -class V8_EXPORT PersistentRegion { - using PersistentNodeSlots = std::array; - - public: - PersistentRegion() = default; - // Clears Persistent fields to avoid stale pointers after heap teardown. - ~PersistentRegion(); - - PersistentRegion(const PersistentRegion&) = delete; - PersistentRegion& operator=(const PersistentRegion&) = delete; - - PersistentNode* AllocateNode(void* owner, TraceCallback trace) { - if (!free_list_head_) { - EnsureNodeSlots(); - } - PersistentNode* node = free_list_head_; - free_list_head_ = free_list_head_->FreeListNext(); - CPPGC_DCHECK(!node->IsUsed()); - node->InitializeAsUsedNode(owner, trace); - nodes_in_use_++; - return node; - } - - void FreeNode(PersistentNode* node) { - CPPGC_DCHECK(node); - CPPGC_DCHECK(node->IsUsed()); - node->InitializeAsFreeNode(free_list_head_); - free_list_head_ = node; - CPPGC_DCHECK(nodes_in_use_ > 0); - nodes_in_use_--; - } - - void Trace(Visitor*); - - size_t NodesInUse() const; - - void ClearAllUsedNodes(); - - private: - void EnsureNodeSlots(); - - template - void ClearAllUsedNodes(); - - std::vector> nodes_; - PersistentNode* free_list_head_ = nullptr; - size_t nodes_in_use_ = 0; - - friend class CrossThreadPersistentRegion; -}; - -// CrossThreadPersistent uses PersistentRegion but protects it using this lock -// when needed. -class V8_EXPORT PersistentRegionLock final { - public: - PersistentRegionLock(); - ~PersistentRegionLock(); - - static void AssertLocked(); -}; - -// Variant of PersistentRegion that checks whether the PersistentRegionLock is -// locked. -class V8_EXPORT CrossThreadPersistentRegion final : protected PersistentRegion { - public: - CrossThreadPersistentRegion() = default; - // Clears Persistent fields to avoid stale pointers after heap teardown. - ~CrossThreadPersistentRegion(); - - CrossThreadPersistentRegion(const CrossThreadPersistentRegion&) = delete; - CrossThreadPersistentRegion& operator=(const CrossThreadPersistentRegion&) = - delete; - - V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) { - PersistentRegionLock::AssertLocked(); - return PersistentRegion::AllocateNode(owner, trace); - } - - V8_INLINE void FreeNode(PersistentNode* node) { - PersistentRegionLock::AssertLocked(); - PersistentRegion::FreeNode(node); - } - - void Trace(Visitor*); - - size_t NodesInUse() const; - - void ClearAllUsedNodes(); -}; - -} // namespace internal - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/pointer-policies.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/pointer-policies.h deleted file mode 100644 index cdf0bb69..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/pointer-policies.h +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ -#define INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ - -#include -#include - -#include "cppgc/internal/write-barrier.h" -#include "cppgc/sentinel-pointer.h" -#include "cppgc/source-location.h" -#include "cppgc/type-traits.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { - -class HeapBase; -class PersistentRegion; -class CrossThreadPersistentRegion; - -// Tags to distinguish between strong and weak member types. -class StrongMemberTag; -class WeakMemberTag; -class UntracedMemberTag; - -struct DijkstraWriteBarrierPolicy { - static void InitializingBarrier(const void*, const void*) { - // Since in initializing writes the source object is always white, having no - // barrier doesn't break the tri-color invariant. - } - static void AssigningBarrier(const void* slot, const void* value) { - WriteBarrier::Params params; - switch (WriteBarrier::GetWriteBarrierType(slot, value, params)) { - case WriteBarrier::Type::kGenerational: - WriteBarrier::GenerationalBarrier(params, slot); - break; - case WriteBarrier::Type::kMarking: - WriteBarrier::DijkstraMarkingBarrier(params, value); - break; - case WriteBarrier::Type::kNone: - break; - } - } -}; - -struct NoWriteBarrierPolicy { - static void InitializingBarrier(const void*, const void*) {} - static void AssigningBarrier(const void*, const void*) {} -}; - -class V8_EXPORT EnabledCheckingPolicy { - protected: - template - void CheckPointer(const T* ptr) { - if (!ptr || (kSentinelPointer == ptr)) return; - - CheckPointersImplTrampoline::Call(this, ptr); - } - - private: - void CheckPointerImpl(const void* ptr, bool points_to_payload); - - template > - struct CheckPointersImplTrampoline { - static void Call(EnabledCheckingPolicy* policy, const T* ptr) { - policy->CheckPointerImpl(ptr, false); - } - }; - - template - struct CheckPointersImplTrampoline { - static void Call(EnabledCheckingPolicy* policy, const T* ptr) { - policy->CheckPointerImpl(ptr, IsGarbageCollectedTypeV); - } - }; - - const HeapBase* heap_ = nullptr; -}; - -class DisabledCheckingPolicy { - protected: - void CheckPointer(const void*) {} -}; - -#if V8_ENABLE_CHECKS -using DefaultMemberCheckingPolicy = EnabledCheckingPolicy; -using DefaultPersistentCheckingPolicy = EnabledCheckingPolicy; -#else -using DefaultMemberCheckingPolicy = DisabledCheckingPolicy; -using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy; -#endif -// For CT(W)P neither marking information (for value), nor objectstart bitmap -// (for slot) are guaranteed to be present because there's no synchonization -// between heaps after marking. -using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy; - -class KeepLocationPolicy { - public: - constexpr const SourceLocation& Location() const { return location_; } - - protected: - constexpr KeepLocationPolicy() = default; - constexpr explicit KeepLocationPolicy(const SourceLocation& location) - : location_(location) {} - - // KeepLocationPolicy must not copy underlying source locations. - KeepLocationPolicy(const KeepLocationPolicy&) = delete; - KeepLocationPolicy& operator=(const KeepLocationPolicy&) = delete; - - // Location of the original moved from object should be preserved. - KeepLocationPolicy(KeepLocationPolicy&&) = default; - KeepLocationPolicy& operator=(KeepLocationPolicy&&) = default; - - private: - SourceLocation location_; -}; - -class IgnoreLocationPolicy { - public: - constexpr SourceLocation Location() const { return {}; } - - protected: - constexpr IgnoreLocationPolicy() = default; - constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {} -}; - -#if CPPGC_SUPPORTS_OBJECT_NAMES -using DefaultLocationPolicy = KeepLocationPolicy; -#else -using DefaultLocationPolicy = IgnoreLocationPolicy; -#endif - -struct StrongPersistentPolicy { - using IsStrongPersistent = std::true_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object); -}; - -struct WeakPersistentPolicy { - using IsStrongPersistent = std::false_type; - static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object); -}; - -struct StrongCrossThreadPersistentPolicy { - using IsStrongPersistent = std::true_type; - static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion( - const void* object); -}; - -struct WeakCrossThreadPersistentPolicy { - using IsStrongPersistent = std::false_type; - static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion( - const void* object); -}; - -// Forward declarations setting up the default policies. -template -class BasicCrossThreadPersistent; -template -class BasicPersistent; -template -class BasicMember; - -} // namespace internal - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/prefinalizer-handler.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/prefinalizer-handler.h deleted file mode 100644 index 64b07ec9..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/prefinalizer-handler.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_ -#define INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_ - -#include "cppgc/heap.h" -#include "cppgc/liveness-broker.h" - -namespace cppgc { -namespace internal { - -class V8_EXPORT PreFinalizerRegistrationDispatcher final { - public: - using PreFinalizerCallback = bool (*)(const LivenessBroker&, void*); - struct PreFinalizer { - void* object; - PreFinalizerCallback callback; - - bool operator==(const PreFinalizer& other) const; - }; - - static void RegisterPrefinalizer(PreFinalizer pre_finalizer); -}; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/write-barrier.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/write-barrier.h deleted file mode 100644 index 28184dc9..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/internal/write-barrier.h +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ -#define INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ - -#include -#include - -#include "cppgc/heap-state.h" -#include "cppgc/internal/api-constants.h" -#include "cppgc/internal/atomic-entry-flag.h" -#include "cppgc/platform.h" -#include "cppgc/sentinel-pointer.h" -#include "cppgc/trace-trait.h" -#include "v8config.h" // NOLINT(build/include_directory) - -#if defined(CPPGC_CAGED_HEAP) -#include "cppgc/internal/caged-heap-local-data.h" -#endif - -namespace cppgc { - -class HeapHandle; - -namespace internal { - -#if defined(CPPGC_CAGED_HEAP) -class WriteBarrierTypeForCagedHeapPolicy; -#else // !CPPGC_CAGED_HEAP -class WriteBarrierTypeForNonCagedHeapPolicy; -#endif // !CPPGC_CAGED_HEAP - -class V8_EXPORT WriteBarrier final { - public: - enum class Type : uint8_t { - kNone, - kMarking, - kGenerational, - }; - - struct Params { - HeapHandle* heap = nullptr; -#if V8_ENABLE_CHECKS - Type type = Type::kNone; -#endif // !V8_ENABLE_CHECKS -#if defined(CPPGC_CAGED_HEAP) - uintptr_t start = 0; - CagedHeapLocalData& caged_heap() const { - return *reinterpret_cast(start); - } - uintptr_t slot_offset = 0; - uintptr_t value_offset = 0; -#endif // CPPGC_CAGED_HEAP - }; - - enum class ValueMode { - kValuePresent, - kNoValuePresent, - }; - - // Returns the required write barrier for a given `slot` and `value`. - static V8_INLINE Type GetWriteBarrierType(const void* slot, const void* value, - Params& params); - // Returns the required write barrier for a given `slot`. - template - static V8_INLINE Type GetWriteBarrierType(const void* slot, Params& params, - HeapHandleCallback callback); - // Returns the required write barrier for a given `value`. - static V8_INLINE Type GetWriteBarrierType(const void* value, Params& params); - - template - static V8_INLINE Type GetWriteBarrierTypeForExternallyReferencedObject( - const void* value, Params& params, HeapHandleCallback callback); - - static V8_INLINE void DijkstraMarkingBarrier(const Params& params, - const void* object); - static V8_INLINE void DijkstraMarkingBarrierRange( - const Params& params, const void* first_element, size_t element_size, - size_t number_of_elements, TraceCallback trace_callback); - static V8_INLINE void SteeleMarkingBarrier(const Params& params, - const void* object); -#if defined(CPPGC_YOUNG_GENERATION) - static V8_INLINE void GenerationalBarrier(const Params& params, - const void* slot); -#else // !CPPGC_YOUNG_GENERATION - static V8_INLINE void GenerationalBarrier(const Params& params, - const void* slot) {} -#endif // CPPGC_YOUNG_GENERATION - -#if V8_ENABLE_CHECKS - static void CheckParams(Type expected_type, const Params& params); -#else // !V8_ENABLE_CHECKS - static void CheckParams(Type expected_type, const Params& params) {} -#endif // !V8_ENABLE_CHECKS - - // The IncrementalOrConcurrentUpdater class allows cppgc internal to update - // |incremental_or_concurrent_marking_flag_|. - class IncrementalOrConcurrentMarkingFlagUpdater; - static bool IsAnyIncrementalOrConcurrentMarking() { - return incremental_or_concurrent_marking_flag_.MightBeEntered(); - } - - private: - WriteBarrier() = delete; - -#if defined(CPPGC_CAGED_HEAP) - using WriteBarrierTypePolicy = WriteBarrierTypeForCagedHeapPolicy; -#else // !CPPGC_CAGED_HEAP - using WriteBarrierTypePolicy = WriteBarrierTypeForNonCagedHeapPolicy; -#endif // !CPPGC_CAGED_HEAP - - static void DijkstraMarkingBarrierSlow(const void* value); - static void DijkstraMarkingBarrierSlowWithSentinelCheck(const void* value); - static void DijkstraMarkingBarrierRangeSlow(HeapHandle& heap_handle, - const void* first_element, - size_t element_size, - size_t number_of_elements, - TraceCallback trace_callback); - static void SteeleMarkingBarrierSlow(const void* value); - static void SteeleMarkingBarrierSlowWithSentinelCheck(const void* value); - -#if defined(CPPGC_YOUNG_GENERATION) - static CagedHeapLocalData& GetLocalData(HeapHandle&); - static void GenerationalBarrierSlow(const CagedHeapLocalData& local_data, - const AgeTable& ageTable, - const void* slot, uintptr_t value_offset); -#endif // CPPGC_YOUNG_GENERATION - - static AtomicEntryFlag incremental_or_concurrent_marking_flag_; -}; - -template -V8_INLINE WriteBarrier::Type SetAndReturnType(WriteBarrier::Params& params) { - if (type == WriteBarrier::Type::kNone) return WriteBarrier::Type::kNone; -#if V8_ENABLE_CHECKS - params.type = type; -#endif // !V8_ENABLE_CHECKS - return type; -} - -#if defined(CPPGC_CAGED_HEAP) -class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final { - public: - template - static V8_INLINE WriteBarrier::Type Get(const void* slot, const void* value, - WriteBarrier::Params& params, - HeapHandleCallback callback) { - return ValueModeDispatch::Get(slot, value, params, callback); - } - - template - static V8_INLINE WriteBarrier::Type Get(const void* value, - WriteBarrier::Params& params, - HeapHandleCallback callback) { - return GetNoSlot(value, params, callback); - } - - template - static V8_INLINE WriteBarrier::Type GetForExternallyReferenced( - const void* value, WriteBarrier::Params& params, - HeapHandleCallback callback) { - return GetNoSlot(value, params, callback); - } - - private: - WriteBarrierTypeForCagedHeapPolicy() = delete; - - template - static V8_INLINE WriteBarrier::Type GetNoSlot(const void* value, - WriteBarrier::Params& params, - HeapHandleCallback) { - if (!TryGetCagedHeap(value, value, params)) { - return WriteBarrier::Type::kNone; - } - if (V8_UNLIKELY(params.caged_heap().is_incremental_marking_in_progress)) { - return SetAndReturnType(params); - } - return SetAndReturnType(params); - } - - template - struct ValueModeDispatch; - - static V8_INLINE bool TryGetCagedHeap(const void* slot, const void* value, - WriteBarrier::Params& params) { - // TODO(chromium:1056170): Check if the null check can be folded in with - // the rest of the write barrier. - if (!value) return false; - params.start = reinterpret_cast(value) & - ~(api_constants::kCagedHeapReservationAlignment - 1); - const uintptr_t slot_offset = - reinterpret_cast(slot) - params.start; - if (slot_offset > api_constants::kCagedHeapReservationSize) { - // Check if slot is on stack or value is sentinel or nullptr. This relies - // on the fact that kSentinelPointer is encoded as 0x1. - return false; - } - return true; - } - - // Returns whether marking is in progress. If marking is not in progress - // sets the start of the cage accordingly. - // - // TODO(chromium:1056170): Create fast path on API. - static bool IsMarking(const HeapHandle&, WriteBarrier::Params&); -}; - -template <> -struct WriteBarrierTypeForCagedHeapPolicy::ValueModeDispatch< - WriteBarrier::ValueMode::kValuePresent> { - template - static V8_INLINE WriteBarrier::Type Get(const void* slot, const void* value, - WriteBarrier::Params& params, - HeapHandleCallback) { - bool within_cage = TryGetCagedHeap(slot, value, params); - if (!within_cage) { - return WriteBarrier::Type::kNone; - } - if (V8_LIKELY(!params.caged_heap().is_incremental_marking_in_progress)) { -#if defined(CPPGC_YOUNG_GENERATION) - params.heap = reinterpret_cast(params.start); - params.slot_offset = reinterpret_cast(slot) - params.start; - params.value_offset = reinterpret_cast(value) - params.start; - return SetAndReturnType(params); -#else // !CPPGC_YOUNG_GENERATION - return SetAndReturnType(params); -#endif // !CPPGC_YOUNG_GENERATION - } - params.heap = reinterpret_cast(params.start); - return SetAndReturnType(params); - } -}; - -template <> -struct WriteBarrierTypeForCagedHeapPolicy::ValueModeDispatch< - WriteBarrier::ValueMode::kNoValuePresent> { - template - static V8_INLINE WriteBarrier::Type Get(const void* slot, const void*, - WriteBarrier::Params& params, - HeapHandleCallback callback) { -#if defined(CPPGC_YOUNG_GENERATION) - HeapHandle& handle = callback(); - if (V8_LIKELY(!IsMarking(handle, params))) { - // params.start is populated by IsMarking(). - params.heap = &handle; - params.slot_offset = reinterpret_cast(slot) - params.start; - // params.value_offset stays 0. - if (params.slot_offset > api_constants::kCagedHeapReservationSize) { - // Check if slot is on stack. - return SetAndReturnType(params); - } - return SetAndReturnType(params); - } -#else // !CPPGC_YOUNG_GENERATION - if (V8_LIKELY(!WriteBarrier::IsAnyIncrementalOrConcurrentMarking())) { - return SetAndReturnType(params); - } - HeapHandle& handle = callback(); - if (V8_UNLIKELY(!subtle::HeapState::IsMarking(handle))) { - return SetAndReturnType(params); - } -#endif // !CPPGC_YOUNG_GENERATION - params.heap = &handle; - return SetAndReturnType(params); - } -}; - -#endif // CPPGC_CAGED_HEAP - -class V8_EXPORT WriteBarrierTypeForNonCagedHeapPolicy final { - public: - template - static V8_INLINE WriteBarrier::Type Get(const void* slot, const void* value, - WriteBarrier::Params& params, - HeapHandleCallback callback) { - return ValueModeDispatch::Get(slot, value, params, callback); - } - - template - static V8_INLINE WriteBarrier::Type Get(const void* value, - WriteBarrier::Params& params, - HeapHandleCallback callback) { - // The slot will never be used in `Get()` below. - return Get(nullptr, value, params, - callback); - } - - template - static V8_INLINE WriteBarrier::Type GetForExternallyReferenced( - const void* value, WriteBarrier::Params& params, - HeapHandleCallback callback) { - // The slot will never be used in `Get()` below. - return Get(nullptr, value, params, - callback); - } - - private: - template - struct ValueModeDispatch; - - // TODO(chromium:1056170): Create fast path on API. - static bool IsMarking(const void*, HeapHandle**); - // TODO(chromium:1056170): Create fast path on API. - static bool IsMarking(HeapHandle&); - - WriteBarrierTypeForNonCagedHeapPolicy() = delete; -}; - -template <> -struct WriteBarrierTypeForNonCagedHeapPolicy::ValueModeDispatch< - WriteBarrier::ValueMode::kValuePresent> { - template - static V8_INLINE WriteBarrier::Type Get(const void*, const void* object, - WriteBarrier::Params& params, - HeapHandleCallback callback) { - // The following check covers nullptr as well as sentinel pointer. - if (object <= static_cast(kSentinelPointer)) { - return WriteBarrier::Type::kNone; - } - if (IsMarking(object, ¶ms.heap)) { - return SetAndReturnType(params); - } - return SetAndReturnType(params); - } -}; - -template <> -struct WriteBarrierTypeForNonCagedHeapPolicy::ValueModeDispatch< - WriteBarrier::ValueMode::kNoValuePresent> { - template - static V8_INLINE WriteBarrier::Type Get(const void*, const void*, - WriteBarrier::Params& params, - HeapHandleCallback callback) { - if (V8_UNLIKELY(WriteBarrier::IsAnyIncrementalOrConcurrentMarking())) { - HeapHandle& handle = callback(); - if (IsMarking(handle)) { - params.heap = &handle; - return SetAndReturnType(params); - } - } - return WriteBarrier::Type::kNone; - } -}; - -// static -WriteBarrier::Type WriteBarrier::GetWriteBarrierType( - const void* slot, const void* value, WriteBarrier::Params& params) { - return WriteBarrierTypePolicy::Get(slot, value, - params, []() {}); -} - -// static -template -WriteBarrier::Type WriteBarrier::GetWriteBarrierType( - const void* slot, WriteBarrier::Params& params, - HeapHandleCallback callback) { - return WriteBarrierTypePolicy::Get( - slot, nullptr, params, callback); -} - -// static -WriteBarrier::Type WriteBarrier::GetWriteBarrierType( - const void* value, WriteBarrier::Params& params) { - return WriteBarrierTypePolicy::Get(value, params, - []() {}); -} - -// static -template -WriteBarrier::Type -WriteBarrier::GetWriteBarrierTypeForExternallyReferencedObject( - const void* value, Params& params, HeapHandleCallback callback) { - return WriteBarrierTypePolicy::GetForExternallyReferenced(value, params, - callback); -} - -// static -void WriteBarrier::DijkstraMarkingBarrier(const Params& params, - const void* object) { - CheckParams(Type::kMarking, params); -#if defined(CPPGC_CAGED_HEAP) - // Caged heap already filters out sentinels. - DijkstraMarkingBarrierSlow(object); -#else // !CPPGC_CAGED_HEAP - DijkstraMarkingBarrierSlowWithSentinelCheck(object); -#endif // !CPPGC_CAGED_HEAP -} - -// static -void WriteBarrier::DijkstraMarkingBarrierRange(const Params& params, - const void* first_element, - size_t element_size, - size_t number_of_elements, - TraceCallback trace_callback) { - CheckParams(Type::kMarking, params); - DijkstraMarkingBarrierRangeSlow(*params.heap, first_element, element_size, - number_of_elements, trace_callback); -} - -// static -void WriteBarrier::SteeleMarkingBarrier(const Params& params, - const void* object) { - CheckParams(Type::kMarking, params); -#if defined(CPPGC_CAGED_HEAP) - // Caged heap already filters out sentinels. - SteeleMarkingBarrierSlow(object); -#else // !CPPGC_CAGED_HEAP - SteeleMarkingBarrierSlowWithSentinelCheck(object); -#endif // !CPPGC_CAGED_HEAP -} - -#if defined(CPPGC_YOUNG_GENERATION) -// static -void WriteBarrier::GenerationalBarrier(const Params& params, const void* slot) { - CheckParams(Type::kGenerational, params); - - const CagedHeapLocalData& local_data = params.caged_heap(); - const AgeTable& age_table = local_data.age_table; - - // Bail out if the slot is in young generation. - if (V8_LIKELY(age_table[params.slot_offset] == AgeTable::Age::kYoung)) return; - - GenerationalBarrierSlow(local_data, age_table, slot, params.value_offset); -} - -#endif // !CPPGC_YOUNG_GENERATION - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/liveness-broker.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/liveness-broker.h deleted file mode 100644 index c94eef0d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/liveness-broker.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_LIVENESS_BROKER_H_ -#define INCLUDE_CPPGC_LIVENESS_BROKER_H_ - -#include "cppgc/heap.h" -#include "cppgc/member.h" -#include "cppgc/trace-trait.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -namespace internal { -class LivenessBrokerFactory; -} // namespace internal - -/** - * The broker is passed to weak callbacks to allow (temporarily) querying - * the liveness state of an object. References to non-live objects must be - * cleared when `IsHeapObjectAlive()` returns false. - * - * \code - * class GCedWithCustomWeakCallback final - * : public GarbageCollected { - * public: - * UntracedMember bar; - * - * void CustomWeakCallbackMethod(const LivenessBroker& broker) { - * if (!broker.IsHeapObjectAlive(bar)) - * bar = nullptr; - * } - * - * void Trace(cppgc::Visitor* visitor) const { - * visitor->RegisterWeakCallbackMethod< - * GCedWithCustomWeakCallback, - * &GCedWithCustomWeakCallback::CustomWeakCallbackMethod>(this); - * } - * }; - * \endcode - */ -class V8_EXPORT LivenessBroker final { - public: - template - bool IsHeapObjectAlive(const T* object) const { - // nullptr objects are considered alive to allow weakness to be used from - // stack while running into a conservative GC. Treating nullptr as dead - // would mean that e.g. custom collectins could not be strongified on stack. - return !object || - IsHeapObjectAliveImpl( - TraceTrait::GetTraceDescriptor(object).base_object_payload); - } - - template - bool IsHeapObjectAlive(const WeakMember& weak_member) const { - return (weak_member != kSentinelPointer) && - IsHeapObjectAlive(weak_member.Get()); - } - - template - bool IsHeapObjectAlive(const UntracedMember& untraced_member) const { - return (untraced_member != kSentinelPointer) && - IsHeapObjectAlive(untraced_member.Get()); - } - - private: - LivenessBroker() = default; - - bool IsHeapObjectAliveImpl(const void*) const; - - friend class internal::LivenessBrokerFactory; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_LIVENESS_BROKER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/macros.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/macros.h deleted file mode 100644 index 030f397e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/macros.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_MACROS_H_ -#define INCLUDE_CPPGC_MACROS_H_ - -#include - -#include "cppgc/internal/compiler-specific.h" - -namespace cppgc { - -// Use if the object is only stack allocated. -#define CPPGC_STACK_ALLOCATED() \ - public: \ - using IsStackAllocatedTypeMarker CPPGC_UNUSED = int; \ - \ - private: \ - void* operator new(size_t) = delete; \ - void* operator new(size_t, void*) = delete; \ - static_assert(true, "Force semicolon.") - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_MACROS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/member.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/member.h deleted file mode 100644 index 38105b8e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/member.h +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_MEMBER_H_ -#define INCLUDE_CPPGC_MEMBER_H_ - -#include -#include -#include - -#include "cppgc/internal/pointer-policies.h" -#include "cppgc/sentinel-pointer.h" -#include "cppgc/type-traits.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class Visitor; - -namespace internal { - -// MemberBase always refers to the object as const object and defers to -// BasicMember on casting to the right type as needed. -class MemberBase { - protected: - struct AtomicInitializerTag {}; - - MemberBase() = default; - explicit MemberBase(const void* value) : raw_(value) {} - MemberBase(const void* value, AtomicInitializerTag) { SetRawAtomic(value); } - - const void** GetRawSlot() const { return &raw_; } - const void* GetRaw() const { return raw_; } - void SetRaw(void* value) { raw_ = value; } - - const void* GetRawAtomic() const { - return reinterpret_cast*>(&raw_)->load( - std::memory_order_relaxed); - } - void SetRawAtomic(const void* value) { - reinterpret_cast*>(&raw_)->store( - value, std::memory_order_relaxed); - } - - void ClearFromGC() const { raw_ = nullptr; } - - private: - mutable const void* raw_ = nullptr; -}; - -// The basic class from which all Member classes are 'generated'. -template -class BasicMember final : private MemberBase, private CheckingPolicy { - public: - using PointeeType = T; - - constexpr BasicMember() = default; - constexpr BasicMember(std::nullptr_t) {} // NOLINT - BasicMember(SentinelPointer s) : MemberBase(s) {} // NOLINT - BasicMember(T* raw) : MemberBase(raw) { // NOLINT - InitializingWriteBarrier(); - this->CheckPointer(Get()); - } - BasicMember(T& raw) : BasicMember(&raw) {} // NOLINT - // Atomic ctor. Using the AtomicInitializerTag forces BasicMember to - // initialize using atomic assignments. This is required for preventing - // data races with concurrent marking. - using AtomicInitializerTag = MemberBase::AtomicInitializerTag; - BasicMember(std::nullptr_t, AtomicInitializerTag atomic) - : MemberBase(nullptr, atomic) {} - BasicMember(SentinelPointer s, AtomicInitializerTag atomic) - : MemberBase(s, atomic) {} - BasicMember(T* raw, AtomicInitializerTag atomic) : MemberBase(raw, atomic) { - InitializingWriteBarrier(); - this->CheckPointer(Get()); - } - BasicMember(T& raw, AtomicInitializerTag atomic) - : BasicMember(&raw, atomic) {} - // Copy ctor. - BasicMember(const BasicMember& other) : BasicMember(other.Get()) {} - // Allow heterogeneous construction. - template ::value>> - BasicMember( // NOLINT - const BasicMember& other) - : BasicMember(other.Get()) {} - // Move ctor. - BasicMember(BasicMember&& other) noexcept : BasicMember(other.Get()) { - other.Clear(); - } - // Allow heterogeneous move construction. - template ::value>> - BasicMember(BasicMember&& other) noexcept - : BasicMember(other.Get()) { - other.Clear(); - } - // Construction from Persistent. - template ::value>> - BasicMember(const BasicPersistent& p) - : BasicMember(p.Get()) {} - - // Copy assignment. - BasicMember& operator=(const BasicMember& other) { - return operator=(other.Get()); - } - // Allow heterogeneous copy assignment. - template ::value>> - BasicMember& operator=( - const BasicMember& other) { - return operator=(other.Get()); - } - // Move assignment. - BasicMember& operator=(BasicMember&& other) noexcept { - operator=(other.Get()); - other.Clear(); - return *this; - } - // Heterogeneous move assignment. - template ::value>> - BasicMember& operator=(BasicMember&& other) noexcept { - operator=(other.Get()); - other.Clear(); - return *this; - } - // Assignment from Persistent. - template ::value>> - BasicMember& operator=( - const BasicPersistent& - other) { - return operator=(other.Get()); - } - BasicMember& operator=(T* other) { - SetRawAtomic(other); - AssigningWriteBarrier(); - this->CheckPointer(Get()); - return *this; - } - BasicMember& operator=(std::nullptr_t) { - Clear(); - return *this; - } - BasicMember& operator=(SentinelPointer s) { - SetRawAtomic(s); - return *this; - } - - template - void Swap(BasicMember& other) { - T* tmp = Get(); - *this = other; - other = tmp; - } - - explicit operator bool() const { return Get(); } - operator T*() const { return Get(); } - T* operator->() const { return Get(); } - T& operator*() const { return *Get(); } - - // CFI cast exemption to allow passing SentinelPointer through T* and support - // heterogeneous assignments between different Member and Persistent handles - // based on their actual types. - V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const { - // Executed by the mutator, hence non atomic load. - // - // The const_cast below removes the constness from MemberBase storage. The - // following static_cast re-adds any constness if specified through the - // user-visible template parameter T. - return static_cast(const_cast(MemberBase::GetRaw())); - } - - void Clear() { SetRawAtomic(nullptr); } - - T* Release() { - T* result = Get(); - Clear(); - return result; - } - - const T** GetSlotForTesting() const { - return reinterpret_cast(GetRawSlot()); - } - - private: - const T* GetRawAtomic() const { - return static_cast(MemberBase::GetRawAtomic()); - } - - void InitializingWriteBarrier() const { - WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), GetRaw()); - } - void AssigningWriteBarrier() const { - WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRaw()); - } - - void ClearFromGC() const { MemberBase::ClearFromGC(); } - - T* GetFromGC() const { return Get(); } - - friend class cppgc::Visitor; - template - friend struct cppgc::TraceTrait; -}; - -template -bool operator==(const BasicMember& member1, - const BasicMember& member2) { - return member1.Get() == member2.Get(); -} - -template -bool operator!=(const BasicMember& member1, - const BasicMember& member2) { - return !(member1 == member2); -} - -template -struct IsWeak< - internal::BasicMember> - : std::true_type {}; - -} // namespace internal - -/** - * Members are used in classes to contain strong pointers to other garbage - * collected objects. All Member fields of a class must be traced in the class' - * trace method. - */ -template -using Member = internal::BasicMember; - -/** - * WeakMember is similar to Member in that it is used to point to other garbage - * collected objects. However instead of creating a strong pointer to the - * object, the WeakMember creates a weak pointer, which does not keep the - * pointee alive. Hence if all pointers to to a heap allocated object are weak - * the object will be garbage collected. At the time of GC the weak pointers - * will automatically be set to null. - */ -template -using WeakMember = internal::BasicMember; - -/** - * UntracedMember is a pointer to an on-heap object that is not traced for some - * reason. Do not use this unless you know what you are doing. Keeping raw - * pointers to on-heap objects is prohibited unless used from stack. Pointee - * must be kept alive through other means. - */ -template -using UntracedMember = internal::BasicMember; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_MEMBER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/name-provider.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/name-provider.h deleted file mode 100644 index 224dd4b5..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/name-provider.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_NAME_PROVIDER_H_ -#define INCLUDE_CPPGC_NAME_PROVIDER_H_ - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -/** - * NameProvider allows for providing a human-readable name for garbage-collected - * objects. - * - * There's two cases of names to distinguish: - * a. Explicitly specified names via using NameProvider. Such names are always - * preserved in the system. - * b. Internal names that Oilpan infers from a C++ type on the class hierarchy - * of the object. This is not necessarily the type of the actually - * instantiated object. - * - * Depending on the build configuration, Oilpan may hide names, i.e., represent - * them with kHiddenName, of case b. to avoid exposing internal details. - */ -class V8_EXPORT NameProvider { - public: - /** - * Name that is used when hiding internals. - */ - static constexpr const char kHiddenName[] = "InternalNode"; - - /** - * Name that is used in case compiler support is missing for composing a name - * from C++ types. - */ - static constexpr const char kNoNameDeducible[] = ""; - - /** - * Indicating whether internal names are hidden or not. - * - * @returns true if C++ names should be hidden and represented by kHiddenName. - */ - static constexpr bool HideInternalNames() { -#if CPPGC_SUPPORTS_OBJECT_NAMES - return false; -#else // !CPPGC_SUPPORTS_OBJECT_NAMES - return true; -#endif // !CPPGC_SUPPORTS_OBJECT_NAMES - } - - virtual ~NameProvider() = default; - - /** - * Specifies a name for the garbage-collected object. Such names will never - * be hidden, as they are explicitly specified by the user of this API. - * - * @returns a human readable name for the object. - */ - virtual const char* GetHumanReadableName() const = 0; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_NAME_PROVIDER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/object-size-trait.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/object-size-trait.h deleted file mode 100644 index 35795596..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/object-size-trait.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_OBJECT_SIZE_TRAIT_H_ -#define INCLUDE_CPPGC_OBJECT_SIZE_TRAIT_H_ - -#include - -#include "cppgc/type-traits.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -namespace internal { - -struct V8_EXPORT BaseObjectSizeTrait { - protected: - static size_t GetObjectSizeForGarbageCollected(const void*); - static size_t GetObjectSizeForGarbageCollectedMixin(const void*); -}; - -} // namespace internal - -namespace subtle { - -/** - * Trait specifying how to get the size of an object that was allocated using - * `MakeGarbageCollected()`. Also supports querying the size with an inner - * pointer to a mixin. - */ -template > -struct ObjectSizeTrait; - -template -struct ObjectSizeTrait : cppgc::internal::BaseObjectSizeTrait { - static_assert(sizeof(T), "T must be fully defined"); - static_assert(IsGarbageCollectedTypeV, - "T must be of type GarbageCollected or GarbageCollectedMixin"); - - static size_t GetSize(const T& object) { - return GetObjectSizeForGarbageCollected(&object); - } -}; - -template -struct ObjectSizeTrait : cppgc::internal::BaseObjectSizeTrait { - static_assert(sizeof(T), "T must be fully defined"); - - static size_t GetSize(const T& object) { - return GetObjectSizeForGarbageCollectedMixin(&object); - } -}; - -} // namespace subtle -} // namespace cppgc - -#endif // INCLUDE_CPPGC_OBJECT_SIZE_TRAIT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/persistent.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/persistent.h deleted file mode 100644 index b83a4645..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/persistent.h +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_PERSISTENT_H_ -#define INCLUDE_CPPGC_PERSISTENT_H_ - -#include - -#include "cppgc/internal/persistent-node.h" -#include "cppgc/internal/pointer-policies.h" -#include "cppgc/sentinel-pointer.h" -#include "cppgc/source-location.h" -#include "cppgc/type-traits.h" -#include "cppgc/visitor.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class Visitor; - -namespace internal { - -// PersistentBase always refers to the object as const object and defers to -// BasicPersistent on casting to the right type as needed. -class PersistentBase { - protected: - PersistentBase() = default; - explicit PersistentBase(const void* raw) : raw_(raw) {} - - const void* GetValue() const { return raw_; } - void SetValue(const void* value) { raw_ = value; } - - PersistentNode* GetNode() const { return node_; } - void SetNode(PersistentNode* node) { node_ = node; } - - // Performs a shallow clear which assumes that internal persistent nodes are - // destroyed elsewhere. - void ClearFromGC() const { - raw_ = nullptr; - node_ = nullptr; - } - - protected: - mutable const void* raw_ = nullptr; - mutable PersistentNode* node_ = nullptr; - - friend class PersistentRegion; -}; - -// The basic class from which all Persistent classes are generated. -template -class BasicPersistent final : public PersistentBase, - public LocationPolicy, - private WeaknessPolicy, - private CheckingPolicy { - public: - using typename WeaknessPolicy::IsStrongPersistent; - using PointeeType = T; - - // Null-state/sentinel constructors. - BasicPersistent( // NOLINT - const SourceLocation& loc = SourceLocation::Current()) - : LocationPolicy(loc) {} - - BasicPersistent(std::nullptr_t, // NOLINT - const SourceLocation& loc = SourceLocation::Current()) - : LocationPolicy(loc) {} - - BasicPersistent( // NOLINT - SentinelPointer s, const SourceLocation& loc = SourceLocation::Current()) - : PersistentBase(s), LocationPolicy(loc) {} - - // Raw value constructors. - BasicPersistent(T* raw, // NOLINT - const SourceLocation& loc = SourceLocation::Current()) - : PersistentBase(raw), LocationPolicy(loc) { - if (!IsValid()) return; - SetNode(WeaknessPolicy::GetPersistentRegion(GetValue()) - .AllocateNode(this, &BasicPersistent::Trace)); - this->CheckPointer(Get()); - } - - BasicPersistent(T& raw, // NOLINT - const SourceLocation& loc = SourceLocation::Current()) - : BasicPersistent(&raw, loc) {} - - // Copy ctor. - BasicPersistent(const BasicPersistent& other, - const SourceLocation& loc = SourceLocation::Current()) - : BasicPersistent(other.Get(), loc) {} - - // Heterogeneous ctor. - template ::value>> - BasicPersistent( - const BasicPersistent& other, - const SourceLocation& loc = SourceLocation::Current()) - : BasicPersistent(other.Get(), loc) {} - - // Move ctor. The heterogeneous move ctor is not supported since e.g. - // persistent can't reuse persistent node from weak persistent. - BasicPersistent( - BasicPersistent&& other, - const SourceLocation& loc = SourceLocation::Current()) noexcept - : PersistentBase(std::move(other)), LocationPolicy(std::move(other)) { - if (!IsValid()) return; - GetNode()->UpdateOwner(this); - other.SetValue(nullptr); - other.SetNode(nullptr); - this->CheckPointer(Get()); - } - - // Constructor from member. - template ::value>> - BasicPersistent(internal::BasicMember - member, - const SourceLocation& loc = SourceLocation::Current()) - : BasicPersistent(member.Get(), loc) {} - - ~BasicPersistent() { Clear(); } - - // Copy assignment. - BasicPersistent& operator=(const BasicPersistent& other) { - return operator=(other.Get()); - } - - template ::value>> - BasicPersistent& operator=( - const BasicPersistent& other) { - return operator=(other.Get()); - } - - // Move assignment. - BasicPersistent& operator=(BasicPersistent&& other) noexcept { - if (this == &other) return *this; - Clear(); - PersistentBase::operator=(std::move(other)); - LocationPolicy::operator=(std::move(other)); - if (!IsValid()) return *this; - GetNode()->UpdateOwner(this); - other.SetValue(nullptr); - other.SetNode(nullptr); - this->CheckPointer(Get()); - return *this; - } - - // Assignment from member. - template ::value>> - BasicPersistent& operator=( - internal::BasicMember - member) { - return operator=(member.Get()); - } - - BasicPersistent& operator=(T* other) { - Assign(other); - return *this; - } - - BasicPersistent& operator=(std::nullptr_t) { - Clear(); - return *this; - } - - BasicPersistent& operator=(SentinelPointer s) { - Assign(s); - return *this; - } - - explicit operator bool() const { return Get(); } - operator T*() const { return Get(); } - T* operator->() const { return Get(); } - T& operator*() const { return *Get(); } - - // CFI cast exemption to allow passing SentinelPointer through T* and support - // heterogeneous assignments between different Member and Persistent handles - // based on their actual types. - V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const { - // The const_cast below removes the constness from PersistentBase storage. - // The following static_cast re-adds any constness if specified through the - // user-visible template parameter T. - return static_cast(const_cast(GetValue())); - } - - void Clear() { - // Simplified version of `Assign()` to allow calling without a complete type - // `T`. - if (IsValid()) { - WeaknessPolicy::GetPersistentRegion(GetValue()).FreeNode(GetNode()); - SetNode(nullptr); - } - SetValue(nullptr); - } - - T* Release() { - T* result = Get(); - Clear(); - return result; - } - - template - BasicPersistent - To() const { - return BasicPersistent(static_cast(Get())); - } - - private: - static void Trace(Visitor* v, const void* ptr) { - const auto* persistent = static_cast(ptr); - v->TraceRoot(*persistent, persistent->Location()); - } - - bool IsValid() const { - // Ideally, handling kSentinelPointer would be done by the embedder. On the - // other hand, having Persistent aware of it is beneficial since no node - // gets wasted. - return GetValue() != nullptr && GetValue() != kSentinelPointer; - } - - void Assign(T* ptr) { - if (IsValid()) { - if (ptr && ptr != kSentinelPointer) { - // Simply assign the pointer reusing the existing node. - SetValue(ptr); - this->CheckPointer(ptr); - return; - } - WeaknessPolicy::GetPersistentRegion(GetValue()).FreeNode(GetNode()); - SetNode(nullptr); - } - SetValue(ptr); - if (!IsValid()) return; - SetNode(WeaknessPolicy::GetPersistentRegion(GetValue()) - .AllocateNode(this, &BasicPersistent::Trace)); - this->CheckPointer(Get()); - } - - void ClearFromGC() const { - if (IsValid()) { - WeaknessPolicy::GetPersistentRegion(GetValue()).FreeNode(GetNode()); - PersistentBase::ClearFromGC(); - } - } - - // Set Get() for details. - V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") - T* GetFromGC() const { - return static_cast(const_cast(GetValue())); - } - - friend class cppgc::Visitor; -}; - -template -bool operator==(const BasicPersistent& p1, - const BasicPersistent& p2) { - return p1.Get() == p2.Get(); -} - -template -bool operator!=(const BasicPersistent& p1, - const BasicPersistent& p2) { - return !(p1 == p2); -} - -template -bool operator==(const BasicPersistent& p, - BasicMember - m) { - return p.Get() == m.Get(); -} - -template -bool operator!=(const BasicPersistent& p, - BasicMember - m) { - return !(p == m); -} - -template -bool operator==(BasicMember - m, - const BasicPersistent& p) { - return m.Get() == p.Get(); -} - -template -bool operator!=(BasicMember - m, - const BasicPersistent& p) { - return !(m == p); -} - -template -struct IsWeak> : std::true_type {}; -} // namespace internal - -/** - * Persistent is a way to create a strong pointer from an off-heap object to - * another on-heap object. As long as the Persistent handle is alive the GC will - * keep the object pointed to alive. The Persistent handle is always a GC root - * from the point of view of the GC. Persistent must be constructed and - * destructed in the same thread. - */ -template -using Persistent = - internal::BasicPersistent; - -/** - * WeakPersistent is a way to create a weak pointer from an off-heap object to - * an on-heap object. The pointer is automatically cleared when the pointee gets - * collected. WeakPersistent must be constructed and destructed in the same - * thread. - */ -template -using WeakPersistent = - internal::BasicPersistent; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_PERSISTENT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/platform.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/platform.h deleted file mode 100644 index 3276a26b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/platform.h +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_PLATFORM_H_ -#define INCLUDE_CPPGC_PLATFORM_H_ - -#include - -#include "v8-platform.h" // NOLINT(build/include_directory) -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -// TODO(v8:10346): Create separate includes for concepts that are not -// V8-specific. -using IdleTask = v8::IdleTask; -using JobHandle = v8::JobHandle; -using JobDelegate = v8::JobDelegate; -using JobTask = v8::JobTask; -using PageAllocator = v8::PageAllocator; -using Task = v8::Task; -using TaskPriority = v8::TaskPriority; -using TaskRunner = v8::TaskRunner; -using TracingController = v8::TracingController; - -/** - * Platform interface used by Heap. Contains allocators and executors. - */ -class V8_EXPORT Platform { - public: - virtual ~Platform() = default; - - /** - * Returns the allocator used by cppgc to allocate its heap and various - * support structures. - */ - virtual PageAllocator* GetPageAllocator() = 0; - - /** - * Monotonically increasing time in seconds from an arbitrary fixed point in - * the past. This function is expected to return at least - * millisecond-precision values. For this reason, - * it is recommended that the fixed point be no further in the past than - * the epoch. - **/ - virtual double MonotonicallyIncreasingTime() = 0; - - /** - * Foreground task runner that should be used by a Heap. - */ - virtual std::shared_ptr GetForegroundTaskRunner() { - return nullptr; - } - - /** - * Posts `job_task` to run in parallel. Returns a `JobHandle` associated with - * the `Job`, which can be joined or canceled. - * This avoids degenerate cases: - * - Calling `CallOnWorkerThread()` for each work item, causing significant - * overhead. - * - Fixed number of `CallOnWorkerThread()` calls that split the work and - * might run for a long time. This is problematic when many components post - * "num cores" tasks and all expect to use all the cores. In these cases, - * the scheduler lacks context to be fair to multiple same-priority requests - * and/or ability to request lower priority work to yield when high priority - * work comes in. - * A canonical implementation of `job_task` looks like: - * \code - * class MyJobTask : public JobTask { - * public: - * MyJobTask(...) : worker_queue_(...) {} - * // JobTask implementation. - * void Run(JobDelegate* delegate) override { - * while (!delegate->ShouldYield()) { - * // Smallest unit of work. - * auto work_item = worker_queue_.TakeWorkItem(); // Thread safe. - * if (!work_item) return; - * ProcessWork(work_item); - * } - * } - * - * size_t GetMaxConcurrency() const override { - * return worker_queue_.GetSize(); // Thread safe. - * } - * }; - * - * // ... - * auto handle = PostJob(TaskPriority::kUserVisible, - * std::make_unique(...)); - * handle->Join(); - * \endcode - * - * `PostJob()` and methods of the returned JobHandle/JobDelegate, must never - * be called while holding a lock that could be acquired by `JobTask::Run()` - * or `JobTask::GetMaxConcurrency()` -- that could result in a deadlock. This - * is because (1) `JobTask::GetMaxConcurrency()` may be invoked while holding - * internal lock (A), hence `JobTask::GetMaxConcurrency()` can only use a lock - * (B) if that lock is *never* held while calling back into `JobHandle` from - * any thread (A=>B/B=>A deadlock) and (2) `JobTask::Run()` or - * `JobTask::GetMaxConcurrency()` may be invoked synchronously from - * `JobHandle` (B=>JobHandle::foo=>B deadlock). - * - * A sufficient `PostJob()` implementation that uses the default Job provided - * in libplatform looks like: - * \code - * std::unique_ptr PostJob( - * TaskPriority priority, std::unique_ptr job_task) override { - * return std::make_unique( - * std::make_shared( - * this, std::move(job_task), kNumThreads)); - * } - * \endcode - */ - virtual std::unique_ptr PostJob( - TaskPriority priority, std::unique_ptr job_task) { - return nullptr; - } - - /** - * Returns an instance of a `TracingController`. This must be non-nullptr. The - * default implementation returns an empty `TracingController` that consumes - * trace data without effect. - */ - virtual TracingController* GetTracingController(); -}; - -/** - * Process-global initialization of the garbage collector. Must be called before - * creating a Heap. - * - * Can be called multiple times when paired with `ShutdownProcess()`. - * - * \param page_allocator The allocator used for maintaining meta data. Must not - * change between multiple calls to InitializeProcess. - */ -V8_EXPORT void InitializeProcess(PageAllocator* page_allocator); - -/** - * Must be called after destroying the last used heap. Some process-global - * metadata may not be returned and reused upon a subsequent - * `InitializeProcess()` call. - */ -V8_EXPORT void ShutdownProcess(); - -namespace internal { - -V8_EXPORT void Abort(); - -} // namespace internal - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_PLATFORM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/prefinalizer.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/prefinalizer.h deleted file mode 100644 index 29b18bef..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/prefinalizer.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_PREFINALIZER_H_ -#define INCLUDE_CPPGC_PREFINALIZER_H_ - -#include "cppgc/internal/compiler-specific.h" -#include "cppgc/internal/prefinalizer-handler.h" -#include "cppgc/liveness-broker.h" - -namespace cppgc { - -namespace internal { - -template -class PrefinalizerRegistration final { - public: - explicit PrefinalizerRegistration(T* self) { - static_assert(sizeof(&T::InvokePreFinalizer) > 0, - "USING_PRE_FINALIZER(T) must be defined."); - - cppgc::internal::PreFinalizerRegistrationDispatcher::RegisterPrefinalizer( - {self, T::InvokePreFinalizer}); - } - - void* operator new(size_t, void* location) = delete; - void* operator new(size_t) = delete; -}; - -} // namespace internal - -#define CPPGC_USING_PRE_FINALIZER(Class, PreFinalizer) \ - public: \ - static bool InvokePreFinalizer(const cppgc::LivenessBroker& liveness_broker, \ - void* object) { \ - static_assert(cppgc::IsGarbageCollectedOrMixinTypeV, \ - "Only garbage collected objects can have prefinalizers"); \ - Class* self = static_cast(object); \ - if (liveness_broker.IsHeapObjectAlive(self)) return false; \ - self->Class::PreFinalizer(); \ - return true; \ - } \ - \ - private: \ - CPPGC_NO_UNIQUE_ADDRESS cppgc::internal::PrefinalizerRegistration \ - prefinalizer_dummy_{this}; \ - static_assert(true, "Force semicolon.") - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_PREFINALIZER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/process-heap-statistics.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/process-heap-statistics.h deleted file mode 100644 index 774cc92f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/process-heap-statistics.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_ -#define INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_ - -#include -#include - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { -namespace internal { -class ProcessHeapStatisticsUpdater; -} // namespace internal - -class V8_EXPORT ProcessHeapStatistics final { - public: - static size_t TotalAllocatedObjectSize() { - return total_allocated_object_size_.load(std::memory_order_relaxed); - } - static size_t TotalAllocatedSpace() { - return total_allocated_space_.load(std::memory_order_relaxed); - } - - private: - static std::atomic_size_t total_allocated_space_; - static std::atomic_size_t total_allocated_object_size_; - - friend class internal::ProcessHeapStatisticsUpdater; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/sentinel-pointer.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/sentinel-pointer.h deleted file mode 100644 index b049d1a2..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/sentinel-pointer.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2021 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_SENTINEL_POINTER_H_ -#define INCLUDE_CPPGC_SENTINEL_POINTER_H_ - -#include - -namespace cppgc { -namespace internal { - -// Special tag type used to denote some sentinel member. The semantics of the -// sentinel is defined by the embedder. -struct SentinelPointer { - template - operator T*() const { - static constexpr intptr_t kSentinelValue = 1; - return reinterpret_cast(kSentinelValue); - } - // Hidden friends. - friend bool operator==(SentinelPointer, SentinelPointer) { return true; } - friend bool operator!=(SentinelPointer, SentinelPointer) { return false; } -}; - -} // namespace internal - -constexpr internal::SentinelPointer kSentinelPointer; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_SENTINEL_POINTER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/source-location.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/source-location.h deleted file mode 100644 index da5a5ede..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/source-location.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_ -#define INCLUDE_CPPGC_SOURCE_LOCATION_H_ - -#include -#include - -#include "v8config.h" // NOLINT(build/include_directory) - -#if defined(__has_builtin) -#define CPPGC_SUPPORTS_SOURCE_LOCATION \ - (__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \ - __has_builtin(__builtin_LINE)) // NOLINT -#elif defined(V8_CC_GNU) && __GNUC__ >= 7 -#define CPPGC_SUPPORTS_SOURCE_LOCATION 1 -#elif defined(V8_CC_INTEL) && __ICC >= 1800 -#define CPPGC_SUPPORTS_SOURCE_LOCATION 1 -#else -#define CPPGC_SUPPORTS_SOURCE_LOCATION 0 -#endif - -namespace cppgc { - -/** - * Encapsulates source location information. Mimics C++20's - * `std::source_location`. - */ -class V8_EXPORT SourceLocation final { - public: - /** - * Construct source location information corresponding to the location of the - * call site. - */ -#if CPPGC_SUPPORTS_SOURCE_LOCATION - static constexpr SourceLocation Current( - const char* function = __builtin_FUNCTION(), - const char* file = __builtin_FILE(), size_t line = __builtin_LINE()) { - return SourceLocation(function, file, line); - } -#else - static constexpr SourceLocation Current() { return SourceLocation(); } -#endif // CPPGC_SUPPORTS_SOURCE_LOCATION - - /** - * Constructs unspecified source location information. - */ - constexpr SourceLocation() = default; - - /** - * Returns the name of the function associated with the position represented - * by this object, if any. - * - * \returns the function name as cstring. - */ - constexpr const char* Function() const { return function_; } - - /** - * Returns the name of the current source file represented by this object. - * - * \returns the file name as cstring. - */ - constexpr const char* FileName() const { return file_; } - - /** - * Returns the line number represented by this object. - * - * \returns the line number. - */ - constexpr size_t Line() const { return line_; } - - /** - * Returns a human-readable string representing this object. - * - * \returns a human-readable string representing source location information. - */ - std::string ToString() const; - - private: - constexpr SourceLocation(const char* function, const char* file, size_t line) - : function_(function), file_(file), line_(line) {} - - const char* function_ = nullptr; - const char* file_ = nullptr; - size_t line_ = 0u; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_SOURCE_LOCATION_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/testing.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/testing.h deleted file mode 100644 index 229ce140..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/testing.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2021 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_TESTING_H_ -#define INCLUDE_CPPGC_TESTING_H_ - -#include "cppgc/common.h" -#include "cppgc/macros.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class HeapHandle; - -/** - * Namespace contains testing helpers. - */ -namespace testing { - -/** - * Overrides the state of the stack with the provided value. Takes precedence - * over other parameters that set the stack state. Must no be nested. - */ -class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final { - CPPGC_STACK_ALLOCATED(); - - public: - /** - * Constructs a scoped object that automatically enters and leaves the scope. - * - * \param heap_handle The corresponding heap. - */ - explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle, - EmbedderStackState state); - ~OverrideEmbedderStackStateScope(); - - OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) = - delete; - OverrideEmbedderStackStateScope& operator=( - const OverrideEmbedderStackStateScope&) = delete; - - private: - HeapHandle& heap_handle_; -}; - -/** - * Testing interface for managed heaps that allows for controlling garbage - * collection timings. Embedders should use this class when testing the - * interaction of their code with incremental/concurrent garbage collection. - */ -class V8_EXPORT StandaloneTestingHeap final { - public: - explicit StandaloneTestingHeap(HeapHandle&); - - /** - * Start an incremental garbage collection. - */ - void StartGarbageCollection(); - - /** - * Perform an incremental step. This will also schedule concurrent steps if - * needed. - * - * \param stack_state The state of the stack during the step. - */ - bool PerformMarkingStep(EmbedderStackState stack_state); - - /** - * Finalize the current garbage collection cycle atomically. - * Assumes that garbage collection is in progress. - * - * \param stack_state The state of the stack for finalizing the garbage - * collection cycle. - */ - void FinalizeGarbageCollection(EmbedderStackState stack_state); - - /** - * Toggle main thread marking on/off. Allows to stress concurrent marking - * (e.g. to better detect data races). - * - * \param should_mark Denotes whether the main thread should contribute to - * marking. Defaults to true. - */ - void ToggleMainThreadMarking(bool should_mark); - - /** - * Force enable compaction for the next garbage collection cycle. - */ - void ForceCompactionForNextGarbageCollection(); - - private: - HeapHandle& heap_handle_; -}; - -} // namespace testing -} // namespace cppgc - -#endif // INCLUDE_CPPGC_TESTING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/trace-trait.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/trace-trait.h deleted file mode 100644 index 83619b1d..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/trace-trait.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_TRACE_TRAIT_H_ -#define INCLUDE_CPPGC_TRACE_TRAIT_H_ - -#include - -#include "cppgc/type-traits.h" -#include "v8config.h" // NOLINT(build/include_directory) - -namespace cppgc { - -class Visitor; - -namespace internal { - -// Implementation of the default TraceTrait handling GarbageCollected and -// GarbageCollectedMixin. -template ::type>> -struct TraceTraitImpl; - -} // namespace internal - -/** - * Callback for invoking tracing on a given object. - * - * \param visitor The visitor to dispatch to. - * \param object The object to invoke tracing on. - */ -using TraceCallback = void (*)(Visitor* visitor, const void* object); - -/** - * Describes how to trace an object, i.e., how to visit all Oilpan-relevant - * fields of an object. - */ -struct TraceDescriptor { - /** - * Adjusted base pointer, i.e., the pointer to the class inheriting directly - * from GarbageCollected, of the object that is being traced. - */ - const void* base_object_payload; - /** - * Callback for tracing the object. - */ - TraceCallback callback; -}; - -namespace internal { - -struct V8_EXPORT TraceTraitFromInnerAddressImpl { - static TraceDescriptor GetTraceDescriptor(const void* address); -}; - -/** - * Trait specifying how the garbage collector processes an object of type T. - * - * Advanced users may override handling by creating a specialization for their - * type. - */ -template -struct TraceTraitBase { - static_assert(internal::IsTraceableV, "T must have a Trace() method"); - - /** - * Accessor for retrieving a TraceDescriptor to process an object of type T. - * - * \param self The object to be processed. - * \returns a TraceDescriptor to process the object. - */ - static TraceDescriptor GetTraceDescriptor(const void* self) { - return internal::TraceTraitImpl::GetTraceDescriptor( - static_cast(self)); - } - - /** - * Function invoking the tracing for an object of type T. - * - * \param visitor The visitor to dispatch to. - * \param self The object to invoke tracing on. - */ - static void Trace(Visitor* visitor, const void* self) { - static_cast(self)->Trace(visitor); - } -}; - -} // namespace internal - -template -struct TraceTrait : public internal::TraceTraitBase {}; - -namespace internal { - -template -struct TraceTraitImpl { - static_assert(IsGarbageCollectedTypeV, - "T must be of type GarbageCollected or GarbageCollectedMixin"); - static TraceDescriptor GetTraceDescriptor(const void* self) { - return {self, TraceTrait::Trace}; - } -}; - -template -struct TraceTraitImpl { - static TraceDescriptor GetTraceDescriptor(const void* self) { - return internal::TraceTraitFromInnerAddressImpl::GetTraceDescriptor(self); - } -}; - -} // namespace internal -} // namespace cppgc - -#endif // INCLUDE_CPPGC_TRACE_TRAIT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/type-traits.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/type-traits.h deleted file mode 100644 index 56cd55d6..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/type-traits.h +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_TYPE_TRAITS_H_ -#define INCLUDE_CPPGC_TYPE_TRAITS_H_ - -// This file should stay with minimal dependencies to allow embedder to check -// against Oilpan types without including any other parts. -#include -#include - -namespace cppgc { - -class Visitor; - -namespace internal { -template -class BasicMember; -struct DijkstraWriteBarrierPolicy; -struct NoWriteBarrierPolicy; -class StrongMemberTag; -class UntracedMemberTag; -class WeakMemberTag; - -// Pre-C++17 custom implementation of std::void_t. -template -struct make_void { - typedef void type; -}; -template -using void_t = typename make_void::type; - -// Not supposed to be specialized by the user. -template -struct IsWeak : std::false_type {}; - -// IsTraceMethodConst is used to verify that all Trace methods are marked as -// const. It is equivalent to IsTraceable but for a non-const object. -template -struct IsTraceMethodConst : std::false_type {}; - -template -struct IsTraceMethodConst().Trace( - std::declval()))>> : std::true_type { -}; - -template -struct IsTraceable : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct IsTraceable< - T, void_t().Trace(std::declval()))>> - : std::true_type { - // All Trace methods should be marked as const. If an object of type - // 'T' is traceable then any object of type 'const T' should also - // be traceable. - static_assert(IsTraceMethodConst(), - "Trace methods should be marked as const."); -}; - -template -constexpr bool IsTraceableV = IsTraceable::value; - -template -struct HasGarbageCollectedMixinTypeMarker : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct HasGarbageCollectedMixinTypeMarker< - T, - void_t::IsGarbageCollectedMixinTypeMarker>> - : std::true_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct HasGarbageCollectedTypeMarker : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct HasGarbageCollectedTypeMarker< - T, void_t::IsGarbageCollectedTypeMarker>> - : std::true_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template ::value, - bool = HasGarbageCollectedMixinTypeMarker::value> -struct IsGarbageCollectedMixinType : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct IsGarbageCollectedMixinType : std::true_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template ::value> -struct IsGarbageCollectedType : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct IsGarbageCollectedType : std::true_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct IsGarbageCollectedOrMixinType - : std::integral_constant::value || - IsGarbageCollectedMixinType::value> { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template ::value && - HasGarbageCollectedMixinTypeMarker::value)> -struct IsGarbageCollectedWithMixinType : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct IsGarbageCollectedWithMixinType : std::true_type { - static_assert(sizeof(T), "T must be fully defined"); -}; - -template -struct IsSubclassOfBasicMemberTemplate { - private: - template - static std::true_type SubclassCheck( - BasicMember*); - static std::false_type SubclassCheck(...); - - public: - static constexpr bool value = - decltype(SubclassCheck(std::declval()))::value; -}; - -template ::value> -struct IsMemberType : std::false_type {}; - -template -struct IsMemberType : std::true_type {}; - -template ::value> -struct IsWeakMemberType : std::false_type {}; - -template -struct IsWeakMemberType : std::true_type {}; - -template ::value> -struct IsUntracedMemberType : std::false_type {}; - -template -struct IsUntracedMemberType : std::true_type {}; - -template -struct IsComplete { - private: - template - static std::true_type IsSizeOfKnown(U*); - static std::false_type IsSizeOfKnown(...); - - public: - static constexpr bool value = - decltype(IsSizeOfKnown(std::declval()))::value; -}; - -} // namespace internal - -/** - * Value is true for types that inherit from `GarbageCollectedMixin` but not - * `GarbageCollected` (i.e., they are free mixins), and false otherwise. - */ -template -constexpr bool IsGarbageCollectedMixinTypeV = - internal::IsGarbageCollectedMixinType::value; - -/** - * Value is true for types that inherit from `GarbageCollected`, and false - * otherwise. - */ -template -constexpr bool IsGarbageCollectedTypeV = - internal::IsGarbageCollectedType::value; - -/** - * Value is true for types that inherit from either `GarbageCollected` or - * `GarbageCollectedMixin`, and false otherwise. - */ -template -constexpr bool IsGarbageCollectedOrMixinTypeV = - internal::IsGarbageCollectedOrMixinType::value; - -/** - * Value is true for types that inherit from `GarbageCollected` and - * `GarbageCollectedMixin`, and false otherwise. - */ -template -constexpr bool IsGarbageCollectedWithMixinTypeV = - internal::IsGarbageCollectedWithMixinType::value; - -/** - * Value is true for types of type `Member`, and false otherwise. - */ -template -constexpr bool IsMemberTypeV = internal::IsMemberType::value; - -/** - * Value is true for types of type `UntracedMember`, and false otherwise. - */ -template -constexpr bool IsUntracedMemberTypeV = internal::IsUntracedMemberType::value; - -/** - * Value is true for types of type `WeakMember`, and false otherwise. - */ -template -constexpr bool IsWeakMemberTypeV = internal::IsWeakMemberType::value; - -/** - * Value is true for types that are considered weak references, and false - * otherwise. - */ -template -constexpr bool IsWeakV = internal::IsWeak::value; - -/** - * Value is true for types that are complete, and false otherwise. - */ -template -constexpr bool IsCompleteV = internal::IsComplete::value; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_TYPE_TRAITS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/visitor.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/visitor.h deleted file mode 100644 index 57e2ce39..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/cppgc/visitor.h +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_VISITOR_H_ -#define INCLUDE_CPPGC_VISITOR_H_ - -#include "cppgc/custom-space.h" -#include "cppgc/ephemeron-pair.h" -#include "cppgc/garbage-collected.h" -#include "cppgc/internal/logging.h" -#include "cppgc/internal/pointer-policies.h" -#include "cppgc/liveness-broker.h" -#include "cppgc/member.h" -#include "cppgc/sentinel-pointer.h" -#include "cppgc/source-location.h" -#include "cppgc/trace-trait.h" -#include "cppgc/type-traits.h" - -namespace cppgc { - -namespace internal { -template -class BasicCrossThreadPersistent; -template -class BasicPersistent; -class ConservativeTracingVisitor; -class VisitorBase; -class VisitorFactory; -} // namespace internal - -using WeakCallback = void (*)(const LivenessBroker&, const void*); - -/** - * Visitor passed to trace methods. All managed pointers must have called the - * Visitor's trace method on them. - * - * \code - * class Foo final : public GarbageCollected { - * public: - * void Trace(Visitor* visitor) const { - * visitor->Trace(foo_); - * visitor->Trace(weak_foo_); - * } - * private: - * Member foo_; - * WeakMember weak_foo_; - * }; - * \endcode - */ -class V8_EXPORT Visitor { - public: - class Key { - private: - Key() = default; - friend class internal::VisitorFactory; - }; - - explicit Visitor(Key) {} - - virtual ~Visitor() = default; - - /** - * Trace method for raw pointers. Prefer the versions for managed pointers. - * - * \param member Reference retaining an object. - */ - template - void Trace(const T* t) { - static_assert(sizeof(T), "Pointee type must be fully defined."); - static_assert(internal::IsGarbageCollectedOrMixinType::value, - "T must be GarbageCollected or GarbageCollectedMixin type"); - if (!t) { - return; - } - Visit(t, TraceTrait::GetTraceDescriptor(t)); - } - - /** - * Trace method for Member. - * - * \param member Member reference retaining an object. - */ - template - void Trace(const Member& member) { - const T* value = member.GetRawAtomic(); - CPPGC_DCHECK(value != kSentinelPointer); - Trace(value); - } - - /** - * Trace method for WeakMember. - * - * \param weak_member WeakMember reference weakly retaining an object. - */ - template - void Trace(const WeakMember& weak_member) { - static_assert(sizeof(T), "Pointee type must be fully defined."); - static_assert(internal::IsGarbageCollectedOrMixinType::value, - "T must be GarbageCollected or GarbageCollectedMixin type"); - static_assert(!internal::IsAllocatedOnCompactableSpace::value, - "Weak references to compactable objects are not allowed"); - - const T* value = weak_member.GetRawAtomic(); - - // Bailout assumes that WeakMember emits write barrier. - if (!value) { - return; - } - - CPPGC_DCHECK(value != kSentinelPointer); - VisitWeak(value, TraceTrait::GetTraceDescriptor(value), - &HandleWeak>, &weak_member); - } - - /** - * Trace method for inlined objects that are not allocated themselves but - * otherwise follow managed heap layout and have a Trace() method. - * - * \param object reference of the inlined object. - */ - template - void Trace(const T& object) { -#if V8_ENABLE_CHECKS - // This object is embedded in potentially multiple nested objects. The - // outermost object must not be in construction as such objects are (a) not - // processed immediately, and (b) only processed conservatively if not - // otherwise possible. - CheckObjectNotInConstruction(&object); -#endif // V8_ENABLE_CHECKS - TraceTrait::Trace(this, &object); - } - - /** - * Registers a weak callback method on the object of type T. See - * LivenessBroker for an usage example. - * - * \param object of type T specifying a weak callback method. - */ - template - void RegisterWeakCallbackMethod(const T* object) { - RegisterWeakCallback(&WeakCallbackMethodDelegate, object); - } - - /** - * Trace method for EphemeronPair. - * - * \param ephemeron_pair EphemeronPair reference weakly retaining a key object - * and strongly retaining a value object in case the key object is alive. - */ - template - void Trace(const EphemeronPair& ephemeron_pair) { - TraceEphemeron(ephemeron_pair.key, &ephemeron_pair.value); - RegisterWeakCallbackMethod, - &EphemeronPair::ClearValueIfKeyIsDead>( - &ephemeron_pair); - } - - /** - * Trace method for a single ephemeron. Used for tracing a raw ephemeron in - * which the `key` and `value` are kept separately. - * - * \param weak_member_key WeakMember reference weakly retaining a key object. - * \param member_value Member reference with ephemeron semantics. - */ - template - void TraceEphemeron(const WeakMember& weak_member_key, - const Member* member_value) { - const KeyType* key = weak_member_key.GetRawAtomic(); - if (!key) return; - - // `value` must always be non-null. - CPPGC_DCHECK(member_value); - const ValueType* value = member_value->GetRawAtomic(); - if (!value) return; - - // KeyType and ValueType may refer to GarbageCollectedMixin. - TraceDescriptor value_desc = - TraceTrait::GetTraceDescriptor(value); - CPPGC_DCHECK(value_desc.base_object_payload); - const void* key_base_object_payload = - TraceTrait::GetTraceDescriptor(key).base_object_payload; - CPPGC_DCHECK(key_base_object_payload); - - VisitEphemeron(key_base_object_payload, value, value_desc); - } - - /** - * Trace method for a single ephemeron. Used for tracing a raw ephemeron in - * which the `key` and `value` are kept separately. Note that this overload - * is for non-GarbageCollected `value`s that can be traced though. - * - * \param key `WeakMember` reference weakly retaining a key object. - * \param value Reference weakly retaining a value object. Note that - * `ValueType` here should not be `Member`. It is expected that - * `TraceTrait::GetTraceDescriptor(value)` returns a - * `TraceDescriptor` with a null base pointer but a valid trace method. - */ - template - void TraceEphemeron(const WeakMember& weak_member_key, - const ValueType* value) { - static_assert(!IsGarbageCollectedOrMixinTypeV, - "garbage-collected types must use WeakMember and Member"); - const KeyType* key = weak_member_key.GetRawAtomic(); - if (!key) return; - - // `value` must always be non-null. - CPPGC_DCHECK(value); - TraceDescriptor value_desc = - TraceTrait::GetTraceDescriptor(value); - // `value_desc.base_object_payload` must be null as this override is only - // taken for non-garbage-collected values. - CPPGC_DCHECK(!value_desc.base_object_payload); - - // KeyType might be a GarbageCollectedMixin. - const void* key_base_object_payload = - TraceTrait::GetTraceDescriptor(key).base_object_payload; - CPPGC_DCHECK(key_base_object_payload); - - VisitEphemeron(key_base_object_payload, value, value_desc); - } - - /** - * Trace method that strongifies a WeakMember. - * - * \param weak_member WeakMember reference retaining an object. - */ - template - void TraceStrongly(const WeakMember& weak_member) { - const T* value = weak_member.GetRawAtomic(); - CPPGC_DCHECK(value != kSentinelPointer); - Trace(value); - } - - /** - * Trace method for weak containers. - * - * \param object reference of the weak container. - * \param callback to be invoked. - * \param data custom data that is passed to the callback. - */ - template - void TraceWeakContainer(const T* object, WeakCallback callback, - const void* data) { - if (!object) return; - VisitWeakContainer(object, TraceTrait::GetTraceDescriptor(object), - TraceTrait::GetWeakTraceDescriptor(object), callback, - data); - } - - /** - * Registers a slot containing a reference to an object allocated on a - * compactable space. Such references maybe be arbitrarily moved by the GC. - * - * \param slot location of reference to object that might be moved by the GC. - */ - template - void RegisterMovableReference(const T** slot) { - static_assert(internal::IsAllocatedOnCompactableSpace::value, - "Only references to objects allocated on compactable spaces " - "should be registered as movable slots."); - static_assert(!IsGarbageCollectedMixinTypeV, - "Mixin types do not support compaction."); - HandleMovableReference(reinterpret_cast(slot)); - } - - /** - * Registers a weak callback that is invoked during garbage collection. - * - * \param callback to be invoked. - * \param data custom data that is passed to the callback. - */ - virtual void RegisterWeakCallback(WeakCallback callback, const void* data) {} - - /** - * Defers tracing an object from a concurrent thread to the mutator thread. - * Should be called by Trace methods of types that are not safe to trace - * concurrently. - * - * \param parameter tells the trace callback which object was deferred. - * \param callback to be invoked for tracing on the mutator thread. - * \param deferred_size size of deferred object. - * - * \returns false if the object does not need to be deferred (i.e. currently - * traced on the mutator thread) and true otherwise (i.e. currently traced on - * a concurrent thread). - */ - virtual V8_WARN_UNUSED_RESULT bool DeferTraceToMutatorThreadIfConcurrent( - const void* parameter, TraceCallback callback, size_t deferred_size) { - // By default tracing is not deferred. - return false; - } - - protected: - virtual void Visit(const void* self, TraceDescriptor) {} - virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback, - const void* weak_member) {} - virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {} - virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback, - const void* weak_root, const SourceLocation&) {} - virtual void VisitEphemeron(const void* key, const void* value, - TraceDescriptor value_desc) {} - virtual void VisitWeakContainer(const void* self, TraceDescriptor strong_desc, - TraceDescriptor weak_desc, - WeakCallback callback, const void* data) {} - virtual void HandleMovableReference(const void**) {} - - private: - template - static void WeakCallbackMethodDelegate(const LivenessBroker& info, - const void* self) { - // Callback is registered through a potential const Trace method but needs - // to be able to modify fields. See HandleWeak. - (const_cast(static_cast(self))->*method)(info); - } - - template - static void HandleWeak(const LivenessBroker& info, const void* object) { - const PointerType* weak = static_cast(object); - auto* raw_ptr = weak->GetFromGC(); - // Sentinel values are preserved for weak pointers. - if (raw_ptr == kSentinelPointer) return; - if (!info.IsHeapObjectAlive(raw_ptr)) { - weak->ClearFromGC(); - } - } - - template * = nullptr> - void TraceRoot(const Persistent& p, const SourceLocation& loc) { - using PointeeType = typename Persistent::PointeeType; - static_assert(sizeof(PointeeType), - "Persistent's pointee type must be fully defined"); - static_assert(internal::IsGarbageCollectedOrMixinType::value, - "Persistent's pointee type must be GarbageCollected or " - "GarbageCollectedMixin"); - auto* ptr = p.GetFromGC(); - if (!ptr) { - return; - } - VisitRoot(ptr, TraceTrait::GetTraceDescriptor(ptr), loc); - } - - template < - typename WeakPersistent, - std::enable_if_t* = nullptr> - void TraceRoot(const WeakPersistent& p, const SourceLocation& loc) { - using PointeeType = typename WeakPersistent::PointeeType; - static_assert(sizeof(PointeeType), - "Persistent's pointee type must be fully defined"); - static_assert(internal::IsGarbageCollectedOrMixinType::value, - "Persistent's pointee type must be GarbageCollected or " - "GarbageCollectedMixin"); - static_assert(!internal::IsAllocatedOnCompactableSpace::value, - "Weak references to compactable objects are not allowed"); - auto* ptr = p.GetFromGC(); - VisitWeakRoot(ptr, TraceTrait::GetTraceDescriptor(ptr), - &HandleWeak, &p, loc); - } - -#if V8_ENABLE_CHECKS - void CheckObjectNotInConstruction(const void* address); -#endif // V8_ENABLE_CHECKS - - template - friend class internal::BasicCrossThreadPersistent; - template - friend class internal::BasicPersistent; - friend class internal::ConservativeTracingVisitor; - friend class internal::VisitorBase; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_VISITOR_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.2.json b/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.2.json deleted file mode 100644 index aff68062..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.2.json +++ /dev/null @@ -1,997 +0,0 @@ -{ - "version": { "major": "1", "minor": "2" }, - "domains": [ - { - "domain": "Schema", - "description": "Provides information about the protocol schema.", - "types": [ - { - "id": "Domain", - "type": "object", - "description": "Description of the protocol domain.", - "exported": true, - "properties": [ - { "name": "name", "type": "string", "description": "Domain name." }, - { "name": "version", "type": "string", "description": "Domain version." } - ] - } - ], - "commands": [ - { - "name": "getDomains", - "description": "Returns supported domains.", - "handlers": ["browser", "renderer"], - "returns": [ - { "name": "domains", "type": "array", "items": { "$ref": "Domain" }, "description": "List of supported domains." } - ] - } - ] - }, - { - "domain": "Runtime", - "description": "Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.", - "types": [ - { - "id": "ScriptId", - "type": "string", - "description": "Unique script identifier." - }, - { - "id": "RemoteObjectId", - "type": "string", - "description": "Unique object identifier." - }, - { - "id": "UnserializableValue", - "type": "string", - "enum": ["Infinity", "NaN", "-Infinity", "-0"], - "description": "Primitive value which cannot be JSON-stringified." - }, - { - "id": "RemoteObject", - "type": "object", - "description": "Mirror object referencing original JavaScript object.", - "exported": true, - "properties": [ - { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error", "proxy", "promise", "typedarray"], "description": "Object subtype hint. Specified for object type values only." }, - { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for object type values only." }, - { "name": "value", "type": "any", "optional": true, "description": "Remote object value in case of primitive values or JSON values (if it was requested)." }, - { "name": "unserializableValue", "$ref": "UnserializableValue", "optional": true, "description": "Primitive value which can not be JSON-stringified does not have value, but gets this property." }, - { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, - { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." }, - { "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for object type values only.", "experimental": true }, - { "name": "customPreview", "$ref": "CustomPreview", "optional": true, "experimental": true} - ] - }, - { - "id": "CustomPreview", - "type": "object", - "experimental": true, - "properties": [ - { "name": "header", "type": "string"}, - { "name": "hasBody", "type": "boolean"}, - { "name": "formatterObjectId", "$ref": "RemoteObjectId"}, - { "name": "bindRemoteObjectFunctionId", "$ref": "RemoteObjectId" }, - { "name": "configObjectId", "$ref": "RemoteObjectId", "optional": true } - ] - }, - { - "id": "ObjectPreview", - "type": "object", - "experimental": true, - "description": "Object containing abbreviated remote object value.", - "properties": [ - { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for object type values only." }, - { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, - { "name": "overflow", "type": "boolean", "description": "True iff some of the properties or entries of the original object did not fit." }, - { "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "description": "List of the properties." }, - { "name": "entries", "type": "array", "items": { "$ref": "EntryPreview" }, "optional": true, "description": "List of the entries. Specified for map and set subtype values only." } - ] - }, - { - "id": "PropertyPreview", - "type": "object", - "experimental": true, - "properties": [ - { "name": "name", "type": "string", "description": "Property name." }, - { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor"], "description": "Object type. Accessor means that the property itself is an accessor property." }, - { "name": "value", "type": "string", "optional": true, "description": "User-friendly property value string." }, - { "name": "valuePreview", "$ref": "ObjectPreview", "optional": true, "description": "Nested value preview." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for object type values only." } - ] - }, - { - "id": "EntryPreview", - "type": "object", - "experimental": true, - "properties": [ - { "name": "key", "$ref": "ObjectPreview", "optional": true, "description": "Preview of the key. Specified for map-like collection entries." }, - { "name": "value", "$ref": "ObjectPreview", "description": "Preview of the value." } - ] - }, - { - "id": "PropertyDescriptor", - "type": "object", - "description": "Object property descriptor.", - "properties": [ - { "name": "name", "type": "string", "description": "Property name or symbol description." }, - { "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." }, - { "name": "writable", "type": "boolean", "optional": true, "description": "True if the value associated with the property may be changed (data descriptors only)." }, - { "name": "get", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only)." }, - { "name": "set", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only)." }, - { "name": "configurable", "type": "boolean", "description": "True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." }, - { "name": "enumerable", "type": "boolean", "description": "True if this property shows up during enumeration of the properties on the corresponding object." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, - { "name": "isOwn", "optional": true, "type": "boolean", "description": "True if the property is owned for the object." }, - { "name": "symbol", "$ref": "RemoteObject", "optional": true, "description": "Property symbol object, if the property is of the symbol type." } - ] - }, - { - "id": "InternalPropertyDescriptor", - "type": "object", - "description": "Object internal property descriptor. This property isn't normally visible in JavaScript code.", - "properties": [ - { "name": "name", "type": "string", "description": "Conventional property name." }, - { "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." } - ] - }, - { - "id": "CallArgument", - "type": "object", - "description": "Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified.", - "properties": [ - { "name": "value", "type": "any", "optional": true, "description": "Primitive value." }, - { "name": "unserializableValue", "$ref": "UnserializableValue", "optional": true, "description": "Primitive value which can not be JSON-stringified." }, - { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." } - ] - }, - { - "id": "ExecutionContextId", - "type": "integer", - "description": "Id of an execution context." - }, - { - "id": "ExecutionContextDescription", - "type": "object", - "description": "Description of an isolated world.", - "properties": [ - { "name": "id", "$ref": "ExecutionContextId", "description": "Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed." }, - { "name": "origin", "type": "string", "description": "Execution context origin." }, - { "name": "name", "type": "string", "description": "Human readable name describing given context." }, - { "name": "auxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data." } - ] - }, - { - "id": "ExceptionDetails", - "type": "object", - "description": "Detailed information about exception (or error) that was thrown during script compilation or execution.", - "properties": [ - { "name": "exceptionId", "type": "integer", "description": "Exception id." }, - { "name": "text", "type": "string", "description": "Exception text, which should be used together with exception object when available." }, - { "name": "lineNumber", "type": "integer", "description": "Line number of the exception location (0-based)." }, - { "name": "columnNumber", "type": "integer", "description": "Column number of the exception location (0-based)." }, - { "name": "scriptId", "$ref": "ScriptId", "optional": true, "description": "Script ID of the exception location." }, - { "name": "url", "type": "string", "optional": true, "description": "URL of the exception location, to be used when the script was not reported." }, - { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace if available." }, - { "name": "exception", "$ref": "RemoteObject", "optional": true, "description": "Exception object if available." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Identifier of the context where exception happened." } - ] - }, - { - "id": "Timestamp", - "type": "number", - "description": "Number of milliseconds since epoch." - }, - { - "id": "CallFrame", - "type": "object", - "description": "Stack entry for runtime errors and assertions.", - "properties": [ - { "name": "functionName", "type": "string", "description": "JavaScript function name." }, - { "name": "scriptId", "$ref": "ScriptId", "description": "JavaScript script id." }, - { "name": "url", "type": "string", "description": "JavaScript script name or url." }, - { "name": "lineNumber", "type": "integer", "description": "JavaScript script line number (0-based)." }, - { "name": "columnNumber", "type": "integer", "description": "JavaScript script column number (0-based)." } - ] - }, - { - "id": "StackTrace", - "type": "object", - "description": "Call frames for assertions or error messages.", - "exported": true, - "properties": [ - { "name": "description", "type": "string", "optional": true, "description": "String label of this stack trace. For async traces this may be a name of the function that initiated the async call." }, - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "JavaScript function name." }, - { "name": "parent", "$ref": "StackTrace", "optional": true, "description": "Asynchronous JavaScript stack trace that preceded this stack, if available." } - ] - } - ], - "commands": [ - { - "name": "evaluate", - "async": true, - "parameters": [ - { "name": "expression", "type": "string", "description": "Expression to evaluate." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, - { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "contextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, - { "name": "userGesture", "type": "boolean", "optional": true, "experimental": true, "description": "Whether execution should be treated as initiated by user in the UI." }, - { "name": "awaitPromise", "type": "boolean", "optional":true, "description": "Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Evaluates expression on global object." - }, - { - "name": "awaitPromise", - "async": true, - "parameters": [ - { "name": "promiseObjectId", "$ref": "RemoteObjectId", "description": "Identifier of the promise." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Promise result. Will contain rejected value if promise was rejected." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details if stack strace is available."} - ], - "description": "Add handler to promise with given promise object id." - }, - { - "name": "callFunctionOn", - "async": true, - "parameters": [ - { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to call function on." }, - { "name": "functionDeclaration", "type": "string", "description": "Declaration of the function to call." }, - { "name": "arguments", "type": "array", "items": { "$ref": "CallArgument", "description": "Call argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same JavaScript world as the target object." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, - { "name": "userGesture", "type": "boolean", "optional": true, "experimental": true, "description": "Whether execution should be treated as initiated by user in the UI." }, - { "name": "awaitPromise", "type": "boolean", "optional":true, "description": "Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Call result." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Calls function with given declaration on the given object. Object group of the result is inherited from the target object." - }, - { - "name": "getProperties", - "parameters": [ - { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." }, - { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." }, - { "name": "accessorPropertiesOnly", "optional": true, "type": "boolean", "description": "If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.", "experimental": true }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the results." } - ], - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor" }, "description": "Object properties." }, - { "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor" }, "description": "Internal object properties (only of the element itself)." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Returns properties of a given object. Object group of the result is inherited from the target object." - }, - { - "name": "releaseObject", - "parameters": [ - { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to release." } - ], - "description": "Releases remote object with given id." - }, - { - "name": "releaseObjectGroup", - "parameters": [ - { "name": "objectGroup", "type": "string", "description": "Symbolic object group name." } - ], - "description": "Releases all remote objects that belong to a given group." - }, - { - "name": "runIfWaitingForDebugger", - "description": "Tells inspected instance to run if it was waiting for debugger to attach." - }, - { - "name": "enable", - "description": "Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context." - }, - { - "name": "disable", - "description": "Disables reporting of execution contexts creation." - }, - { - "name": "discardConsoleEntries", - "description": "Discards collected exceptions and console API calls." - }, - { - "name": "setCustomObjectFormatterEnabled", - "parameters": [ - { - "name": "enabled", - "type": "boolean" - } - ], - "experimental": true - }, - { - "name": "compileScript", - "parameters": [ - { "name": "expression", "type": "string", "description": "Expression to compile." }, - { "name": "sourceURL", "type": "string", "description": "Source url to be set for the script." }, - { "name": "persistScript", "type": "boolean", "description": "Specifies whether the compiled script should be persisted." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page." } - ], - "returns": [ - { "name": "scriptId", "$ref": "ScriptId", "optional": true, "description": "Id of the script." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Compiles expression." - }, - { - "name": "runScript", - "async": true, - "parameters": [ - { "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to run." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." }, - { "name": "awaitPromise", "type": "boolean", "optional": true, "description": "Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Run result." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Runs script with given id in a given context." - } - ], - "events": [ - { - "name": "executionContextCreated", - "parameters": [ - { "name": "context", "$ref": "ExecutionContextDescription", "description": "A newly created execution contex." } - ], - "description": "Issued when new execution context is created." - }, - { - "name": "executionContextDestroyed", - "parameters": [ - { "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Id of the destroyed context" } - ], - "description": "Issued when execution context is destroyed." - }, - { - "name": "executionContextsCleared", - "description": "Issued when all executionContexts were cleared in browser" - }, - { - "name": "exceptionThrown", - "description": "Issued when exception was thrown and unhandled.", - "parameters": [ - { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp of the exception." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails" } - ] - }, - { - "name": "exceptionRevoked", - "description": "Issued when unhandled exception was revoked.", - "parameters": [ - { "name": "reason", "type": "string", "description": "Reason describing why exception was revoked." }, - { "name": "exceptionId", "type": "integer", "description": "The id of revoked exception, as reported in exceptionUnhandled." } - ] - }, - { - "name": "consoleAPICalled", - "description": "Issued when console API was called.", - "parameters": [ - { "name": "type", "type": "string", "enum": ["log", "debug", "info", "error", "warning", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "profile", "profileEnd"], "description": "Type of the call." }, - { "name": "args", "type": "array", "items": { "$ref": "RemoteObject" }, "description": "Call arguments." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Identifier of the context where the call was made." }, - { "name": "timestamp", "$ref": "Timestamp", "description": "Call timestamp." }, - { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "Stack trace captured when the call was made." } - ] - }, - { - "name": "inspectRequested", - "description": "Issued when object should be inspected (for example, as a result of inspect() command line API call).", - "parameters": [ - { "name": "object", "$ref": "RemoteObject" }, - { "name": "hints", "type": "object" } - ] - } - ] - }, - { - "domain": "Debugger", - "description": "Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.", - "dependencies": ["Runtime"], - "types": [ - { - "id": "BreakpointId", - "type": "string", - "description": "Breakpoint identifier." - }, - { - "id": "CallFrameId", - "type": "string", - "description": "Call frame identifier." - }, - { - "id": "Location", - "type": "object", - "properties": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the Debugger.scriptParsed." }, - { "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." }, - { "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." } - ], - "description": "Location in the source code." - }, - { - "id": "ScriptPosition", - "experimental": true, - "type": "object", - "properties": [ - { "name": "lineNumber", "type": "integer" }, - { "name": "columnNumber", "type": "integer" } - ], - "description": "Location in the source code." - }, - { - "id": "CallFrame", - "type": "object", - "properties": [ - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier. This identifier is only valid while the virtual machine is paused." }, - { "name": "functionName", "type": "string", "description": "Name of the JavaScript function called on this call frame." }, - { "name": "functionLocation", "$ref": "Location", "optional": true, "experimental": true, "description": "Location in the source code." }, - { "name": "location", "$ref": "Location", "description": "Location in the source code." }, - { "name": "scopeChain", "type": "array", "items": { "$ref": "Scope" }, "description": "Scope chain for this call frame." }, - { "name": "this", "$ref": "Runtime.RemoteObject", "description": "this object for this call frame." }, - { "name": "returnValue", "$ref": "Runtime.RemoteObject", "optional": true, "description": "The value being returned, if the function is at return point." } - ], - "description": "JavaScript call frame. Array of call frames form the call stack." - }, - { - "id": "Scope", - "type": "object", - "properties": [ - { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "block", "script"], "description": "Scope type." }, - { "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." }, - { "name": "name", "type": "string", "optional": true }, - { "name": "startLocation", "$ref": "Location", "optional": true, "description": "Location in the source code where scope starts" }, - { "name": "endLocation", "$ref": "Location", "optional": true, "description": "Location in the source code where scope ends" } - ], - "description": "Scope description." - }, - { - "id": "SearchMatch", - "type": "object", - "description": "Search match for resource.", - "exported": true, - "properties": [ - { "name": "lineNumber", "type": "number", "description": "Line number in resource content." }, - { "name": "lineContent", "type": "string", "description": "Line with match content." } - ], - "experimental": true - } - ], - "commands": [ - { - "name": "enable", - "description": "Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received." - }, - { - "name": "disable", - "description": "Disables debugger for given page." - }, - { - "name": "setBreakpointsActive", - "parameters": [ - { "name": "active", "type": "boolean", "description": "New value for breakpoints active state." } - ], - "description": "Activates / deactivates all breakpoints on the page." - }, - { - "name": "setSkipAllPauses", - "parameters": [ - { "name": "skip", "type": "boolean", "description": "New value for skip pauses state." } - ], - "description": "Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc)." - }, - { - "name": "setBreakpointByUrl", - "parameters": [ - { "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." }, - { "name": "url", "type": "string", "optional": true, "description": "URL of the resources to set breakpoint on." }, - { "name": "urlRegex", "type": "string", "optional": true, "description": "Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified." }, - { "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." }, - { "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." } - ], - "returns": [ - { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, - { "name": "locations", "type": "array", "items": { "$ref": "Location" }, "description": "List of the locations this breakpoint resolved into upon addition." } - ], - "description": "Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads." - }, - { - "name": "setBreakpoint", - "parameters": [ - { "name": "location", "$ref": "Location", "description": "Location to set breakpoint in." }, - { "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." } - ], - "returns": [ - { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, - { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." } - ], - "description": "Sets JavaScript breakpoint at a given location." - }, - { - "name": "removeBreakpoint", - "parameters": [ - { "name": "breakpointId", "$ref": "BreakpointId" } - ], - "description": "Removes JavaScript breakpoint." - }, - { - "name": "continueToLocation", - "parameters": [ - { "name": "location", "$ref": "Location", "description": "Location to continue to." } - ], - "description": "Continues execution until specific location is reached." - }, - { - "name": "stepOver", - "description": "Steps over the statement." - }, - { - "name": "stepInto", - "description": "Steps into the function call." - }, - { - "name": "stepOut", - "description": "Steps out of the function call." - }, - { - "name": "pause", - "description": "Stops on the next JavaScript statement." - }, - { - "name": "resume", - "description": "Resumes JavaScript execution." - }, - { - "name": "searchInContent", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to search in." }, - { "name": "query", "type": "string", "description": "String to search for." }, - { "name": "caseSensitive", "type": "boolean", "optional": true, "description": "If true, search is case sensitive." }, - { "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, treats string parameter as regex." } - ], - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "SearchMatch" }, "description": "List of search matches." } - ], - "experimental": true, - "description": "Searches for given string in script content." - }, - { - "name": "setScriptSource", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to edit." }, - { "name": "scriptSource", "type": "string", "description": "New content of the script." }, - { "name": "dryRun", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code." } - ], - "returns": [ - { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame" }, "description": "New stack trace in case editing has happened while VM was stopped." }, - { "name": "stackChanged", "type": "boolean", "optional": true, "description": "Whether current call stack was modified after applying the changes." }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." }, - { "name": "exceptionDetails", "optional": true, "$ref": "Runtime.ExceptionDetails", "description": "Exception details if any." } - ], - "description": "Edits JavaScript source live." - }, - { - "name": "restartFrame", - "parameters": [ - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." } - ], - "returns": [ - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "New stack trace." }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." } - ], - "description": "Restarts particular call frame from the beginning." - }, - { - "name": "getScriptSource", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." } - ], - "returns": [ - { "name": "scriptSource", "type": "string", "description": "Script source." } - ], - "description": "Returns source for the script with given id." - }, - { - "name": "setPauseOnExceptions", - "parameters": [ - { "name": "state", "type": "string", "enum": ["none", "uncaught", "all"], "description": "Pause on exceptions mode." } - ], - "description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none." - }, - { - "name": "evaluateOnCallFrame", - "parameters": [ - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." }, - { "name": "expression", "type": "string", "description": "Expression to evaluate." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup)." }, - { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." } - ], - "returns": [ - { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." }, - { "name": "exceptionDetails", "$ref": "Runtime.ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Evaluates expression on a given call frame." - }, - { - "name": "setVariableValue", - "parameters": [ - { "name": "scopeNumber", "type": "integer", "description": "0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually." }, - { "name": "variableName", "type": "string", "description": "Variable name." }, - { "name": "newValue", "$ref": "Runtime.CallArgument", "description": "New variable value." }, - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Id of callframe that holds variable." } - ], - "description": "Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually." - }, - { - "name": "setAsyncCallStackDepth", - "parameters": [ - { "name": "maxDepth", "type": "integer", "description": "Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default)." } - ], - "description": "Enables or disables async call stacks tracking." - }, - { - "name": "setBlackboxPatterns", - "parameters": [ - { "name": "patterns", "type": "array", "items": { "type": "string" }, "description": "Array of regexps that will be used to check script url for blackbox state." } - ], - "experimental": true, - "description": "Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful." - }, - { - "name": "setBlackboxedRanges", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script." }, - { "name": "positions", "type": "array", "items": { "$ref": "ScriptPosition" } } - ], - "experimental": true, - "description": "Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted." - } - ], - "events": [ - { - "name": "scriptParsed", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Identifier of the script parsed." }, - { "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." }, - { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, - { "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, - { "name": "endLine", "type": "integer", "description": "Last line of the script." }, - { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, - { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context." }, - { "name": "hash", "type": "string", "description": "Content hash of the script."}, - { "name": "executionContextAuxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data." }, - { "name": "isLiveEdit", "type": "boolean", "optional": true, "description": "True, if this script is generated as a result of the live edit operation.", "experimental": true }, - { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "experimental": true } - ], - "description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger." - }, - { - "name": "scriptFailedToParse", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Identifier of the script parsed." }, - { "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." }, - { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, - { "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, - { "name": "endLine", "type": "integer", "description": "Last line of the script." }, - { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, - { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context." }, - { "name": "hash", "type": "string", "description": "Content hash of the script."}, - { "name": "executionContextAuxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data." }, - { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "experimental": true } - ], - "description": "Fired when virtual machine fails to parse the script." - }, - { - "name": "breakpointResolved", - "parameters": [ - { "name": "breakpointId", "$ref": "BreakpointId", "description": "Breakpoint unique identifier." }, - { "name": "location", "$ref": "Location", "description": "Actual breakpoint location." } - ], - "description": "Fired when breakpoint is resolved to an actual script and location." - }, - { - "name": "paused", - "parameters": [ - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, - { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "debugCommand", "promiseRejection", "other" ], "description": "Pause reason.", "exported": true }, - { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." }, - { "name": "hitBreakpoints", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Hit breakpoints IDs" }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." } - ], - "description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria." - }, - { - "name": "resumed", - "description": "Fired when the virtual machine resumed execution." - } - ] - }, - { - "domain": "Console", - "description": "This domain is deprecated - use Runtime or Log instead.", - "dependencies": ["Runtime"], - "deprecated": true, - "types": [ - { - "id": "ConsoleMessage", - "type": "object", - "description": "Console message.", - "properties": [ - { "name": "source", "type": "string", "enum": ["xml", "javascript", "network", "console-api", "storage", "appcache", "rendering", "security", "other", "deprecation", "worker"], "description": "Message source." }, - { "name": "level", "type": "string", "enum": ["log", "warning", "error", "debug", "info"], "description": "Message severity." }, - { "name": "text", "type": "string", "description": "Message text." }, - { "name": "url", "type": "string", "optional": true, "description": "URL of the message origin." }, - { "name": "line", "type": "integer", "optional": true, "description": "Line number in the resource that generated this message (1-based)." }, - { "name": "column", "type": "integer", "optional": true, "description": "Column number in the resource that generated this message (1-based)." } - ] - } - ], - "commands": [ - { - "name": "enable", - "description": "Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification." - }, - { - "name": "disable", - "description": "Disables console domain, prevents further console messages from being reported to the client." - }, - { - "name": "clearMessages", - "description": "Does nothing." - } - ], - "events": [ - { - "name": "messageAdded", - "parameters": [ - { "name": "message", "$ref": "ConsoleMessage", "description": "Console message that has been added." } - ], - "description": "Issued when new console message is added." - } - ] - }, - { - "domain": "Profiler", - "dependencies": ["Runtime", "Debugger"], - "types": [ - { - "id": "ProfileNode", - "type": "object", - "description": "Profile node. Holds callsite information, execution statistics and child nodes.", - "properties": [ - { "name": "id", "type": "integer", "description": "Unique id of the node." }, - { "name": "callFrame", "$ref": "Runtime.CallFrame", "description": "Function location." }, - { "name": "hitCount", "type": "integer", "optional": true, "experimental": true, "description": "Number of samples where this node was on top of the call stack." }, - { "name": "children", "type": "array", "items": { "type": "integer" }, "optional": true, "description": "Child node ids." }, - { "name": "deoptReason", "type": "string", "optional": true, "description": "The reason of being not optimized. The function may be deoptimized or marked as don't optimize."}, - { "name": "positionTicks", "type": "array", "items": { "$ref": "PositionTickInfo" }, "optional": true, "experimental": true, "description": "An array of source position ticks." } - ] - }, - { - "id": "Profile", - "type": "object", - "description": "Profile.", - "properties": [ - { "name": "nodes", "type": "array", "items": { "$ref": "ProfileNode" }, "description": "The list of profile nodes. First item is the root node." }, - { "name": "startTime", "type": "number", "description": "Profiling start timestamp in microseconds." }, - { "name": "endTime", "type": "number", "description": "Profiling end timestamp in microseconds." }, - { "name": "samples", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Ids of samples top nodes." }, - { "name": "timeDeltas", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime." } - ] - }, - { - "id": "PositionTickInfo", - "type": "object", - "experimental": true, - "description": "Specifies a number of samples attributed to a certain source position.", - "properties": [ - { "name": "line", "type": "integer", "description": "Source line number (1-based)." }, - { "name": "ticks", "type": "integer", "description": "Number of samples attributed to the source line." } - ] - } - ], - "commands": [ - { - "name": "enable" - }, - { - "name": "disable" - }, - { - "name": "setSamplingInterval", - "parameters": [ - { "name": "interval", "type": "integer", "description": "New sampling interval in microseconds." } - ], - "description": "Changes CPU profiler sampling interval. Must be called before CPU profiles recording started." - }, - { - "name": "start" - }, - { - "name": "stop", - "returns": [ - { "name": "profile", "$ref": "Profile", "description": "Recorded profile." } - ] - } - ], - "events": [ - { - "name": "consoleProfileStarted", - "parameters": [ - { "name": "id", "type": "string" }, - { "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profile()." }, - { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as an argument to console.profile()." } - ], - "description": "Sent when new profile recodring is started using console.profile() call." - }, - { - "name": "consoleProfileFinished", - "parameters": [ - { "name": "id", "type": "string" }, - { "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profileEnd()." }, - { "name": "profile", "$ref": "Profile" }, - { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as an argument to console.profile()." } - ] - } - ] - }, - { - "domain": "HeapProfiler", - "dependencies": ["Runtime"], - "experimental": true, - "types": [ - { - "id": "HeapSnapshotObjectId", - "type": "string", - "description": "Heap snapshot object id." - }, - { - "id": "SamplingHeapProfileNode", - "type": "object", - "description": "Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.", - "properties": [ - { "name": "callFrame", "$ref": "Runtime.CallFrame", "description": "Function location." }, - { "name": "selfSize", "type": "number", "description": "Allocations size in bytes for the node excluding children." }, - { "name": "children", "type": "array", "items": { "$ref": "SamplingHeapProfileNode" }, "description": "Child nodes." } - ] - }, - { - "id": "SamplingHeapProfile", - "type": "object", - "description": "Profile.", - "properties": [ - { "name": "head", "$ref": "SamplingHeapProfileNode" } - ] - } - ], - "commands": [ - { - "name": "enable" - }, - { - "name": "disable" - }, - { - "name": "startTrackingHeapObjects", - "parameters": [ - { "name": "trackAllocations", "type": "boolean", "optional": true } - ] - }, - { - "name": "stopTrackingHeapObjects", - "parameters": [ - { "name": "reportProgress", "type": "boolean", "optional": true, "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped." } - ] - }, - { - "name": "takeHeapSnapshot", - "parameters": [ - { "name": "reportProgress", "type": "boolean", "optional": true, "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken." } - ] - }, - { - "name": "collectGarbage" - }, - { - "name": "getObjectByHeapObjectId", - "parameters": [ - { "name": "objectId", "$ref": "HeapSnapshotObjectId" }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } - ], - "returns": [ - { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Evaluation result." } - ] - }, - { - "name": "addInspectedHeapObject", - "parameters": [ - { "name": "heapObjectId", "$ref": "HeapSnapshotObjectId", "description": "Heap snapshot object id to be accessible by means of $x command line API." } - ], - "description": "Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions)." - }, - { - "name": "getHeapObjectId", - "parameters": [ - { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Identifier of the object to get heap object id for." } - ], - "returns": [ - { "name": "heapSnapshotObjectId", "$ref": "HeapSnapshotObjectId", "description": "Id of the heap snapshot object corresponding to the passed remote object id." } - ] - }, - { - "name": "startSampling", - "parameters": [ - { "name": "samplingInterval", "type": "number", "optional": true, "description": "Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes." } - ] - }, - { - "name": "stopSampling", - "returns": [ - { "name": "profile", "$ref": "SamplingHeapProfile", "description": "Recorded sampling heap profile." } - ] - } - ], - "events": [ - { - "name": "addHeapSnapshotChunk", - "parameters": [ - { "name": "chunk", "type": "string" } - ] - }, - { - "name": "resetProfiles" - }, - { - "name": "reportHeapSnapshotProgress", - "parameters": [ - { "name": "done", "type": "integer" }, - { "name": "total", "type": "integer" }, - { "name": "finished", "type": "boolean", "optional": true } - ] - }, - { - "name": "lastSeenObjectId", - "description": "If heap objects tracking has been started then backend regulary sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.", - "parameters": [ - { "name": "lastSeenObjectId", "type": "integer" }, - { "name": "timestamp", "type": "number" } - ] - }, - { - "name": "heapStatsUpdate", - "description": "If heap objects tracking has been started then backend may send update for one or more fragments", - "parameters": [ - { "name": "statsUpdate", "type": "array", "items": { "type": "integer" }, "description": "An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment."} - ] - } - ] - }] -} diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.3.json b/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.3.json deleted file mode 100644 index ea573d11..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol-1.3.json +++ /dev/null @@ -1,1205 +0,0 @@ -{ - "version": { "major": "1", "minor": "3" }, - "domains": [ - { - "domain": "Schema", - "description": "This domain is deprecated.", - "deprecated": true, - "types": [ - { - "id": "Domain", - "type": "object", - "description": "Description of the protocol domain.", - "properties": [ - { "name": "name", "type": "string", "description": "Domain name." }, - { "name": "version", "type": "string", "description": "Domain version." } - ] - } - ], - "commands": [ - { - "name": "getDomains", - "description": "Returns supported domains.", - "handlers": ["browser", "renderer"], - "returns": [ - { "name": "domains", "type": "array", "items": { "$ref": "Domain" }, "description": "List of supported domains." } - ] - } - ] - }, - { - "domain": "Runtime", - "description": "Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.", - "types": [ - { - "id": "ScriptId", - "type": "string", - "description": "Unique script identifier." - }, - { - "id": "RemoteObjectId", - "type": "string", - "description": "Unique object identifier." - }, - { - "id": "UnserializableValue", - "type": "string", - "enum": ["Infinity", "NaN", "-Infinity", "-0"], - "description": "Primitive value which cannot be JSON-stringified." - }, - { - "id": "RemoteObject", - "type": "object", - "description": "Mirror object referencing original JavaScript object.", - "properties": [ - { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "weakmap", "weakset", "iterator", "generator", "error", "proxy", "promise", "typedarray"], "description": "Object subtype hint. Specified for object type values only." }, - { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for object type values only." }, - { "name": "value", "type": "any", "optional": true, "description": "Remote object value in case of primitive values or JSON values (if it was requested)." }, - { "name": "unserializableValue", "$ref": "UnserializableValue", "optional": true, "description": "Primitive value which can not be JSON-stringified does not have value, but gets this property." }, - { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, - { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." }, - { "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for object type values only.", "experimental": true }, - { "name": "customPreview", "$ref": "CustomPreview", "optional": true, "experimental": true} - ] - }, - { - "id": "CustomPreview", - "type": "object", - "experimental": true, - "properties": [ - { "name": "header", "type": "string"}, - { "name": "hasBody", "type": "boolean"}, - { "name": "formatterObjectId", "$ref": "RemoteObjectId"}, - { "name": "bindRemoteObjectFunctionId", "$ref": "RemoteObjectId" }, - { "name": "configObjectId", "$ref": "RemoteObjectId", "optional": true } - ] - }, - { - "id": "ObjectPreview", - "type": "object", - "experimental": true, - "description": "Object containing abbreviated remote object value.", - "properties": [ - { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "weakmap", "weakset", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for object type values only." }, - { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, - { "name": "overflow", "type": "boolean", "description": "True iff some of the properties or entries of the original object did not fit." }, - { "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "description": "List of the properties." }, - { "name": "entries", "type": "array", "items": { "$ref": "EntryPreview" }, "optional": true, "description": "List of the entries. Specified for map and set subtype values only." } - ] - }, - { - "id": "PropertyPreview", - "type": "object", - "experimental": true, - "properties": [ - { "name": "name", "type": "string", "description": "Property name." }, - { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor"], "description": "Object type. Accessor means that the property itself is an accessor property." }, - { "name": "value", "type": "string", "optional": true, "description": "User-friendly property value string." }, - { "name": "valuePreview", "$ref": "ObjectPreview", "optional": true, "description": "Nested value preview." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "weakmap", "weakset", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for object type values only." } - ] - }, - { - "id": "EntryPreview", - "type": "object", - "experimental": true, - "properties": [ - { "name": "key", "$ref": "ObjectPreview", "optional": true, "description": "Preview of the key. Specified for map-like collection entries." }, - { "name": "value", "$ref": "ObjectPreview", "description": "Preview of the value." } - ] - }, - { - "id": "PropertyDescriptor", - "type": "object", - "description": "Object property descriptor.", - "properties": [ - { "name": "name", "type": "string", "description": "Property name or symbol description." }, - { "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." }, - { "name": "writable", "type": "boolean", "optional": true, "description": "True if the value associated with the property may be changed (data descriptors only)." }, - { "name": "get", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only)." }, - { "name": "set", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only)." }, - { "name": "configurable", "type": "boolean", "description": "True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." }, - { "name": "enumerable", "type": "boolean", "description": "True if this property shows up during enumeration of the properties on the corresponding object." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, - { "name": "isOwn", "optional": true, "type": "boolean", "description": "True if the property is owned for the object." }, - { "name": "symbol", "$ref": "RemoteObject", "optional": true, "description": "Property symbol object, if the property is of the symbol type." } - ] - }, - { - "id": "InternalPropertyDescriptor", - "type": "object", - "description": "Object internal property descriptor. This property isn't normally visible in JavaScript code.", - "properties": [ - { "name": "name", "type": "string", "description": "Conventional property name." }, - { "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." } - ] - }, - { - "id": "CallArgument", - "type": "object", - "description": "Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified.", - "properties": [ - { "name": "value", "type": "any", "optional": true, "description": "Primitive value or serializable javascript object." }, - { "name": "unserializableValue", "$ref": "UnserializableValue", "optional": true, "description": "Primitive value which can not be JSON-stringified." }, - { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." } - ] - }, - { - "id": "ExecutionContextId", - "type": "integer", - "description": "Id of an execution context." - }, - { - "id": "ExecutionContextDescription", - "type": "object", - "description": "Description of an isolated world.", - "properties": [ - { "name": "id", "$ref": "ExecutionContextId", "description": "Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed." }, - { "name": "origin", "type": "string", "description": "Execution context origin." }, - { "name": "name", "type": "string", "description": "Human readable name describing given context." }, - { "name": "auxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data." } - ] - }, - { - "id": "ExceptionDetails", - "type": "object", - "description": "Detailed information about exception (or error) that was thrown during script compilation or execution.", - "properties": [ - { "name": "exceptionId", "type": "integer", "description": "Exception id." }, - { "name": "text", "type": "string", "description": "Exception text, which should be used together with exception object when available." }, - { "name": "lineNumber", "type": "integer", "description": "Line number of the exception location (0-based)." }, - { "name": "columnNumber", "type": "integer", "description": "Column number of the exception location (0-based)." }, - { "name": "scriptId", "$ref": "ScriptId", "optional": true, "description": "Script ID of the exception location." }, - { "name": "url", "type": "string", "optional": true, "description": "URL of the exception location, to be used when the script was not reported." }, - { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace if available." }, - { "name": "exception", "$ref": "RemoteObject", "optional": true, "description": "Exception object if available." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Identifier of the context where exception happened." } - ] - }, - { - "id": "Timestamp", - "type": "number", - "description": "Number of milliseconds since epoch." - }, - { - "id": "CallFrame", - "type": "object", - "description": "Stack entry for runtime errors and assertions.", - "properties": [ - { "name": "functionName", "type": "string", "description": "JavaScript function name." }, - { "name": "scriptId", "$ref": "ScriptId", "description": "JavaScript script id." }, - { "name": "url", "type": "string", "description": "JavaScript script name or url." }, - { "name": "lineNumber", "type": "integer", "description": "JavaScript script line number (0-based)." }, - { "name": "columnNumber", "type": "integer", "description": "JavaScript script column number (0-based)." } - ] - }, - { - "id": "StackTrace", - "type": "object", - "description": "Call frames for assertions or error messages.", - "properties": [ - { "name": "description", "type": "string", "optional": true, "description": "String label of this stack trace. For async traces this may be a name of the function that initiated the async call." }, - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "JavaScript function name." }, - { "name": "parent", "$ref": "StackTrace", "optional": true, "description": "Asynchronous JavaScript stack trace that preceded this stack, if available." }, - { "name": "parentId", "$ref": "StackTraceId", "optional": true, "experimental": true, "description": "Asynchronous JavaScript stack trace that preceded this stack, if available." } - ] - }, - { - "id": "UniqueDebuggerId", - "type": "string", - "description": "Unique identifier of current debugger.", - "experimental": true - }, - { - "id": "StackTraceId", - "type": "object", - "description": "If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages.", - "properties": [ - { "name": "id", "type": "string" }, - { "name": "debuggerId", "$ref": "UniqueDebuggerId", "optional": true } - ], - "experimental": true - } - ], - "commands": [ - { - "name": "evaluate", - "parameters": [ - { "name": "expression", "type": "string", "description": "Expression to evaluate." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, - { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "contextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, - { "name": "userGesture", "type": "boolean", "optional": true, "description": "Whether execution should be treated as initiated by user in the UI." }, - { "name": "awaitPromise", "type": "boolean", "optional":true, "description": "Whether execution should await for resulting value and return once awaited promise is resolved." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Evaluates expression on global object." - }, - { - "name": "awaitPromise", - "parameters": [ - { "name": "promiseObjectId", "$ref": "RemoteObjectId", "description": "Identifier of the promise." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Promise result. Will contain rejected value if promise was rejected." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details if stack strace is available."} - ], - "description": "Add handler to promise with given promise object id." - }, - { - "name": "callFunctionOn", - "parameters": [ - { "name": "functionDeclaration", "type": "string", "description": "Declaration of the function to call." }, - { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Identifier of the object to call function on. Either objectId or executionContextId should be specified." }, - { "name": "arguments", "type": "array", "items": { "$ref": "CallArgument", "description": "Call argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same JavaScript world as the target object." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, - { "name": "userGesture", "type": "boolean", "optional": true, "description": "Whether execution should be treated as initiated by user in the UI." }, - { "name": "awaitPromise", "type": "boolean", "optional":true, "description": "Whether execution should await for resulting value and return once awaited promise is resolved." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Call result." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Calls function with given declaration on the given object. Object group of the result is inherited from the target object." - }, - { - "name": "getProperties", - "parameters": [ - { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." }, - { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." }, - { "name": "accessorPropertiesOnly", "optional": true, "type": "boolean", "description": "If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.", "experimental": true }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the results." } - ], - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor" }, "description": "Object properties." }, - { "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor" }, "description": "Internal object properties (only of the element itself)." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Returns properties of a given object. Object group of the result is inherited from the target object." - }, - { - "name": "releaseObject", - "parameters": [ - { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to release." } - ], - "description": "Releases remote object with given id." - }, - { - "name": "releaseObjectGroup", - "parameters": [ - { "name": "objectGroup", "type": "string", "description": "Symbolic object group name." } - ], - "description": "Releases all remote objects that belong to a given group." - }, - { - "name": "runIfWaitingForDebugger", - "description": "Tells inspected instance to run if it was waiting for debugger to attach." - }, - { - "name": "enable", - "description": "Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context." - }, - { - "name": "disable", - "description": "Disables reporting of execution contexts creation." - }, - { - "name": "discardConsoleEntries", - "description": "Discards collected exceptions and console API calls." - }, - { - "name": "setCustomObjectFormatterEnabled", - "parameters": [ - { - "name": "enabled", - "type": "boolean" - } - ], - "experimental": true - }, - { - "name": "compileScript", - "parameters": [ - { "name": "expression", "type": "string", "description": "Expression to compile." }, - { "name": "sourceURL", "type": "string", "description": "Source url to be set for the script." }, - { "name": "persistScript", "type": "boolean", "description": "Specifies whether the compiled script should be persisted." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page." } - ], - "returns": [ - { "name": "scriptId", "$ref": "ScriptId", "optional": true, "description": "Id of the script." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Compiles expression." - }, - { - "name": "runScript", - "parameters": [ - { "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to run." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." }, - { "name": "awaitPromise", "type": "boolean", "optional": true, "description": "Whether execution should await for resulting value and return once awaited promise is resolved." } - ], - "returns": [ - { "name": "result", "$ref": "RemoteObject", "description": "Run result." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Runs script with given id in a given context." - }, - { - "name": "queryObjects", - "parameters": [ - { "name": "prototypeObjectId", "$ref": "RemoteObjectId", "description": "Identifier of the prototype to return objects for." } - ], - "returns": [ - { "name": "objects", "$ref": "RemoteObject", "description": "Array with objects." } - ] - }, - { - "name": "globalLexicalScopeNames", - "parameters": [ - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to lookup global scope variables." } - ], - "returns": [ - { "name": "names", "type": "array", "items": { "type": "string" } } - ], - "description": "Returns all let, const and class variables from global scope." - } - ], - "events": [ - { - "name": "executionContextCreated", - "parameters": [ - { "name": "context", "$ref": "ExecutionContextDescription", "description": "A newly created execution context." } - ], - "description": "Issued when new execution context is created." - }, - { - "name": "executionContextDestroyed", - "parameters": [ - { "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Id of the destroyed context" } - ], - "description": "Issued when execution context is destroyed." - }, - { - "name": "executionContextsCleared", - "description": "Issued when all executionContexts were cleared in browser" - }, - { - "name": "exceptionThrown", - "description": "Issued when exception was thrown and unhandled.", - "parameters": [ - { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp of the exception." }, - { "name": "exceptionDetails", "$ref": "ExceptionDetails" } - ] - }, - { - "name": "exceptionRevoked", - "description": "Issued when unhandled exception was revoked.", - "parameters": [ - { "name": "reason", "type": "string", "description": "Reason describing why exception was revoked." }, - { "name": "exceptionId", "type": "integer", "description": "The id of revoked exception, as reported in exceptionThrown." } - ] - }, - { - "name": "consoleAPICalled", - "description": "Issued when console API was called.", - "parameters": [ - { "name": "type", "type": "string", "enum": ["log", "debug", "info", "error", "warning", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "profile", "profileEnd", "count", "timeEnd"], "description": "Type of the call." }, - { "name": "args", "type": "array", "items": { "$ref": "RemoteObject" }, "description": "Call arguments." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Identifier of the context where the call was made." }, - { "name": "timestamp", "$ref": "Timestamp", "description": "Call timestamp." }, - { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "Stack trace captured when the call was made." }, - { "name": "context", "type": "string", "optional": true, "experimental": true, "description": "Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context." } - ] - }, - { - "name": "inspectRequested", - "description": "Issued when object should be inspected (for example, as a result of inspect() command line API call).", - "parameters": [ - { "name": "object", "$ref": "RemoteObject" }, - { "name": "hints", "type": "object" } - ] - } - ] - }, - { - "domain": "Debugger", - "description": "Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.", - "dependencies": ["Runtime"], - "types": [ - { - "id": "BreakpointId", - "type": "string", - "description": "Breakpoint identifier." - }, - { - "id": "CallFrameId", - "type": "string", - "description": "Call frame identifier." - }, - { - "id": "Location", - "type": "object", - "properties": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the Debugger.scriptParsed." }, - { "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." }, - { "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." } - ], - "description": "Location in the source code." - }, - { - "id": "ScriptPosition", - "experimental": true, - "type": "object", - "properties": [ - { "name": "lineNumber", "type": "integer" }, - { "name": "columnNumber", "type": "integer" } - ], - "description": "Location in the source code." - }, - { - "id": "CallFrame", - "type": "object", - "properties": [ - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier. This identifier is only valid while the virtual machine is paused." }, - { "name": "functionName", "type": "string", "description": "Name of the JavaScript function called on this call frame." }, - { "name": "functionLocation", "$ref": "Location", "optional": true, "description": "Location in the source code." }, - { "name": "location", "$ref": "Location", "description": "Location in the source code." }, - { "name": "url", "type": "string", "description": "JavaScript script name or url." }, - { "name": "scopeChain", "type": "array", "items": { "$ref": "Scope" }, "description": "Scope chain for this call frame." }, - { "name": "this", "$ref": "Runtime.RemoteObject", "description": "this object for this call frame." }, - { "name": "returnValue", "$ref": "Runtime.RemoteObject", "optional": true, "description": "The value being returned, if the function is at return point." } - ], - "description": "JavaScript call frame. Array of call frames form the call stack." - }, - { - "id": "Scope", - "type": "object", - "properties": [ - { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "block", "script", "eval", "module"], "description": "Scope type." }, - { "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." }, - { "name": "name", "type": "string", "optional": true }, - { "name": "startLocation", "$ref": "Location", "optional": true, "description": "Location in the source code where scope starts" }, - { "name": "endLocation", "$ref": "Location", "optional": true, "description": "Location in the source code where scope ends" } - ], - "description": "Scope description." - }, - { - "id": "SearchMatch", - "type": "object", - "description": "Search match for resource.", - "properties": [ - { "name": "lineNumber", "type": "number", "description": "Line number in resource content." }, - { "name": "lineContent", "type": "string", "description": "Line with match content." } - ] - }, - { - "id": "BreakLocation", - "type": "object", - "properties": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the Debugger.scriptParsed." }, - { "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." }, - { "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." }, - { "name": "type", "type": "string", "enum": [ "debuggerStatement", "call", "return" ], "optional": true } - ] - } - ], - "commands": [ - { - "name": "enable", - "returns": [ - { "name": "debuggerId", "$ref": "Runtime.UniqueDebuggerId", "experimental": true, "description": "Unique identifier of the debugger." } - ], - "description": "Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received." - }, - { - "name": "disable", - "description": "Disables debugger for given page." - }, - { - "name": "setBreakpointsActive", - "parameters": [ - { "name": "active", "type": "boolean", "description": "New value for breakpoints active state." } - ], - "description": "Activates / deactivates all breakpoints on the page." - }, - { - "name": "setSkipAllPauses", - "parameters": [ - { "name": "skip", "type": "boolean", "description": "New value for skip pauses state." } - ], - "description": "Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc)." - }, - { - "name": "setBreakpointByUrl", - "parameters": [ - { "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." }, - { "name": "url", "type": "string", "optional": true, "description": "URL of the resources to set breakpoint on." }, - { "name": "urlRegex", "type": "string", "optional": true, "description": "Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified." }, - { "name": "scriptHash", "type": "string", "optional": true, "description": "Script hash of the resources to set breakpoint on." }, - { "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." }, - { "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." } - ], - "returns": [ - { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, - { "name": "locations", "type": "array", "items": { "$ref": "Location" }, "description": "List of the locations this breakpoint resolved into upon addition." } - ], - "description": "Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads." - }, - { - "name": "setBreakpoint", - "parameters": [ - { "name": "location", "$ref": "Location", "description": "Location to set breakpoint in." }, - { "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." } - ], - "returns": [ - { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, - { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." } - ], - "description": "Sets JavaScript breakpoint at a given location." - }, - { - "name": "removeBreakpoint", - "parameters": [ - { "name": "breakpointId", "$ref": "BreakpointId" } - ], - "description": "Removes JavaScript breakpoint." - }, - { - "name": "getPossibleBreakpoints", - "parameters": [ - { "name": "start", "$ref": "Location", "description": "Start of range to search possible breakpoint locations in." }, - { "name": "end", "$ref": "Location", "optional": true, "description": "End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range." }, - { "name": "restrictToFunction", "type": "boolean", "optional": true, "description": "Only consider locations which are in the same (non-nested) function as start." } - ], - "returns": [ - { "name": "locations", "type": "array", "items": { "$ref": "BreakLocation" }, "description": "List of the possible breakpoint locations." } - ], - "description": "Returns possible locations for breakpoint. scriptId in start and end range locations should be the same." - }, - { - "name": "continueToLocation", - "parameters": [ - { "name": "location", "$ref": "Location", "description": "Location to continue to." }, - { "name": "targetCallFrames", "type": "string", "enum": ["any", "current"], "optional": true } - ], - "description": "Continues execution until specific location is reached." - }, - { - "name": "pauseOnAsyncCall", - "parameters": [ - { "name": "parentStackTraceId", "$ref": "Runtime.StackTraceId", "description": "Debugger will pause when async call with given stack trace is started." } - ], - "experimental": true - }, - { - "name": "stepOver", - "description": "Steps over the statement." - }, - { - "name": "stepInto", - "parameters": [ - { "name": "breakOnAsyncCall", "type": "boolean", "optional": true, "experimental": true, "description": "Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause." } - ], - "description": "Steps into the function call." - }, - { - "name": "stepOut", - "description": "Steps out of the function call." - }, - { - "name": "pause", - "description": "Stops on the next JavaScript statement." - }, - { - "name": "scheduleStepIntoAsync", - "description": "This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called.", - "experimental": true - }, - { - "name": "resume", - "description": "Resumes JavaScript execution." - }, - { - "name": "getStackTrace", - "parameters": [ - { "name": "stackTraceId", "$ref": "Runtime.StackTraceId" } - ], - "returns": [ - { "name": "stackTrace", "$ref": "Runtime.StackTrace" } - ], - "description": "Returns stack trace with given stackTraceId.", - "experimental": true - }, - { - "name": "searchInContent", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to search in." }, - { "name": "query", "type": "string", "description": "String to search for." }, - { "name": "caseSensitive", "type": "boolean", "optional": true, "description": "If true, search is case sensitive." }, - { "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, treats string parameter as regex." } - ], - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "SearchMatch" }, "description": "List of search matches." } - ], - "description": "Searches for given string in script content." - }, - { - "name": "setScriptSource", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to edit." }, - { "name": "scriptSource", "type": "string", "description": "New content of the script." }, - { "name": "dryRun", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code." } - ], - "returns": [ - { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame" }, "description": "New stack trace in case editing has happened while VM was stopped." }, - { "name": "stackChanged", "type": "boolean", "optional": true, "description": "Whether current call stack was modified after applying the changes." }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." }, - { "name": "asyncStackTraceId", "$ref": "Runtime.StackTraceId", "optional": true, "experimental": true, "description": "Async stack trace, if any." }, - { "name": "exceptionDetails", "optional": true, "$ref": "Runtime.ExceptionDetails", "description": "Exception details if any." } - ], - "description": "Edits JavaScript source live." - }, - { - "name": "restartFrame", - "parameters": [ - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." } - ], - "returns": [ - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "New stack trace." }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." }, - { "name": "asyncStackTraceId", "$ref": "Runtime.StackTraceId", "optional": true, "experimental": true, "description": "Async stack trace, if any." } - ], - "description": "Restarts particular call frame from the beginning." - }, - { - "name": "getScriptSource", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." } - ], - "returns": [ - { "name": "scriptSource", "type": "string", "description": "Script source." } - ], - "description": "Returns source for the script with given id." - }, - { - "name": "setPauseOnExceptions", - "parameters": [ - { "name": "state", "type": "string", "enum": ["none", "uncaught", "all"], "description": "Pause on exceptions mode." } - ], - "description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none." - }, - { - "name": "evaluateOnCallFrame", - "parameters": [ - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." }, - { "name": "expression", "type": "string", "description": "Expression to evaluate." }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup)." }, - { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false." }, - { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state." }, - { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, - { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, - { "name": "throwOnSideEffect", "type": "boolean", "optional": true, "description": "Whether to throw an exception if side effect cannot be ruled out during evaluation." } - ], - "returns": [ - { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." }, - { "name": "exceptionDetails", "$ref": "Runtime.ExceptionDetails", "optional": true, "description": "Exception details."} - ], - "description": "Evaluates expression on a given call frame." - }, - { - "name": "setVariableValue", - "parameters": [ - { "name": "scopeNumber", "type": "integer", "description": "0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually." }, - { "name": "variableName", "type": "string", "description": "Variable name." }, - { "name": "newValue", "$ref": "Runtime.CallArgument", "description": "New variable value." }, - { "name": "callFrameId", "$ref": "CallFrameId", "description": "Id of callframe that holds variable." } - ], - "description": "Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually." - }, - { - "name": "setReturnValue", - "parameters": [ - { "name": "newValue", "$ref": "Runtime.CallArgument", "description": "New return value." } - ], - "experimental": true, - "description": "Changes return value in top frame. Available only at return break position." - }, - { - "name": "setAsyncCallStackDepth", - "parameters": [ - { "name": "maxDepth", "type": "integer", "description": "Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default)." } - ], - "description": "Enables or disables async call stacks tracking." - }, - { - "name": "setBlackboxPatterns", - "parameters": [ - { "name": "patterns", "type": "array", "items": { "type": "string" }, "description": "Array of regexps that will be used to check script url for blackbox state." } - ], - "experimental": true, - "description": "Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful." - }, - { - "name": "setBlackboxedRanges", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script." }, - { "name": "positions", "type": "array", "items": { "$ref": "ScriptPosition" } } - ], - "experimental": true, - "description": "Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted." - } - ], - "events": [ - { - "name": "scriptParsed", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Identifier of the script parsed." }, - { "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." }, - { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, - { "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, - { "name": "endLine", "type": "integer", "description": "Last line of the script." }, - { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, - { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context." }, - { "name": "hash", "type": "string", "description": "Content hash of the script."}, - { "name": "executionContextAuxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data." }, - { "name": "isLiveEdit", "type": "boolean", "optional": true, "description": "True, if this script is generated as a result of the live edit operation.", "experimental": true }, - { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL." }, - { "name": "isModule", "type": "boolean", "optional": true, "description": "True, if this script is ES6 module." }, - { "name": "length", "type": "integer", "optional": true, "description": "This script length." }, - { "name": "stackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "JavaScript top stack frame of where the script parsed event was triggered if available.", "experimental": true } - ], - "description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger." - }, - { - "name": "scriptFailedToParse", - "parameters": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Identifier of the script parsed." }, - { "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." }, - { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, - { "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, - { "name": "endLine", "type": "integer", "description": "Last line of the script." }, - { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, - { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context." }, - { "name": "hash", "type": "string", "description": "Content hash of the script."}, - { "name": "executionContextAuxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data." }, - { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL." }, - { "name": "isModule", "type": "boolean", "optional": true, "description": "True, if this script is ES6 module." }, - { "name": "length", "type": "integer", "optional": true, "description": "This script length." }, - { "name": "stackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "JavaScript top stack frame of where the script parsed event was triggered if available.", "experimental": true } - ], - "description": "Fired when virtual machine fails to parse the script." - }, - { - "name": "breakpointResolved", - "parameters": [ - { "name": "breakpointId", "$ref": "BreakpointId", "description": "Breakpoint unique identifier." }, - { "name": "location", "$ref": "Location", "description": "Actual breakpoint location." } - ], - "description": "Fired when breakpoint is resolved to an actual script and location." - }, - { - "name": "paused", - "parameters": [ - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, - { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "debugCommand", "promiseRejection", "OOM", "other", "ambiguous" ], "description": "Pause reason." }, - { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." }, - { "name": "hitBreakpoints", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Hit breakpoints IDs" }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." }, - { "name": "asyncStackTraceId", "$ref": "Runtime.StackTraceId", "optional": true, "experimental": true, "description": "Async stack trace, if any." }, - { "name": "asyncCallStackTraceId", "$ref": "Runtime.StackTraceId", "optional": true, "experimental": true, "description": "Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag." } - ], - "description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria." - }, - { - "name": "resumed", - "description": "Fired when the virtual machine resumed execution." - } - ] - }, - { - "domain": "Console", - "description": "This domain is deprecated - use Runtime or Log instead.", - "dependencies": ["Runtime"], - "deprecated": true, - "types": [ - { - "id": "ConsoleMessage", - "type": "object", - "description": "Console message.", - "properties": [ - { "name": "source", "type": "string", "enum": ["xml", "javascript", "network", "console-api", "storage", "appcache", "rendering", "security", "other", "deprecation", "worker"], "description": "Message source." }, - { "name": "level", "type": "string", "enum": ["log", "warning", "error", "debug", "info"], "description": "Message severity." }, - { "name": "text", "type": "string", "description": "Message text." }, - { "name": "url", "type": "string", "optional": true, "description": "URL of the message origin." }, - { "name": "line", "type": "integer", "optional": true, "description": "Line number in the resource that generated this message (1-based)." }, - { "name": "column", "type": "integer", "optional": true, "description": "Column number in the resource that generated this message (1-based)." } - ] - } - ], - "commands": [ - { - "name": "enable", - "description": "Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification." - }, - { - "name": "disable", - "description": "Disables console domain, prevents further console messages from being reported to the client." - }, - { - "name": "clearMessages", - "description": "Does nothing." - } - ], - "events": [ - { - "name": "messageAdded", - "parameters": [ - { "name": "message", "$ref": "ConsoleMessage", "description": "Console message that has been added." } - ], - "description": "Issued when new console message is added." - } - ] - }, - { - "domain": "Profiler", - "dependencies": ["Runtime", "Debugger"], - "types": [ - { - "id": "ProfileNode", - "type": "object", - "description": "Profile node. Holds callsite information, execution statistics and child nodes.", - "properties": [ - { "name": "id", "type": "integer", "description": "Unique id of the node." }, - { "name": "callFrame", "$ref": "Runtime.CallFrame", "description": "Function location." }, - { "name": "hitCount", "type": "integer", "optional": true, "description": "Number of samples where this node was on top of the call stack." }, - { "name": "children", "type": "array", "items": { "type": "integer" }, "optional": true, "description": "Child node ids." }, - { "name": "deoptReason", "type": "string", "optional": true, "description": "The reason of being not optimized. The function may be deoptimized or marked as don't optimize."}, - { "name": "positionTicks", "type": "array", "items": { "$ref": "PositionTickInfo" }, "optional": true, "description": "An array of source position ticks." } - ] - }, - { - "id": "Profile", - "type": "object", - "description": "Profile.", - "properties": [ - { "name": "nodes", "type": "array", "items": { "$ref": "ProfileNode" }, "description": "The list of profile nodes. First item is the root node." }, - { "name": "startTime", "type": "number", "description": "Profiling start timestamp in microseconds." }, - { "name": "endTime", "type": "number", "description": "Profiling end timestamp in microseconds." }, - { "name": "samples", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Ids of samples top nodes." }, - { "name": "timeDeltas", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime." } - ] - }, - { - "id": "PositionTickInfo", - "type": "object", - "description": "Specifies a number of samples attributed to a certain source position.", - "properties": [ - { "name": "line", "type": "integer", "description": "Source line number (1-based)." }, - { "name": "ticks", "type": "integer", "description": "Number of samples attributed to the source line." } - ] - }, - { "id": "CoverageRange", - "type": "object", - "description": "Coverage data for a source range.", - "properties": [ - { "name": "startOffset", "type": "integer", "description": "JavaScript script source offset for the range start." }, - { "name": "endOffset", "type": "integer", "description": "JavaScript script source offset for the range end." }, - { "name": "count", "type": "integer", "description": "Collected execution count of the source range." } - ] - }, - { "id": "FunctionCoverage", - "type": "object", - "description": "Coverage data for a JavaScript function.", - "properties": [ - { "name": "functionName", "type": "string", "description": "JavaScript function name." }, - { "name": "ranges", "type": "array", "items": { "$ref": "CoverageRange" }, "description": "Source ranges inside the function with coverage data." }, - { "name": "isBlockCoverage", "type": "boolean", "description": "Whether coverage data for this function has block granularity." } - ] - }, - { - "id": "ScriptCoverage", - "type": "object", - "description": "Coverage data for a JavaScript script.", - "properties": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "JavaScript script id." }, - { "name": "url", "type": "string", "description": "JavaScript script name or url." }, - { "name": "functions", "type": "array", "items": { "$ref": "FunctionCoverage" }, "description": "Functions contained in the script that has coverage data." } - ] - }, - { "id": "TypeObject", - "type": "object", - "description": "Describes a type collected during runtime.", - "properties": [ - { "name": "name", "type": "string", "description": "Name of a type collected with type profiling." } - ], - "experimental": true - }, - { "id": "TypeProfileEntry", - "type": "object", - "description": "Source offset and types for a parameter or return value.", - "properties": [ - { "name": "offset", "type": "integer", "description": "Source offset of the parameter or end of function for return values." }, - { "name": "types", "type": "array", "items": {"$ref": "TypeObject"}, "description": "The types for this parameter or return value."} - ], - "experimental": true - }, - { - "id": "ScriptTypeProfile", - "type": "object", - "description": "Type profile data collected during runtime for a JavaScript script.", - "properties": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "JavaScript script id." }, - { "name": "url", "type": "string", "description": "JavaScript script name or url." }, - { "name": "entries", "type": "array", "items": { "$ref": "TypeProfileEntry" }, "description": "Type profile entries for parameters and return values of the functions in the script." } - ], - "experimental": true - } - ], - "commands": [ - { - "name": "enable" - }, - { - "name": "disable" - }, - { - "name": "setSamplingInterval", - "parameters": [ - { "name": "interval", "type": "integer", "description": "New sampling interval in microseconds." } - ], - "description": "Changes CPU profiler sampling interval. Must be called before CPU profiles recording started." - }, - { - "name": "start" - }, - { - "name": "stop", - "returns": [ - { "name": "profile", "$ref": "Profile", "description": "Recorded profile." } - ] - }, - { - "name": "startPreciseCoverage", - "parameters": [ - { "name": "callCount", "type": "boolean", "optional": true, "description": "Collect accurate call counts beyond simple 'covered' or 'not covered'." }, - { "name": "detailed", "type": "boolean", "optional": true, "description": "Collect block-based coverage." } - ], - "description": "Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters." - }, - { - "name": "stopPreciseCoverage", - "description": "Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code." - }, - { - "name": "takePreciseCoverage", - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "ScriptCoverage" }, "description": "Coverage data for the current isolate." } - ], - "description": "Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started." - }, - { - "name": "getBestEffortCoverage", - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "ScriptCoverage" }, "description": "Coverage data for the current isolate." } - ], - "description": "Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection." - }, - { - "name": "startTypeProfile", - "description": "Enable type profile.", - "experimental": true - }, - { - "name": "stopTypeProfile", - "description": "Disable type profile. Disabling releases type profile data collected so far.", - "experimental": true - }, - { - "name": "takeTypeProfile", - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "ScriptTypeProfile" }, "description": "Type profile for all scripts since startTypeProfile() was turned on." } - ], - "description": "Collect type profile.", - "experimental": true - } - ], - "events": [ - { - "name": "consoleProfileStarted", - "parameters": [ - { "name": "id", "type": "string" }, - { "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profile()." }, - { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as an argument to console.profile()." } - ], - "description": "Sent when new profile recording is started using console.profile() call." - }, - { - "name": "consoleProfileFinished", - "parameters": [ - { "name": "id", "type": "string" }, - { "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profileEnd()." }, - { "name": "profile", "$ref": "Profile" }, - { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as an argument to console.profile()." } - ] - } - ] - }, - { - "domain": "HeapProfiler", - "dependencies": ["Runtime"], - "experimental": true, - "types": [ - { - "id": "HeapSnapshotObjectId", - "type": "string", - "description": "Heap snapshot object id." - }, - { - "id": "SamplingHeapProfileNode", - "type": "object", - "description": "Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.", - "properties": [ - { "name": "callFrame", "$ref": "Runtime.CallFrame", "description": "Function location." }, - { "name": "selfSize", "type": "number", "description": "Allocations size in bytes for the node excluding children." }, - { "name": "children", "type": "array", "items": { "$ref": "SamplingHeapProfileNode" }, "description": "Child nodes." } - ] - }, - { - "id": "SamplingHeapProfile", - "type": "object", - "description": "Profile.", - "properties": [ - { "name": "head", "$ref": "SamplingHeapProfileNode" } - ] - } - ], - "commands": [ - { - "name": "enable" - }, - { - "name": "disable" - }, - { - "name": "startTrackingHeapObjects", - "parameters": [ - { "name": "trackAllocations", "type": "boolean", "optional": true } - ] - }, - { - "name": "stopTrackingHeapObjects", - "parameters": [ - { "name": "reportProgress", "type": "boolean", "optional": true, "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped." } - ] - }, - { - "name": "takeHeapSnapshot", - "parameters": [ - { "name": "reportProgress", "type": "boolean", "optional": true, "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken." } - ] - }, - { - "name": "collectGarbage" - }, - { - "name": "getObjectByHeapObjectId", - "parameters": [ - { "name": "objectId", "$ref": "HeapSnapshotObjectId" }, - { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } - ], - "returns": [ - { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Evaluation result." } - ] - }, - { - "name": "addInspectedHeapObject", - "parameters": [ - { "name": "heapObjectId", "$ref": "HeapSnapshotObjectId", "description": "Heap snapshot object id to be accessible by means of $x command line API." } - ], - "description": "Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions)." - }, - { - "name": "getHeapObjectId", - "parameters": [ - { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Identifier of the object to get heap object id for." } - ], - "returns": [ - { "name": "heapSnapshotObjectId", "$ref": "HeapSnapshotObjectId", "description": "Id of the heap snapshot object corresponding to the passed remote object id." } - ] - }, - { - "name": "startSampling", - "parameters": [ - { "name": "samplingInterval", "type": "number", "optional": true, "description": "Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes." } - ] - }, - { - "name": "stopSampling", - "returns": [ - { "name": "profile", "$ref": "SamplingHeapProfile", "description": "Recorded sampling heap profile." } - ] - }, - { - "name": "getSamplingProfile", - "returns": [ - { "name": "profile", "$ref": "SamplingHeapProfile", "description": "Return the sampling profile being collected." } - ] - } - ], - "events": [ - { - "name": "addHeapSnapshotChunk", - "parameters": [ - { "name": "chunk", "type": "string" } - ] - }, - { - "name": "resetProfiles" - }, - { - "name": "reportHeapSnapshotProgress", - "parameters": [ - { "name": "done", "type": "integer" }, - { "name": "total", "type": "integer" }, - { "name": "finished", "type": "boolean", "optional": true } - ] - }, - { - "name": "lastSeenObjectId", - "description": "If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.", - "parameters": [ - { "name": "lastSeenObjectId", "type": "integer" }, - { "name": "timestamp", "type": "number" } - ] - }, - { - "name": "heapStatsUpdate", - "description": "If heap objects tracking has been started then backend may send update for one or more fragments", - "parameters": [ - { "name": "statsUpdate", "type": "array", "items": { "type": "integer" }, "description": "An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment."} - ] - } - ] - }] -} diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol.pdl b/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol.pdl deleted file mode 100644 index ebf9eb7f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/js_protocol.pdl +++ /dev/null @@ -1,1693 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -version - major 1 - minor 3 - -# This domain is deprecated - use Runtime or Log instead. -deprecated domain Console - depends on Runtime - - # Console message. - type ConsoleMessage extends object - properties - # Message source. - enum source - xml - javascript - network - console-api - storage - appcache - rendering - security - other - deprecation - worker - # Message severity. - enum level - log - warning - error - debug - info - # Message text. - string text - # URL of the message origin. - optional string url - # Line number in the resource that generated this message (1-based). - optional integer line - # Column number in the resource that generated this message (1-based). - optional integer column - - # Does nothing. - command clearMessages - - # Disables console domain, prevents further console messages from being reported to the client. - command disable - - # Enables console domain, sends the messages collected so far to the client by means of the - # `messageAdded` notification. - command enable - - # Issued when new console message is added. - event messageAdded - parameters - # Console message that has been added. - ConsoleMessage message - -# Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing -# breakpoints, stepping through execution, exploring stack traces, etc. -domain Debugger - depends on Runtime - - # Breakpoint identifier. - type BreakpointId extends string - - # Call frame identifier. - type CallFrameId extends string - - # Location in the source code. - type Location extends object - properties - # Script identifier as reported in the `Debugger.scriptParsed`. - Runtime.ScriptId scriptId - # Line number in the script (0-based). - integer lineNumber - # Column number in the script (0-based). - optional integer columnNumber - - # Location in the source code. - experimental type ScriptPosition extends object - properties - integer lineNumber - integer columnNumber - - # Location range within one script. - experimental type LocationRange extends object - properties - Runtime.ScriptId scriptId - ScriptPosition start - ScriptPosition end - - # JavaScript call frame. Array of call frames form the call stack. - type CallFrame extends object - properties - # Call frame identifier. This identifier is only valid while the virtual machine is paused. - CallFrameId callFrameId - # Name of the JavaScript function called on this call frame. - string functionName - # Location in the source code. - optional Location functionLocation - # Location in the source code. - Location location - # JavaScript script name or url. - string url - # Scope chain for this call frame. - array of Scope scopeChain - # `this` object for this call frame. - Runtime.RemoteObject this - # The value being returned, if the function is at return point. - optional Runtime.RemoteObject returnValue - - # Scope description. - type Scope extends object - properties - # Scope type. - enum type - global - local - with - closure - catch - block - script - eval - module - wasm-expression-stack - # Object representing the scope. For `global` and `with` scopes it represents the actual - # object; for the rest of the scopes, it is artificial transient object enumerating scope - # variables as its properties. - Runtime.RemoteObject object - optional string name - # Location in the source code where scope starts - optional Location startLocation - # Location in the source code where scope ends - optional Location endLocation - - # Search match for resource. - type SearchMatch extends object - properties - # Line number in resource content. - number lineNumber - # Line with match content. - string lineContent - - type BreakLocation extends object - properties - # Script identifier as reported in the `Debugger.scriptParsed`. - Runtime.ScriptId scriptId - # Line number in the script (0-based). - integer lineNumber - # Column number in the script (0-based). - optional integer columnNumber - optional enum type - debuggerStatement - call - return - - # Continues execution until specific location is reached. - command continueToLocation - parameters - # Location to continue to. - Location location - optional enum targetCallFrames - any - current - - # Disables debugger for given page. - command disable - - # Enables debugger for the given page. Clients should not assume that the debugging has been - # enabled until the result for this command is received. - command enable - parameters - # The maximum size in bytes of collected scripts (not referenced by other heap objects) - # the debugger can hold. Puts no limit if parameter is omitted. - experimental optional number maxScriptsCacheSize - returns - # Unique identifier of the debugger. - experimental Runtime.UniqueDebuggerId debuggerId - - # Evaluates expression on a given call frame. - command evaluateOnCallFrame - parameters - # Call frame identifier to evaluate on. - CallFrameId callFrameId - # Expression to evaluate. - string expression - # String object group name to put result into (allows rapid releasing resulting object handles - # using `releaseObjectGroup`). - optional string objectGroup - # Specifies whether command line API should be available to the evaluated expression, defaults - # to false. - optional boolean includeCommandLineAPI - # In silent mode exceptions thrown during evaluation are not reported and do not pause - # execution. Overrides `setPauseOnException` state. - optional boolean silent - # Whether the result is expected to be a JSON object that should be sent by value. - optional boolean returnByValue - # Whether preview should be generated for the result. - experimental optional boolean generatePreview - # Whether to throw an exception if side effect cannot be ruled out during evaluation. - optional boolean throwOnSideEffect - # Terminate execution after timing out (number of milliseconds). - experimental optional Runtime.TimeDelta timeout - returns - # Object wrapper for the evaluation result. - Runtime.RemoteObject result - # Exception details. - optional Runtime.ExceptionDetails exceptionDetails - - # Returns possible locations for breakpoint. scriptId in start and end range locations should be - # the same. - command getPossibleBreakpoints - parameters - # Start of range to search possible breakpoint locations in. - Location start - # End of range to search possible breakpoint locations in (excluding). When not specified, end - # of scripts is used as end of range. - optional Location end - # Only consider locations which are in the same (non-nested) function as start. - optional boolean restrictToFunction - returns - # List of the possible breakpoint locations. - array of BreakLocation locations - - # Returns source for the script with given id. - command getScriptSource - parameters - # Id of the script to get source for. - Runtime.ScriptId scriptId - returns - # Script source (empty in case of Wasm bytecode). - string scriptSource - # Wasm bytecode. - optional binary bytecode - - # This command is deprecated. Use getScriptSource instead. - deprecated command getWasmBytecode - parameters - # Id of the Wasm script to get source for. - Runtime.ScriptId scriptId - returns - # Script source. - binary bytecode - - # Returns stack trace with given `stackTraceId`. - experimental command getStackTrace - parameters - Runtime.StackTraceId stackTraceId - returns - Runtime.StackTrace stackTrace - - # Stops on the next JavaScript statement. - command pause - - experimental deprecated command pauseOnAsyncCall - parameters - # Debugger will pause when async call with given stack trace is started. - Runtime.StackTraceId parentStackTraceId - - # Removes JavaScript breakpoint. - command removeBreakpoint - parameters - BreakpointId breakpointId - - # Restarts particular call frame from the beginning. - deprecated command restartFrame - parameters - # Call frame identifier to evaluate on. - CallFrameId callFrameId - returns - # New stack trace. - array of CallFrame callFrames - # Async stack trace, if any. - optional Runtime.StackTrace asyncStackTrace - # Async stack trace, if any. - experimental optional Runtime.StackTraceId asyncStackTraceId - - # Resumes JavaScript execution. - command resume - parameters - # Set to true to terminate execution upon resuming execution. In contrast - # to Runtime.terminateExecution, this will allows to execute further - # JavaScript (i.e. via evaluation) until execution of the paused code - # is actually resumed, at which point termination is triggered. - # If execution is currently not paused, this parameter has no effect. - optional boolean terminateOnResume - - # Searches for given string in script content. - command searchInContent - parameters - # Id of the script to search in. - Runtime.ScriptId scriptId - # String to search for. - string query - # If true, search is case sensitive. - optional boolean caseSensitive - # If true, treats string parameter as regex. - optional boolean isRegex - returns - # List of search matches. - array of SearchMatch result - - # Enables or disables async call stacks tracking. - command setAsyncCallStackDepth - parameters - # Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async - # call stacks (default). - integer maxDepth - - # Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in - # scripts with url matching one of the patterns. VM will try to leave blackboxed script by - # performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - experimental command setBlackboxPatterns - parameters - # Array of regexps that will be used to check script url for blackbox state. - array of string patterns - - # Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted - # scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - # Positions array contains positions where blackbox state is changed. First interval isn't - # blackboxed. Array should be sorted. - experimental command setBlackboxedRanges - parameters - # Id of the script. - Runtime.ScriptId scriptId - array of ScriptPosition positions - - # Sets JavaScript breakpoint at a given location. - command setBreakpoint - parameters - # Location to set breakpoint in. - Location location - # Expression to use as a breakpoint condition. When specified, debugger will only stop on the - # breakpoint if this expression evaluates to true. - optional string condition - returns - # Id of the created breakpoint for further reference. - BreakpointId breakpointId - # Location this breakpoint resolved into. - Location actualLocation - - # Sets instrumentation breakpoint. - command setInstrumentationBreakpoint - parameters - # Instrumentation name. - enum instrumentation - beforeScriptExecution - beforeScriptWithSourceMapExecution - returns - # Id of the created breakpoint for further reference. - BreakpointId breakpointId - - # Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this - # command is issued, all existing parsed scripts will have breakpoints resolved and returned in - # `locations` property. Further matching script parsing will result in subsequent - # `breakpointResolved` events issued. This logical breakpoint will survive page reloads. - command setBreakpointByUrl - parameters - # Line number to set breakpoint at. - integer lineNumber - # URL of the resources to set breakpoint on. - optional string url - # Regex pattern for the URLs of the resources to set breakpoints on. Either `url` or - # `urlRegex` must be specified. - optional string urlRegex - # Script hash of the resources to set breakpoint on. - optional string scriptHash - # Offset in the line to set breakpoint at. - optional integer columnNumber - # Expression to use as a breakpoint condition. When specified, debugger will only stop on the - # breakpoint if this expression evaluates to true. - optional string condition - returns - # Id of the created breakpoint for further reference. - BreakpointId breakpointId - # List of the locations this breakpoint resolved into upon addition. - array of Location locations - - # Sets JavaScript breakpoint before each call to the given function. - # If another function was created from the same source as a given one, - # calling it will also trigger the breakpoint. - experimental command setBreakpointOnFunctionCall - parameters - # Function object id. - Runtime.RemoteObjectId objectId - # Expression to use as a breakpoint condition. When specified, debugger will - # stop on the breakpoint if this expression evaluates to true. - optional string condition - returns - # Id of the created breakpoint for further reference. - BreakpointId breakpointId - - # Activates / deactivates all breakpoints on the page. - command setBreakpointsActive - parameters - # New value for breakpoints active state. - boolean active - - # Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or - # no exceptions. Initial pause on exceptions state is `none`. - command setPauseOnExceptions - parameters - # Pause on exceptions mode. - enum state - none - uncaught - all - - # Changes return value in top frame. Available only at return break position. - experimental command setReturnValue - parameters - # New return value. - Runtime.CallArgument newValue - - # Edits JavaScript source live. - command setScriptSource - parameters - # Id of the script to edit. - Runtime.ScriptId scriptId - # New content of the script. - string scriptSource - # If true the change will not actually be applied. Dry run may be used to get result - # description without actually modifying the code. - optional boolean dryRun - returns - # New stack trace in case editing has happened while VM was stopped. - optional array of CallFrame callFrames - # Whether current call stack was modified after applying the changes. - optional boolean stackChanged - # Async stack trace, if any. - optional Runtime.StackTrace asyncStackTrace - # Async stack trace, if any. - experimental optional Runtime.StackTraceId asyncStackTraceId - # Exception details if any. - optional Runtime.ExceptionDetails exceptionDetails - - # Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - command setSkipAllPauses - parameters - # New value for skip pauses state. - boolean skip - - # Changes value of variable in a callframe. Object-based scopes are not supported and must be - # mutated manually. - command setVariableValue - parameters - # 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' - # scope types are allowed. Other scopes could be manipulated manually. - integer scopeNumber - # Variable name. - string variableName - # New variable value. - Runtime.CallArgument newValue - # Id of callframe that holds variable. - CallFrameId callFrameId - - # Steps into the function call. - command stepInto - parameters - # Debugger will pause on the execution of the first async task which was scheduled - # before next pause. - experimental optional boolean breakOnAsyncCall - # The skipList specifies location ranges that should be skipped on step into. - experimental optional array of LocationRange skipList - - # Steps out of the function call. - command stepOut - - # Steps over the statement. - command stepOver - parameters - # The skipList specifies location ranges that should be skipped on step over. - experimental optional array of LocationRange skipList - - # Fired when breakpoint is resolved to an actual script and location. - event breakpointResolved - parameters - # Breakpoint unique identifier. - BreakpointId breakpointId - # Actual breakpoint location. - Location location - - # Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - event paused - parameters - # Call stack the virtual machine stopped on. - array of CallFrame callFrames - # Pause reason. - enum reason - ambiguous - assert - CSPViolation - debugCommand - DOM - EventListener - exception - instrumentation - OOM - other - promiseRejection - XHR - # Object containing break-specific auxiliary properties. - optional object data - # Hit breakpoints IDs - optional array of string hitBreakpoints - # Async stack trace, if any. - optional Runtime.StackTrace asyncStackTrace - # Async stack trace, if any. - experimental optional Runtime.StackTraceId asyncStackTraceId - # Never present, will be removed. - experimental deprecated optional Runtime.StackTraceId asyncCallStackTraceId - - # Fired when the virtual machine resumed execution. - event resumed - - # Enum of possible script languages. - type ScriptLanguage extends string - enum - JavaScript - WebAssembly - - # Debug symbols available for a wasm script. - type DebugSymbols extends object - properties - # Type of the debug symbols. - enum type - None - SourceMap - EmbeddedDWARF - ExternalDWARF - # URL of the external symbol source. - optional string externalURL - - # Fired when virtual machine fails to parse the script. - event scriptFailedToParse - parameters - # Identifier of the script parsed. - Runtime.ScriptId scriptId - # URL or name of the script parsed (if any). - string url - # Line offset of the script within the resource with given URL (for script tags). - integer startLine - # Column offset of the script within the resource with given URL. - integer startColumn - # Last line of the script. - integer endLine - # Length of the last line of the script. - integer endColumn - # Specifies script creation context. - Runtime.ExecutionContextId executionContextId - # Content hash of the script. - string hash - # Embedder-specific auxiliary data. - optional object executionContextAuxData - # URL of source map associated with script (if any). - optional string sourceMapURL - # True, if this script has sourceURL. - optional boolean hasSourceURL - # True, if this script is ES6 module. - optional boolean isModule - # This script length. - optional integer length - # JavaScript top stack frame of where the script parsed event was triggered if available. - experimental optional Runtime.StackTrace stackTrace - # If the scriptLanguage is WebAssembly, the code section offset in the module. - experimental optional integer codeOffset - # The language of the script. - experimental optional Debugger.ScriptLanguage scriptLanguage - # The name the embedder supplied for this script. - experimental optional string embedderName - - # Fired when virtual machine parses script. This event is also fired for all known and uncollected - # scripts upon enabling debugger. - event scriptParsed - parameters - # Identifier of the script parsed. - Runtime.ScriptId scriptId - # URL or name of the script parsed (if any). - string url - # Line offset of the script within the resource with given URL (for script tags). - integer startLine - # Column offset of the script within the resource with given URL. - integer startColumn - # Last line of the script. - integer endLine - # Length of the last line of the script. - integer endColumn - # Specifies script creation context. - Runtime.ExecutionContextId executionContextId - # Content hash of the script. - string hash - # Embedder-specific auxiliary data. - optional object executionContextAuxData - # True, if this script is generated as a result of the live edit operation. - experimental optional boolean isLiveEdit - # URL of source map associated with script (if any). - optional string sourceMapURL - # True, if this script has sourceURL. - optional boolean hasSourceURL - # True, if this script is ES6 module. - optional boolean isModule - # This script length. - optional integer length - # JavaScript top stack frame of where the script parsed event was triggered if available. - experimental optional Runtime.StackTrace stackTrace - # If the scriptLanguage is WebAssembly, the code section offset in the module. - experimental optional integer codeOffset - # The language of the script. - experimental optional Debugger.ScriptLanguage scriptLanguage - # If the scriptLanguage is WebASsembly, the source of debug symbols for the module. - experimental optional Debugger.DebugSymbols debugSymbols - # The name the embedder supplied for this script. - experimental optional string embedderName - -experimental domain HeapProfiler - depends on Runtime - - # Heap snapshot object id. - type HeapSnapshotObjectId extends string - - # Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - type SamplingHeapProfileNode extends object - properties - # Function location. - Runtime.CallFrame callFrame - # Allocations size in bytes for the node excluding children. - number selfSize - # Node id. Ids are unique across all profiles collected between startSampling and stopSampling. - integer id - # Child nodes. - array of SamplingHeapProfileNode children - - # A single sample from a sampling profile. - type SamplingHeapProfileSample extends object - properties - # Allocation size in bytes attributed to the sample. - number size - # Id of the corresponding profile tree node. - integer nodeId - # Time-ordered sample ordinal number. It is unique across all profiles retrieved - # between startSampling and stopSampling. - number ordinal - - # Sampling profile. - type SamplingHeapProfile extends object - properties - SamplingHeapProfileNode head - array of SamplingHeapProfileSample samples - - # Enables console to refer to the node with given id via $x (see Command Line API for more details - # $x functions). - command addInspectedHeapObject - parameters - # Heap snapshot object id to be accessible by means of $x command line API. - HeapSnapshotObjectId heapObjectId - - command collectGarbage - - command disable - - command enable - - command getHeapObjectId - parameters - # Identifier of the object to get heap object id for. - Runtime.RemoteObjectId objectId - returns - # Id of the heap snapshot object corresponding to the passed remote object id. - HeapSnapshotObjectId heapSnapshotObjectId - - command getObjectByHeapObjectId - parameters - HeapSnapshotObjectId objectId - # Symbolic group name that can be used to release multiple objects. - optional string objectGroup - returns - # Evaluation result. - Runtime.RemoteObject result - - command getSamplingProfile - returns - # Return the sampling profile being collected. - SamplingHeapProfile profile - - command startSampling - parameters - # Average sample interval in bytes. Poisson distribution is used for the intervals. The - # default value is 32768 bytes. - optional number samplingInterval - - command startTrackingHeapObjects - parameters - optional boolean trackAllocations - - command stopSampling - returns - # Recorded sampling heap profile. - SamplingHeapProfile profile - - command stopTrackingHeapObjects - parameters - # If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken - # when the tracking is stopped. - optional boolean reportProgress - optional boolean treatGlobalObjectsAsRoots - # If true, numerical values are included in the snapshot - optional boolean captureNumericValue - - command takeHeapSnapshot - parameters - # If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - optional boolean reportProgress - # If true, a raw snapshot without artificial roots will be generated - optional boolean treatGlobalObjectsAsRoots - # If true, numerical values are included in the snapshot - optional boolean captureNumericValue - - event addHeapSnapshotChunk - parameters - string chunk - - # If heap objects tracking has been started then backend may send update for one or more fragments - event heapStatsUpdate - parameters - # An array of triplets. Each triplet describes a fragment. The first integer is the fragment - # index, the second integer is a total count of objects for the fragment, the third integer is - # a total size of the objects for the fragment. - array of integer statsUpdate - - # If heap objects tracking has been started then backend regularly sends a current value for last - # seen object id and corresponding timestamp. If the were changes in the heap since last event - # then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - event lastSeenObjectId - parameters - integer lastSeenObjectId - number timestamp - - event reportHeapSnapshotProgress - parameters - integer done - integer total - optional boolean finished - - event resetProfiles - -domain Profiler - depends on Runtime - depends on Debugger - - # Profile node. Holds callsite information, execution statistics and child nodes. - type ProfileNode extends object - properties - # Unique id of the node. - integer id - # Function location. - Runtime.CallFrame callFrame - # Number of samples where this node was on top of the call stack. - optional integer hitCount - # Child node ids. - optional array of integer children - # The reason of being not optimized. The function may be deoptimized or marked as don't - # optimize. - optional string deoptReason - # An array of source position ticks. - optional array of PositionTickInfo positionTicks - - # Profile. - type Profile extends object - properties - # The list of profile nodes. First item is the root node. - array of ProfileNode nodes - # Profiling start timestamp in microseconds. - number startTime - # Profiling end timestamp in microseconds. - number endTime - # Ids of samples top nodes. - optional array of integer samples - # Time intervals between adjacent samples in microseconds. The first delta is relative to the - # profile startTime. - optional array of integer timeDeltas - - # Specifies a number of samples attributed to a certain source position. - type PositionTickInfo extends object - properties - # Source line number (1-based). - integer line - # Number of samples attributed to the source line. - integer ticks - - # Coverage data for a source range. - type CoverageRange extends object - properties - # JavaScript script source offset for the range start. - integer startOffset - # JavaScript script source offset for the range end. - integer endOffset - # Collected execution count of the source range. - integer count - - # Coverage data for a JavaScript function. - type FunctionCoverage extends object - properties - # JavaScript function name. - string functionName - # Source ranges inside the function with coverage data. - array of CoverageRange ranges - # Whether coverage data for this function has block granularity. - boolean isBlockCoverage - - # Coverage data for a JavaScript script. - type ScriptCoverage extends object - properties - # JavaScript script id. - Runtime.ScriptId scriptId - # JavaScript script name or url. - string url - # Functions contained in the script that has coverage data. - array of FunctionCoverage functions - - # Describes a type collected during runtime. - experimental type TypeObject extends object - properties - # Name of a type collected with type profiling. - string name - - # Source offset and types for a parameter or return value. - experimental type TypeProfileEntry extends object - properties - # Source offset of the parameter or end of function for return values. - integer offset - # The types for this parameter or return value. - array of TypeObject types - - # Type profile data collected during runtime for a JavaScript script. - experimental type ScriptTypeProfile extends object - properties - # JavaScript script id. - Runtime.ScriptId scriptId - # JavaScript script name or url. - string url - # Type profile entries for parameters and return values of the functions in the script. - array of TypeProfileEntry entries - - # Collected counter information. - experimental type CounterInfo extends object - properties - # Counter name. - string name - # Counter value. - integer value - - # Runtime call counter information. - experimental type RuntimeCallCounterInfo extends object - properties - # Counter name. - string name - # Counter value. - number value - # Counter time in seconds. - number time - - command disable - - command enable - - # Collect coverage data for the current isolate. The coverage data may be incomplete due to - # garbage collection. - command getBestEffortCoverage - returns - # Coverage data for the current isolate. - array of ScriptCoverage result - - # Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - command setSamplingInterval - parameters - # New sampling interval in microseconds. - integer interval - - command start - - # Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code - # coverage may be incomplete. Enabling prevents running optimized code and resets execution - # counters. - command startPreciseCoverage - parameters - # Collect accurate call counts beyond simple 'covered' or 'not covered'. - optional boolean callCount - # Collect block-based coverage. - optional boolean detailed - # Allow the backend to send updates on its own initiative - optional boolean allowTriggeredUpdates - returns - # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. - number timestamp - - # Enable type profile. - experimental command startTypeProfile - - command stop - returns - # Recorded profile. - Profile profile - - # Disable precise code coverage. Disabling releases unnecessary execution count records and allows - # executing optimized code. - command stopPreciseCoverage - - # Disable type profile. Disabling releases type profile data collected so far. - experimental command stopTypeProfile - - # Collect coverage data for the current isolate, and resets execution counters. Precise code - # coverage needs to have started. - command takePreciseCoverage - returns - # Coverage data for the current isolate. - array of ScriptCoverage result - # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. - number timestamp - - # Collect type profile. - experimental command takeTypeProfile - returns - # Type profile for all scripts since startTypeProfile() was turned on. - array of ScriptTypeProfile result - - # Enable counters collection. - experimental command enableCounters - - # Disable counters collection. - experimental command disableCounters - - # Retrieve counters. - experimental command getCounters - returns - # Collected counters information. - array of CounterInfo result - - # Enable run time call stats collection. - experimental command enableRuntimeCallStats - - # Disable run time call stats collection. - experimental command disableRuntimeCallStats - - # Retrieve run time call stats. - experimental command getRuntimeCallStats - returns - # Collected runtime call counter information. - array of RuntimeCallCounterInfo result - - event consoleProfileFinished - parameters - string id - # Location of console.profileEnd(). - Debugger.Location location - Profile profile - # Profile title passed as an argument to console.profile(). - optional string title - - # Sent when new profile recording is started using console.profile() call. - event consoleProfileStarted - parameters - string id - # Location of console.profile(). - Debugger.Location location - # Profile title passed as an argument to console.profile(). - optional string title - - # Reports coverage delta since the last poll (either from an event like this, or from - # `takePreciseCoverage` for the current isolate. May only be sent if precise code - # coverage has been started. This event can be trigged by the embedder to, for example, - # trigger collection of coverage data immediately at a certain point in time. - experimental event preciseCoverageDeltaUpdate - parameters - # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. - number timestamp - # Identifier for distinguishing coverage events. - string occasion - # Coverage data for the current isolate. - array of ScriptCoverage result - -# Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. -# Evaluation results are returned as mirror object that expose object type, string representation -# and unique identifier that can be used for further object reference. Original objects are -# maintained in memory unless they are either explicitly released or are released along with the -# other objects in their object group. -domain Runtime - - # Unique script identifier. - type ScriptId extends string - - # Unique object identifier. - type RemoteObjectId extends string - - # Primitive value which cannot be JSON-stringified. Includes values `-0`, `NaN`, `Infinity`, - # `-Infinity`, and bigint literals. - type UnserializableValue extends string - - # Mirror object referencing original JavaScript object. - type RemoteObject extends object - properties - # Object type. - enum type - object - function - undefined - string - number - boolean - symbol - bigint - # Object subtype hint. Specified for `object` type values only. - # NOTE: If you change anything here, make sure to also update - # `subtype` in `ObjectPreview` and `PropertyPreview` below. - optional enum subtype - array - null - node - regexp - date - map - set - weakmap - weakset - iterator - generator - error - proxy - promise - typedarray - arraybuffer - dataview - webassemblymemory - wasmvalue - # Object class (constructor) name. Specified for `object` type values only. - optional string className - # Remote object value in case of primitive values or JSON values (if it was requested). - optional any value - # Primitive value which can not be JSON-stringified does not have `value`, but gets this - # property. - optional UnserializableValue unserializableValue - # String representation of the object. - optional string description - # Unique object identifier (for non-primitive values). - optional RemoteObjectId objectId - # Preview containing abbreviated property values. Specified for `object` type values only. - experimental optional ObjectPreview preview - experimental optional CustomPreview customPreview - - experimental type CustomPreview extends object - properties - # The JSON-stringified result of formatter.header(object, config) call. - # It contains json ML array that represents RemoteObject. - string header - # If formatter returns true as a result of formatter.hasBody call then bodyGetterId will - # contain RemoteObjectId for the function that returns result of formatter.body(object, config) call. - # The result value is json ML array. - optional RemoteObjectId bodyGetterId - - # Object containing abbreviated remote object value. - experimental type ObjectPreview extends object - properties - # Object type. - enum type - object - function - undefined - string - number - boolean - symbol - bigint - # Object subtype hint. Specified for `object` type values only. - optional enum subtype - array - null - node - regexp - date - map - set - weakmap - weakset - iterator - generator - error - proxy - promise - typedarray - arraybuffer - dataview - webassemblymemory - wasmvalue - # String representation of the object. - optional string description - # True iff some of the properties or entries of the original object did not fit. - boolean overflow - # List of the properties. - array of PropertyPreview properties - # List of the entries. Specified for `map` and `set` subtype values only. - optional array of EntryPreview entries - - experimental type PropertyPreview extends object - properties - # Property name. - string name - # Object type. Accessor means that the property itself is an accessor property. - enum type - object - function - undefined - string - number - boolean - symbol - accessor - bigint - # User-friendly property value string. - optional string value - # Nested value preview. - optional ObjectPreview valuePreview - # Object subtype hint. Specified for `object` type values only. - optional enum subtype - array - null - node - regexp - date - map - set - weakmap - weakset - iterator - generator - error - proxy - promise - typedarray - arraybuffer - dataview - webassemblymemory - wasmvalue - - experimental type EntryPreview extends object - properties - # Preview of the key. Specified for map-like collection entries. - optional ObjectPreview key - # Preview of the value. - ObjectPreview value - - # Object property descriptor. - type PropertyDescriptor extends object - properties - # Property name or symbol description. - string name - # The value associated with the property. - optional RemoteObject value - # True if the value associated with the property may be changed (data descriptors only). - optional boolean writable - # A function which serves as a getter for the property, or `undefined` if there is no getter - # (accessor descriptors only). - optional RemoteObject get - # A function which serves as a setter for the property, or `undefined` if there is no setter - # (accessor descriptors only). - optional RemoteObject set - # True if the type of this property descriptor may be changed and if the property may be - # deleted from the corresponding object. - boolean configurable - # True if this property shows up during enumeration of the properties on the corresponding - # object. - boolean enumerable - # True if the result was thrown during the evaluation. - optional boolean wasThrown - # True if the property is owned for the object. - optional boolean isOwn - # Property symbol object, if the property is of the `symbol` type. - optional RemoteObject symbol - - # Object internal property descriptor. This property isn't normally visible in JavaScript code. - type InternalPropertyDescriptor extends object - properties - # Conventional property name. - string name - # The value associated with the property. - optional RemoteObject value - - # Object private field descriptor. - experimental type PrivatePropertyDescriptor extends object - properties - # Private property name. - string name - # The value associated with the private property. - optional RemoteObject value - # A function which serves as a getter for the private property, - # or `undefined` if there is no getter (accessor descriptors only). - optional RemoteObject get - # A function which serves as a setter for the private property, - # or `undefined` if there is no setter (accessor descriptors only). - optional RemoteObject set - - # Represents function call argument. Either remote object id `objectId`, primitive `value`, - # unserializable primitive value or neither of (for undefined) them should be specified. - type CallArgument extends object - properties - # Primitive value or serializable javascript object. - optional any value - # Primitive value which can not be JSON-stringified. - optional UnserializableValue unserializableValue - # Remote object handle. - optional RemoteObjectId objectId - - # Id of an execution context. - type ExecutionContextId extends integer - - # Description of an isolated world. - type ExecutionContextDescription extends object - properties - # Unique id of the execution context. It can be used to specify in which execution context - # script evaluation should be performed. - ExecutionContextId id - # Execution context origin. - string origin - # Human readable name describing given context. - string name - # A system-unique execution context identifier. Unlike the id, this is unique across - # multiple processes, so can be reliably used to identify specific context while backend - # performs a cross-process navigation. - experimental string uniqueId - # Embedder-specific auxiliary data. - optional object auxData - - # Detailed information about exception (or error) that was thrown during script compilation or - # execution. - type ExceptionDetails extends object - properties - # Exception id. - integer exceptionId - # Exception text, which should be used together with exception object when available. - string text - # Line number of the exception location (0-based). - integer lineNumber - # Column number of the exception location (0-based). - integer columnNumber - # Script ID of the exception location. - optional ScriptId scriptId - # URL of the exception location, to be used when the script was not reported. - optional string url - # JavaScript stack trace if available. - optional StackTrace stackTrace - # Exception object if available. - optional RemoteObject exception - # Identifier of the context where exception happened. - optional ExecutionContextId executionContextId - # Dictionary with entries of meta data that the client associated - # with this exception, such as information about associated network - # requests, etc. - experimental optional object exceptionMetaData - - # Number of milliseconds since epoch. - type Timestamp extends number - - # Number of milliseconds. - type TimeDelta extends number - - # Stack entry for runtime errors and assertions. - type CallFrame extends object - properties - # JavaScript function name. - string functionName - # JavaScript script id. - ScriptId scriptId - # JavaScript script name or url. - string url - # JavaScript script line number (0-based). - integer lineNumber - # JavaScript script column number (0-based). - integer columnNumber - - # Call frames for assertions or error messages. - type StackTrace extends object - properties - # String label of this stack trace. For async traces this may be a name of the function that - # initiated the async call. - optional string description - # JavaScript function name. - array of CallFrame callFrames - # Asynchronous JavaScript stack trace that preceded this stack, if available. - optional StackTrace parent - # Asynchronous JavaScript stack trace that preceded this stack, if available. - experimental optional StackTraceId parentId - - # Unique identifier of current debugger. - experimental type UniqueDebuggerId extends string - - # If `debuggerId` is set stack trace comes from another debugger and can be resolved there. This - # allows to track cross-debugger calls. See `Runtime.StackTrace` and `Debugger.paused` for usages. - experimental type StackTraceId extends object - properties - string id - optional UniqueDebuggerId debuggerId - - # Add handler to promise with given promise object id. - command awaitPromise - parameters - # Identifier of the promise. - RemoteObjectId promiseObjectId - # Whether the result is expected to be a JSON object that should be sent by value. - optional boolean returnByValue - # Whether preview should be generated for the result. - optional boolean generatePreview - returns - # Promise result. Will contain rejected value if promise was rejected. - RemoteObject result - # Exception details if stack strace is available. - optional ExceptionDetails exceptionDetails - - # Calls function with given declaration on the given object. Object group of the result is - # inherited from the target object. - command callFunctionOn - parameters - # Declaration of the function to call. - string functionDeclaration - # Identifier of the object to call function on. Either objectId or executionContextId should - # be specified. - optional RemoteObjectId objectId - # Call arguments. All call arguments must belong to the same JavaScript world as the target - # object. - optional array of CallArgument arguments - # In silent mode exceptions thrown during evaluation are not reported and do not pause - # execution. Overrides `setPauseOnException` state. - optional boolean silent - # Whether the result is expected to be a JSON object which should be sent by value. - optional boolean returnByValue - # Whether preview should be generated for the result. - experimental optional boolean generatePreview - # Whether execution should be treated as initiated by user in the UI. - optional boolean userGesture - # Whether execution should `await` for resulting value and return once awaited promise is - # resolved. - optional boolean awaitPromise - # Specifies execution context which global object will be used to call function on. Either - # executionContextId or objectId should be specified. - optional ExecutionContextId executionContextId - # Symbolic group name that can be used to release multiple objects. If objectGroup is not - # specified and objectId is, objectGroup will be inherited from object. - optional string objectGroup - # Whether to throw an exception if side effect cannot be ruled out during evaluation. - experimental optional boolean throwOnSideEffect - returns - # Call result. - RemoteObject result - # Exception details. - optional ExceptionDetails exceptionDetails - - # Compiles expression. - command compileScript - parameters - # Expression to compile. - string expression - # Source url to be set for the script. - string sourceURL - # Specifies whether the compiled script should be persisted. - boolean persistScript - # Specifies in which execution context to perform script run. If the parameter is omitted the - # evaluation will be performed in the context of the inspected page. - optional ExecutionContextId executionContextId - returns - # Id of the script. - optional ScriptId scriptId - # Exception details. - optional ExceptionDetails exceptionDetails - - # Disables reporting of execution contexts creation. - command disable - - # Discards collected exceptions and console API calls. - command discardConsoleEntries - - # Enables reporting of execution contexts creation by means of `executionContextCreated` event. - # When the reporting gets enabled the event will be sent immediately for each existing execution - # context. - command enable - - # Evaluates expression on global object. - command evaluate - parameters - # Expression to evaluate. - string expression - # Symbolic group name that can be used to release multiple objects. - optional string objectGroup - # Determines whether Command Line API should be available during the evaluation. - optional boolean includeCommandLineAPI - # In silent mode exceptions thrown during evaluation are not reported and do not pause - # execution. Overrides `setPauseOnException` state. - optional boolean silent - # Specifies in which execution context to perform evaluation. If the parameter is omitted the - # evaluation will be performed in the context of the inspected page. - # This is mutually exclusive with `uniqueContextId`, which offers an - # alternative way to identify the execution context that is more reliable - # in a multi-process environment. - optional ExecutionContextId contextId - # Whether the result is expected to be a JSON object that should be sent by value. - optional boolean returnByValue - # Whether preview should be generated for the result. - experimental optional boolean generatePreview - # Whether execution should be treated as initiated by user in the UI. - optional boolean userGesture - # Whether execution should `await` for resulting value and return once awaited promise is - # resolved. - optional boolean awaitPromise - # Whether to throw an exception if side effect cannot be ruled out during evaluation. - # This implies `disableBreaks` below. - experimental optional boolean throwOnSideEffect - # Terminate execution after timing out (number of milliseconds). - experimental optional TimeDelta timeout - # Disable breakpoints during execution. - experimental optional boolean disableBreaks - # Setting this flag to true enables `let` re-declaration and top-level `await`. - # Note that `let` variables can only be re-declared if they originate from - # `replMode` themselves. - experimental optional boolean replMode - # The Content Security Policy (CSP) for the target might block 'unsafe-eval' - # which includes eval(), Function(), setTimeout() and setInterval() - # when called with non-callable arguments. This flag bypasses CSP for this - # evaluation and allows unsafe-eval. Defaults to true. - experimental optional boolean allowUnsafeEvalBlockedByCSP - # An alternative way to specify the execution context to evaluate in. - # Compared to contextId that may be reused across processes, this is guaranteed to be - # system-unique, so it can be used to prevent accidental evaluation of the expression - # in context different than intended (e.g. as a result of navigation across process - # boundaries). - # This is mutually exclusive with `contextId`. - experimental optional string uniqueContextId - returns - # Evaluation result. - RemoteObject result - # Exception details. - optional ExceptionDetails exceptionDetails - - # Returns the isolate id. - experimental command getIsolateId - returns - # The isolate id. - string id - - # Returns the JavaScript heap usage. - # It is the total usage of the corresponding isolate not scoped to a particular Runtime. - experimental command getHeapUsage - returns - # Used heap size in bytes. - number usedSize - # Allocated heap size in bytes. - number totalSize - - # Returns properties of a given object. Object group of the result is inherited from the target - # object. - command getProperties - parameters - # Identifier of the object to return properties for. - RemoteObjectId objectId - # If true, returns properties belonging only to the element itself, not to its prototype - # chain. - optional boolean ownProperties - # If true, returns accessor properties (with getter/setter) only; internal properties are not - # returned either. - experimental optional boolean accessorPropertiesOnly - # Whether preview should be generated for the results. - experimental optional boolean generatePreview - returns - # Object properties. - array of PropertyDescriptor result - # Internal object properties (only of the element itself). - optional array of InternalPropertyDescriptor internalProperties - # Object private properties. - experimental optional array of PrivatePropertyDescriptor privateProperties - # Exception details. - optional ExceptionDetails exceptionDetails - - # Returns all let, const and class variables from global scope. - command globalLexicalScopeNames - parameters - # Specifies in which execution context to lookup global scope variables. - optional ExecutionContextId executionContextId - returns - array of string names - - command queryObjects - parameters - # Identifier of the prototype to return objects for. - RemoteObjectId prototypeObjectId - # Symbolic group name that can be used to release the results. - optional string objectGroup - returns - # Array with objects. - RemoteObject objects - - # Releases remote object with given id. - command releaseObject - parameters - # Identifier of the object to release. - RemoteObjectId objectId - - # Releases all remote objects that belong to a given group. - command releaseObjectGroup - parameters - # Symbolic object group name. - string objectGroup - - # Tells inspected instance to run if it was waiting for debugger to attach. - command runIfWaitingForDebugger - - # Runs script with given id in a given context. - command runScript - parameters - # Id of the script to run. - ScriptId scriptId - # Specifies in which execution context to perform script run. If the parameter is omitted the - # evaluation will be performed in the context of the inspected page. - optional ExecutionContextId executionContextId - # Symbolic group name that can be used to release multiple objects. - optional string objectGroup - # In silent mode exceptions thrown during evaluation are not reported and do not pause - # execution. Overrides `setPauseOnException` state. - optional boolean silent - # Determines whether Command Line API should be available during the evaluation. - optional boolean includeCommandLineAPI - # Whether the result is expected to be a JSON object which should be sent by value. - optional boolean returnByValue - # Whether preview should be generated for the result. - optional boolean generatePreview - # Whether execution should `await` for resulting value and return once awaited promise is - # resolved. - optional boolean awaitPromise - returns - # Run result. - RemoteObject result - # Exception details. - optional ExceptionDetails exceptionDetails - - # Enables or disables async call stacks tracking. - command setAsyncCallStackDepth - redirect Debugger - parameters - # Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async - # call stacks (default). - integer maxDepth - - experimental command setCustomObjectFormatterEnabled - parameters - boolean enabled - - experimental command setMaxCallStackSizeToCapture - parameters - integer size - - # Terminate current or next JavaScript execution. - # Will cancel the termination when the outer-most script execution ends. - experimental command terminateExecution - - # If executionContextId is empty, adds binding with the given name on the - # global objects of all inspected contexts, including those created later, - # bindings survive reloads. - # Binding function takes exactly one argument, this argument should be string, - # in case of any other input, function throws an exception. - # Each binding function call produces Runtime.bindingCalled notification. - experimental command addBinding - parameters - string name - # If specified, the binding would only be exposed to the specified - # execution context. If omitted and `executionContextName` is not set, - # the binding is exposed to all execution contexts of the target. - # This parameter is mutually exclusive with `executionContextName`. - # Deprecated in favor of `executionContextName` due to an unclear use case - # and bugs in implementation (crbug.com/1169639). `executionContextId` will be - # removed in the future. - deprecated optional ExecutionContextId executionContextId - # If specified, the binding is exposed to the executionContext with - # matching name, even for contexts created after the binding is added. - # See also `ExecutionContext.name` and `worldName` parameter to - # `Page.addScriptToEvaluateOnNewDocument`. - # This parameter is mutually exclusive with `executionContextId`. - experimental optional string executionContextName - - # This method does not remove binding function from global object but - # unsubscribes current runtime agent from Runtime.bindingCalled notifications. - experimental command removeBinding - parameters - string name - - # Notification is issued every time when binding is called. - experimental event bindingCalled - parameters - string name - string payload - # Identifier of the context where the call was made. - ExecutionContextId executionContextId - - # Issued when console API was called. - event consoleAPICalled - parameters - # Type of the call. - enum type - log - debug - info - error - warning - dir - dirxml - table - trace - clear - startGroup - startGroupCollapsed - endGroup - assert - profile - profileEnd - count - timeEnd - # Call arguments. - array of RemoteObject args - # Identifier of the context where the call was made. - ExecutionContextId executionContextId - # Call timestamp. - Timestamp timestamp - # Stack trace captured when the call was made. The async stack chain is automatically reported for - # the following call types: `assert`, `error`, `trace`, `warning`. For other types the async call - # chain can be retrieved using `Debugger.getStackTrace` and `stackTrace.parentId` field. - optional StackTrace stackTrace - # Console context descriptor for calls on non-default console context (not console.*): - # 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call - # on named context. - experimental optional string context - - # Issued when unhandled exception was revoked. - event exceptionRevoked - parameters - # Reason describing why exception was revoked. - string reason - # The id of revoked exception, as reported in `exceptionThrown`. - integer exceptionId - - # Issued when exception was thrown and unhandled. - event exceptionThrown - parameters - # Timestamp of the exception. - Timestamp timestamp - ExceptionDetails exceptionDetails - - # Issued when new execution context is created. - event executionContextCreated - parameters - # A newly created execution context. - ExecutionContextDescription context - - # Issued when execution context is destroyed. - event executionContextDestroyed - parameters - # Id of the destroyed context - ExecutionContextId executionContextId - - # Issued when all executionContexts were cleared in browser - event executionContextsCleared - - # Issued when object should be inspected (for example, as a result of inspect() command line API - # call). - event inspectRequested - parameters - RemoteObject object - object hints - # Identifier of the context where the call was made. - experimental optional ExecutionContextId executionContextId - -# This domain is deprecated. -deprecated domain Schema - - # Description of the protocol domain. - type Domain extends object - properties - # Domain name. - string name - # Domain version. - string version - - # Returns supported domains. - command getDomains - returns - # List of supported domains. - array of Domain domains diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/DEPS b/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/DEPS deleted file mode 100644 index d8bcf998..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/DEPS +++ /dev/null @@ -1,9 +0,0 @@ -include_rules = [ - "+libplatform/libplatform-export.h", -] - -specific_include_rules = { - "libplatform\.h": [ - "+libplatform/v8-tracing.h", - ], -} diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform-export.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform-export.h deleted file mode 100644 index 15618434..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform-export.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ -#define V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ - -#if defined(_WIN32) - -#ifdef BUILDING_V8_PLATFORM_SHARED -#define V8_PLATFORM_EXPORT __declspec(dllexport) -#elif USING_V8_PLATFORM_SHARED -#define V8_PLATFORM_EXPORT __declspec(dllimport) -#else -#define V8_PLATFORM_EXPORT -#endif // BUILDING_V8_PLATFORM_SHARED - -#else // defined(_WIN32) - -// Setup for Linux shared library export. -#ifdef BUILDING_V8_PLATFORM_SHARED -#define V8_PLATFORM_EXPORT __attribute__((visibility("default"))) -#else -#define V8_PLATFORM_EXPORT -#endif - -#endif // defined(_WIN32) - -#endif // V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform.h deleted file mode 100644 index 00de81df..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/libplatform.h +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_ -#define V8_LIBPLATFORM_LIBPLATFORM_H_ - -#include - -#include "libplatform/libplatform-export.h" -#include "libplatform/v8-tracing.h" -#include "v8-platform.h" // NOLINT(build/include_directory) -#include "v8config.h" // NOLINT(build/include_directory) - -namespace v8 { -namespace platform { - -enum class IdleTaskSupport { kDisabled, kEnabled }; -enum class InProcessStackDumping { kDisabled, kEnabled }; - -enum class MessageLoopBehavior : bool { - kDoNotWait = false, - kWaitForWork = true -}; - -/** - * Returns a new instance of the default v8::Platform implementation. - * - * The caller will take ownership of the returned pointer. |thread_pool_size| - * is the number of worker threads to allocate for background jobs. If a value - * of zero is passed, a suitable default based on the current number of - * processors online will be chosen. - * If |idle_task_support| is enabled then the platform will accept idle - * tasks (IdleTasksEnabled will return true) and will rely on the embedder - * calling v8::platform::RunIdleTasks to process the idle tasks. - * If |tracing_controller| is nullptr, the default platform will create a - * v8::platform::TracingController instance and use it. - */ -V8_PLATFORM_EXPORT std::unique_ptr NewDefaultPlatform( - int thread_pool_size = 0, - IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled, - InProcessStackDumping in_process_stack_dumping = - InProcessStackDumping::kDisabled, - std::unique_ptr tracing_controller = {}); - -/** - * The same as NewDefaultPlatform but disables the worker thread pool. - * It must be used with the --single-threaded V8 flag. - */ -V8_PLATFORM_EXPORT std::unique_ptr -NewSingleThreadedDefaultPlatform( - IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled, - InProcessStackDumping in_process_stack_dumping = - InProcessStackDumping::kDisabled, - std::unique_ptr tracing_controller = {}); - -/** - * Returns a new instance of the default v8::JobHandle implementation. - * - * The job will be executed by spawning up to |num_worker_threads| many worker - * threads on the provided |platform| with the given |priority|. - */ -V8_PLATFORM_EXPORT std::unique_ptr NewDefaultJobHandle( - v8::Platform* platform, v8::TaskPriority priority, - std::unique_ptr job_task, size_t num_worker_threads); - -/** - * Pumps the message loop for the given isolate. - * - * The caller has to make sure that this is called from the right thread. - * Returns true if a task was executed, and false otherwise. If the call to - * PumpMessageLoop is nested within another call to PumpMessageLoop, only - * nestable tasks may run. Otherwise, any task may run. Unless requested through - * the |behavior| parameter, this call does not block if no task is pending. The - * |platform| has to be created using |NewDefaultPlatform|. - */ -V8_PLATFORM_EXPORT bool PumpMessageLoop( - v8::Platform* platform, v8::Isolate* isolate, - MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait); - -/** - * Runs pending idle tasks for at most |idle_time_in_seconds| seconds. - * - * The caller has to make sure that this is called from the right thread. - * This call does not block if no task is pending. The |platform| has to be - * created using |NewDefaultPlatform|. - */ -V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform, - v8::Isolate* isolate, - double idle_time_in_seconds); - -/** - * Attempts to set the tracing controller for the given platform. - * - * The |platform| has to be created using |NewDefaultPlatform|. - * - */ -V8_DEPRECATE_SOON("Access the DefaultPlatform directly") -V8_PLATFORM_EXPORT void SetTracingController( - v8::Platform* platform, - v8::platform::tracing::TracingController* tracing_controller); - -/** - * Notifies the given platform about the Isolate getting deleted soon. Has to be - * called for all Isolates which are deleted - unless we're shutting down the - * platform. - * - * The |platform| has to be created using |NewDefaultPlatform|. - * - */ -V8_PLATFORM_EXPORT void NotifyIsolateShutdown(v8::Platform* platform, - Isolate* isolate); - -} // namespace platform -} // namespace v8 - -#endif // V8_LIBPLATFORM_LIBPLATFORM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/v8-tracing.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/v8-tracing.h deleted file mode 100644 index c7a5c4f9..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/libplatform/v8-tracing.h +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_LIBPLATFORM_V8_TRACING_H_ -#define V8_LIBPLATFORM_V8_TRACING_H_ - -#include -#include -#include -#include -#include - -#include "libplatform/libplatform-export.h" -#include "v8-platform.h" // NOLINT(build/include_directory) - -namespace perfetto { -namespace trace_processor { -class TraceProcessorStorage; -} -class TracingSession; -} - -namespace v8 { - -namespace base { -class Mutex; -} // namespace base - -namespace platform { -namespace tracing { - -class TraceEventListener; - -const int kTraceMaxNumArgs = 2; - -class V8_PLATFORM_EXPORT TraceObject { - public: - union ArgValue { - V8_DEPRECATED("use as_uint ? true : false") bool as_bool; - uint64_t as_uint; - int64_t as_int; - double as_double; - const void* as_pointer; - const char* as_string; - }; - - TraceObject() = default; - ~TraceObject(); - void Initialize( - char phase, const uint8_t* category_enabled_flag, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags, int64_t timestamp, int64_t cpu_timestamp); - void UpdateDuration(int64_t timestamp, int64_t cpu_timestamp); - void InitializeForTesting( - char phase, const uint8_t* category_enabled_flag, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags, int pid, int tid, int64_t ts, int64_t tts, - uint64_t duration, uint64_t cpu_duration); - - int pid() const { return pid_; } - int tid() const { return tid_; } - char phase() const { return phase_; } - const uint8_t* category_enabled_flag() const { - return category_enabled_flag_; - } - const char* name() const { return name_; } - const char* scope() const { return scope_; } - uint64_t id() const { return id_; } - uint64_t bind_id() const { return bind_id_; } - int num_args() const { return num_args_; } - const char** arg_names() { return arg_names_; } - uint8_t* arg_types() { return arg_types_; } - ArgValue* arg_values() { return arg_values_; } - std::unique_ptr* arg_convertables() { - return arg_convertables_; - } - unsigned int flags() const { return flags_; } - int64_t ts() { return ts_; } - int64_t tts() { return tts_; } - uint64_t duration() { return duration_; } - uint64_t cpu_duration() { return cpu_duration_; } - - private: - int pid_; - int tid_; - char phase_; - const char* name_; - const char* scope_; - const uint8_t* category_enabled_flag_; - uint64_t id_; - uint64_t bind_id_; - int num_args_ = 0; - const char* arg_names_[kTraceMaxNumArgs]; - uint8_t arg_types_[kTraceMaxNumArgs]; - ArgValue arg_values_[kTraceMaxNumArgs]; - std::unique_ptr - arg_convertables_[kTraceMaxNumArgs]; - char* parameter_copy_storage_ = nullptr; - unsigned int flags_; - int64_t ts_; - int64_t tts_; - uint64_t duration_; - uint64_t cpu_duration_; - - // Disallow copy and assign - TraceObject(const TraceObject&) = delete; - void operator=(const TraceObject&) = delete; -}; - -class V8_PLATFORM_EXPORT TraceWriter { - public: - TraceWriter() = default; - virtual ~TraceWriter() = default; - virtual void AppendTraceEvent(TraceObject* trace_event) = 0; - virtual void Flush() = 0; - - static TraceWriter* CreateJSONTraceWriter(std::ostream& stream); - static TraceWriter* CreateJSONTraceWriter(std::ostream& stream, - const std::string& tag); - - static TraceWriter* CreateSystemInstrumentationTraceWriter(); - - private: - // Disallow copy and assign - TraceWriter(const TraceWriter&) = delete; - void operator=(const TraceWriter&) = delete; -}; - -class V8_PLATFORM_EXPORT TraceBufferChunk { - public: - explicit TraceBufferChunk(uint32_t seq); - - void Reset(uint32_t new_seq); - bool IsFull() const { return next_free_ == kChunkSize; } - TraceObject* AddTraceEvent(size_t* event_index); - TraceObject* GetEventAt(size_t index) { return &chunk_[index]; } - - uint32_t seq() const { return seq_; } - size_t size() const { return next_free_; } - - static const size_t kChunkSize = 64; - - private: - size_t next_free_ = 0; - TraceObject chunk_[kChunkSize]; - uint32_t seq_; - - // Disallow copy and assign - TraceBufferChunk(const TraceBufferChunk&) = delete; - void operator=(const TraceBufferChunk&) = delete; -}; - -class V8_PLATFORM_EXPORT TraceBuffer { - public: - TraceBuffer() = default; - virtual ~TraceBuffer() = default; - - virtual TraceObject* AddTraceEvent(uint64_t* handle) = 0; - virtual TraceObject* GetEventByHandle(uint64_t handle) = 0; - virtual bool Flush() = 0; - - static const size_t kRingBufferChunks = 1024; - - static TraceBuffer* CreateTraceBufferRingBuffer(size_t max_chunks, - TraceWriter* trace_writer); - - private: - // Disallow copy and assign - TraceBuffer(const TraceBuffer&) = delete; - void operator=(const TraceBuffer&) = delete; -}; - -// Options determines how the trace buffer stores data. -enum TraceRecordMode { - // Record until the trace buffer is full. - RECORD_UNTIL_FULL, - - // Record until the user ends the trace. The trace buffer is a fixed size - // and we use it as a ring buffer during recording. - RECORD_CONTINUOUSLY, - - // Record until the trace buffer is full, but with a huge buffer size. - RECORD_AS_MUCH_AS_POSSIBLE, - - // Echo to console. Events are discarded. - ECHO_TO_CONSOLE, -}; - -class V8_PLATFORM_EXPORT TraceConfig { - public: - typedef std::vector StringList; - - static TraceConfig* CreateDefaultTraceConfig(); - - TraceConfig() : enable_systrace_(false), enable_argument_filter_(false) {} - TraceRecordMode GetTraceRecordMode() const { return record_mode_; } - const StringList& GetEnabledCategories() const { - return included_categories_; - } - bool IsSystraceEnabled() const { return enable_systrace_; } - bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } - - void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } - void EnableSystrace() { enable_systrace_ = true; } - void EnableArgumentFilter() { enable_argument_filter_ = true; } - - void AddIncludedCategory(const char* included_category); - - bool IsCategoryGroupEnabled(const char* category_group) const; - - private: - TraceRecordMode record_mode_; - bool enable_systrace_ : 1; - bool enable_argument_filter_ : 1; - StringList included_categories_; - - // Disallow copy and assign - TraceConfig(const TraceConfig&) = delete; - void operator=(const TraceConfig&) = delete; -}; - -#if defined(_MSC_VER) -#define V8_PLATFORM_NON_EXPORTED_BASE(code) \ - __pragma(warning(suppress : 4275)) code -#else -#define V8_PLATFORM_NON_EXPORTED_BASE(code) code -#endif // defined(_MSC_VER) - -class V8_PLATFORM_EXPORT TracingController - : public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) { - public: - TracingController(); - ~TracingController() override; - -#if defined(V8_USE_PERFETTO) - // Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides - // the output stream for the JSON trace data. - void InitializeForPerfetto(std::ostream* output_stream); - // Provide an optional listener for testing that will receive trace events. - // Must be called before StartTracing(). - void SetTraceEventListenerForTesting(TraceEventListener* listener); -#else // defined(V8_USE_PERFETTO) - // The pointer returned from GetCategoryGroupEnabled() points to a value with - // zero or more of the following bits. Used in this class only. The - // TRACE_EVENT macros should only use the value as a bool. These values must - // be in sync with macro values in TraceEvent.h in Blink. - enum CategoryGroupEnabledFlags { - // Category group enabled for the recording mode. - ENABLED_FOR_RECORDING = 1 << 0, - // Category group enabled by SetEventCallbackEnabled(). - ENABLED_FOR_EVENT_CALLBACK = 1 << 2, - // Category group enabled to export events to ETW. - ENABLED_FOR_ETW_EXPORT = 1 << 3 - }; - - // Takes ownership of |trace_buffer|. - void Initialize(TraceBuffer* trace_buffer); - - // v8::TracingController implementation. - const uint8_t* GetCategoryGroupEnabled(const char* category_group) override; - uint64_t AddTraceEvent( - char phase, const uint8_t* category_enabled_flag, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags) override; - uint64_t AddTraceEventWithTimestamp( - char phase, const uint8_t* category_enabled_flag, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags, int64_t timestamp) override; - void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, - const char* name, uint64_t handle) override; - - static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag); -#endif // !defined(V8_USE_PERFETTO) - - void AddTraceStateObserver( - v8::TracingController::TraceStateObserver* observer) override; - void RemoveTraceStateObserver( - v8::TracingController::TraceStateObserver* observer) override; - - void StartTracing(TraceConfig* trace_config); - void StopTracing(); - - protected: -#if !defined(V8_USE_PERFETTO) - virtual int64_t CurrentTimestampMicroseconds(); - virtual int64_t CurrentCpuTimestampMicroseconds(); -#endif // !defined(V8_USE_PERFETTO) - - private: -#if !defined(V8_USE_PERFETTO) - void UpdateCategoryGroupEnabledFlag(size_t category_index); - void UpdateCategoryGroupEnabledFlags(); -#endif // !defined(V8_USE_PERFETTO) - - std::unique_ptr mutex_; - std::unique_ptr trace_config_; - std::atomic_bool recording_{false}; - std::unordered_set observers_; - -#if defined(V8_USE_PERFETTO) - std::ostream* output_stream_ = nullptr; - std::unique_ptr - trace_processor_; - TraceEventListener* listener_for_testing_ = nullptr; - std::unique_ptr tracing_session_; -#else // !defined(V8_USE_PERFETTO) - std::unique_ptr trace_buffer_; -#endif // !defined(V8_USE_PERFETTO) - - // Disallow copy and assign - TracingController(const TracingController&) = delete; - void operator=(const TracingController&) = delete; -}; - -#undef V8_PLATFORM_NON_EXPORTED_BASE - -} // namespace tracing -} // namespace platform -} // namespace v8 - -#endif // V8_LIBPLATFORM_V8_TRACING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-cppgc.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-cppgc.h deleted file mode 100644 index 745fb043..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-cppgc.h +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_V8_CPPGC_H_ -#define INCLUDE_V8_CPPGC_H_ - -#include -#include -#include - -#include "cppgc/common.h" -#include "cppgc/custom-space.h" -#include "cppgc/heap-statistics.h" -#include "cppgc/internal/write-barrier.h" -#include "cppgc/visitor.h" -#include "v8-internal.h" // NOLINT(build/include_directory) -#include "v8.h" // NOLINT(build/include_directory) - -namespace cppgc { -class AllocationHandle; -class HeapHandle; -} // namespace cppgc - -namespace v8 { - -namespace internal { -class CppHeap; -} // namespace internal - -class CustomSpaceStatisticsReceiver; - -/** - * Describes how V8 wrapper objects maintain references to garbage-collected C++ - * objects. - */ -struct WrapperDescriptor final { - /** - * The index used on `v8::Ojbect::SetAlignedPointerFromInternalField()` and - * related APIs to add additional data to an object which is used to identify - * JS->C++ references. - */ - using InternalFieldIndex = int; - - /** - * Unknown embedder id. The value is reserved for internal usages and must not - * be used with `CppHeap`. - */ - static constexpr uint16_t kUnknownEmbedderId = UINT16_MAX; - - constexpr WrapperDescriptor(InternalFieldIndex wrappable_type_index, - InternalFieldIndex wrappable_instance_index, - uint16_t embedder_id_for_garbage_collected) - : wrappable_type_index(wrappable_type_index), - wrappable_instance_index(wrappable_instance_index), - embedder_id_for_garbage_collected(embedder_id_for_garbage_collected) {} - - /** - * Index of the wrappable type. - */ - InternalFieldIndex wrappable_type_index; - - /** - * Index of the wrappable instance. - */ - InternalFieldIndex wrappable_instance_index; - - /** - * Embedder id identifying instances of garbage-collected objects. It is - * expected that the first field of the wrappable type is a uint16_t holding - * the id. Only references to instances of wrappables types with an id of - * `embedder_id_for_garbage_collected` will be considered by CppHeap. - */ - uint16_t embedder_id_for_garbage_collected; -}; - -struct V8_EXPORT CppHeapCreateParams { - CppHeapCreateParams(const CppHeapCreateParams&) = delete; - CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete; - - std::vector> custom_spaces; - WrapperDescriptor wrapper_descriptor; -}; - -/** - * A heap for allocating managed C++ objects. - */ -class V8_EXPORT CppHeap { - public: - static std::unique_ptr Create(v8::Platform* platform, - const CppHeapCreateParams& params); - - virtual ~CppHeap() = default; - - /** - * \returns the opaque handle for allocating objects using - * `MakeGarbageCollected()`. - */ - cppgc::AllocationHandle& GetAllocationHandle(); - - /** - * \returns the opaque heap handle which may be used to refer to this heap in - * other APIs. Valid as long as the underlying `CppHeap` is alive. - */ - cppgc::HeapHandle& GetHeapHandle(); - - /** - * Terminate clears all roots and performs multiple garbage collections to - * reclaim potentially newly created objects in destructors. - * - * After this call, object allocation is prohibited. - */ - void Terminate(); - - /** - * \param detail_level specifies whether should return detailed - * statistics or only brief summary statistics. - * \returns current CppHeap statistics regarding memory consumption - * and utilization. - */ - cppgc::HeapStatistics CollectStatistics( - cppgc::HeapStatistics::DetailLevel detail_level); - - /** - * Collects statistics for the given spaces and reports them to the receiver. - * - * \param custom_spaces a collection of custom space indicies. - * \param receiver an object that gets the results. - */ - void CollectCustomSpaceStatisticsAtLastGC( - std::vector custom_spaces, - std::unique_ptr receiver); - - /** - * Enables a detached mode that allows testing garbage collection using - * `cppgc::testing` APIs. Once used, the heap cannot be attached to an - * `Isolate` anymore. - */ - void EnableDetachedGarbageCollectionsForTesting(); - - /** - * Performs a stop-the-world garbage collection for testing purposes. - * - * \param stack_state The stack state to assume for the garbage collection. - */ - void CollectGarbageForTesting(cppgc::EmbedderStackState stack_state); - - private: - CppHeap() = default; - - friend class internal::CppHeap; -}; - -class JSVisitor : public cppgc::Visitor { - public: - explicit JSVisitor(cppgc::Visitor::Key key) : cppgc::Visitor(key) {} - - void Trace(const TracedReferenceBase& ref) { - if (ref.IsEmptyThreadSafe()) return; - Visit(ref); - } - - protected: - using cppgc::Visitor::Visit; - - virtual void Visit(const TracedReferenceBase& ref) {} -}; - -/** - * **DO NOT USE: Use the appropriate managed types.** - * - * Consistency helpers that aid in maintaining a consistent internal state of - * the garbage collector. - */ -class V8_EXPORT JSHeapConsistency final { - public: - using WriteBarrierParams = cppgc::internal::WriteBarrier::Params; - using WriteBarrierType = cppgc::internal::WriteBarrier::Type; - - /** - * Gets the required write barrier type for a specific write. - * - * Note: Handling for C++ to JS references. - * - * \param ref The reference being written to. - * \param params Parameters that may be used for actual write barrier calls. - * Only filled if return value indicates that a write barrier is needed. The - * contents of the `params` are an implementation detail. - * \param callback Callback returning the corresponding heap handle. The - * callback is only invoked if the heap cannot otherwise be figured out. The - * callback must not allocate. - * \returns whether a write barrier is needed and which barrier to invoke. - */ - template - static V8_INLINE WriteBarrierType - GetWriteBarrierType(const TracedReferenceBase& ref, - WriteBarrierParams& params, HeapHandleCallback callback) { - if (ref.IsEmpty()) return WriteBarrierType::kNone; - - if (V8_LIKELY(!cppgc::internal::WriteBarrier:: - IsAnyIncrementalOrConcurrentMarking())) { - return cppgc::internal::WriteBarrier::Type::kNone; - } - cppgc::HeapHandle& handle = callback(); - if (!cppgc::subtle::HeapState::IsMarking(handle)) { - return cppgc::internal::WriteBarrier::Type::kNone; - } - params.heap = &handle; -#if V8_ENABLE_CHECKS - params.type = cppgc::internal::WriteBarrier::Type::kMarking; -#endif // !V8_ENABLE_CHECKS - return cppgc::internal::WriteBarrier::Type::kMarking; - } - - /** - * Gets the required write barrier type for a specific write. - * - * Note: Handling for JS to C++ references. - * - * \param wrapper The wrapper that has been written into. - * \param wrapper_index The wrapper index in `wrapper` that has been written - * into. - * \param wrappable The value that was written. - * \param params Parameters that may be used for actual write barrier calls. - * Only filled if return value indicates that a write barrier is needed. The - * contents of the `params` are an implementation detail. - * \param callback Callback returning the corresponding heap handle. The - * callback is only invoked if the heap cannot otherwise be figured out. The - * callback must not allocate. - * \returns whether a write barrier is needed and which barrier to invoke. - */ - template - static V8_INLINE WriteBarrierType GetWriteBarrierType( - v8::Local& wrapper, int wrapper_index, const void* wrappable, - WriteBarrierParams& params, HeapHandleCallback callback) { -#if V8_ENABLE_CHECKS - CheckWrapper(wrapper, wrapper_index, wrappable); -#endif // V8_ENABLE_CHECKS - return cppgc::internal::WriteBarrier:: - GetWriteBarrierTypeForExternallyReferencedObject(wrappable, params, - callback); - } - - /** - * Conservative Dijkstra-style write barrier that processes an object if it - * has not yet been processed. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param ref The reference being written to. - */ - static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params, - cppgc::HeapHandle& heap_handle, - const TracedReferenceBase& ref) { - cppgc::internal::WriteBarrier::CheckParams(WriteBarrierType::kMarking, - params); - DijkstraMarkingBarrierSlow(heap_handle, ref); - } - - /** - * Conservative Dijkstra-style write barrier that processes an object if it - * has not yet been processed. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param object The pointer to the object. May be an interior pointer to a - * an interface of the actual object. - */ - static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params, - cppgc::HeapHandle& heap_handle, - const void* object) { - cppgc::internal::WriteBarrier::DijkstraMarkingBarrier(params, object); - } - - /** - * Generational barrier for maintaining consistency when running with multiple - * generations. - * - * \param params The parameters retrieved from `GetWriteBarrierType()`. - * \param ref The reference being written to. - */ - static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params, - const TracedReferenceBase& ref) {} - - private: - JSHeapConsistency() = delete; - - static void CheckWrapper(v8::Local&, int, const void*); - - static void DijkstraMarkingBarrierSlow(cppgc::HeapHandle&, - const TracedReferenceBase& ref); -}; - -/** - * Provided as input to `CppHeap::CollectCustomSpaceStatisticsAtLastGC()`. - * - * Its method is invoked with the results of the statistic collection. - */ -class CustomSpaceStatisticsReceiver { - public: - virtual ~CustomSpaceStatisticsReceiver() = default; - /** - * Reports the size of a space at the last GC. It is called for each space - * that was requested in `CollectCustomSpaceStatisticsAtLastGC()`. - * - * \param space_index The index of the space. - * \param bytes The total size of live objects in the space at the last GC. - * It is zero if there was no GC yet. - */ - virtual void AllocatedBytes(cppgc::CustomSpaceIndex space_index, - size_t bytes) = 0; -}; - -} // namespace v8 - -namespace cppgc { - -template -struct TraceTrait> { - static void Trace(Visitor* visitor, const v8::TracedReference* self) { - static_cast(visitor)->Trace(*self); - } -}; - -} // namespace cppgc - -#endif // INCLUDE_V8_CPPGC_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-fast-api-calls.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-fast-api-calls.h deleted file mode 100644 index 5dc7473e..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-fast-api-calls.h +++ /dev/null @@ -1,836 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * This file provides additional API on top of the default one for making - * API calls, which come from embedder C++ functions. The functions are being - * called directly from optimized code, doing all the necessary typechecks - * in the compiler itself, instead of on the embedder side. Hence the "fast" - * in the name. Example usage might look like: - * - * \code - * void FastMethod(int param, bool another_param); - * - * v8::FunctionTemplate::New(isolate, SlowCallback, data, - * signature, length, constructor_behavior - * side_effect_type, - * &v8::CFunction::Make(FastMethod)); - * \endcode - * - * By design, fast calls are limited by the following requirements, which - * the embedder should enforce themselves: - * - they should not allocate on the JS heap; - * - they should not trigger JS execution. - * To enforce them, the embedder could use the existing - * v8::Isolate::DisallowJavascriptExecutionScope and a utility similar to - * Blink's NoAllocationScope: - * https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/heap/thread_state_scopes.h;l=16 - * - * Due to these limitations, it's not directly possible to report errors by - * throwing a JS exception or to otherwise do an allocation. There is an - * alternative way of creating fast calls that supports falling back to the - * slow call and then performing the necessary allocation. When one creates - * the fast method by using CFunction::MakeWithFallbackSupport instead of - * CFunction::Make, the fast callback gets as last parameter an output variable, - * through which it can request falling back to the slow call. So one might - * declare their method like: - * - * \code - * void FastMethodWithFallback(int param, FastApiCallbackOptions& options); - * \endcode - * - * If the callback wants to signal an error condition or to perform an - * allocation, it must set options.fallback to true and do an early return from - * the fast method. Then V8 checks the value of options.fallback and if it's - * true, falls back to executing the SlowCallback, which is capable of reporting - * the error (either by throwing a JS exception or logging to the console) or - * doing the allocation. It's the embedder's responsibility to ensure that the - * fast callback is idempotent up to the point where error and fallback - * conditions are checked, because otherwise executing the slow callback might - * produce visible side-effects twice. - * - * An example for custom embedder type support might employ a way to wrap/ - * unwrap various C++ types in JSObject instances, e.g: - * - * \code - * - * // Helper method with a check for field count. - * template - * inline T* GetInternalField(v8::Local wrapper) { - * assert(offset < wrapper->InternalFieldCount()); - * return reinterpret_cast( - * wrapper->GetAlignedPointerFromInternalField(offset)); - * } - * - * class CustomEmbedderType { - * public: - * // Returns the raw C object from a wrapper JS object. - * static CustomEmbedderType* Unwrap(v8::Local wrapper) { - * return GetInternalField(wrapper); - * } - * static void FastMethod(v8::Local receiver_obj, int param) { - * CustomEmbedderType* receiver = static_cast( - * receiver_obj->GetAlignedPointerFromInternalField( - * kV8EmbedderWrapperObjectIndex)); - * - * // Type checks are already done by the optimized code. - * // Then call some performance-critical method like: - * // receiver->Method(param); - * } - * - * static void SlowMethod( - * const v8::FunctionCallbackInfo& info) { - * v8::Local instance = - * v8::Local::Cast(info.Holder()); - * CustomEmbedderType* receiver = Unwrap(instance); - * // TODO: Do type checks and extract {param}. - * receiver->Method(param); - * } - * }; - * - * // TODO(mslekova): Clean-up these constants - * // The constants kV8EmbedderWrapperTypeIndex and - * // kV8EmbedderWrapperObjectIndex describe the offsets for the type info - * // struct and the native object, when expressed as internal field indices - * // within a JSObject. The existance of this helper function assumes that - * // all embedder objects have their JSObject-side type info at the same - * // offset, but this is not a limitation of the API itself. For a detailed - * // use case, see the third example. - * static constexpr int kV8EmbedderWrapperTypeIndex = 0; - * static constexpr int kV8EmbedderWrapperObjectIndex = 1; - * - * // The following setup function can be templatized based on - * // the {embedder_object} argument. - * void SetupCustomEmbedderObject(v8::Isolate* isolate, - * v8::Local context, - * CustomEmbedderType* embedder_object) { - * isolate->set_embedder_wrapper_type_index( - * kV8EmbedderWrapperTypeIndex); - * isolate->set_embedder_wrapper_object_index( - * kV8EmbedderWrapperObjectIndex); - * - * v8::CFunction c_func = - * MakeV8CFunction(CustomEmbedderType::FastMethod); - * - * Local method_template = - * v8::FunctionTemplate::New( - * isolate, CustomEmbedderType::SlowMethod, v8::Local(), - * v8::Local(), 1, v8::ConstructorBehavior::kAllow, - * v8::SideEffectType::kHasSideEffect, &c_func); - * - * v8::Local object_template = - * v8::ObjectTemplate::New(isolate); - * object_template->SetInternalFieldCount( - * kV8EmbedderWrapperObjectIndex + 1); - * object_template->Set(isolate, "method", method_template); - * - * // Instantiate the wrapper JS object. - * v8::Local object = - * object_template->NewInstance(context).ToLocalChecked(); - * object->SetAlignedPointerInInternalField( - * kV8EmbedderWrapperObjectIndex, - * reinterpret_cast(embedder_object)); - * - * // TODO: Expose {object} where it's necessary. - * } - * \endcode - * - * For instance if {object} is exposed via a global "obj" variable, - * one could write in JS: - * function hot_func() { - * obj.method(42); - * } - * and once {hot_func} gets optimized, CustomEmbedderType::FastMethod - * will be called instead of the slow version, with the following arguments: - * receiver := the {embedder_object} from above - * param := 42 - * - * Currently supported return types: - * - void - * - bool - * - int32_t - * - uint32_t - * - float32_t - * - float64_t - * Currently supported argument types: - * - pointer to an embedder type - * - JavaScript array of primitive types - * - bool - * - int32_t - * - uint32_t - * - int64_t - * - uint64_t - * - float32_t - * - float64_t - * - * The 64-bit integer types currently have the IDL (unsigned) long long - * semantics: https://heycam.github.io/webidl/#abstract-opdef-converttoint - * In the future we'll extend the API to also provide conversions from/to - * BigInt to preserve full precision. - * The floating point types currently have the IDL (unrestricted) semantics, - * which is the only one used by WebGL. We plan to add support also for - * restricted floats/doubles, similarly to the BigInt conversion policies. - * We also differ from the specific NaN bit pattern that WebIDL prescribes - * (https://heycam.github.io/webidl/#es-unrestricted-float) in that Blink - * passes NaN values as-is, i.e. doesn't normalize them. - * - * To be supported types: - * - TypedArrays and ArrayBuffers - * - arrays of embedder types - * - * - * The API offers a limited support for function overloads: - * - * \code - * void FastMethod_2Args(int param, bool another_param); - * void FastMethod_3Args(int param, bool another_param, int third_param); - * - * v8::CFunction fast_method_2args_c_func = - * MakeV8CFunction(FastMethod_2Args); - * v8::CFunction fast_method_3args_c_func = - * MakeV8CFunction(FastMethod_3Args); - * const v8::CFunction fast_method_overloads[] = {fast_method_2args_c_func, - * fast_method_3args_c_func}; - * Local method_template = - * v8::FunctionTemplate::NewWithCFunctionOverloads( - * isolate, SlowCallback, data, signature, length, - * constructor_behavior, side_effect_type, - * {fast_method_overloads, 2}); - * \endcode - * - * In this example a single FunctionTemplate is associated to multiple C++ - * functions. The overload resolution is currently only based on the number of - * arguments passed in a call. For example, if this method_template is - * registered with a wrapper JS object as described above, a call with two - * arguments: - * obj.method(42, true); - * will result in a fast call to FastMethod_2Args, while a call with three or - * more arguments: - * obj.method(42, true, 11); - * will result in a fast call to FastMethod_3Args. Instead a call with less than - * two arguments, like: - * obj.method(42); - * would not result in a fast call but would fall back to executing the - * associated SlowCallback. - */ - -#ifndef INCLUDE_V8_FAST_API_CALLS_H_ -#define INCLUDE_V8_FAST_API_CALLS_H_ - -#include -#include - -#include -#include - -#include "v8-internal.h" // NOLINT(build/include_directory) -#include "v8.h" // NOLINT(build/include_directory) -#include "v8config.h" // NOLINT(build/include_directory) - -namespace v8 { - -class Isolate; - -class CTypeInfo { - public: - enum class Type : uint8_t { - kVoid, - kBool, - kInt32, - kUint32, - kInt64, - kUint64, - kFloat32, - kFloat64, - kV8Value, - kApiObject, // This will be deprecated once all users have - // migrated from v8::ApiObject to v8::Local. - }; - - // kCallbackOptionsType is not part of the Type enum - // because it is only used internally. Use value 255 that is larger - // than any valid Type enum. - static constexpr Type kCallbackOptionsType = Type(255); - - enum class SequenceType : uint8_t { - kScalar, - kIsSequence, // sequence - kIsTypedArray, // TypedArray of T or any ArrayBufferView if T - // is void - kIsArrayBuffer // ArrayBuffer - }; - - enum class Flags : uint8_t { - kNone = 0, - kAllowSharedBit = 1 << 0, // Must be an ArrayBuffer or TypedArray - kEnforceRangeBit = 1 << 1, // T must be integral - kClampBit = 1 << 2, // T must be integral - kIsRestrictedBit = 1 << 3, // T must be float or double - }; - - explicit constexpr CTypeInfo( - Type type, SequenceType sequence_type = SequenceType::kScalar, - Flags flags = Flags::kNone) - : type_(type), sequence_type_(sequence_type), flags_(flags) {} - - constexpr Type GetType() const { return type_; } - constexpr SequenceType GetSequenceType() const { return sequence_type_; } - constexpr Flags GetFlags() const { return flags_; } - - static constexpr bool IsIntegralType(Type type) { - return type == Type::kInt32 || type == Type::kUint32 || - type == Type::kInt64 || type == Type::kUint64; - } - - static constexpr bool IsFloatingPointType(Type type) { - return type == Type::kFloat32 || type == Type::kFloat64; - } - - static constexpr bool IsPrimitive(Type type) { - return IsIntegralType(type) || IsFloatingPointType(type) || - type == Type::kBool; - } - - private: - Type type_; - SequenceType sequence_type_; - Flags flags_; -}; - -struct FastApiTypedArrayBase { - public: - // Returns the length in number of elements. - size_t V8_EXPORT length() const { return length_; } - // Checks whether the given index is within the bounds of the collection. - void V8_EXPORT ValidateIndex(size_t index) const; - - protected: - size_t length_ = 0; -}; - -template -struct FastApiTypedArray : public FastApiTypedArrayBase { - public: - V8_INLINE T get(size_t index) const { -#ifdef DEBUG - ValidateIndex(index); -#endif // DEBUG - T tmp; - memcpy(&tmp, reinterpret_cast(data_) + index, sizeof(T)); - return tmp; - } - - private: - // This pointer should include the typed array offset applied. - // It's not guaranteed that it's aligned to sizeof(T), it's only - // guaranteed that it's 4-byte aligned, so for 8-byte types we need to - // provide a special implementation for reading from it, which hides - // the possibly unaligned read in the `get` method. - void* data_; -}; - -// Any TypedArray. It uses kTypedArrayBit with base type void -// Overloaded args of ArrayBufferView and TypedArray are not supported -// (for now) because the generic “any” ArrayBufferView doesn’t have its -// own instance type. It could be supported if we specify that -// TypedArray always has precedence over the generic ArrayBufferView, -// but this complicates overload resolution. -struct FastApiArrayBufferView { - void* data; - size_t byte_length; -}; - -struct FastApiArrayBuffer { - void* data; - size_t byte_length; -}; - -class V8_EXPORT CFunctionInfo { - public: - // Construct a struct to hold a CFunction's type information. - // |return_info| describes the function's return type. - // |arg_info| is an array of |arg_count| CTypeInfos describing the - // arguments. Only the last argument may be of the special type - // CTypeInfo::kCallbackOptionsType. - CFunctionInfo(const CTypeInfo& return_info, unsigned int arg_count, - const CTypeInfo* arg_info); - - const CTypeInfo& ReturnInfo() const { return return_info_; } - - // The argument count, not including the v8::FastApiCallbackOptions - // if present. - unsigned int ArgumentCount() const { - return HasOptions() ? arg_count_ - 1 : arg_count_; - } - - // |index| must be less than ArgumentCount(). - // Note: if the last argument passed on construction of CFunctionInfo - // has type CTypeInfo::kCallbackOptionsType, it is not included in - // ArgumentCount(). - const CTypeInfo& ArgumentInfo(unsigned int index) const; - - bool HasOptions() const { - // The options arg is always the last one. - return arg_count_ > 0 && arg_info_[arg_count_ - 1].GetType() == - CTypeInfo::kCallbackOptionsType; - } - - private: - const CTypeInfo return_info_; - const unsigned int arg_count_; - const CTypeInfo* arg_info_; -}; - -class V8_EXPORT CFunction { - public: - constexpr CFunction() : address_(nullptr), type_info_(nullptr) {} - - const CTypeInfo& ReturnInfo() const { return type_info_->ReturnInfo(); } - - const CTypeInfo& ArgumentInfo(unsigned int index) const { - return type_info_->ArgumentInfo(index); - } - - unsigned int ArgumentCount() const { return type_info_->ArgumentCount(); } - - const void* GetAddress() const { return address_; } - const CFunctionInfo* GetTypeInfo() const { return type_info_; } - - enum class OverloadResolution { kImpossible, kAtRuntime, kAtCompileTime }; - - // Returns whether an overload between this and the given CFunction can - // be resolved at runtime by the RTTI available for the arguments or at - // compile time for functions with different number of arguments. - OverloadResolution GetOverloadResolution(const CFunction* other) { - // Runtime overload resolution can only deal with functions with the - // same number of arguments. Functions with different arity are handled - // by compile time overload resolution though. - if (ArgumentCount() != other->ArgumentCount()) { - return OverloadResolution::kAtCompileTime; - } - - // The functions can only differ by a single argument position. - int diff_index = -1; - for (unsigned int i = 0; i < ArgumentCount(); ++i) { - if (ArgumentInfo(i).GetSequenceType() != - other->ArgumentInfo(i).GetSequenceType()) { - if (diff_index >= 0) { - return OverloadResolution::kImpossible; - } - diff_index = i; - - // We only support overload resolution between sequence types. - if (ArgumentInfo(i).GetSequenceType() == - CTypeInfo::SequenceType::kScalar || - other->ArgumentInfo(i).GetSequenceType() == - CTypeInfo::SequenceType::kScalar) { - return OverloadResolution::kImpossible; - } - } - } - - return OverloadResolution::kAtRuntime; - } - - template - static CFunction Make(F* func) { - return ArgUnwrap::Make(func); - } - - template - V8_DEPRECATED("Use CFunctionBuilder instead.") - static CFunction MakeWithFallbackSupport(F* func) { - return ArgUnwrap::Make(func); - } - - CFunction(const void* address, const CFunctionInfo* type_info); - - private: - const void* address_; - const CFunctionInfo* type_info_; - - template - class ArgUnwrap { - static_assert(sizeof(F) != sizeof(F), - "CFunction must be created from a function pointer."); - }; - - template - class ArgUnwrap { - public: - static CFunction Make(R (*func)(Args...)); - }; -}; - -struct ApiObject { - uintptr_t address; -}; - -/** - * A struct which may be passed to a fast call callback, like so: - * \code - * void FastMethodWithOptions(int param, FastApiCallbackOptions& options); - * \endcode - */ -struct FastApiCallbackOptions { - /** - * Creates a new instance of FastApiCallbackOptions for testing purpose. The - * returned instance may be filled with mock data. - */ - static FastApiCallbackOptions CreateForTesting(Isolate* isolate) { - return {false, {0}}; - } - - /** - * If the callback wants to signal an error condition or to perform an - * allocation, it must set options.fallback to true and do an early return - * from the fast method. Then V8 checks the value of options.fallback and if - * it's true, falls back to executing the SlowCallback, which is capable of - * reporting the error (either by throwing a JS exception or logging to the - * console) or doing the allocation. It's the embedder's responsibility to - * ensure that the fast callback is idempotent up to the point where error and - * fallback conditions are checked, because otherwise executing the slow - * callback might produce visible side-effects twice. - */ - bool fallback; - - /** - * The `data` passed to the FunctionTemplate constructor, or `undefined`. - * `data_ptr` allows for default constructing FastApiCallbackOptions. - */ - union { - uintptr_t data_ptr; - v8::Value data; - }; -}; - -namespace internal { - -// Helper to count the number of occurances of `T` in `List` -template -struct count : std::integral_constant {}; -template -struct count - : std::integral_constant::value> {}; -template -struct count : count {}; - -template -class CFunctionInfoImpl : public CFunctionInfo { - static constexpr int kOptionsArgCount = - count(); - static constexpr int kReceiverCount = 1; - - static_assert(kOptionsArgCount == 0 || kOptionsArgCount == 1, - "Only one options parameter is supported."); - - static_assert(sizeof...(ArgBuilders) >= kOptionsArgCount + kReceiverCount, - "The receiver or the options argument is missing."); - - public: - constexpr CFunctionInfoImpl() - : CFunctionInfo(RetBuilder::Build(), sizeof...(ArgBuilders), - arg_info_storage_), - arg_info_storage_{ArgBuilders::Build()...} { - constexpr CTypeInfo::Type kReturnType = RetBuilder::Build().GetType(); - static_assert(kReturnType == CTypeInfo::Type::kVoid || - kReturnType == CTypeInfo::Type::kBool || - kReturnType == CTypeInfo::Type::kInt32 || - kReturnType == CTypeInfo::Type::kUint32 || - kReturnType == CTypeInfo::Type::kFloat32 || - kReturnType == CTypeInfo::Type::kFloat64, - "64-bit int and api object values are not currently " - "supported return types."); - } - - private: - const CTypeInfo arg_info_storage_[sizeof...(ArgBuilders)]; -}; - -template -struct TypeInfoHelper { - static_assert(sizeof(T) != sizeof(T), "This type is not supported"); -}; - -#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR(T, Enum) \ - template <> \ - struct TypeInfoHelper { \ - static constexpr CTypeInfo::Flags Flags() { \ - return CTypeInfo::Flags::kNone; \ - } \ - \ - static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \ - static constexpr CTypeInfo::SequenceType SequenceType() { \ - return CTypeInfo::SequenceType::kScalar; \ - } \ - }; - -template -struct CTypeInfoTraits {}; - -#define DEFINE_TYPE_INFO_TRAITS(CType, Enum) \ - template <> \ - struct CTypeInfoTraits { \ - using ctype = CType; \ - }; - -#define PRIMITIVE_C_TYPES(V) \ - V(bool, kBool) \ - V(int32_t, kInt32) \ - V(uint32_t, kUint32) \ - V(int64_t, kInt64) \ - V(uint64_t, kUint64) \ - V(float, kFloat32) \ - V(double, kFloat64) - -// Same as above, but includes deprecated types for compatibility. -#define ALL_C_TYPES(V) \ - PRIMITIVE_C_TYPES(V) \ - V(void, kVoid) \ - V(v8::Local, kV8Value) \ - V(v8::Local, kV8Value) \ - V(ApiObject, kApiObject) - -// ApiObject was a temporary solution to wrap the pointer to the v8::Value. -// Please use v8::Local in new code for the arguments and -// v8::Local for the receiver, as ApiObject will be deprecated. - -ALL_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR) -PRIMITIVE_C_TYPES(DEFINE_TYPE_INFO_TRAITS) - -#undef PRIMITIVE_C_TYPES -#undef ALL_C_TYPES - -#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA(T, Enum) \ - template <> \ - struct TypeInfoHelper&> { \ - static constexpr CTypeInfo::Flags Flags() { \ - return CTypeInfo::Flags::kNone; \ - } \ - \ - static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \ - static constexpr CTypeInfo::SequenceType SequenceType() { \ - return CTypeInfo::SequenceType::kIsTypedArray; \ - } \ - }; - -#define TYPED_ARRAY_C_TYPES(V) \ - V(int32_t, kInt32) \ - V(uint32_t, kUint32) \ - V(int64_t, kInt64) \ - V(uint64_t, kUint64) \ - V(float, kFloat32) \ - V(double, kFloat64) - -TYPED_ARRAY_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA) - -#undef TYPED_ARRAY_C_TYPES - -template <> -struct TypeInfoHelper> { - static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } - - static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kVoid; } - static constexpr CTypeInfo::SequenceType SequenceType() { - return CTypeInfo::SequenceType::kIsSequence; - } -}; - -template <> -struct TypeInfoHelper> { - static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } - - static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kUint32; } - static constexpr CTypeInfo::SequenceType SequenceType() { - return CTypeInfo::SequenceType::kIsTypedArray; - } -}; - -template <> -struct TypeInfoHelper { - static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } - - static constexpr CTypeInfo::Type Type() { - return CTypeInfo::kCallbackOptionsType; - } - static constexpr CTypeInfo::SequenceType SequenceType() { - return CTypeInfo::SequenceType::kScalar; - } -}; - -#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \ - static_assert(((COND) == 0) || (ASSERTION), MSG) - -template -class CTypeInfoBuilder { - public: - using BaseType = T; - - static constexpr CTypeInfo Build() { - constexpr CTypeInfo::Flags kFlags = - MergeFlags(TypeInfoHelper::Flags(), Flags...); - constexpr CTypeInfo::Type kType = TypeInfoHelper::Type(); - constexpr CTypeInfo::SequenceType kSequenceType = - TypeInfoHelper::SequenceType(); - - STATIC_ASSERT_IMPLIES( - uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit), - (kSequenceType == CTypeInfo::SequenceType::kIsTypedArray || - kSequenceType == CTypeInfo::SequenceType::kIsArrayBuffer), - "kAllowSharedBit is only allowed for TypedArrays and ArrayBuffers."); - STATIC_ASSERT_IMPLIES( - uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kEnforceRangeBit), - CTypeInfo::IsIntegralType(kType), - "kEnforceRangeBit is only allowed for integral types."); - STATIC_ASSERT_IMPLIES( - uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kClampBit), - CTypeInfo::IsIntegralType(kType), - "kClampBit is only allowed for integral types."); - STATIC_ASSERT_IMPLIES( - uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kIsRestrictedBit), - CTypeInfo::IsFloatingPointType(kType), - "kIsRestrictedBit is only allowed for floating point types."); - STATIC_ASSERT_IMPLIES(kSequenceType == CTypeInfo::SequenceType::kIsSequence, - kType == CTypeInfo::Type::kVoid, - "Sequences are only supported from void type."); - STATIC_ASSERT_IMPLIES( - kSequenceType == CTypeInfo::SequenceType::kIsTypedArray, - CTypeInfo::IsPrimitive(kType) || kType == CTypeInfo::Type::kVoid, - "TypedArrays are only supported from primitive types or void."); - - // Return the same type with the merged flags. - return CTypeInfo(TypeInfoHelper::Type(), - TypeInfoHelper::SequenceType(), kFlags); - } - - private: - template - static constexpr CTypeInfo::Flags MergeFlags(CTypeInfo::Flags flags, - Rest... rest) { - return CTypeInfo::Flags(uint8_t(flags) | uint8_t(MergeFlags(rest...))); - } - static constexpr CTypeInfo::Flags MergeFlags() { return CTypeInfo::Flags(0); } -}; - -template -class CFunctionBuilderWithFunction { - public: - explicit constexpr CFunctionBuilderWithFunction(const void* fn) : fn_(fn) {} - - template - constexpr auto Ret() { - return CFunctionBuilderWithFunction< - CTypeInfoBuilder, - ArgBuilders...>(fn_); - } - - template - constexpr auto Arg() { - // Return a copy of the builder with the Nth arg builder merged with - // template parameter pack Flags. - return ArgImpl( - std::make_index_sequence()); - } - - auto Build() { - static CFunctionInfoImpl instance; - return CFunction(fn_, &instance); - } - - private: - template - struct GetArgBuilder; - - // Returns the same ArgBuilder as the one at index N, including its flags. - // Flags in the template parameter pack are ignored. - template - struct GetArgBuilder { - using type = - typename std::tuple_element>::type; - }; - - // Returns an ArgBuilder with the same base type as the one at index N, - // but merges the flags with the flags in the template parameter pack. - template - struct GetArgBuilder { - using type = CTypeInfoBuilder< - typename std::tuple_element>::type::BaseType, - std::tuple_element>::type::Build() - .GetFlags(), - Flags...>; - }; - - // Return a copy of the CFunctionBuilder, but merges the Flags on - // ArgBuilder index N with the new Flags passed in the template parameter - // pack. - template - constexpr auto ArgImpl(std::index_sequence) { - return CFunctionBuilderWithFunction< - RetBuilder, typename GetArgBuilder::type...>(fn_); - } - - const void* fn_; -}; - -class CFunctionBuilder { - public: - constexpr CFunctionBuilder() {} - - template - constexpr auto Fn(R (*fn)(Args...)) { - return CFunctionBuilderWithFunction, - CTypeInfoBuilder...>( - reinterpret_cast(fn)); - } -}; - -} // namespace internal - -// static -template -CFunction CFunction::ArgUnwrap::Make(R (*func)(Args...)) { - return internal::CFunctionBuilder().Fn(func).Build(); -} - -using CFunctionBuilder = internal::CFunctionBuilder; - -static constexpr CTypeInfo kTypeInfoInt32 = CTypeInfo(CTypeInfo::Type::kInt32); -static constexpr CTypeInfo kTypeInfoFloat64 = - CTypeInfo(CTypeInfo::Type::kFloat64); - -/** - * Copies the contents of this JavaScript array to a C++ buffer with - * a given max_length. A CTypeInfo is passed as an argument, - * instructing different rules for conversion (e.g. restricted float/double). - * The element type T of the destination array must match the C type - * corresponding to the CTypeInfo (specified by CTypeInfoTraits). - * If the array length is larger than max_length or the array is of - * unsupported type, the operation will fail, returning false. Generally, an - * array which contains objects, undefined, null or anything not convertible - * to the requested destination type, is considered unsupported. The operation - * returns true on success. `type_info` will be used for conversions. - */ -template -bool V8_EXPORT V8_WARN_UNUSED_RESULT TryCopyAndConvertArrayToCppBuffer( - Local src, T* dst, uint32_t max_length); - -template <> -inline bool V8_WARN_UNUSED_RESULT -TryCopyAndConvertArrayToCppBuffer<&kTypeInfoInt32, int32_t>( - Local src, int32_t* dst, uint32_t max_length) { - return CopyAndConvertArrayToCppBufferInt32(src, dst, max_length); -} - -template <> -inline bool V8_WARN_UNUSED_RESULT -TryCopyAndConvertArrayToCppBuffer<&kTypeInfoFloat64, double>( - Local src, double* dst, uint32_t max_length) { - return CopyAndConvertArrayToCppBufferFloat64(src, dst, max_length); -} - -} // namespace v8 - -#endif // INCLUDE_V8_FAST_API_CALLS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector-protocol.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector-protocol.h deleted file mode 100644 index a5ffb7d6..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector-protocol.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_V8_INSPECTOR_PROTOCOL_H_ -#define V8_V8_INSPECTOR_PROTOCOL_H_ - -#include "inspector/Debugger.h" // NOLINT(build/include_directory) -#include "inspector/Runtime.h" // NOLINT(build/include_directory) -#include "inspector/Schema.h" // NOLINT(build/include_directory) -#include "v8-inspector.h" // NOLINT(build/include_directory) - -#endif // V8_V8_INSPECTOR_PROTOCOL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector.h deleted file mode 100644 index e6621ccd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-inspector.h +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_V8_INSPECTOR_H_ -#define V8_V8_INSPECTOR_H_ - -#include -#include - -#include -#include - -#include "v8.h" // NOLINT(build/include_directory) - -namespace v8_inspector { - -namespace protocol { -namespace Debugger { -namespace API { -class SearchMatch; -} -} -namespace Runtime { -namespace API { -class RemoteObject; -class StackTrace; -class StackTraceId; -} -} -namespace Schema { -namespace API { -class Domain; -} -} -} // namespace protocol - -class V8_EXPORT StringView { - public: - StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {} - - StringView(const uint8_t* characters, size_t length) - : m_is8Bit(true), m_length(length), m_characters8(characters) {} - - StringView(const uint16_t* characters, size_t length) - : m_is8Bit(false), m_length(length), m_characters16(characters) {} - - bool is8Bit() const { return m_is8Bit; } - size_t length() const { return m_length; } - - // TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used - // here. - const uint8_t* characters8() const { return m_characters8; } - const uint16_t* characters16() const { return m_characters16; } - - private: - bool m_is8Bit; - size_t m_length; - union { - const uint8_t* m_characters8; - const uint16_t* m_characters16; - }; -}; - -class V8_EXPORT StringBuffer { - public: - virtual ~StringBuffer() = default; - virtual StringView string() const = 0; - // This method copies contents. - static std::unique_ptr create(StringView); -}; - -class V8_EXPORT V8ContextInfo { - public: - V8ContextInfo(v8::Local context, int contextGroupId, - StringView humanReadableName) - : context(context), - contextGroupId(contextGroupId), - humanReadableName(humanReadableName), - hasMemoryOnConsole(false) {} - - v8::Local context; - // Each v8::Context is a part of a group. The group id must be non-zero. - int contextGroupId; - StringView humanReadableName; - StringView origin; - StringView auxData; - bool hasMemoryOnConsole; - - static int executionContextId(v8::Local context); - - // Disallow copying and allocating this one. - enum NotNullTagEnum { NotNullLiteral }; - void* operator new(size_t) = delete; - void* operator new(size_t, NotNullTagEnum, void*) = delete; - void* operator new(size_t, void*) = delete; - V8ContextInfo(const V8ContextInfo&) = delete; - V8ContextInfo& operator=(const V8ContextInfo&) = delete; -}; - -class V8_EXPORT V8StackTrace { - public: - virtual StringView firstNonEmptySourceURL() const = 0; - virtual bool isEmpty() const = 0; - virtual StringView topSourceURL() const = 0; - virtual int topLineNumber() const = 0; - virtual int topColumnNumber() const = 0; - virtual int topScriptId() const = 0; - V8_DEPRECATE_SOON("Use V8::StackTrace::topScriptId() instead.") - int topScriptIdAsInteger() const { return topScriptId(); } - virtual StringView topFunctionName() const = 0; - - virtual ~V8StackTrace() = default; - virtual std::unique_ptr - buildInspectorObject() const = 0; - virtual std::unique_ptr - buildInspectorObject(int maxAsyncDepth) const = 0; - virtual std::unique_ptr toString() const = 0; - - // Safe to pass between threads, drops async chain. - virtual std::unique_ptr clone() = 0; -}; - -class V8_EXPORT V8InspectorSession { - public: - virtual ~V8InspectorSession() = default; - - // Cross-context inspectable values (DOM nodes in different worlds, etc.). - class V8_EXPORT Inspectable { - public: - virtual v8::Local get(v8::Local) = 0; - virtual ~Inspectable() = default; - }; - class V8_EXPORT CommandLineAPIScope { - public: - virtual ~CommandLineAPIScope() = default; - }; - virtual void addInspectedObject(std::unique_ptr) = 0; - - // Dispatching protocol messages. - static bool canDispatchMethod(StringView method); - virtual void dispatchProtocolMessage(StringView message) = 0; - virtual std::vector state() = 0; - virtual std::vector> - supportedDomains() = 0; - - virtual std::unique_ptr - initializeCommandLineAPIScope(int executionContextId) = 0; - - // Debugger actions. - virtual void schedulePauseOnNextStatement(StringView breakReason, - StringView breakDetails) = 0; - virtual void cancelPauseOnNextStatement() = 0; - virtual void breakProgram(StringView breakReason, - StringView breakDetails) = 0; - virtual void setSkipAllPauses(bool) = 0; - virtual void resume(bool setTerminateOnResume = false) = 0; - virtual void stepOver() = 0; - virtual std::vector> - searchInTextByLines(StringView text, StringView query, bool caseSensitive, - bool isRegex) = 0; - - // Remote objects. - virtual std::unique_ptr wrapObject( - v8::Local, v8::Local, StringView groupName, - bool generatePreview) = 0; - - virtual bool unwrapObject(std::unique_ptr* error, - StringView objectId, v8::Local*, - v8::Local*, - std::unique_ptr* objectGroup) = 0; - virtual void releaseObjectGroup(StringView) = 0; - virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0; -}; - -class V8_EXPORT V8InspectorClient { - public: - virtual ~V8InspectorClient() = default; - - virtual void runMessageLoopOnPause(int contextGroupId) {} - virtual void quitMessageLoopOnPause() {} - virtual void runIfWaitingForDebugger(int contextGroupId) {} - - virtual void muteMetrics(int contextGroupId) {} - virtual void unmuteMetrics(int contextGroupId) {} - - virtual void beginUserGesture() {} - virtual void endUserGesture() {} - - virtual std::unique_ptr valueSubtype(v8::Local) { - return nullptr; - } - virtual std::unique_ptr descriptionForValueSubtype( - v8::Local, v8::Local) { - return nullptr; - } - virtual bool isInspectableHeapObject(v8::Local) { return true; } - - virtual v8::Local ensureDefaultContextInGroup( - int contextGroupId) { - return v8::Local(); - } - virtual void beginEnsureAllContextsInGroup(int contextGroupId) {} - virtual void endEnsureAllContextsInGroup(int contextGroupId) {} - - virtual void installAdditionalCommandLineAPI(v8::Local, - v8::Local) {} - virtual void consoleAPIMessage(int contextGroupId, - v8::Isolate::MessageErrorLevel level, - const StringView& message, - const StringView& url, unsigned lineNumber, - unsigned columnNumber, V8StackTrace*) {} - virtual v8::MaybeLocal memoryInfo(v8::Isolate*, - v8::Local) { - return v8::MaybeLocal(); - } - - virtual void consoleTime(const StringView& title) {} - virtual void consoleTimeEnd(const StringView& title) {} - virtual void consoleTimeStamp(const StringView& title) {} - virtual void consoleClear(int contextGroupId) {} - virtual double currentTimeMS() { return 0; } - typedef void (*TimerCallback)(void*); - virtual void startRepeatingTimer(double, TimerCallback, void* data) {} - virtual void cancelTimer(void* data) {} - - // TODO(dgozman): this was added to support service worker shadow page. We - // should not connect at all. - virtual bool canExecuteScripts(int contextGroupId) { return true; } - - virtual void maxAsyncCallStackDepthChanged(int depth) {} - - virtual std::unique_ptr resourceNameToUrl( - const StringView& resourceName) { - return nullptr; - } - - // The caller would defer to generating a random 64 bit integer if - // this method returns 0. - virtual int64_t generateUniqueId() { return 0; } -}; - -// These stack trace ids are intended to be passed between debuggers and be -// resolved later. This allows to track cross-debugger calls and step between -// them if a single client connects to multiple debuggers. -struct V8_EXPORT V8StackTraceId { - uintptr_t id; - std::pair debugger_id; - bool should_pause = false; - - V8StackTraceId(); - V8StackTraceId(const V8StackTraceId&) = default; - V8StackTraceId(uintptr_t id, const std::pair debugger_id); - V8StackTraceId(uintptr_t id, const std::pair debugger_id, - bool should_pause); - explicit V8StackTraceId(StringView); - V8StackTraceId& operator=(const V8StackTraceId&) = default; - V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default; - ~V8StackTraceId() = default; - - bool IsInvalid() const; - std::unique_ptr ToString(); -}; - -class V8_EXPORT V8Inspector { - public: - static std::unique_ptr create(v8::Isolate*, V8InspectorClient*); - virtual ~V8Inspector() = default; - - // Contexts instrumentation. - virtual void contextCreated(const V8ContextInfo&) = 0; - virtual void contextDestroyed(v8::Local) = 0; - virtual void resetContextGroup(int contextGroupId) = 0; - virtual v8::MaybeLocal contextById(int contextId) = 0; - - // Various instrumentation. - virtual void idleStarted() = 0; - virtual void idleFinished() = 0; - - // Async stack traces instrumentation. - virtual void asyncTaskScheduled(StringView taskName, void* task, - bool recurring) = 0; - virtual void asyncTaskCanceled(void* task) = 0; - virtual void asyncTaskStarted(void* task) = 0; - virtual void asyncTaskFinished(void* task) = 0; - virtual void allAsyncTasksCanceled() = 0; - - virtual V8StackTraceId storeCurrentStackTrace(StringView description) = 0; - virtual void externalAsyncTaskStarted(const V8StackTraceId& parent) = 0; - virtual void externalAsyncTaskFinished(const V8StackTraceId& parent) = 0; - - // Exceptions instrumentation. - virtual unsigned exceptionThrown(v8::Local, StringView message, - v8::Local exception, - StringView detailedMessage, StringView url, - unsigned lineNumber, unsigned columnNumber, - std::unique_ptr, - int scriptId) = 0; - virtual void exceptionRevoked(v8::Local, unsigned exceptionId, - StringView message) = 0; - virtual bool associateExceptionData(v8::Local, - v8::Local exception, - v8::Local key, - v8::Local value) = 0; - - // Connection. - class V8_EXPORT Channel { - public: - virtual ~Channel() = default; - virtual void sendResponse(int callId, - std::unique_ptr message) = 0; - virtual void sendNotification(std::unique_ptr message) = 0; - virtual void flushProtocolNotifications() = 0; - }; - virtual std::unique_ptr connect(int contextGroupId, - Channel*, - StringView state) = 0; - - // API methods. - virtual std::unique_ptr createStackTrace( - v8::Local) = 0; - virtual std::unique_ptr captureStackTrace(bool fullStack) = 0; - - // Performance counters. - class V8_EXPORT Counters : public std::enable_shared_from_this { - public: - explicit Counters(v8::Isolate* isolate); - ~Counters(); - const std::unordered_map& getCountersMap() const { - return m_countersMap; - } - - private: - static int* getCounterPtr(const char* name); - - v8::Isolate* m_isolate; - std::unordered_map m_countersMap; - }; - - virtual std::shared_ptr enableCounters() = 0; -}; - -} // namespace v8_inspector - -#endif // V8_V8_INSPECTOR_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-internal.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-internal.h deleted file mode 100644 index 0b95c2ca..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-internal.h +++ /dev/null @@ -1,511 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_V8_INTERNAL_H_ -#define INCLUDE_V8_INTERNAL_H_ - -#include -#include -#include -#include - -#include "v8-version.h" // NOLINT(build/include_directory) -#include "v8config.h" // NOLINT(build/include_directory) - -namespace v8 { - -class Array; -class Context; -class Data; -class Isolate; -template -class Local; - -namespace internal { - -class Isolate; - -typedef uintptr_t Address; -static const Address kNullAddress = 0; - -/** - * Configuration of tagging scheme. - */ -const int kApiSystemPointerSize = sizeof(void*); -const int kApiDoubleSize = sizeof(double); -const int kApiInt32Size = sizeof(int32_t); -const int kApiInt64Size = sizeof(int64_t); - -// Tag information for HeapObject. -const int kHeapObjectTag = 1; -const int kWeakHeapObjectTag = 3; -const int kHeapObjectTagSize = 2; -const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; - -// Tag information for fowarding pointers stored in object headers. -// 0b00 at the lowest 2 bits in the header indicates that the map word is a -// forwarding pointer. -const int kForwardingTag = 0; -const int kForwardingTagSize = 2; -const intptr_t kForwardingTagMask = (1 << kForwardingTagSize) - 1; - -// Tag information for Smi. -const int kSmiTag = 0; -const int kSmiTagSize = 1; -const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; - -template -struct SmiTagging; - -constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1}; -constexpr uintptr_t kUintptrAllBitsSet = - static_cast(kIntptrAllBitsSet); - -// Smi constants for systems where tagged pointer is a 32-bit value. -template <> -struct SmiTagging<4> { - enum { kSmiShiftSize = 0, kSmiValueSize = 31 }; - - static constexpr intptr_t kSmiMinValue = - static_cast(kUintptrAllBitsSet << (kSmiValueSize - 1)); - static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1); - - V8_INLINE static int SmiToInt(const internal::Address value) { - int shift_bits = kSmiTagSize + kSmiShiftSize; - // Truncate and shift down (requires >> to be sign extending). - return static_cast(static_cast(value)) >> shift_bits; - } - V8_INLINE static constexpr bool IsValidSmi(intptr_t value) { - // Is value in range [kSmiMinValue, kSmiMaxValue]. - // Use unsigned operations in order to avoid undefined behaviour in case of - // signed integer overflow. - return (static_cast(value) - - static_cast(kSmiMinValue)) <= - (static_cast(kSmiMaxValue) - - static_cast(kSmiMinValue)); - } -}; - -// Smi constants for systems where tagged pointer is a 64-bit value. -template <> -struct SmiTagging<8> { - enum { kSmiShiftSize = 31, kSmiValueSize = 32 }; - - static constexpr intptr_t kSmiMinValue = - static_cast(kUintptrAllBitsSet << (kSmiValueSize - 1)); - static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1); - - V8_INLINE static int SmiToInt(const internal::Address value) { - int shift_bits = kSmiTagSize + kSmiShiftSize; - // Shift down and throw away top 32 bits. - return static_cast(static_cast(value) >> shift_bits); - } - V8_INLINE static constexpr bool IsValidSmi(intptr_t value) { - // To be representable as a long smi, the value must be a 32-bit integer. - return (value == static_cast(value)); - } -}; - -#ifdef V8_COMPRESS_POINTERS -static_assert( - kApiSystemPointerSize == kApiInt64Size, - "Pointer compression can be enabled only for 64-bit architectures"); -const int kApiTaggedSize = kApiInt32Size; -#else -const int kApiTaggedSize = kApiSystemPointerSize; -#endif - -constexpr bool PointerCompressionIsEnabled() { - return kApiTaggedSize != kApiSystemPointerSize; -} - -constexpr bool HeapSandboxIsEnabled() { -#ifdef V8_HEAP_SANDBOX - return true; -#else - return false; -#endif -} - -using ExternalPointer_t = Address; - -// If the heap sandbox is enabled, these tag values will be ORed with the -// external pointers in the external pointer table to prevent use of pointers of -// the wrong type. When a pointer is loaded, it is ANDed with the inverse of the -// expected type's tag. The tags are constructed in a way that guarantees that a -// failed type check will result in one or more of the top bits of the pointer -// to be set, rendering the pointer inacessible. This construction allows -// performing the type check and removing GC marking bits from the pointer at -// the same time. -enum ExternalPointerTag : uint64_t { - kExternalPointerNullTag = 0x0000000000000000, - kArrayBufferBackingStoreTag = 0x00ff000000000000, // 0b000000011111111 - kTypedArrayExternalPointerTag = 0x017f000000000000, // 0b000000101111111 - kDataViewDataPointerTag = 0x01bf000000000000, // 0b000000110111111 - kExternalStringResourceTag = 0x01df000000000000, // 0b000000111011111 - kExternalStringResourceDataTag = 0x01ef000000000000, // 0b000000111101111 - kForeignForeignAddressTag = 0x01f7000000000000, // 0b000000111110111 - kNativeContextMicrotaskQueueTag = 0x01fb000000000000, // 0b000000111111011 - kEmbedderDataSlotPayloadTag = 0x01fd000000000000, // 0b000000111111101 - kCodeEntryPointTag = 0x01fe000000000000, // 0b000000111111110 -}; - -constexpr uint64_t kExternalPointerTagMask = 0xffff000000000000; - -#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH -using PlatformSmiTagging = SmiTagging; -#else -using PlatformSmiTagging = SmiTagging; -#endif - -// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize -// since it's used much more often than the inividual constants. -const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; -const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; -const int kSmiMinValue = static_cast(PlatformSmiTagging::kSmiMinValue); -const int kSmiMaxValue = static_cast(PlatformSmiTagging::kSmiMaxValue); -constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; } -constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; } - -V8_INLINE static constexpr internal::Address IntToSmi(int value) { - return (static_cast
(value) << (kSmiTagSize + kSmiShiftSize)) | - kSmiTag; -} - -// Converts encoded external pointer to address. -V8_EXPORT Address DecodeExternalPointerImpl(const Isolate* isolate, - ExternalPointer_t pointer, - ExternalPointerTag tag); - -// {obj} must be the raw tagged pointer representation of a HeapObject -// that's guaranteed to never be in ReadOnlySpace. -V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj); - -// Returns if we need to throw when an error occurs. This infers the language -// mode based on the current context and the closure. This returns true if the -// language mode is strict. -V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate); - -/** - * This class exports constants and functionality from within v8 that - * is necessary to implement inline functions in the v8 api. Don't - * depend on functions and constants defined here. - */ -class Internals { -#ifdef V8_MAP_PACKING - V8_INLINE static constexpr internal::Address UnpackMapWord( - internal::Address mapword) { - // TODO(wenyuzhao): Clear header metadata. - return mapword ^ kMapWordXorMask; - } -#endif - - public: - // These values match non-compiler-dependent values defined within - // the implementation of v8. - static const int kHeapObjectMapOffset = 0; - static const int kMapInstanceTypeOffset = 1 * kApiTaggedSize + kApiInt32Size; - static const int kStringResourceOffset = - 1 * kApiTaggedSize + 2 * kApiInt32Size; - - static const int kOddballKindOffset = 4 * kApiTaggedSize + kApiDoubleSize; - static const int kJSObjectHeaderSize = 3 * kApiTaggedSize; - static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize; - static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize; - static const int kEmbedderDataSlotSize = kApiSystemPointerSize; -#ifdef V8_HEAP_SANDBOX - static const int kEmbedderDataSlotRawPayloadOffset = kApiTaggedSize; -#endif - static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize; - static const int kFullStringRepresentationMask = 0x0f; - static const int kStringEncodingMask = 0x8; - static const int kExternalTwoByteRepresentationTag = 0x02; - static const int kExternalOneByteRepresentationTag = 0x0a; - - static const uint32_t kNumIsolateDataSlots = 4; - - // IsolateData layout guarantees. - static const int kIsolateEmbedderDataOffset = 0; - static const int kIsolateFastCCallCallerFpOffset = - kNumIsolateDataSlots * kApiSystemPointerSize; - static const int kIsolateFastCCallCallerPcOffset = - kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize; - static const int kIsolateFastApiCallTargetOffset = - kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize; - static const int kIsolateStackGuardOffset = - kIsolateFastApiCallTargetOffset + kApiSystemPointerSize; - static const int kIsolateRootsOffset = - kIsolateStackGuardOffset + 7 * kApiSystemPointerSize; - - static const int kExternalPointerTableBufferOffset = 0; - static const int kExternalPointerTableLengthOffset = - kExternalPointerTableBufferOffset + kApiSystemPointerSize; - static const int kExternalPointerTableCapacityOffset = - kExternalPointerTableLengthOffset + kApiInt32Size; - - static const int kUndefinedValueRootIndex = 4; - static const int kTheHoleValueRootIndex = 5; - static const int kNullValueRootIndex = 6; - static const int kTrueValueRootIndex = 7; - static const int kFalseValueRootIndex = 8; - static const int kEmptyStringRootIndex = 9; - - static const int kNodeClassIdOffset = 1 * kApiSystemPointerSize; - static const int kNodeFlagsOffset = 1 * kApiSystemPointerSize + 3; - static const int kNodeStateMask = 0x7; - static const int kNodeStateIsWeakValue = 2; - static const int kNodeStateIsPendingValue = 3; - - static const int kFirstNonstringType = 0x40; - static const int kOddballType = 0x43; - static const int kForeignType = 0x46; - static const int kJSSpecialApiObjectType = 0x410; - static const int kJSApiObjectType = 0x420; - static const int kJSObjectType = 0x421; - - static const int kUndefinedOddballKind = 5; - static const int kNullOddballKind = 3; - - // Constants used by PropertyCallbackInfo to check if we should throw when an - // error occurs. - static const int kThrowOnError = 0; - static const int kDontThrow = 1; - static const int kInferShouldThrowMode = 2; - - // Soft limit for AdjustAmountofExternalAllocatedMemory. Trigger an - // incremental GC once the external memory reaches this limit. - static constexpr int kExternalAllocationSoftLimit = 64 * 1024 * 1024; - -#ifdef V8_MAP_PACKING - static const uintptr_t kMapWordMetadataMask = 0xffffULL << 48; - // The lowest two bits of mapwords are always `0b10` - static const uintptr_t kMapWordSignature = 0b10; - // XORing a (non-compressed) map with this mask ensures that the two - // low-order bits are 0b10. The 0 at the end makes this look like a Smi, - // although real Smis have all lower 32 bits unset. We only rely on these - // values passing as Smis in very few places. - static const int kMapWordXorMask = 0b11; -#endif - - V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); - V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { -#ifdef V8_ENABLE_CHECKS - CheckInitializedImpl(isolate); -#endif - } - - V8_INLINE static bool HasHeapObjectTag(const internal::Address value) { - return (value & kHeapObjectTagMask) == static_cast
(kHeapObjectTag); - } - - V8_INLINE static int SmiValue(const internal::Address value) { - return PlatformSmiTagging::SmiToInt(value); - } - - V8_INLINE static constexpr internal::Address IntToSmi(int value) { - return internal::IntToSmi(value); - } - - V8_INLINE static constexpr bool IsValidSmi(intptr_t value) { - return PlatformSmiTagging::IsValidSmi(value); - } - - V8_INLINE static int GetInstanceType(const internal::Address obj) { - typedef internal::Address A; - A map = ReadTaggedPointerField(obj, kHeapObjectMapOffset); -#ifdef V8_MAP_PACKING - map = UnpackMapWord(map); -#endif - return ReadRawField(map, kMapInstanceTypeOffset); - } - - V8_INLINE static int GetOddballKind(const internal::Address obj) { - return SmiValue(ReadTaggedSignedField(obj, kOddballKindOffset)); - } - - V8_INLINE static bool IsExternalTwoByteString(int instance_type) { - int representation = (instance_type & kFullStringRepresentationMask); - return representation == kExternalTwoByteRepresentationTag; - } - - V8_INLINE static uint8_t GetNodeFlag(internal::Address* obj, int shift) { - uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; - return *addr & static_cast(1U << shift); - } - - V8_INLINE static void UpdateNodeFlag(internal::Address* obj, bool value, - int shift) { - uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; - uint8_t mask = static_cast(1U << shift); - *addr = static_cast((*addr & ~mask) | (value << shift)); - } - - V8_INLINE static uint8_t GetNodeState(internal::Address* obj) { - uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; - return *addr & kNodeStateMask; - } - - V8_INLINE static void UpdateNodeState(internal::Address* obj, uint8_t value) { - uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; - *addr = static_cast((*addr & ~kNodeStateMask) | value); - } - - V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, uint32_t slot, - void* data) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateEmbedderDataOffset + - slot * kApiSystemPointerSize; - *reinterpret_cast(addr) = data; - } - - V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate, - uint32_t slot) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateEmbedderDataOffset + - slot * kApiSystemPointerSize; - return *reinterpret_cast(addr); - } - - V8_INLINE static internal::Address* GetRoot(v8::Isolate* isolate, int index) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateRootsOffset + - index * kApiSystemPointerSize; - return reinterpret_cast(addr); - } - - template - V8_INLINE static T ReadRawField(internal::Address heap_object_ptr, - int offset) { - internal::Address addr = heap_object_ptr + offset - kHeapObjectTag; -#ifdef V8_COMPRESS_POINTERS - if (sizeof(T) > kApiTaggedSize) { - // TODO(ishell, v8:8875): When pointer compression is enabled 8-byte size - // fields (external pointers, doubles and BigInt data) are only - // kTaggedSize aligned so we have to use unaligned pointer friendly way of - // accessing them in order to avoid undefined behavior in C++ code. - T r; - memcpy(&r, reinterpret_cast(addr), sizeof(T)); - return r; - } -#endif - return *reinterpret_cast(addr); - } - - V8_INLINE static internal::Address ReadTaggedPointerField( - internal::Address heap_object_ptr, int offset) { -#ifdef V8_COMPRESS_POINTERS - uint32_t value = ReadRawField(heap_object_ptr, offset); - internal::Address base = - GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr); - return base + static_cast(static_cast(value)); -#else - return ReadRawField(heap_object_ptr, offset); -#endif - } - - V8_INLINE static internal::Address ReadTaggedSignedField( - internal::Address heap_object_ptr, int offset) { -#ifdef V8_COMPRESS_POINTERS - uint32_t value = ReadRawField(heap_object_ptr, offset); - return static_cast(static_cast(value)); -#else - return ReadRawField(heap_object_ptr, offset); -#endif - } - - V8_INLINE static internal::Isolate* GetIsolateForHeapSandbox( - internal::Address obj) { -#ifdef V8_HEAP_SANDBOX - return internal::IsolateFromNeverReadOnlySpaceObject(obj); -#else - // Not used in non-sandbox mode. - return nullptr; -#endif - } - - V8_INLINE static Address DecodeExternalPointer( - const Isolate* isolate, ExternalPointer_t encoded_pointer, - ExternalPointerTag tag) { -#ifdef V8_HEAP_SANDBOX - return internal::DecodeExternalPointerImpl(isolate, encoded_pointer, tag); -#else - return encoded_pointer; -#endif - } - - V8_INLINE static internal::Address ReadExternalPointerField( - internal::Isolate* isolate, internal::Address heap_object_ptr, int offset, - ExternalPointerTag tag) { -#ifdef V8_HEAP_SANDBOX - internal::ExternalPointer_t encoded_value = - ReadRawField(heap_object_ptr, offset); - // We currently have to treat zero as nullptr in embedder slots. - return encoded_value ? DecodeExternalPointer(isolate, encoded_value, tag) - : 0; -#else - return ReadRawField
(heap_object_ptr, offset); -#endif - } - -#ifdef V8_COMPRESS_POINTERS - // See v8:7703 or src/ptr-compr.* for details about pointer compression. - static constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32; - static constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32; - - V8_INLINE static internal::Address GetPtrComprCageBaseFromOnHeapAddress( - internal::Address addr) { - return addr & -static_cast(kPtrComprCageBaseAlignment); - } - - V8_INLINE static internal::Address DecompressTaggedAnyField( - internal::Address heap_object_ptr, uint32_t value) { - internal::Address base = - GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr); - return base + static_cast(static_cast(value)); - } - -#endif // V8_COMPRESS_POINTERS -}; - -// Only perform cast check for types derived from v8::Data since -// other types do not implement the Cast method. -template -struct CastCheck { - template - static void Perform(T* data); -}; - -template <> -template -void CastCheck::Perform(T* data) { - T::Cast(data); -} - -template <> -template -void CastCheck::Perform(T* data) {} - -template -V8_INLINE void PerformCastCheck(T* data) { - CastCheck::value && - !std::is_same>::value>::Perform(data); -} - -// A base class for backing stores, which is needed due to vagaries of -// how static casts work with std::shared_ptr. -class BackingStoreBase {}; - -} // namespace internal - -V8_EXPORT bool CopyAndConvertArrayToCppBufferInt32(Local src, - int32_t* dst, - uint32_t max_length); - -V8_EXPORT bool CopyAndConvertArrayToCppBufferFloat64(Local src, - double* dst, - uint32_t max_length); - -} // namespace v8 - -#endif // INCLUDE_V8_INTERNAL_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-metrics.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-metrics.h deleted file mode 100644 index 498ee25f..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-metrics.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_METRICS_H_ -#define V8_METRICS_H_ - -#include "v8.h" // NOLINT(build/include_directory) - -namespace v8 { -namespace metrics { - -struct GarbageCollectionPhases { - int64_t compact_wall_clock_duration_in_us = -1; - int64_t mark_wall_clock_duration_in_us = -1; - int64_t sweep_wall_clock_duration_in_us = -1; - int64_t weak_wall_clock_duration_in_us = -1; -}; - -struct GarbageCollectionSizes { - int64_t bytes_before = -1; - int64_t bytes_after = -1; - int64_t bytes_freed = -1; -}; - -struct GarbageCollectionFullCycle { - GarbageCollectionPhases total; - GarbageCollectionPhases total_cpp; - GarbageCollectionPhases main_thread; - GarbageCollectionPhases main_thread_cpp; - GarbageCollectionPhases main_thread_atomic; - GarbageCollectionPhases main_thread_atomic_cpp; - GarbageCollectionPhases main_thread_incremental; - GarbageCollectionPhases main_thread_incremental_cpp; - GarbageCollectionSizes objects; - GarbageCollectionSizes objects_cpp; - GarbageCollectionSizes memory; - GarbageCollectionSizes memory_cpp; - double collection_rate_in_percent; - double collection_rate_cpp_in_percent; - double efficiency_in_bytes_per_us; - double efficiency_cpp_in_bytes_per_us; - double main_thread_efficiency_in_bytes_per_us; - double main_thread_efficiency_cpp_in_bytes_per_us; -}; - -struct GarbageCollectionFullMainThreadIncrementalMark { - int64_t wall_clock_duration_in_us = -1; - int64_t cpp_wall_clock_duration_in_us = -1; -}; - -struct GarbageCollectionFullMainThreadBatchedIncrementalMark { - std::vector events; -}; - -struct GarbageCollectionFullMainThreadIncrementalSweep { - int64_t wall_clock_duration_in_us = -1; - int64_t cpp_wall_clock_duration_in_us = -1; -}; - -struct GarbageCollectionFullMainThreadBatchedIncrementalSweep { - std::vector events; -}; - -struct GarbageCollectionYoungCycle { - int64_t total_wall_clock_duration_in_us = -1; - int64_t main_thread_wall_clock_duration_in_us = -1; - double collection_rate_in_percent; - double efficiency_in_bytes_per_us; - double main_thread_efficiency_in_bytes_per_us; -}; - -struct WasmModuleDecoded { - bool async = false; - bool streamed = false; - bool success = false; - size_t module_size_in_bytes = 0; - size_t function_count = 0; - int64_t wall_clock_duration_in_us = -1; - int64_t cpu_duration_in_us = -1; -}; - -struct WasmModuleCompiled { - bool async = false; - bool streamed = false; - bool cached = false; - bool deserialized = false; - bool lazy = false; - bool success = false; - size_t code_size_in_bytes = 0; - size_t liftoff_bailout_count = 0; - int64_t wall_clock_duration_in_us = -1; - int64_t cpu_duration_in_us = -1; -}; - -struct WasmModuleInstantiated { - bool async = false; - bool success = false; - size_t imported_function_count = 0; - int64_t wall_clock_duration_in_us = -1; -}; - -struct WasmModuleTieredUp { - bool lazy = false; - size_t code_size_in_bytes = 0; - int64_t wall_clock_duration_in_us = -1; - int64_t cpu_duration_in_us = -1; -}; - -struct WasmModulesPerIsolate { - size_t count = 0; -}; - -#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ - V(GarbageCollectionFullCycle) \ - V(GarbageCollectionFullMainThreadIncrementalMark) \ - V(GarbageCollectionFullMainThreadBatchedIncrementalMark) \ - V(GarbageCollectionFullMainThreadIncrementalSweep) \ - V(GarbageCollectionFullMainThreadBatchedIncrementalSweep) \ - V(GarbageCollectionYoungCycle) \ - V(WasmModuleDecoded) \ - V(WasmModuleCompiled) \ - V(WasmModuleInstantiated) \ - V(WasmModuleTieredUp) - -#define V8_THREAD_SAFE_METRICS_EVENTS(V) V(WasmModulesPerIsolate) - -/** - * This class serves as a base class for recording event-based metrics in V8. - * There a two kinds of metrics, those which are expected to be thread-safe and - * whose implementation is required to fulfill this requirement and those whose - * implementation does not have that requirement and only needs to be - * executable on the main thread. If such an event is triggered from a - * background thread, it will be delayed and executed by the foreground task - * runner. - * - * The thread-safe events are listed in the V8_THREAD_SAFE_METRICS_EVENTS - * macro above while the main thread event are listed in - * V8_MAIN_THREAD_METRICS_EVENTS above. For the former, a virtual method - * AddMainThreadEvent(const E& event, v8::Context::Token token) will be - * generated and for the latter AddThreadSafeEvent(const E& event). - * - * Thread-safe events are not allowed to access the context and therefore do - * not carry a context ID with them. These IDs can be generated using - * Recorder::GetContextId() and the ID will be valid throughout the lifetime - * of the isolate. It is not guaranteed that the ID will still resolve to - * a valid context using Recorder::GetContext() at the time the metric is - * recorded. In this case, an empty handle will be returned. - * - * The embedder is expected to call v8::Isolate::SetMetricsRecorder() - * providing its implementation and have the virtual methods overwritten - * for the events it cares about. - */ -class V8_EXPORT Recorder { - public: - // A unique identifier for a context in this Isolate. - // It is guaranteed to not be reused throughout the lifetime of the Isolate. - class ContextId { - public: - ContextId() : id_(kEmptyId) {} - - bool IsEmpty() const { return id_ == kEmptyId; } - static const ContextId Empty() { return ContextId{kEmptyId}; } - - bool operator==(const ContextId& other) const { return id_ == other.id_; } - bool operator!=(const ContextId& other) const { return id_ != other.id_; } - - private: - friend class ::v8::Context; - friend class ::v8::internal::Isolate; - - explicit ContextId(uintptr_t id) : id_(id) {} - - static constexpr uintptr_t kEmptyId = 0; - uintptr_t id_; - }; - - virtual ~Recorder() = default; - -#define ADD_MAIN_THREAD_EVENT(E) \ - virtual void AddMainThreadEvent(const E& event, ContextId context_id) {} - V8_MAIN_THREAD_METRICS_EVENTS(ADD_MAIN_THREAD_EVENT) -#undef ADD_MAIN_THREAD_EVENT - -#define ADD_THREAD_SAFE_EVENT(E) \ - virtual void AddThreadSafeEvent(const E& event) {} - V8_THREAD_SAFE_METRICS_EVENTS(ADD_THREAD_SAFE_EVENT) -#undef ADD_THREAD_SAFE_EVENT - - virtual void NotifyIsolateDisposal() {} - - // Return the context with the given id or an empty handle if the context - // was already garbage collected. - static MaybeLocal GetContext(Isolate* isolate, ContextId id); - // Return the unique id corresponding to the given context. - static ContextId GetContextId(Local context); -}; - -} // namespace metrics -} // namespace v8 - -#endif // V8_METRICS_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-platform.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-platform.h deleted file mode 100644 index 4c94d7fd..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-platform.h +++ /dev/null @@ -1,709 +0,0 @@ -// Copyright 2013 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_V8_PLATFORM_H_ -#define V8_V8_PLATFORM_H_ - -#include -#include -#include // For abort. -#include -#include - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace v8 { - -class Isolate; - -// Valid priorities supported by the task scheduling infrastructure. -enum class TaskPriority : uint8_t { - /** - * Best effort tasks are not critical for performance of the application. The - * platform implementation should preempt such tasks if higher priority tasks - * arrive. - */ - kBestEffort, - /** - * User visible tasks are long running background tasks that will - * improve performance and memory usage of the application upon completion. - * Example: background compilation and garbage collection. - */ - kUserVisible, - /** - * User blocking tasks are highest priority tasks that block the execution - * thread (e.g. major garbage collection). They must be finished as soon as - * possible. - */ - kUserBlocking, -}; - -/** - * A Task represents a unit of work. - */ -class Task { - public: - virtual ~Task() = default; - - virtual void Run() = 0; -}; - -/** - * An IdleTask represents a unit of work to be performed in idle time. - * The Run method is invoked with an argument that specifies the deadline in - * seconds returned by MonotonicallyIncreasingTime(). - * The idle task is expected to complete by this deadline. - */ -class IdleTask { - public: - virtual ~IdleTask() = default; - virtual void Run(double deadline_in_seconds) = 0; -}; - -/** - * A TaskRunner allows scheduling of tasks. The TaskRunner may still be used to - * post tasks after the isolate gets destructed, but these tasks may not get - * executed anymore. All tasks posted to a given TaskRunner will be invoked in - * sequence. Tasks can be posted from any thread. - */ -class TaskRunner { - public: - /** - * Schedules a task to be invoked by this TaskRunner. The TaskRunner - * implementation takes ownership of |task|. - */ - virtual void PostTask(std::unique_ptr task) = 0; - - /** - * Schedules a task to be invoked by this TaskRunner. The TaskRunner - * implementation takes ownership of |task|. The |task| cannot be nested - * within other task executions. - * - * Tasks which shouldn't be interleaved with JS execution must be posted with - * |PostNonNestableTask| or |PostNonNestableDelayedTask|. This is because the - * embedder may process tasks in a callback which is called during JS - * execution. - * - * In particular, tasks which execute JS must be non-nestable, since JS - * execution is not allowed to nest. - * - * Requires that |TaskRunner::NonNestableTasksEnabled()| is true. - */ - virtual void PostNonNestableTask(std::unique_ptr task) {} - - /** - * Schedules a task to be invoked by this TaskRunner. The task is scheduled - * after the given number of seconds |delay_in_seconds|. The TaskRunner - * implementation takes ownership of |task|. - */ - virtual void PostDelayedTask(std::unique_ptr task, - double delay_in_seconds) = 0; - - /** - * Schedules a task to be invoked by this TaskRunner. The task is scheduled - * after the given number of seconds |delay_in_seconds|. The TaskRunner - * implementation takes ownership of |task|. The |task| cannot be nested - * within other task executions. - * - * Tasks which shouldn't be interleaved with JS execution must be posted with - * |PostNonNestableTask| or |PostNonNestableDelayedTask|. This is because the - * embedder may process tasks in a callback which is called during JS - * execution. - * - * In particular, tasks which execute JS must be non-nestable, since JS - * execution is not allowed to nest. - * - * Requires that |TaskRunner::NonNestableDelayedTasksEnabled()| is true. - */ - virtual void PostNonNestableDelayedTask(std::unique_ptr task, - double delay_in_seconds) {} - - /** - * Schedules an idle task to be invoked by this TaskRunner. The task is - * scheduled when the embedder is idle. Requires that - * |TaskRunner::IdleTasksEnabled()| is true. Idle tasks may be reordered - * relative to other task types and may be starved for an arbitrarily long - * time if no idle time is available. The TaskRunner implementation takes - * ownership of |task|. - */ - virtual void PostIdleTask(std::unique_ptr task) = 0; - - /** - * Returns true if idle tasks are enabled for this TaskRunner. - */ - virtual bool IdleTasksEnabled() = 0; - - /** - * Returns true if non-nestable tasks are enabled for this TaskRunner. - */ - virtual bool NonNestableTasksEnabled() const { return false; } - - /** - * Returns true if non-nestable delayed tasks are enabled for this TaskRunner. - */ - virtual bool NonNestableDelayedTasksEnabled() const { return false; } - - TaskRunner() = default; - virtual ~TaskRunner() = default; - - TaskRunner(const TaskRunner&) = delete; - TaskRunner& operator=(const TaskRunner&) = delete; -}; - -/** - * Delegate that's passed to Job's worker task, providing an entry point to - * communicate with the scheduler. - */ -class JobDelegate { - public: - /** - * Returns true if this thread should return from the worker task on the - * current thread ASAP. Workers should periodically invoke ShouldYield (or - * YieldIfNeeded()) as often as is reasonable. - */ - virtual bool ShouldYield() = 0; - - /** - * Notifies the scheduler that max concurrency was increased, and the number - * of worker should be adjusted accordingly. See Platform::PostJob() for more - * details. - */ - virtual void NotifyConcurrencyIncrease() = 0; - - /** - * Returns a task_id unique among threads currently running this job, such - * that GetTaskId() < worker count. To achieve this, the same task_id may be - * reused by a different thread after a worker_task returns. - */ - virtual uint8_t GetTaskId() = 0; - - /** - * Returns true if the current task is called from the thread currently - * running JobHandle::Join(). - * TODO(etiennep): Make pure virtual once custom embedders implement it. - */ - virtual bool IsJoiningThread() const { return false; } -}; - -/** - * Handle returned when posting a Job. Provides methods to control execution of - * the posted Job. - */ -class JobHandle { - public: - virtual ~JobHandle() = default; - - /** - * Notifies the scheduler that max concurrency was increased, and the number - * of worker should be adjusted accordingly. See Platform::PostJob() for more - * details. - */ - virtual void NotifyConcurrencyIncrease() = 0; - - /** - * Contributes to the job on this thread. Doesn't return until all tasks have - * completed and max concurrency becomes 0. When Join() is called and max - * concurrency reaches 0, it should not increase again. This also promotes - * this Job's priority to be at least as high as the calling thread's - * priority. - */ - virtual void Join() = 0; - - /** - * Forces all existing workers to yield ASAP. Waits until they have all - * returned from the Job's callback before returning. - */ - virtual void Cancel() = 0; - - /* - * Forces all existing workers to yield ASAP but doesn’t wait for them. - * Warning, this is dangerous if the Job's callback is bound to or has access - * to state which may be deleted after this call. - * TODO(etiennep): Cleanup once implemented by all embedders. - */ - virtual void CancelAndDetach() { Cancel(); } - - /** - * Returns true if there's any work pending or any worker running. - */ - virtual bool IsActive() = 0; - - // TODO(etiennep): Clean up once all overrides are removed. - V8_DEPRECATED("Use !IsActive() instead.") - virtual bool IsCompleted() { return !IsActive(); } - - /** - * Returns true if associated with a Job and other methods may be called. - * Returns false after Join() or Cancel() was called. This may return true - * even if no workers are running and IsCompleted() returns true - */ - virtual bool IsValid() = 0; - - // TODO(etiennep): Clean up once all overrides are removed. - V8_DEPRECATED("Use IsValid() instead.") - virtual bool IsRunning() { return IsValid(); } - - /** - * Returns true if job priority can be changed. - */ - virtual bool UpdatePriorityEnabled() const { return false; } - - /** - * Update this Job's priority. - */ - virtual void UpdatePriority(TaskPriority new_priority) {} -}; - -/** - * A JobTask represents work to run in parallel from Platform::PostJob(). - */ -class JobTask { - public: - virtual ~JobTask() = default; - - virtual void Run(JobDelegate* delegate) = 0; - - /** - * Controls the maximum number of threads calling Run() concurrently, given - * the number of threads currently assigned to this job and executing Run(). - * Run() is only invoked if the number of threads previously running Run() was - * less than the value returned. Since GetMaxConcurrency() is a leaf function, - * it must not call back any JobHandle methods. - */ - virtual size_t GetMaxConcurrency(size_t worker_count) const = 0; - - // TODO(1114823): Clean up once all overrides are removed. - V8_DEPRECATED("Use the version that takes |worker_count|.") - virtual size_t GetMaxConcurrency() const { return 0; } -}; - -/** - * The interface represents complex arguments to trace events. - */ -class ConvertableToTraceFormat { - public: - virtual ~ConvertableToTraceFormat() = default; - - /** - * Append the class info to the provided |out| string. The appended - * data must be a valid JSON object. Strings must be properly quoted, and - * escaped. There is no processing applied to the content after it is - * appended. - */ - virtual void AppendAsTraceFormat(std::string* out) const = 0; -}; - -/** - * V8 Tracing controller. - * - * Can be implemented by an embedder to record trace events from V8. - */ -class TracingController { - public: - virtual ~TracingController() = default; - - // In Perfetto mode, trace events are written using Perfetto's Track Event - // API directly without going through the embedder. However, it is still - // possible to observe tracing being enabled and disabled. -#if !defined(V8_USE_PERFETTO) - /** - * Called by TRACE_EVENT* macros, don't call this directly. - * The name parameter is a category group for example: - * TRACE_EVENT0("v8,parse", "V8.Parse") - * The pointer returned points to a value with zero or more of the bits - * defined in CategoryGroupEnabledFlags. - **/ - virtual const uint8_t* GetCategoryGroupEnabled(const char* name) { - static uint8_t no = 0; - return &no; - } - - /** - * Adds a trace event to the platform tracing system. These function calls are - * usually the result of a TRACE_* macro from trace_event_common.h when - * tracing and the category of the particular trace are enabled. It is not - * advisable to call these functions on their own; they are really only meant - * to be used by the trace macros. The returned handle can be used by - * UpdateTraceEventDuration to update the duration of COMPLETE events. - */ - virtual uint64_t AddTraceEvent( - char phase, const uint8_t* category_enabled_flag, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags) { - return 0; - } - virtual uint64_t AddTraceEventWithTimestamp( - char phase, const uint8_t* category_enabled_flag, const char* name, - const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args, - const char** arg_names, const uint8_t* arg_types, - const uint64_t* arg_values, - std::unique_ptr* arg_convertables, - unsigned int flags, int64_t timestamp) { - return 0; - } - - /** - * Sets the duration field of a COMPLETE trace event. It must be called with - * the handle returned from AddTraceEvent(). - **/ - virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, - const char* name, uint64_t handle) {} -#endif // !defined(V8_USE_PERFETTO) - - class TraceStateObserver { - public: - virtual ~TraceStateObserver() = default; - virtual void OnTraceEnabled() = 0; - virtual void OnTraceDisabled() = 0; - }; - - /** Adds tracing state change observer. */ - virtual void AddTraceStateObserver(TraceStateObserver*) {} - - /** Removes tracing state change observer. */ - virtual void RemoveTraceStateObserver(TraceStateObserver*) {} -}; - -/** - * A V8 memory page allocator. - * - * Can be implemented by an embedder to manage large host OS allocations. - */ -class PageAllocator { - public: - virtual ~PageAllocator() = default; - - /** - * Gets the page granularity for AllocatePages and FreePages. Addresses and - * lengths for those calls should be multiples of AllocatePageSize(). - */ - virtual size_t AllocatePageSize() = 0; - - /** - * Gets the page granularity for SetPermissions and ReleasePages. Addresses - * and lengths for those calls should be multiples of CommitPageSize(). - */ - virtual size_t CommitPageSize() = 0; - - /** - * Sets the random seed so that GetRandomMmapAddr() will generate repeatable - * sequences of random mmap addresses. - */ - virtual void SetRandomMmapSeed(int64_t seed) = 0; - - /** - * Returns a randomized address, suitable for memory allocation under ASLR. - * The address will be aligned to AllocatePageSize. - */ - virtual void* GetRandomMmapAddr() = 0; - - /** - * Memory permissions. - */ - enum Permission { - kNoAccess, - kRead, - kReadWrite, - kReadWriteExecute, - kReadExecute, - // Set this when reserving memory that will later require kReadWriteExecute - // permissions. The resulting behavior is platform-specific, currently - // this is used to set the MAP_JIT flag on Apple Silicon. - // TODO(jkummerow): Remove this when Wasm has a platform-independent - // w^x implementation. - kNoAccessWillJitLater - }; - - /** - * Allocates memory in range with the given alignment and permission. - */ - virtual void* AllocatePages(void* address, size_t length, size_t alignment, - Permission permissions) = 0; - - /** - * Frees memory in a range that was allocated by a call to AllocatePages. - */ - virtual bool FreePages(void* address, size_t length) = 0; - - /** - * Releases memory in a range that was allocated by a call to AllocatePages. - */ - virtual bool ReleasePages(void* address, size_t length, - size_t new_length) = 0; - - /** - * Sets permissions on pages in an allocated range. - */ - virtual bool SetPermissions(void* address, size_t length, - Permission permissions) = 0; - - /** - * Frees memory in the given [address, address + size) range. address and size - * should be operating system page-aligned. The next write to this - * memory area brings the memory transparently back. - */ - virtual bool DiscardSystemPages(void* address, size_t size) { return true; } - - /** - * INTERNAL ONLY: This interface has not been stabilised and may change - * without notice from one release to another without being deprecated first. - */ - class SharedMemoryMapping { - public: - // Implementations are expected to free the shared memory mapping in the - // destructor. - virtual ~SharedMemoryMapping() = default; - virtual void* GetMemory() const = 0; - }; - - /** - * INTERNAL ONLY: This interface has not been stabilised and may change - * without notice from one release to another without being deprecated first. - */ - class SharedMemory { - public: - // Implementations are expected to free the shared memory in the destructor. - virtual ~SharedMemory() = default; - virtual std::unique_ptr RemapTo( - void* new_address) const = 0; - virtual void* GetMemory() const = 0; - virtual size_t GetSize() const = 0; - }; - - /** - * INTERNAL ONLY: This interface has not been stabilised and may change - * without notice from one release to another without being deprecated first. - * - * Reserve pages at a fixed address returning whether the reservation is - * possible. The reserved memory is detached from the PageAllocator and so - * should not be freed by it. It's intended for use with - * SharedMemory::RemapTo, where ~SharedMemoryMapping would free the memory. - */ - virtual bool ReserveForSharedMemoryMapping(void* address, size_t size) { - return false; - } - - /** - * INTERNAL ONLY: This interface has not been stabilised and may change - * without notice from one release to another without being deprecated first. - * - * Allocates shared memory pages. Not all PageAllocators need support this and - * so this method need not be overridden. - * Allocates a new read-only shared memory region of size |length| and copies - * the memory at |original_address| into it. - */ - virtual std::unique_ptr AllocateSharedPages( - size_t length, const void* original_address) { - return {}; - } - - /** - * INTERNAL ONLY: This interface has not been stabilised and may change - * without notice from one release to another without being deprecated first. - * - * If not overridden and changed to return true, V8 will not attempt to call - * AllocateSharedPages or RemapSharedPages. If overridden, AllocateSharedPages - * and RemapSharedPages must also be overridden. - */ - virtual bool CanAllocateSharedPages() { return false; } -}; - -/** - * V8 Platform abstraction layer. - * - * The embedder has to provide an implementation of this interface before - * initializing the rest of V8. - */ -class Platform { - public: - virtual ~Platform() = default; - - /** - * Allows the embedder to manage memory page allocations. - */ - virtual PageAllocator* GetPageAllocator() { - // TODO(bbudge) Make this abstract after all embedders implement this. - return nullptr; - } - - /** - * Enables the embedder to respond in cases where V8 can't allocate large - * blocks of memory. V8 retries the failed allocation once after calling this - * method. On success, execution continues; otherwise V8 exits with a fatal - * error. - * Embedder overrides of this function must NOT call back into V8. - */ - virtual void OnCriticalMemoryPressure() { - // TODO(bbudge) Remove this when embedders override the following method. - // See crbug.com/634547. - } - - /** - * Enables the embedder to respond in cases where V8 can't allocate large - * memory regions. The |length| parameter is the amount of memory needed. - * Returns true if memory is now available. Returns false if no memory could - * be made available. V8 will retry allocations until this method returns - * false. - * - * Embedder overrides of this function must NOT call back into V8. - */ - virtual bool OnCriticalMemoryPressure(size_t length) { return false; } - - /** - * Gets the number of worker threads used by - * Call(BlockingTask)OnWorkerThread(). This can be used to estimate the number - * of tasks a work package should be split into. A return value of 0 means - * that there are no worker threads available. Note that a value of 0 won't - * prohibit V8 from posting tasks using |CallOnWorkerThread|. - */ - virtual int NumberOfWorkerThreads() = 0; - - /** - * Returns a TaskRunner which can be used to post a task on the foreground. - * The TaskRunner's NonNestableTasksEnabled() must be true. This function - * should only be called from a foreground thread. - */ - virtual std::shared_ptr GetForegroundTaskRunner( - Isolate* isolate) = 0; - - /** - * Schedules a task to be invoked on a worker thread. - */ - virtual void CallOnWorkerThread(std::unique_ptr task) = 0; - - /** - * Schedules a task that blocks the main thread to be invoked with - * high-priority on a worker thread. - */ - virtual void CallBlockingTaskOnWorkerThread(std::unique_ptr task) { - // Embedders may optionally override this to process these tasks in a high - // priority pool. - CallOnWorkerThread(std::move(task)); - } - - /** - * Schedules a task to be invoked with low-priority on a worker thread. - */ - virtual void CallLowPriorityTaskOnWorkerThread(std::unique_ptr task) { - // Embedders may optionally override this to process these tasks in a low - // priority pool. - CallOnWorkerThread(std::move(task)); - } - - /** - * Schedules a task to be invoked on a worker thread after |delay_in_seconds| - * expires. - */ - virtual void CallDelayedOnWorkerThread(std::unique_ptr task, - double delay_in_seconds) = 0; - - /** - * Returns true if idle tasks are enabled for the given |isolate|. - */ - virtual bool IdleTasksEnabled(Isolate* isolate) { return false; } - - /** - * Posts |job_task| to run in parallel. Returns a JobHandle associated with - * the Job, which can be joined or canceled. - * This avoids degenerate cases: - * - Calling CallOnWorkerThread() for each work item, causing significant - * overhead. - * - Fixed number of CallOnWorkerThread() calls that split the work and might - * run for a long time. This is problematic when many components post - * "num cores" tasks and all expect to use all the cores. In these cases, - * the scheduler lacks context to be fair to multiple same-priority requests - * and/or ability to request lower priority work to yield when high priority - * work comes in. - * A canonical implementation of |job_task| looks like: - * class MyJobTask : public JobTask { - * public: - * MyJobTask(...) : worker_queue_(...) {} - * // JobTask: - * void Run(JobDelegate* delegate) override { - * while (!delegate->ShouldYield()) { - * // Smallest unit of work. - * auto work_item = worker_queue_.TakeWorkItem(); // Thread safe. - * if (!work_item) return; - * ProcessWork(work_item); - * } - * } - * - * size_t GetMaxConcurrency() const override { - * return worker_queue_.GetSize(); // Thread safe. - * } - * }; - * auto handle = PostJob(TaskPriority::kUserVisible, - * std::make_unique(...)); - * handle->Join(); - * - * PostJob() and methods of the returned JobHandle/JobDelegate, must never be - * called while holding a lock that could be acquired by JobTask::Run or - * JobTask::GetMaxConcurrency -- that could result in a deadlock. This is - * because [1] JobTask::GetMaxConcurrency may be invoked while holding - * internal lock (A), hence JobTask::GetMaxConcurrency can only use a lock (B) - * if that lock is *never* held while calling back into JobHandle from any - * thread (A=>B/B=>A deadlock) and [2] JobTask::Run or - * JobTask::GetMaxConcurrency may be invoked synchronously from JobHandle - * (B=>JobHandle::foo=>B deadlock). - * - * A sufficient PostJob() implementation that uses the default Job provided in - * libplatform looks like: - * std::unique_ptr PostJob( - * TaskPriority priority, std::unique_ptr job_task) override { - * return v8::platform::NewDefaultJobHandle( - * this, priority, std::move(job_task), NumberOfWorkerThreads()); - * } - */ - virtual std::unique_ptr PostJob( - TaskPriority priority, std::unique_ptr job_task) = 0; - - /** - * Monotonically increasing time in seconds from an arbitrary fixed point in - * the past. This function is expected to return at least - * millisecond-precision values. For this reason, - * it is recommended that the fixed point be no further in the past than - * the epoch. - **/ - virtual double MonotonicallyIncreasingTime() = 0; - - /** - * Current wall-clock time in milliseconds since epoch. - * This function is expected to return at least millisecond-precision values. - */ - virtual double CurrentClockTimeMillis() = 0; - - typedef void (*StackTracePrinter)(); - - /** - * Returns a function pointer that print a stack trace of the current stack - * on invocation. Disables printing of the stack trace if nullptr. - */ - virtual StackTracePrinter GetStackTracePrinter() { return nullptr; } - - /** - * Returns an instance of a v8::TracingController. This must be non-nullptr. - */ - virtual TracingController* GetTracingController() = 0; - - /** - * Tells the embedder to generate and upload a crashdump during an unexpected - * but non-critical scenario. - */ - virtual void DumpWithoutCrashing() {} - - protected: - /** - * Default implementation of current wall-clock time in milliseconds - * since epoch. Useful for implementing |CurrentClockTimeMillis| if - * nothing special needed. - */ - V8_EXPORT static double SystemClockTimeMillis(); -}; - -} // namespace v8 - -#endif // V8_V8_PLATFORM_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-profiler.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-profiler.h deleted file mode 100644 index 49ada0a7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-profiler.h +++ /dev/null @@ -1,1123 +0,0 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_V8_PROFILER_H_ -#define V8_V8_PROFILER_H_ - -#include - -#include -#include -#include - -#include "v8.h" // NOLINT(build/include_directory) - -/** - * Profiler support for the V8 JavaScript engine. - */ -namespace v8 { - -class HeapGraphNode; -struct HeapStatsUpdate; - -using NativeObject = void*; -using SnapshotObjectId = uint32_t; - -struct CpuProfileDeoptFrame { - int script_id; - size_t position; -}; - -namespace internal { -class CpuProfile; -} // namespace internal - -} // namespace v8 - -#ifdef V8_OS_WIN -template class V8_EXPORT std::vector; -#endif - -namespace v8 { - -struct V8_EXPORT CpuProfileDeoptInfo { - /** A pointer to a static string owned by v8. */ - const char* deopt_reason; - std::vector stack; -}; - -} // namespace v8 - -#ifdef V8_OS_WIN -template class V8_EXPORT std::vector; -#endif - -namespace v8 { - -/** - * CpuProfileNode represents a node in a call graph. - */ -class V8_EXPORT CpuProfileNode { - public: - struct LineTick { - /** The 1-based number of the source line where the function originates. */ - int line; - - /** The count of samples associated with the source line. */ - unsigned int hit_count; - }; - - // An annotation hinting at the source of a CpuProfileNode. - enum SourceType { - // User-supplied script with associated resource information. - kScript = 0, - // Native scripts and provided builtins. - kBuiltin = 1, - // Callbacks into native code. - kCallback = 2, - // VM-internal functions or state. - kInternal = 3, - // A node that failed to symbolize. - kUnresolved = 4, - }; - - /** Returns function name (empty string for anonymous functions.) */ - Local GetFunctionName() const; - - /** - * Returns function name (empty string for anonymous functions.) - * The string ownership is *not* passed to the caller. It stays valid until - * profile is deleted. The function is thread safe. - */ - const char* GetFunctionNameStr() const; - - /** Returns id of the script where function is located. */ - int GetScriptId() const; - - /** Returns resource name for script from where the function originates. */ - Local GetScriptResourceName() const; - - /** - * Returns resource name for script from where the function originates. - * The string ownership is *not* passed to the caller. It stays valid until - * profile is deleted. The function is thread safe. - */ - const char* GetScriptResourceNameStr() const; - - /** - * Return true if the script from where the function originates is flagged as - * being shared cross-origin. - */ - bool IsScriptSharedCrossOrigin() const; - - /** - * Returns the number, 1-based, of the line where the function originates. - * kNoLineNumberInfo if no line number information is available. - */ - int GetLineNumber() const; - - /** - * Returns 1-based number of the column where the function originates. - * kNoColumnNumberInfo if no column number information is available. - */ - int GetColumnNumber() const; - - /** - * Returns the number of the function's source lines that collect the samples. - */ - unsigned int GetHitLineCount() const; - - /** Returns the set of source lines that collect the samples. - * The caller allocates buffer and responsible for releasing it. - * True if all available entries are copied, otherwise false. - * The function copies nothing if buffer is not large enough. - */ - bool GetLineTicks(LineTick* entries, unsigned int length) const; - - /** Returns bailout reason for the function - * if the optimization was disabled for it. - */ - const char* GetBailoutReason() const; - - /** - * Returns the count of samples where the function was currently executing. - */ - unsigned GetHitCount() const; - - /** Returns id of the node. The id is unique within the tree */ - unsigned GetNodeId() const; - - /** - * Gets the type of the source which the node was captured from. - */ - SourceType GetSourceType() const; - - /** Returns child nodes count of the node. */ - int GetChildrenCount() const; - - /** Retrieves a child node by index. */ - const CpuProfileNode* GetChild(int index) const; - - /** Retrieves the ancestor node, or null if the root. */ - const CpuProfileNode* GetParent() const; - - /** Retrieves deopt infos for the node. */ - const std::vector& GetDeoptInfos() const; - - static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; - static const int kNoColumnNumberInfo = Message::kNoColumnInfo; -}; - - -/** - * CpuProfile contains a CPU profile in a form of top-down call tree - * (from main() down to functions that do all the work). - */ -class V8_EXPORT CpuProfile { - public: - /** Returns CPU profile title. */ - Local GetTitle() const; - - /** Returns the root node of the top down call tree. */ - const CpuProfileNode* GetTopDownRoot() const; - - /** - * Returns number of samples recorded. The samples are not recorded unless - * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true. - */ - int GetSamplesCount() const; - - /** - * Returns profile node corresponding to the top frame the sample at - * the given index. - */ - const CpuProfileNode* GetSample(int index) const; - - /** - * Returns the timestamp of the sample. The timestamp is the number of - * microseconds since some unspecified starting point. - * The point is equal to the starting point used by GetStartTime. - */ - int64_t GetSampleTimestamp(int index) const; - - /** - * Returns time when the profile recording was started (in microseconds) - * since some unspecified starting point. - */ - int64_t GetStartTime() const; - - /** - * Returns time when the profile recording was stopped (in microseconds) - * since some unspecified starting point. - * The point is equal to the starting point used by GetStartTime. - */ - int64_t GetEndTime() const; - - /** - * Deletes the profile and removes it from CpuProfiler's list. - * All pointers to nodes previously returned become invalid. - */ - void Delete(); -}; - -enum CpuProfilingMode { - // In the resulting CpuProfile tree, intermediate nodes in a stack trace - // (from the root to a leaf) will have line numbers that point to the start - // line of the function, rather than the line of the callsite of the child. - kLeafNodeLineNumbers, - // In the resulting CpuProfile tree, nodes are separated based on the line - // number of their callsite in their parent. - kCallerLineNumbers, -}; - -// Determines how names are derived for functions sampled. -enum CpuProfilingNamingMode { - // Use the immediate name of functions at compilation time. - kStandardNaming, - // Use more verbose naming for functions without names, inferred from scope - // where possible. - kDebugNaming, -}; - -enum CpuProfilingLoggingMode { - // Enables logging when a profile is active, and disables logging when all - // profiles are detached. - kLazyLogging, - // Enables logging for the lifetime of the CpuProfiler. Calls to - // StartRecording are faster, at the expense of runtime overhead. - kEagerLogging, -}; - -// Enum for returning profiling status. Once StartProfiling is called, -// we want to return to clients whether the profiling was able to start -// correctly, or return a descriptive error. -enum class CpuProfilingStatus { - kStarted, - kAlreadyStarted, - kErrorTooManyProfilers -}; - -/** - * Delegate for when max samples reached and samples are discarded. - */ -class V8_EXPORT DiscardedSamplesDelegate { - public: - DiscardedSamplesDelegate() {} - - virtual ~DiscardedSamplesDelegate() = default; - virtual void Notify() = 0; -}; - -/** - * Optional profiling attributes. - */ -class V8_EXPORT CpuProfilingOptions { - public: - // Indicates that the sample buffer size should not be explicitly limited. - static const unsigned kNoSampleLimit = UINT_MAX; - - /** - * \param mode Type of computation of stack frame line numbers. - * \param max_samples The maximum number of samples that should be recorded by - * the profiler. Samples obtained after this limit will be - * discarded. - * \param sampling_interval_us controls the profile-specific target - * sampling interval. The provided sampling - * interval will be snapped to the next lowest - * non-zero multiple of the profiler's sampling - * interval, set via SetSamplingInterval(). If - * zero, the sampling interval will be equal to - * the profiler's sampling interval. - * \param filter_context Deprecated option to filter by context, currently a - * no-op. - */ - CpuProfilingOptions( - CpuProfilingMode mode = kLeafNodeLineNumbers, - unsigned max_samples = kNoSampleLimit, int sampling_interval_us = 0, - MaybeLocal filter_context = MaybeLocal()); - - CpuProfilingMode mode() const { return mode_; } - unsigned max_samples() const { return max_samples_; } - int sampling_interval_us() const { return sampling_interval_us_; } - - private: - friend class internal::CpuProfile; - - CpuProfilingMode mode_; - unsigned max_samples_; - int sampling_interval_us_; -}; - -/** - * Interface for controlling CPU profiling. Instance of the - * profiler can be created using v8::CpuProfiler::New method. - */ -class V8_EXPORT CpuProfiler { - public: - /** - * Creates a new CPU profiler for the |isolate|. The isolate must be - * initialized. The profiler object must be disposed after use by calling - * |Dispose| method. - */ - static CpuProfiler* New(Isolate* isolate, - CpuProfilingNamingMode = kDebugNaming, - CpuProfilingLoggingMode = kLazyLogging); - - /** - * Synchronously collect current stack sample in all profilers attached to - * the |isolate|. The call does not affect number of ticks recorded for - * the current top node. - */ - static void CollectSample(Isolate* isolate); - - /** - * Disposes the CPU profiler object. - */ - void Dispose(); - - /** - * Changes default CPU profiler sampling interval to the specified number - * of microseconds. Default interval is 1000us. This method must be called - * when there are no profiles being recorded. - */ - void SetSamplingInterval(int us); - - /** - * Sets whether or not the profiler should prioritize consistency of sample - * periodicity on Windows. Disabling this can greatly reduce CPU usage, but - * may result in greater variance in sample timings from the platform's - * scheduler. Defaults to enabled. This method must be called when there are - * no profiles being recorded. - */ - void SetUsePreciseSampling(bool); - - /** - * Starts collecting a CPU profile. Title may be an empty string. Several - * profiles may be collected at once. Attempts to start collecting several - * profiles with the same title are silently ignored. - */ - CpuProfilingStatus StartProfiling( - Local title, CpuProfilingOptions options, - std::unique_ptr delegate = nullptr); - - /** - * Starts profiling with the same semantics as above, except with expanded - * parameters. - * - * |record_samples| parameter controls whether individual samples should - * be recorded in addition to the aggregated tree. - * - * |max_samples| controls the maximum number of samples that should be - * recorded by the profiler. Samples obtained after this limit will be - * discarded. - */ - CpuProfilingStatus StartProfiling( - Local title, CpuProfilingMode mode, bool record_samples = false, - unsigned max_samples = CpuProfilingOptions::kNoSampleLimit); - /** - * The same as StartProfiling above, but the CpuProfilingMode defaults to - * kLeafNodeLineNumbers mode, which was the previous default behavior of the - * profiler. - */ - CpuProfilingStatus StartProfiling(Local title, - bool record_samples = false); - - /** - * Stops collecting CPU profile with a given title and returns it. - * If the title given is empty, finishes the last profile started. - */ - CpuProfile* StopProfiling(Local title); - - /** - * Generate more detailed source positions to code objects. This results in - * better results when mapping profiling samples to script source. - */ - static void UseDetailedSourcePositionsForProfiling(Isolate* isolate); - - private: - CpuProfiler(); - ~CpuProfiler(); - CpuProfiler(const CpuProfiler&); - CpuProfiler& operator=(const CpuProfiler&); -}; - -/** - * HeapSnapshotEdge represents a directed connection between heap - * graph nodes: from retainers to retained nodes. - */ -class V8_EXPORT HeapGraphEdge { - public: - enum Type { - kContextVariable = 0, // A variable from a function context. - kElement = 1, // An element of an array. - kProperty = 2, // A named object property. - kInternal = 3, // A link that can't be accessed from JS, - // thus, its name isn't a real property name - // (e.g. parts of a ConsString). - kHidden = 4, // A link that is needed for proper sizes - // calculation, but may be hidden from user. - kShortcut = 5, // A link that must not be followed during - // sizes calculation. - kWeak = 6 // A weak reference (ignored by the GC). - }; - - /** Returns edge type (see HeapGraphEdge::Type). */ - Type GetType() const; - - /** - * Returns edge name. This can be a variable name, an element index, or - * a property name. - */ - Local GetName() const; - - /** Returns origin node. */ - const HeapGraphNode* GetFromNode() const; - - /** Returns destination node. */ - const HeapGraphNode* GetToNode() const; -}; - - -/** - * HeapGraphNode represents a node in a heap graph. - */ -class V8_EXPORT HeapGraphNode { - public: - enum Type { - kHidden = 0, // Hidden node, may be filtered when shown to user. - kArray = 1, // An array of elements. - kString = 2, // A string. - kObject = 3, // A JS object (except for arrays and strings). - kCode = 4, // Compiled code. - kClosure = 5, // Function closure. - kRegExp = 6, // RegExp. - kHeapNumber = 7, // Number stored in the heap. - kNative = 8, // Native object (not from V8 heap). - kSynthetic = 9, // Synthetic object, usually used for grouping - // snapshot items together. - kConsString = 10, // Concatenated string. A pair of pointers to strings. - kSlicedString = 11, // Sliced string. A fragment of another string. - kSymbol = 12, // A Symbol (ES6). - kBigInt = 13 // BigInt. - }; - - /** Returns node type (see HeapGraphNode::Type). */ - Type GetType() const; - - /** - * Returns node name. Depending on node's type this can be the name - * of the constructor (for objects), the name of the function (for - * closures), string value, or an empty string (for compiled code). - */ - Local GetName() const; - - /** - * Returns node id. For the same heap object, the id remains the same - * across all snapshots. - */ - SnapshotObjectId GetId() const; - - /** Returns node's own size, in bytes. */ - size_t GetShallowSize() const; - - /** Returns child nodes count of the node. */ - int GetChildrenCount() const; - - /** Retrieves a child by index. */ - const HeapGraphEdge* GetChild(int index) const; -}; - - -/** - * An interface for exporting data from V8, using "push" model. - */ -class V8_EXPORT OutputStream { - public: - enum WriteResult { - kContinue = 0, - kAbort = 1 - }; - virtual ~OutputStream() = default; - /** Notify about the end of stream. */ - virtual void EndOfStream() = 0; - /** Get preferred output chunk size. Called only once. */ - virtual int GetChunkSize() { return 1024; } - /** - * Writes the next chunk of snapshot data into the stream. Writing - * can be stopped by returning kAbort as function result. EndOfStream - * will not be called in case writing was aborted. - */ - virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; - /** - * Writes the next chunk of heap stats data into the stream. Writing - * can be stopped by returning kAbort as function result. EndOfStream - * will not be called in case writing was aborted. - */ - virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) { - return kAbort; - } -}; - -/** - * HeapSnapshots record the state of the JS heap at some moment. - */ -class V8_EXPORT HeapSnapshot { - public: - enum SerializationFormat { - kJSON = 0 // See format description near 'Serialize' method. - }; - - /** Returns the root node of the heap graph. */ - const HeapGraphNode* GetRoot() const; - - /** Returns a node by its id. */ - const HeapGraphNode* GetNodeById(SnapshotObjectId id) const; - - /** Returns total nodes count in the snapshot. */ - int GetNodesCount() const; - - /** Returns a node by index. */ - const HeapGraphNode* GetNode(int index) const; - - /** Returns a max seen JS object Id. */ - SnapshotObjectId GetMaxSnapshotJSObjectId() const; - - /** - * Deletes the snapshot and removes it from HeapProfiler's list. - * All pointers to nodes, edges and paths previously returned become - * invalid. - */ - void Delete(); - - /** - * Prepare a serialized representation of the snapshot. The result - * is written into the stream provided in chunks of specified size. - * The total length of the serialized snapshot is unknown in - * advance, it can be roughly equal to JS heap size (that means, - * it can be really big - tens of megabytes). - * - * For the JSON format, heap contents are represented as an object - * with the following structure: - * - * { - * snapshot: { - * title: "...", - * uid: nnn, - * meta: { meta-info }, - * node_count: nnn, - * edge_count: nnn - * }, - * nodes: [nodes array], - * edges: [edges array], - * strings: [strings array] - * } - * - * Nodes reference strings, other nodes, and edges by their indexes - * in corresponding arrays. - */ - void Serialize(OutputStream* stream, - SerializationFormat format = kJSON) const; -}; - - -/** - * An interface for reporting progress and controlling long-running - * activities. - */ -class V8_EXPORT ActivityControl { - public: - enum ControlOption { - kContinue = 0, - kAbort = 1 - }; - virtual ~ActivityControl() = default; - /** - * Notify about current progress. The activity can be stopped by - * returning kAbort as the callback result. - */ - virtual ControlOption ReportProgressValue(int done, int total) = 0; -}; - -/** - * AllocationProfile is a sampled profile of allocations done by the program. - * This is structured as a call-graph. - */ -class V8_EXPORT AllocationProfile { - public: - struct Allocation { - /** - * Size of the sampled allocation object. - */ - size_t size; - - /** - * The number of objects of such size that were sampled. - */ - unsigned int count; - }; - - /** - * Represents a node in the call-graph. - */ - struct Node { - /** - * Name of the function. May be empty for anonymous functions or if the - * script corresponding to this function has been unloaded. - */ - Local name; - - /** - * Name of the script containing the function. May be empty if the script - * name is not available, or if the script has been unloaded. - */ - Local script_name; - - /** - * id of the script where the function is located. May be equal to - * v8::UnboundScript::kNoScriptId in cases where the script doesn't exist. - */ - int script_id; - - /** - * Start position of the function in the script. - */ - int start_position; - - /** - * 1-indexed line number where the function starts. May be - * kNoLineNumberInfo if no line number information is available. - */ - int line_number; - - /** - * 1-indexed column number where the function starts. May be - * kNoColumnNumberInfo if no line number information is available. - */ - int column_number; - - /** - * Unique id of the node. - */ - uint32_t node_id; - - /** - * List of callees called from this node for which we have sampled - * allocations. The lifetime of the children is scoped to the containing - * AllocationProfile. - */ - std::vector children; - - /** - * List of self allocations done by this node in the call-graph. - */ - std::vector allocations; - }; - - /** - * Represent a single sample recorded for an allocation. - */ - struct Sample { - /** - * id of the node in the profile tree. - */ - uint32_t node_id; - - /** - * Size of the sampled allocation object. - */ - size_t size; - - /** - * The number of objects of such size that were sampled. - */ - unsigned int count; - - /** - * Unique time-ordered id of the allocation sample. Can be used to track - * what samples were added or removed between two snapshots. - */ - uint64_t sample_id; - }; - - /** - * Returns the root node of the call-graph. The root node corresponds to an - * empty JS call-stack. The lifetime of the returned Node* is scoped to the - * containing AllocationProfile. - */ - virtual Node* GetRootNode() = 0; - virtual const std::vector& GetSamples() = 0; - - virtual ~AllocationProfile() = default; - - static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; - static const int kNoColumnNumberInfo = Message::kNoColumnInfo; -}; - -/** - * An object graph consisting of embedder objects and V8 objects. - * Edges of the graph are strong references between the objects. - * The embedder can build this graph during heap snapshot generation - * to include the embedder objects in the heap snapshot. - * Usage: - * 1) Define derived class of EmbedderGraph::Node for embedder objects. - * 2) Set the build embedder graph callback on the heap profiler using - * HeapProfiler::AddBuildEmbedderGraphCallback. - * 3) In the callback use graph->AddEdge(node1, node2) to add an edge from - * node1 to node2. - * 4) To represent references from/to V8 object, construct V8 nodes using - * graph->V8Node(value). - */ -class V8_EXPORT EmbedderGraph { - public: - class Node { - public: - /** - * Detachedness specifies whether an object is attached or detached from the - * main application state. While unkown in general, there may be objects - * that specifically know their state. V8 passes this information along in - * the snapshot. Users of the snapshot may use it to annotate the object - * graph. - */ - enum class Detachedness : uint8_t { - kUnknown = 0, - kAttached = 1, - kDetached = 2, - }; - - Node() = default; - virtual ~Node() = default; - virtual const char* Name() = 0; - virtual size_t SizeInBytes() = 0; - /** - * The corresponding V8 wrapper node if not null. - * During heap snapshot generation the embedder node and the V8 wrapper - * node will be merged into one node to simplify retaining paths. - */ - virtual Node* WrapperNode() { return nullptr; } - virtual bool IsRootNode() { return false; } - /** Must return true for non-V8 nodes. */ - virtual bool IsEmbedderNode() { return true; } - /** - * Optional name prefix. It is used in Chrome for tagging detached nodes. - */ - virtual const char* NamePrefix() { return nullptr; } - - /** - * Returns the NativeObject that can be used for querying the - * |HeapSnapshot|. - */ - virtual NativeObject GetNativeObject() { return nullptr; } - - /** - * Detachedness state of a given object. While unkown in general, there may - * be objects that specifically know their state. V8 passes this information - * along in the snapshot. Users of the snapshot may use it to annotate the - * object graph. - */ - virtual Detachedness GetDetachedness() { return Detachedness::kUnknown; } - - Node(const Node&) = delete; - Node& operator=(const Node&) = delete; - }; - - /** - * Returns a node corresponding to the given V8 value. Ownership is not - * transferred. The result pointer is valid while the graph is alive. - */ - virtual Node* V8Node(const v8::Local& value) = 0; - - /** - * Adds the given node to the graph and takes ownership of the node. - * Returns a raw pointer to the node that is valid while the graph is alive. - */ - virtual Node* AddNode(std::unique_ptr node) = 0; - - /** - * Adds an edge that represents a strong reference from the given - * node |from| to the given node |to|. The nodes must be added to the graph - * before calling this function. - * - * If name is nullptr, the edge will have auto-increment indexes, otherwise - * it will be named accordingly. - */ - virtual void AddEdge(Node* from, Node* to, const char* name = nullptr) = 0; - - virtual ~EmbedderGraph() = default; -}; - -/** - * Interface for controlling heap profiling. Instance of the - * profiler can be retrieved using v8::Isolate::GetHeapProfiler. - */ -class V8_EXPORT HeapProfiler { - public: - enum SamplingFlags { - kSamplingNoFlags = 0, - kSamplingForceGC = 1 << 0, - }; - - /** - * Callback function invoked during heap snapshot generation to retrieve - * the embedder object graph. The callback should use graph->AddEdge(..) to - * add references between the objects. - * The callback must not trigger garbage collection in V8. - */ - typedef void (*BuildEmbedderGraphCallback)(v8::Isolate* isolate, - v8::EmbedderGraph* graph, - void* data); - - /** - * Callback function invoked during heap snapshot generation to retrieve - * the detachedness state of an object referenced by a TracedReference. - * - * The callback takes Local as parameter to allow the embedder to - * unpack the TracedReference into a Local and reuse that Local for different - * purposes. - */ - using GetDetachednessCallback = EmbedderGraph::Node::Detachedness (*)( - v8::Isolate* isolate, const v8::Local& v8_value, - uint16_t class_id, void* data); - - /** Returns the number of snapshots taken. */ - int GetSnapshotCount(); - - /** Returns a snapshot by index. */ - const HeapSnapshot* GetHeapSnapshot(int index); - - /** - * Returns SnapshotObjectId for a heap object referenced by |value| if - * it has been seen by the heap profiler, kUnknownObjectId otherwise. - */ - SnapshotObjectId GetObjectId(Local value); - - /** - * Returns SnapshotObjectId for a native object referenced by |value| if it - * has been seen by the heap profiler, kUnknownObjectId otherwise. - */ - SnapshotObjectId GetObjectId(NativeObject value); - - /** - * Returns heap object with given SnapshotObjectId if the object is alive, - * otherwise empty handle is returned. - */ - Local FindObjectById(SnapshotObjectId id); - - /** - * Clears internal map from SnapshotObjectId to heap object. The new objects - * will not be added into it unless a heap snapshot is taken or heap object - * tracking is kicked off. - */ - void ClearObjectIds(); - - /** - * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will return - * it in case heap profiler cannot find id for the object passed as - * parameter. HeapSnapshot::GetNodeById will always return NULL for such id. - */ - static const SnapshotObjectId kUnknownObjectId = 0; - - /** - * Callback interface for retrieving user friendly names of global objects. - */ - class ObjectNameResolver { - public: - /** - * Returns name to be used in the heap snapshot for given node. Returned - * string must stay alive until snapshot collection is completed. - */ - virtual const char* GetName(Local object) = 0; - - protected: - virtual ~ObjectNameResolver() = default; - }; - - /** - * Takes a heap snapshot and returns it. - */ - const HeapSnapshot* TakeHeapSnapshot( - ActivityControl* control = nullptr, - ObjectNameResolver* global_object_name_resolver = nullptr, - bool treat_global_objects_as_roots = true); - - /** - * Takes a heap snapshot and returns it. - */ - const HeapSnapshot* TakeHeapSnapshotV8_92( - ActivityControl* control = nullptr, - ObjectNameResolver* global_object_name_resolver = nullptr, - bool treat_global_objects_as_roots = true, - bool capture_numeric_value = false); - - /** - * Starts tracking of heap objects population statistics. After calling - * this method, all heap objects relocations done by the garbage collector - * are being registered. - * - * |track_allocations| parameter controls whether stack trace of each - * allocation in the heap will be recorded and reported as part of - * HeapSnapshot. - */ - void StartTrackingHeapObjects(bool track_allocations = false); - - /** - * Adds a new time interval entry to the aggregated statistics array. The - * time interval entry contains information on the current heap objects - * population size. The method also updates aggregated statistics and - * reports updates for all previous time intervals via the OutputStream - * object. Updates on each time interval are provided as a stream of the - * HeapStatsUpdate structure instances. - * If |timestamp_us| is supplied, timestamp of the new entry will be written - * into it. The return value of the function is the last seen heap object Id. - * - * StartTrackingHeapObjects must be called before the first call to this - * method. - */ - SnapshotObjectId GetHeapStats(OutputStream* stream, - int64_t* timestamp_us = nullptr); - - /** - * Stops tracking of heap objects population statistics, cleans up all - * collected data. StartHeapObjectsTracking must be called again prior to - * calling GetHeapStats next time. - */ - void StopTrackingHeapObjects(); - - /** - * Starts gathering a sampling heap profile. A sampling heap profile is - * similar to tcmalloc's heap profiler and Go's mprof. It samples object - * allocations and builds an online 'sampling' heap profile. At any point in - * time, this profile is expected to be a representative sample of objects - * currently live in the system. Each sampled allocation includes the stack - * trace at the time of allocation, which makes this really useful for memory - * leak detection. - * - * This mechanism is intended to be cheap enough that it can be used in - * production with minimal performance overhead. - * - * Allocations are sampled using a randomized Poisson process. On average, one - * allocation will be sampled every |sample_interval| bytes allocated. The - * |stack_depth| parameter controls the maximum number of stack frames to be - * captured on each allocation. - * - * NOTE: This is a proof-of-concept at this point. Right now we only sample - * newspace allocations. Support for paged space allocation (e.g. pre-tenured - * objects, large objects, code objects, etc.) and native allocations - * doesn't exist yet, but is anticipated in the future. - * - * Objects allocated before the sampling is started will not be included in - * the profile. - * - * Returns false if a sampling heap profiler is already running. - */ - bool StartSamplingHeapProfiler(uint64_t sample_interval = 512 * 1024, - int stack_depth = 16, - SamplingFlags flags = kSamplingNoFlags); - - /** - * Stops the sampling heap profile and discards the current profile. - */ - void StopSamplingHeapProfiler(); - - /** - * Returns the sampled profile of allocations allocated (and still live) since - * StartSamplingHeapProfiler was called. The ownership of the pointer is - * transferred to the caller. Returns nullptr if sampling heap profiler is not - * active. - */ - AllocationProfile* GetAllocationProfile(); - - /** - * Deletes all snapshots taken. All previously returned pointers to - * snapshots and their contents become invalid after this call. - */ - void DeleteAllHeapSnapshots(); - - void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, - void* data); - void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, - void* data); - - void SetGetDetachednessCallback(GetDetachednessCallback callback, void* data); - - /** - * Default value of persistent handle class ID. Must not be used to - * define a class. Can be used to reset a class of a persistent - * handle. - */ - static const uint16_t kPersistentHandleNoClassId = 0; - - private: - HeapProfiler(); - ~HeapProfiler(); - HeapProfiler(const HeapProfiler&); - HeapProfiler& operator=(const HeapProfiler&); -}; - -/** - * A struct for exporting HeapStats data from V8, using "push" model. - * See HeapProfiler::GetHeapStats. - */ -struct HeapStatsUpdate { - HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size) - : index(index), count(count), size(size) { } - uint32_t index; // Index of the time interval that was changed. - uint32_t count; // New value of count field for the interval with this index. - uint32_t size; // New value of size field for the interval with this index. -}; - -#define CODE_EVENTS_LIST(V) \ - V(Builtin) \ - V(Callback) \ - V(Eval) \ - V(Function) \ - V(InterpretedFunction) \ - V(Handler) \ - V(BytecodeHandler) \ - V(LazyCompile) \ - V(RegExp) \ - V(Script) \ - V(Stub) \ - V(Relocation) - -/** - * Note that this enum may be extended in the future. Please include a default - * case if this enum is used in a switch statement. - */ -enum CodeEventType { - kUnknownType = 0 -#define V(Name) , k##Name##Type - CODE_EVENTS_LIST(V) -#undef V -}; - -/** - * Representation of a code creation event - */ -class V8_EXPORT CodeEvent { - public: - uintptr_t GetCodeStartAddress(); - size_t GetCodeSize(); - Local GetFunctionName(); - Local GetScriptName(); - int GetScriptLine(); - int GetScriptColumn(); - /** - * NOTE (mmarchini): We can't allocate objects in the heap when we collect - * existing code, and both the code type and the comment are not stored in the - * heap, so we return those as const char*. - */ - CodeEventType GetCodeType(); - const char* GetComment(); - - static const char* GetCodeEventTypeName(CodeEventType code_event_type); - - uintptr_t GetPreviousCodeStartAddress(); -}; - -/** - * Interface to listen to code creation and code relocation events. - */ -class V8_EXPORT CodeEventHandler { - public: - /** - * Creates a new listener for the |isolate|. The isolate must be initialized. - * The listener object must be disposed after use by calling |Dispose| method. - * Multiple listeners can be created for the same isolate. - */ - explicit CodeEventHandler(Isolate* isolate); - virtual ~CodeEventHandler(); - - /** - * Handle is called every time a code object is created or moved. Information - * about each code event will be available through the `code_event` - * parameter. - * - * When the CodeEventType is kRelocationType, the code for this CodeEvent has - * moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`. - */ - virtual void Handle(CodeEvent* code_event) = 0; - - /** - * Call `Enable()` to starts listening to code creation and code relocation - * events. These events will be handled by `Handle()`. - */ - void Enable(); - - /** - * Call `Disable()` to stop listening to code creation and code relocation - * events. - */ - void Disable(); - - private: - CodeEventHandler(); - CodeEventHandler(const CodeEventHandler&); - CodeEventHandler& operator=(const CodeEventHandler&); - void* internal_listener_; -}; - -} // namespace v8 - - -#endif // V8_V8_PROFILER_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-unwinder-state.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-unwinder-state.h deleted file mode 100644 index 00f8b8b1..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-unwinder-state.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_V8_UNWINDER_STATE_H_ -#define INCLUDE_V8_UNWINDER_STATE_H_ - -namespace v8 { - -#ifdef V8_TARGET_ARCH_ARM -struct CalleeSavedRegisters { - void* arm_r4; - void* arm_r5; - void* arm_r6; - void* arm_r7; - void* arm_r8; - void* arm_r9; - void* arm_r10; -}; -#elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \ - V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || \ - V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 -struct CalleeSavedRegisters {}; -#else -#error Target architecture was not detected as supported by v8 -#endif - -} // namespace v8 - -#endif // INCLUDE_V8_UNWINDER _STATE_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-util.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-util.h deleted file mode 100644 index 8e4d6615..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-util.h +++ /dev/null @@ -1,652 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_UTIL_H_ -#define V8_UTIL_H_ - -#include "v8.h" // NOLINT(build/include_directory) -#include -#include -#include - -/** - * Support for Persistent containers. - * - * C++11 embedders can use STL containers with Global values, - * but pre-C++11 does not support the required move semantic and hence - * may want these container classes. - */ -namespace v8 { - -typedef uintptr_t PersistentContainerValue; -static const uintptr_t kPersistentContainerNotFound = 0; -enum PersistentContainerCallbackType { - kNotWeak, - // These correspond to v8::WeakCallbackType - kWeakWithParameter, - kWeakWithInternalFields -}; - -/** - * A default trait implementation for PersistentValueMap which uses std::map - * as a backing map. - * - * Users will have to implement their own weak callbacks & dispose traits. - */ -template -class StdMapTraits { - public: - // STL map & related: - typedef std::map Impl; - typedef typename Impl::iterator Iterator; - - static bool Empty(Impl* impl) { return impl->empty(); } - static size_t Size(Impl* impl) { return impl->size(); } - static void Swap(Impl& a, Impl& b) { std::swap(a, b); } - static Iterator Begin(Impl* impl) { return impl->begin(); } - static Iterator End(Impl* impl) { return impl->end(); } - static K Key(Iterator it) { return it->first; } - static PersistentContainerValue Value(Iterator it) { return it->second; } - static PersistentContainerValue Set(Impl* impl, K key, - PersistentContainerValue value) { - std::pair res = impl->insert(std::make_pair(key, value)); - PersistentContainerValue old_value = kPersistentContainerNotFound; - if (!res.second) { - old_value = res.first->second; - res.first->second = value; - } - return old_value; - } - static PersistentContainerValue Get(Impl* impl, K key) { - Iterator it = impl->find(key); - if (it == impl->end()) return kPersistentContainerNotFound; - return it->second; - } - static PersistentContainerValue Remove(Impl* impl, K key) { - Iterator it = impl->find(key); - if (it == impl->end()) return kPersistentContainerNotFound; - PersistentContainerValue value = it->second; - impl->erase(it); - return value; - } -}; - - -/** - * A default trait implementation for PersistentValueMap, which inherits - * a std:map backing map from StdMapTraits and holds non-weak persistent - * objects and has no special Dispose handling. - * - * You should not derive from this class, since MapType depends on the - * surrounding class, and hence a subclass cannot simply inherit the methods. - */ -template -class DefaultPersistentValueMapTraits : public StdMapTraits { - public: - // Weak callback & friends: - static const PersistentContainerCallbackType kCallbackType = kNotWeak; - typedef PersistentValueMap > - MapType; - typedef void WeakCallbackDataType; - - static WeakCallbackDataType* WeakCallbackParameter( - MapType* map, const K& key, Local value) { - return nullptr; - } - static MapType* MapFromWeakCallbackInfo( - const WeakCallbackInfo& data) { - return nullptr; - } - static K KeyFromWeakCallbackInfo( - const WeakCallbackInfo& data) { - return K(); - } - static void DisposeCallbackData(WeakCallbackDataType* data) { } - static void Dispose(Isolate* isolate, Global value, K key) {} -}; - - -template -class DefaultGlobalMapTraits : public StdMapTraits { - private: - template - struct RemovePointer; - - public: - // Weak callback & friends: - static const PersistentContainerCallbackType kCallbackType = kNotWeak; - typedef GlobalValueMap > MapType; - typedef void WeakCallbackDataType; - - static WeakCallbackDataType* WeakCallbackParameter(MapType* map, const K& key, - Local value) { - return nullptr; - } - static MapType* MapFromWeakCallbackInfo( - const WeakCallbackInfo& data) { - return nullptr; - } - static K KeyFromWeakCallbackInfo( - const WeakCallbackInfo& data) { - return K(); - } - static void DisposeCallbackData(WeakCallbackDataType* data) {} - static void OnWeakCallback( - const WeakCallbackInfo& data) {} - static void Dispose(Isolate* isolate, Global value, K key) {} - // This is a second pass callback, so SetSecondPassCallback cannot be called. - static void DisposeWeak(const WeakCallbackInfo& data) {} - - private: - template - struct RemovePointer { - typedef T Type; - }; -}; - - -/** - * A map wrapper that allows using Global as a mapped value. - * C++11 embedders don't need this class, as they can use Global - * directly in std containers. - * - * The map relies on a backing map, whose type and accessors are described - * by the Traits class. The backing map will handle values of type - * PersistentContainerValue, with all conversion into and out of V8 - * handles being transparently handled by this class. - */ -template -class PersistentValueMapBase { - public: - Isolate* GetIsolate() { return isolate_; } - - /** - * Return size of the map. - */ - size_t Size() { return Traits::Size(&impl_); } - - /** - * Return whether the map holds weak persistents. - */ - bool IsWeak() { return Traits::kCallbackType != kNotWeak; } - - /** - * Get value stored in map. - */ - Local Get(const K& key) { - return Local::New(isolate_, FromVal(Traits::Get(&impl_, key))); - } - - /** - * Check whether a value is contained in the map. - */ - bool Contains(const K& key) { - return Traits::Get(&impl_, key) != kPersistentContainerNotFound; - } - - /** - * Get value stored in map and set it in returnValue. - * Return true if a value was found. - */ - bool SetReturnValue(const K& key, - ReturnValue returnValue) { - return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key)); - } - - /** - * Return value for key and remove it from the map. - */ - Global Remove(const K& key) { - return Release(Traits::Remove(&impl_, key)).Pass(); - } - - /** - * Traverses the map repeatedly, - * in case side effects of disposal cause insertions. - **/ - void Clear() { - typedef typename Traits::Iterator It; - HandleScope handle_scope(isolate_); - // TODO(dcarney): figure out if this swap and loop is necessary. - while (!Traits::Empty(&impl_)) { - typename Traits::Impl impl; - Traits::Swap(impl_, impl); - for (It i = Traits::Begin(&impl); i != Traits::End(&impl); ++i) { - Traits::Dispose(isolate_, Release(Traits::Value(i)).Pass(), - Traits::Key(i)); - } - } - } - - /** - * Helper class for GetReference/SetWithReference. Do not use outside - * that context. - */ - class PersistentValueReference { - public: - PersistentValueReference() : value_(kPersistentContainerNotFound) { } - PersistentValueReference(const PersistentValueReference& other) - : value_(other.value_) { } - - Local NewLocal(Isolate* isolate) const { - return Local::New(isolate, FromVal(value_)); - } - bool IsEmpty() const { - return value_ == kPersistentContainerNotFound; - } - template - bool SetReturnValue(ReturnValue returnValue) { - return SetReturnValueFromVal(&returnValue, value_); - } - void Reset() { - value_ = kPersistentContainerNotFound; - } - void operator=(const PersistentValueReference& other) { - value_ = other.value_; - } - - private: - friend class PersistentValueMapBase; - friend class PersistentValueMap; - friend class GlobalValueMap; - - explicit PersistentValueReference(PersistentContainerValue value) - : value_(value) { } - - void operator=(PersistentContainerValue value) { - value_ = value; - } - - PersistentContainerValue value_; - }; - - /** - * Get a reference to a map value. This enables fast, repeated access - * to a value stored in the map while the map remains unchanged. - * - * Careful: This is potentially unsafe, so please use with care. - * The value will become invalid if the value for this key changes - * in the underlying map, as a result of Set or Remove for the same - * key; as a result of the weak callback for the same key; or as a - * result of calling Clear() or destruction of the map. - */ - PersistentValueReference GetReference(const K& key) { - return PersistentValueReference(Traits::Get(&impl_, key)); - } - - protected: - explicit PersistentValueMapBase(Isolate* isolate) - : isolate_(isolate), label_(nullptr) {} - PersistentValueMapBase(Isolate* isolate, const char* label) - : isolate_(isolate), label_(label) {} - - ~PersistentValueMapBase() { Clear(); } - - Isolate* isolate() { return isolate_; } - typename Traits::Impl* impl() { return &impl_; } - - static V* FromVal(PersistentContainerValue v) { - return reinterpret_cast(v); - } - - static PersistentContainerValue ClearAndLeak(Global* persistent) { - V* v = persistent->val_; - persistent->val_ = nullptr; - return reinterpret_cast(v); - } - - static PersistentContainerValue Leak(Global* persistent) { - return reinterpret_cast(persistent->val_); - } - - /** - * Return a container value as Global and make sure the weak - * callback is properly disposed of. All remove functionality should go - * through this. - */ - static Global Release(PersistentContainerValue v) { - Global p; - p.val_ = FromVal(v); - if (Traits::kCallbackType != kNotWeak && p.IsWeak()) { - Traits::DisposeCallbackData( - p.template ClearWeak()); - } - return p.Pass(); - } - - void RemoveWeak(const K& key) { - Global p; - p.val_ = FromVal(Traits::Remove(&impl_, key)); - p.Reset(); - } - - void AnnotateStrongRetainer(Global* persistent) { - persistent->AnnotateStrongRetainer(label_); - } - - private: - PersistentValueMapBase(PersistentValueMapBase&); - void operator=(PersistentValueMapBase&); - - static bool SetReturnValueFromVal(ReturnValue* returnValue, - PersistentContainerValue value) { - bool hasValue = value != kPersistentContainerNotFound; - if (hasValue) { - returnValue->SetInternal( - *reinterpret_cast(FromVal(value))); - } - return hasValue; - } - - Isolate* isolate_; - typename Traits::Impl impl_; - const char* label_; -}; - -template -class PersistentValueMap : public PersistentValueMapBase { - public: - explicit PersistentValueMap(Isolate* isolate) - : PersistentValueMapBase(isolate) {} - PersistentValueMap(Isolate* isolate, const char* label) - : PersistentValueMapBase(isolate, label) {} - - typedef - typename PersistentValueMapBase::PersistentValueReference - PersistentValueReference; - - /** - * Put value into map. Depending on Traits::kIsWeak, the value will be held - * by the map strongly or weakly. - * Returns old value as Global. - */ - Global Set(const K& key, Local value) { - Global persistent(this->isolate(), value); - return SetUnique(key, &persistent); - } - - /** - * Put value into map, like Set(const K&, Local). - */ - Global Set(const K& key, Global value) { - return SetUnique(key, &value); - } - - /** - * Put the value into the map, and set the 'weak' callback when demanded - * by the Traits class. - */ - Global SetUnique(const K& key, Global* persistent) { - if (Traits::kCallbackType == kNotWeak) { - this->AnnotateStrongRetainer(persistent); - } else { - WeakCallbackType callback_type = - Traits::kCallbackType == kWeakWithInternalFields - ? WeakCallbackType::kInternalFields - : WeakCallbackType::kParameter; - Local value(Local::New(this->isolate(), *persistent)); - persistent->template SetWeak( - Traits::WeakCallbackParameter(this, key, value), WeakCallback, - callback_type); - } - PersistentContainerValue old_value = - Traits::Set(this->impl(), key, this->ClearAndLeak(persistent)); - return this->Release(old_value).Pass(); - } - - /** - * Put a value into the map and update the reference. - * Restrictions of GetReference apply here as well. - */ - Global Set(const K& key, Global value, - PersistentValueReference* reference) { - *reference = this->Leak(&value); - return SetUnique(key, &value); - } - - private: - static void WeakCallback( - const WeakCallbackInfo& data) { - if (Traits::kCallbackType != kNotWeak) { - PersistentValueMap* persistentValueMap = - Traits::MapFromWeakCallbackInfo(data); - K key = Traits::KeyFromWeakCallbackInfo(data); - Traits::Dispose(data.GetIsolate(), - persistentValueMap->Remove(key).Pass(), key); - Traits::DisposeCallbackData(data.GetParameter()); - } - } -}; - - -template -class GlobalValueMap : public PersistentValueMapBase { - public: - explicit GlobalValueMap(Isolate* isolate) - : PersistentValueMapBase(isolate) {} - GlobalValueMap(Isolate* isolate, const char* label) - : PersistentValueMapBase(isolate, label) {} - - typedef - typename PersistentValueMapBase::PersistentValueReference - PersistentValueReference; - - /** - * Put value into map. Depending on Traits::kIsWeak, the value will be held - * by the map strongly or weakly. - * Returns old value as Global. - */ - Global Set(const K& key, Local value) { - Global persistent(this->isolate(), value); - return SetUnique(key, &persistent); - } - - /** - * Put value into map, like Set(const K&, Local). - */ - Global Set(const K& key, Global value) { - return SetUnique(key, &value); - } - - /** - * Put the value into the map, and set the 'weak' callback when demanded - * by the Traits class. - */ - Global SetUnique(const K& key, Global* persistent) { - if (Traits::kCallbackType == kNotWeak) { - this->AnnotateStrongRetainer(persistent); - } else { - WeakCallbackType callback_type = - Traits::kCallbackType == kWeakWithInternalFields - ? WeakCallbackType::kInternalFields - : WeakCallbackType::kParameter; - Local value(Local::New(this->isolate(), *persistent)); - persistent->template SetWeak( - Traits::WeakCallbackParameter(this, key, value), OnWeakCallback, - callback_type); - } - PersistentContainerValue old_value = - Traits::Set(this->impl(), key, this->ClearAndLeak(persistent)); - return this->Release(old_value).Pass(); - } - - /** - * Put a value into the map and update the reference. - * Restrictions of GetReference apply here as well. - */ - Global Set(const K& key, Global value, - PersistentValueReference* reference) { - *reference = this->Leak(&value); - return SetUnique(key, &value); - } - - private: - static void OnWeakCallback( - const WeakCallbackInfo& data) { - if (Traits::kCallbackType != kNotWeak) { - auto map = Traits::MapFromWeakCallbackInfo(data); - K key = Traits::KeyFromWeakCallbackInfo(data); - map->RemoveWeak(key); - Traits::OnWeakCallback(data); - data.SetSecondPassCallback(SecondWeakCallback); - } - } - - static void SecondWeakCallback( - const WeakCallbackInfo& data) { - Traits::DisposeWeak(data); - } -}; - - -/** - * A map that uses Global as value and std::map as the backing - * implementation. Persistents are held non-weak. - * - * C++11 embedders don't need this class, as they can use - * Global directly in std containers. - */ -template > -class StdPersistentValueMap : public PersistentValueMap { - public: - explicit StdPersistentValueMap(Isolate* isolate) - : PersistentValueMap(isolate) {} -}; - - -/** - * A map that uses Global as value and std::map as the backing - * implementation. Globals are held non-weak. - * - * C++11 embedders don't need this class, as they can use - * Global directly in std containers. - */ -template > -class StdGlobalValueMap : public GlobalValueMap { - public: - explicit StdGlobalValueMap(Isolate* isolate) - : GlobalValueMap(isolate) {} -}; - - -class DefaultPersistentValueVectorTraits { - public: - typedef std::vector Impl; - - static void Append(Impl* impl, PersistentContainerValue value) { - impl->push_back(value); - } - static bool IsEmpty(const Impl* impl) { - return impl->empty(); - } - static size_t Size(const Impl* impl) { - return impl->size(); - } - static PersistentContainerValue Get(const Impl* impl, size_t i) { - return (i < impl->size()) ? impl->at(i) : kPersistentContainerNotFound; - } - static void ReserveCapacity(Impl* impl, size_t capacity) { - impl->reserve(capacity); - } - static void Clear(Impl* impl) { - impl->clear(); - } -}; - - -/** - * A vector wrapper that safely stores Global values. - * C++11 embedders don't need this class, as they can use Global - * directly in std containers. - * - * This class relies on a backing vector implementation, whose type and methods - * are described by the Traits class. The backing map will handle values of type - * PersistentContainerValue, with all conversion into and out of V8 - * handles being transparently handled by this class. - */ -template -class PersistentValueVector { - public: - explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { } - - ~PersistentValueVector() { - Clear(); - } - - /** - * Append a value to the vector. - */ - void Append(Local value) { - Global persistent(isolate_, value); - Traits::Append(&impl_, ClearAndLeak(&persistent)); - } - - /** - * Append a persistent's value to the vector. - */ - void Append(Global persistent) { - Traits::Append(&impl_, ClearAndLeak(&persistent)); - } - - /** - * Are there any values in the vector? - */ - bool IsEmpty() const { - return Traits::IsEmpty(&impl_); - } - - /** - * How many elements are in the vector? - */ - size_t Size() const { - return Traits::Size(&impl_); - } - - /** - * Retrieve the i-th value in the vector. - */ - Local Get(size_t index) const { - return Local::New(isolate_, FromVal(Traits::Get(&impl_, index))); - } - - /** - * Remove all elements from the vector. - */ - void Clear() { - size_t length = Traits::Size(&impl_); - for (size_t i = 0; i < length; i++) { - Global p; - p.val_ = FromVal(Traits::Get(&impl_, i)); - } - Traits::Clear(&impl_); - } - - /** - * Reserve capacity in the vector. - * (Efficiency gains depend on the backing implementation.) - */ - void ReserveCapacity(size_t capacity) { - Traits::ReserveCapacity(&impl_, capacity); - } - - private: - static PersistentContainerValue ClearAndLeak(Global* persistent) { - V* v = persistent->val_; - persistent->val_ = nullptr; - return reinterpret_cast(v); - } - - static V* FromVal(PersistentContainerValue v) { - return reinterpret_cast(v); - } - - Isolate* isolate_; - typename Traits::Impl impl_; -}; - -} // namespace v8 - -#endif // V8_UTIL_H diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-value-serializer-version.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-value-serializer-version.h deleted file mode 100644 index c72911c6..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-value-serializer-version.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * Compile-time constants. - * - * This header provides access to information about the value serializer at - * compile time, without declaring or defining any symbols that require linking - * to V8. - */ - -#ifndef INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_ -#define INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_ - -#include - -namespace v8 { - -constexpr uint32_t CurrentValueSerializerFormatVersion() { return 13; } - -} // namespace v8 - -#endif // INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version-string.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version-string.h deleted file mode 100644 index 8faed2a7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version-string.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_VERSION_STRING_H_ -#define V8_VERSION_STRING_H_ - -#include "v8-version.h" // NOLINT(build/include_directory) - -// This is here rather than v8-version.h to keep that file simple and -// machine-processable. - -#if V8_IS_CANDIDATE_VERSION -#define V8_CANDIDATE_STRING " (candidate)" -#else -#define V8_CANDIDATE_STRING "" -#endif - -#ifndef V8_EMBEDDER_STRING -#define V8_EMBEDDER_STRING "" -#endif - -#define V8_SX(x) #x -#define V8_S(x) V8_SX(x) - -#if V8_PATCH_LEVEL > 0 -#define V8_VERSION_STRING \ - V8_S(V8_MAJOR_VERSION) \ - "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) "." V8_S( \ - V8_PATCH_LEVEL) V8_EMBEDDER_STRING V8_CANDIDATE_STRING -#else -#define V8_VERSION_STRING \ - V8_S(V8_MAJOR_VERSION) \ - "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) \ - V8_EMBEDDER_STRING V8_CANDIDATE_STRING -#endif - -#endif // V8_VERSION_STRING_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version.h deleted file mode 100644 index a4ef2015..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-version.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_INCLUDE_VERSION_H_ // V8_VERSION_H_ conflicts with src/version.h -#define V8_INCLUDE_VERSION_H_ - -// These macros define the version number for the current version. -// NOTE these macros are used by some of the tool scripts and the build -// system so their names cannot be changed without changing the scripts. -#define V8_MAJOR_VERSION 9 -#define V8_MINOR_VERSION 4 -#define V8_BUILD_NUMBER 146 -#define V8_PATCH_LEVEL 24 - -// Use 1 for candidates and 0 otherwise. -// (Boolean macro values are not supported by all preprocessors.) -#define V8_IS_CANDIDATE_VERSION 0 - -#endif // V8_INCLUDE_VERSION_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-posix.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-posix.h deleted file mode 100644 index 9b8e8a5b..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-posix.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_WASM_TRAP_HANDLER_POSIX_H_ -#define V8_WASM_TRAP_HANDLER_POSIX_H_ - -#include - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace v8 { -/** - * This function determines whether a memory access violation has been an - * out-of-bounds memory access in WebAssembly. If so, it will modify the context - * parameter and add a return address where the execution can continue after the - * signal handling, and return true. Otherwise, false will be returned. - * - * The parameters to this function correspond to those passed to a Posix signal - * handler. Use this function only on Linux and Mac. - * - * \param sig_code The signal code, e.g. SIGSEGV. - * \param info A pointer to the siginfo_t struct provided to the signal handler. - * \param context A pointer to a ucontext_t struct provided to the signal - * handler. - */ -V8_EXPORT bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info, - void* context); - -} // namespace v8 -#endif // V8_WASM_TRAP_HANDLER_POSIX_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-win.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-win.h deleted file mode 100644 index 9d3cad58..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8-wasm-trap-handler-win.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_WASM_TRAP_HANDLER_WIN_H_ -#define V8_WASM_TRAP_HANDLER_WIN_H_ - -#include - -#include "v8config.h" // NOLINT(build/include_directory) - -namespace v8 { -/** - * This function determines whether a memory access violation has been an - * out-of-bounds memory access in WebAssembly. If so, it will modify the - * exception parameter and add a return address where the execution can continue - * after the exception handling, and return true. Otherwise the return value - * will be false. - * - * The parameter to this function corresponds to the one passed to a Windows - * vectored exception handler. Use this function only on Windows. - * - * \param exception An EXCEPTION_POINTERS* as provided to the exception handler. - */ -V8_EXPORT bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS* exception); - -} // namespace v8 -#endif // V8_WASM_TRAP_HANDLER_WIN_H_ diff --git a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8.h b/repo/packages/s/scriptx-legacy/include/libnode/v8/v8.h deleted file mode 100644 index eacdaae7..00000000 --- a/repo/packages/s/scriptx-legacy/include/libnode/v8/v8.h +++ /dev/null @@ -1,12652 +0,0 @@ -// Copyright 2012 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** \mainpage V8 API Reference Guide - * - * V8 is Google's open source JavaScript engine. - * - * This set of documents provides reference material generated from the - * V8 header file, include/v8.h. - * - * For other documentation see https://v8.dev/. - */ - -#ifndef INCLUDE_V8_H_ -#define INCLUDE_V8_H_ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "cppgc/common.h" -#include "v8-internal.h" // NOLINT(build/include_directory) -#include "v8-version.h" // NOLINT(build/include_directory) -#include "v8config.h" // NOLINT(build/include_directory) - -// We reserve the V8_* prefix for macros defined in V8 public API and -// assume there are no name conflicts with the embedder's code. - -/** - * The v8 JavaScript engine. - */ -namespace v8 { - -class AccessorSignature; -class Array; -class ArrayBuffer; -class BigInt; -class BigIntObject; -class Boolean; -class BooleanObject; -class CFunction; -class CallHandlerHelper; -class Context; -class CppHeap; -class CTypeInfo; -class Data; -class Date; -class EscapableHandleScope; -class External; -class Function; -class FunctionTemplate; -class HeapProfiler; -class ImplementationUtilities; -class Int32; -class Integer; -class Isolate; -class Isolate; -class MicrotaskQueue; -class Name; -class Number; -class NumberObject; -class Object; -class ObjectOperationDescriptor; -class ObjectTemplate; -class Platform; -class Primitive; -class PrimitiveArray; -class Private; -class Promise; -class PropertyDescriptor; -class Proxy; -class RawOperationDescriptor; -class Script; -class SharedArrayBuffer; -class Signature; -class StackFrame; -class StackTrace; -class StartupData; -class String; -class StringObject; -class Symbol; -class SymbolObject; -class TracedReferenceBase; -class Uint32; -class Utils; -class Value; -class WasmMemoryObject; -class WasmModuleObject; -template -class GlobalValueMap; -template -class PersistentValueMapBase; -template class NonCopyablePersistentTraits; -template > -class Persistent; -template -class BasicTracedReference; -template -class Eternal; -template -class Global; -template -class Local; -template -class Maybe; -template -class MaybeLocal; -template -class TracedGlobal; -template -class TracedReference; -template class PersistentValueMap; -template class WeakCallbackObject; -template -class PersistentBase; -template -class PersistentValueVector; -template class FunctionCallbackInfo; -template class PropertyCallbackInfo; -template class ReturnValue; - -namespace internal { -class BasicTracedReferenceExtractor; -class ExternalString; -class FunctionCallbackArguments; -class GlobalHandles; -class Heap; -class HeapObject; -class Isolate; -class LocalEmbedderHeapTracer; -class MicrotaskQueue; -class PropertyCallbackArguments; -class ReadOnlyHeap; -class ScopedExternalStringLock; -class ThreadLocalTop; -struct ScriptStreamingData; -enum class ArgumentsType; -template -class Arguments; -template -class CustomArguments; - -namespace wasm { -class NativeModule; -class StreamingDecoder; -} // namespace wasm - -} // namespace internal - -namespace metrics { -class Recorder; -} // namespace metrics - -namespace debug { -class ConsoleCallArguments; -} // namespace debug - -// --- Handles --- - -/** - * An object reference managed by the v8 garbage collector. - * - * All objects returned from v8 have to be tracked by the garbage - * collector so that it knows that the objects are still alive. Also, - * because the garbage collector may move objects, it is unsafe to - * point directly to an object. Instead, all objects are stored in - * handles which are known by the garbage collector and updated - * whenever an object moves. Handles should always be passed by value - * (except in cases like out-parameters) and they should never be - * allocated on the heap. - * - * There are two types of handles: local and persistent handles. - * - * Local handles are light-weight and transient and typically used in - * local operations. They are managed by HandleScopes. That means that a - * HandleScope must exist on the stack when they are created and that they are - * only valid inside of the HandleScope active during their creation. - * For passing a local handle to an outer HandleScope, an EscapableHandleScope - * and its Escape() method must be used. - * - * Persistent handles can be used when storing objects across several - * independent operations and have to be explicitly deallocated when they're no - * longer used. - * - * It is safe to extract the object stored in the handle by - * dereferencing the handle (for instance, to extract the Object* from - * a Local); the value will still be governed by a handle - * behind the scenes and the same rules apply to these values as to - * their handles. - */ -template -class Local { - public: - V8_INLINE Local() : val_(nullptr) {} - template - V8_INLINE Local(Local that) - : val_(reinterpret_cast(*that)) { - /** - * This check fails when trying to convert between incompatible - * handles. For example, converting from a Local to a - * Local. - */ - static_assert(std::is_base_of::value, "type check"); - } - - /** - * Returns true if the handle is empty. - */ - V8_INLINE bool IsEmpty() const { return val_ == nullptr; } - - /** - * Sets the handle to be empty. IsEmpty() will then return true. - */ - V8_INLINE void Clear() { val_ = nullptr; } - - V8_INLINE T* operator->() const { return val_; } - - V8_INLINE T* operator*() const { return val_; } - - /** - * Checks whether two handles are the same. - * Returns true if both are empty, or if the objects to which they refer - * are identical. - * - * If both handles refer to JS objects, this is the same as strict equality. - * For primitives, such as numbers or strings, a `false` return value does not - * indicate that the values aren't equal in the JavaScript sense. - * Use `Value::StrictEquals()` to check primitives for equality. - */ - template - V8_INLINE bool operator==(const Local& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } - - template V8_INLINE bool operator==( - const PersistentBase& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } - - /** - * Checks whether two handles are different. - * Returns true if only one of the handles is empty, or if - * the objects to which they refer are different. - * - * If both handles refer to JS objects, this is the same as strict - * non-equality. For primitives, such as numbers or strings, a `true` return - * value does not indicate that the values aren't equal in the JavaScript - * sense. Use `Value::StrictEquals()` to check primitives for equality. - */ - template - V8_INLINE bool operator!=(const Local& that) const { - return !operator==(that); - } - - template V8_INLINE bool operator!=( - const Persistent& that) const { - return !operator==(that); - } - - /** - * Cast a handle to a subclass, e.g. Local to Local. - * This is only valid if the handle actually refers to a value of the - * target type. - */ - template V8_INLINE static Local Cast(Local that) { -#ifdef V8_ENABLE_CHECKS - // If we're going to perform the type check then we have to check - // that the handle isn't empty before doing the checked cast. - if (that.IsEmpty()) return Local(); -#endif - return Local(T::Cast(*that)); - } - - /** - * Calling this is equivalent to Local::Cast(). - * In particular, this is only valid if the handle actually refers to a value - * of the target type. - */ - template - V8_INLINE Local As() const { - return Local::Cast(*this); - } - - /** - * Create a local handle for the content of another handle. - * The referee is kept alive by the local handle even when - * the original handle is destroyed/disposed. - */ - V8_INLINE static Local New(Isolate* isolate, Local that); - V8_INLINE static Local New(Isolate* isolate, - const PersistentBase& that); - V8_INLINE static Local New(Isolate* isolate, - const BasicTracedReference& that); - - private: - friend class TracedReferenceBase; - friend class Utils; - template friend class Eternal; - template friend class PersistentBase; - template friend class Persistent; - template friend class Local; - template - friend class MaybeLocal; - template friend class FunctionCallbackInfo; - template friend class PropertyCallbackInfo; - friend class String; - friend class Object; - friend class Context; - friend class Isolate; - friend class Private; - template friend class internal::CustomArguments; - friend Local Undefined(Isolate* isolate); - friend Local Null(Isolate* isolate); - friend Local True(Isolate* isolate); - friend Local False(Isolate* isolate); - friend class HandleScope; - friend class EscapableHandleScope; - template - friend class PersistentValueMapBase; - template friend class PersistentValueVector; - template - friend class ReturnValue; - template - friend class Traced; - template - friend class TracedGlobal; - template - friend class BasicTracedReference; - template - friend class TracedReference; - - explicit V8_INLINE Local(T* that) : val_(that) {} - V8_INLINE static Local New(Isolate* isolate, T* that); - T* val_; -}; - - -#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) -// Handle is an alias for Local for historical reasons. -template -using Handle = Local; -#endif - - -/** - * A MaybeLocal<> is a wrapper around Local<> that enforces a check whether - * the Local<> is empty before it can be used. - * - * If an API method returns a MaybeLocal<>, the API method can potentially fail - * either because an exception is thrown, or because an exception is pending, - * e.g. because a previous API call threw an exception that hasn't been caught - * yet, or because a TerminateExecution exception was thrown. In that case, an - * empty MaybeLocal is returned. - */ -template -class MaybeLocal { - public: - V8_INLINE MaybeLocal() : val_(nullptr) {} - template - V8_INLINE MaybeLocal(Local that) - : val_(reinterpret_cast(*that)) { - static_assert(std::is_base_of::value, "type check"); - } - - V8_INLINE bool IsEmpty() const { return val_ == nullptr; } - - /** - * Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, - * |false| is returned and |out| is left untouched. - */ - template - V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local* out) const { - out->val_ = IsEmpty() ? nullptr : this->val_; - return !IsEmpty(); - } - - /** - * Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, - * V8 will crash the process. - */ - V8_INLINE Local ToLocalChecked(); - - /** - * Converts this MaybeLocal<> to a Local<>, using a default value if this - * MaybeLocal<> is empty. - */ - template - V8_INLINE Local FromMaybe(Local default_value) const { - return IsEmpty() ? default_value : Local(val_); - } - - private: - T* val_; -}; - -/** - * Eternal handles are set-once handles that live for the lifetime of the - * isolate. - */ -template class Eternal { - public: - V8_INLINE Eternal() : val_(nullptr) {} - template - V8_INLINE Eternal(Isolate* isolate, Local handle) : val_(nullptr) { - Set(isolate, handle); - } - // Can only be safely called if already set. - V8_INLINE Local Get(Isolate* isolate) const; - V8_INLINE bool IsEmpty() const { return val_ == nullptr; } - template V8_INLINE void Set(Isolate* isolate, Local handle); - - private: - T* val_; -}; - - -static const int kInternalFieldsInWeakCallback = 2; -static const int kEmbedderFieldsInWeakCallback = 2; - -template -class WeakCallbackInfo { - public: - using Callback = void (*)(const WeakCallbackInfo& data); - - WeakCallbackInfo(Isolate* isolate, T* parameter, - void* embedder_fields[kEmbedderFieldsInWeakCallback], - Callback* callback) - : isolate_(isolate), parameter_(parameter), callback_(callback) { - for (int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) { - embedder_fields_[i] = embedder_fields[i]; - } - } - - V8_INLINE Isolate* GetIsolate() const { return isolate_; } - V8_INLINE T* GetParameter() const { return parameter_; } - V8_INLINE void* GetInternalField(int index) const; - - // When first called, the embedder MUST Reset() the Global which triggered the - // callback. The Global itself is unusable for anything else. No v8 other api - // calls may be called in the first callback. Should additional work be - // required, the embedder must set a second pass callback, which will be - // called after all the initial callbacks are processed. - // Calling SetSecondPassCallback on the second pass will immediately crash. - void SetSecondPassCallback(Callback callback) const { *callback_ = callback; } - - private: - Isolate* isolate_; - T* parameter_; - Callback* callback_; - void* embedder_fields_[kEmbedderFieldsInWeakCallback]; -}; - - -// kParameter will pass a void* parameter back to the callback, kInternalFields -// will pass the first two internal fields back to the callback, kFinalizer -// will pass a void* parameter back, but is invoked before the object is -// actually collected, so it can be resurrected. In the last case, it is not -// possible to request a second pass callback. -enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer }; - -/** - * An object reference that is independent of any handle scope. Where - * a Local handle only lives as long as the HandleScope in which it was - * allocated, a PersistentBase handle remains valid until it is explicitly - * disposed using Reset(). - * - * A persistent handle contains a reference to a storage cell within - * the V8 engine which holds an object value and which is updated by - * the garbage collector whenever the object is moved. A new storage - * cell can be created using the constructor or PersistentBase::Reset and - * existing handles can be disposed using PersistentBase::Reset. - * - */ -template class PersistentBase { - public: - /** - * If non-empty, destroy the underlying storage cell - * IsEmpty() will return true after this call. - */ - V8_INLINE void Reset(); - /** - * If non-empty, destroy the underlying storage cell - * and create a new one with the contents of other if other is non empty - */ - template - V8_INLINE void Reset(Isolate* isolate, const Local& other); - - /** - * If non-empty, destroy the underlying storage cell - * and create a new one with the contents of other if other is non empty - */ - template - V8_INLINE void Reset(Isolate* isolate, const PersistentBase& other); - - V8_INLINE bool IsEmpty() const { return val_ == nullptr; } - V8_INLINE void Empty() { val_ = 0; } - - V8_INLINE Local Get(Isolate* isolate) const { - return Local::New(isolate, *this); - } - - template - V8_INLINE bool operator==(const PersistentBase& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } - - template - V8_INLINE bool operator==(const Local& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } - - template - V8_INLINE bool operator!=(const PersistentBase& that) const { - return !operator==(that); - } - - template - V8_INLINE bool operator!=(const Local& that) const { - return !operator==(that); - } - - /** - * Install a finalization callback on this object. - * NOTE: There is no guarantee as to *when* or even *if* the callback is - * invoked. The invocation is performed solely on a best effort basis. - * As always, GC-based finalization should *not* be relied upon for any - * critical form of resource management! - * - * The callback is supposed to reset the handle. No further V8 API may be - * called in this callback. In case additional work involving V8 needs to be - * done, a second callback can be scheduled using - * WeakCallbackInfo::SetSecondPassCallback. - */ - template - V8_INLINE void SetWeak(P* parameter, - typename WeakCallbackInfo

::Callback callback, - WeakCallbackType type); - - /** - * Turns this handle into a weak phantom handle without finalization callback. - * The handle will be reset automatically when the garbage collector detects - * that the object is no longer reachable. - * A related function Isolate::NumberOfPhantomHandleResetsSinceLastCall - * returns how many phantom handles were reset by the garbage collector. - */ - V8_INLINE void SetWeak(); - - template - V8_INLINE P* ClearWeak(); - - // TODO(dcarney): remove this. - V8_INLINE void ClearWeak() { ClearWeak(); } - - /** - * Annotates the strong handle with the given label, which is then used by the - * heap snapshot generator as a name of the edge from the root to the handle. - * The function does not take ownership of the label and assumes that the - * label is valid as long as the handle is valid. - */ - V8_INLINE void AnnotateStrongRetainer(const char* label); - - /** Returns true if the handle's reference is weak. */ - V8_INLINE bool IsWeak() const; - - /** - * Assigns a wrapper class ID to the handle. - */ - V8_INLINE void SetWrapperClassId(uint16_t class_id); - - /** - * Returns the class ID previously assigned to this handle or 0 if no class ID - * was previously assigned. - */ - V8_INLINE uint16_t WrapperClassId() const; - - PersistentBase(const PersistentBase& other) = delete; - void operator=(const PersistentBase&) = delete; - - private: - friend class Isolate; - friend class Utils; - template friend class Local; - template friend class Persistent; - template - friend class Global; - template friend class PersistentBase; - template friend class ReturnValue; - template - friend class PersistentValueMapBase; - template friend class PersistentValueVector; - friend class Object; - - explicit V8_INLINE PersistentBase(T* val) : val_(val) {} - V8_INLINE static T* New(Isolate* isolate, T* that); - - T* val_; -}; - - -/** - * Default traits for Persistent. This class does not allow - * use of the copy constructor or assignment operator. - * At present kResetInDestructor is not set, but that will change in a future - * version. - */ -template -class NonCopyablePersistentTraits { - public: - using NonCopyablePersistent = Persistent>; - static const bool kResetInDestructor = false; - template - V8_INLINE static void Copy(const Persistent& source, - NonCopyablePersistent* dest) { - static_assert(sizeof(S) < 0, - "NonCopyablePersistentTraits::Copy is not instantiable"); - } -}; - - -/** - * Helper class traits to allow copying and assignment of Persistent. - * This will clone the contents of storage cell, but not any of the flags, etc. - */ -template -struct CopyablePersistentTraits { - using CopyablePersistent = Persistent>; - static const bool kResetInDestructor = true; - template - static V8_INLINE void Copy(const Persistent& source, - CopyablePersistent* dest) { - // do nothing, just allow copy - } -}; - - -/** - * A PersistentBase which allows copy and assignment. - * - * Copy, assignment and destructor behavior is controlled by the traits - * class M. - * - * Note: Persistent class hierarchy is subject to future changes. - */ -template class Persistent : public PersistentBase { - public: - /** - * A Persistent with no storage cell. - */ - V8_INLINE Persistent() : PersistentBase(nullptr) {} - /** - * Construct a Persistent from a Local. - * When the Local is non-empty, a new storage cell is created - * pointing to the same object, and no flags are set. - */ - template - V8_INLINE Persistent(Isolate* isolate, Local that) - : PersistentBase(PersistentBase::New(isolate, *that)) { - static_assert(std::is_base_of::value, "type check"); - } - /** - * Construct a Persistent from a Persistent. - * When the Persistent is non-empty, a new storage cell is created - * pointing to the same object, and no flags are set. - */ - template - V8_INLINE Persistent(Isolate* isolate, const Persistent& that) - : PersistentBase(PersistentBase::New(isolate, *that)) { - static_assert(std::is_base_of::value, "type check"); - } - /** - * The copy constructors and assignment operator create a Persistent - * exactly as the Persistent constructor, but the Copy function from the - * traits class is called, allowing the setting of flags based on the - * copied Persistent. - */ - V8_INLINE Persistent(const Persistent& that) : PersistentBase(nullptr) { - Copy(that); - } - template - V8_INLINE Persistent(const Persistent& that) : PersistentBase(0) { - Copy(that); - } - V8_INLINE Persistent& operator=(const Persistent& that) { - Copy(that); - return *this; - } - template - V8_INLINE Persistent& operator=(const Persistent& that) { - Copy(that); - return *this; - } - /** - * The destructor will dispose the Persistent based on the - * kResetInDestructor flags in the traits class. Since not calling dispose - * can result in a memory leak, it is recommended to always set this flag. - */ - V8_INLINE ~Persistent() { - if (M::kResetInDestructor) this->Reset(); - } - - // TODO(dcarney): this is pretty useless, fix or remove - template - V8_INLINE static Persistent& Cast(const Persistent& that) { -#ifdef V8_ENABLE_CHECKS - // If we're going to perform the type check then we have to check - // that the handle isn't empty before doing the checked cast. - if (!that.IsEmpty()) T::Cast(*that); -#endif - return reinterpret_cast&>(const_cast&>(that)); - } - - // TODO(dcarney): this is pretty useless, fix or remove - template - V8_INLINE Persistent& As() const { - return Persistent::Cast(*this); - } - - private: - friend class Isolate; - friend class Utils; - template friend class Local; - template friend class Persistent; - template friend class ReturnValue; - - explicit V8_INLINE Persistent(T* that) : PersistentBase(that) {} - V8_INLINE T* operator*() const { return this->val_; } - template - V8_INLINE void Copy(const Persistent& that); -}; - - -/** - * A PersistentBase which has move semantics. - * - * Note: Persistent class hierarchy is subject to future changes. - */ -template -class Global : public PersistentBase { - public: - /** - * A Global with no storage cell. - */ - V8_INLINE Global() : PersistentBase(nullptr) {} - - /** - * Construct a Global from a Local. - * When the Local is non-empty, a new storage cell is created - * pointing to the same object, and no flags are set. - */ - template - V8_INLINE Global(Isolate* isolate, Local that) - : PersistentBase(PersistentBase::New(isolate, *that)) { - static_assert(std::is_base_of::value, "type check"); - } - - /** - * Construct a Global from a PersistentBase. - * When the Persistent is non-empty, a new storage cell is created - * pointing to the same object, and no flags are set. - */ - template - V8_INLINE Global(Isolate* isolate, const PersistentBase& that) - : PersistentBase(PersistentBase::New(isolate, that.val_)) { - static_assert(std::is_base_of::value, "type check"); - } - - /** - * Move constructor. - */ - V8_INLINE Global(Global&& other); - - V8_INLINE ~Global() { this->Reset(); } - - /** - * Move via assignment. - */ - template - V8_INLINE Global& operator=(Global&& rhs); - - /** - * Pass allows returning uniques from functions, etc. - */ - Global Pass() { return static_cast(*this); } - - /* - * For compatibility with Chromium's base::Bind (base::Passed). - */ - using MoveOnlyTypeForCPP03 = void; - - Global(const Global&) = delete; - void operator=(const Global&) = delete; - - private: - template - friend class ReturnValue; - V8_INLINE T* operator*() const { return this->val_; } -}; - - -// UniquePersistent is an alias for Global for historical reason. -template -using UniquePersistent = Global; - -/** - * Deprecated. Use |TracedReference| instead. - */ -template -struct TracedGlobalTrait {}; - -class TracedReferenceBase { - public: - /** - * Returns true if the reference is empty, i.e., has not been assigned - * object. - */ - bool IsEmpty() const { return val_ == nullptr; } - - /** - * If non-empty, destroy the underlying storage cell. |IsEmpty| will return - * true after this call. - */ - V8_INLINE void Reset(); - - /** - * Construct a Local from this handle. - */ - V8_INLINE v8::Local Get(v8::Isolate* isolate) const; - - /** - * Returns true if this TracedReference is empty, i.e., has not been - * assigned an object. This version of IsEmpty is thread-safe. - */ - bool IsEmptyThreadSafe() const { - return this->GetSlotThreadSafe() == nullptr; - } - - /** - * Assigns a wrapper class ID to the handle. - */ - V8_INLINE void SetWrapperClassId(uint16_t class_id); - - /** - * Returns the class ID previously assigned to this handle or 0 if no class ID - * was previously assigned. - */ - V8_INLINE uint16_t WrapperClassId() const; - - protected: - /** - * Update this reference in a thread-safe way. - */ - void SetSlotThreadSafe(void* new_val) { - reinterpret_cast*>(&val_)->store( - new_val, std::memory_order_relaxed); - } - - /** - * Get this reference in a thread-safe way - */ - const void* GetSlotThreadSafe() const { - return reinterpret_cast const*>(&val_)->load( - std::memory_order_relaxed); - } - - V8_EXPORT void CheckValue() const; - - // val_ points to a GlobalHandles node. - internal::Address* val_ = nullptr; - - friend class internal::BasicTracedReferenceExtractor; - template - friend class Local; - template - friend bool operator==(const TracedReferenceBase&, const Local&); - friend bool operator==(const TracedReferenceBase&, - const TracedReferenceBase&); -}; - -/** - * A traced handle with copy and move semantics. The handle is to be used - * together with |v8::EmbedderHeapTracer| or as part of GarbageCollected objects - * (see v8-cppgc.h) and specifies edges from C++ objects to JavaScript. - * - * The exact semantics are: - * - Tracing garbage collections use |v8::EmbedderHeapTracer| or cppgc. - * - Non-tracing garbage collections refer to - * |v8::EmbedderRootsHandler::IsRoot()| whether the handle should - * be treated as root or not. - * - * Note that the base class cannot be instantiated itself. Choose from - * - TracedGlobal - * - TracedReference - */ -template -class BasicTracedReference : public TracedReferenceBase { - public: - /** - * Construct a Local from this handle. - */ - Local Get(Isolate* isolate) const { return Local::New(isolate, *this); } - - template - V8_INLINE BasicTracedReference& As() const { - return reinterpret_cast&>( - const_cast&>(*this)); - } - - T* operator->() const { -#ifdef V8_ENABLE_CHECKS - CheckValue(); -#endif // V8_ENABLE_CHECKS - return reinterpret_cast(val_); - } - T* operator*() const { -#ifdef V8_ENABLE_CHECKS - CheckValue(); -#endif // V8_ENABLE_CHECKS - return reinterpret_cast(val_); - } - - private: - enum DestructionMode { kWithDestructor, kWithoutDestructor }; - - /** - * An empty BasicTracedReference without storage cell. - */ - BasicTracedReference() = default; - - V8_INLINE static internal::Address* New(Isolate* isolate, T* that, void* slot, - DestructionMode destruction_mode); - - friend class EmbedderHeapTracer; - template - friend class Local; - friend class Object; - template - friend class TracedGlobal; - template - friend class TracedReference; - template - friend class BasicTracedReference; - template - friend class ReturnValue; -}; - -/** - * A traced handle with destructor that clears the handle. For more details see - * BasicTracedReference. - */ -template -class TracedGlobal : public BasicTracedReference { - public: - using BasicTracedReference::Reset; - - /** - * Destructor resetting the handle.Is - */ - ~TracedGlobal() { this->Reset(); } - - /** - * An empty TracedGlobal without storage cell. - */ - TracedGlobal() : BasicTracedReference() {} - - /** - * Construct a TracedGlobal from a Local. - * - * When the Local is non-empty, a new storage cell is created - * pointing to the same object. - */ - template - TracedGlobal(Isolate* isolate, Local that) : BasicTracedReference() { - this->val_ = this->New(isolate, that.val_, &this->val_, - BasicTracedReference::kWithDestructor); - static_assert(std::is_base_of::value, "type check"); - } - - /** - * Move constructor initializing TracedGlobal from an existing one. - */ - V8_INLINE TracedGlobal(TracedGlobal&& other) { - // Forward to operator=. - *this = std::move(other); - } - - /** - * Move constructor initializing TracedGlobal from an existing one. - */ - template - V8_INLINE TracedGlobal(TracedGlobal&& other) { - // Forward to operator=. - *this = std::move(other); - } - - /** - * Copy constructor initializing TracedGlobal from an existing one. - */ - V8_INLINE TracedGlobal(const TracedGlobal& other) { - // Forward to operator=; - *this = other; - } - - /** - * Copy constructor initializing TracedGlobal from an existing one. - */ - template - V8_INLINE TracedGlobal(const TracedGlobal& other) { - // Forward to operator=; - *this = other; - } - - /** - * Move assignment operator initializing TracedGlobal from an existing one. - */ - V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs); - - /** - * Move assignment operator initializing TracedGlobal from an existing one. - */ - template - V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs); - - /** - * Copy assignment operator initializing TracedGlobal from an existing one. - * - * Note: Prohibited when |other| has a finalization callback set through - * |SetFinalizationCallback|. - */ - V8_INLINE TracedGlobal& operator=(const TracedGlobal& rhs); - - /** - * Copy assignment operator initializing TracedGlobal from an existing one. - * - * Note: Prohibited when |other| has a finalization callback set through - * |SetFinalizationCallback|. - */ - template - V8_INLINE TracedGlobal& operator=(const TracedGlobal& rhs); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of other if other is non empty - */ - template - V8_INLINE void Reset(Isolate* isolate, const Local& other); - - template - V8_INLINE TracedGlobal& As() const { - return reinterpret_cast&>( - const_cast&>(*this)); - } - - /** - * Adds a finalization callback to the handle. The type of this callback is - * similar to WeakCallbackType::kInternalFields, i.e., it will pass the - * parameter and the first two internal fields of the object. - * - * The callback is then supposed to reset the handle in the callback. No - * further V8 API may be called in this callback. In case additional work - * involving V8 needs to be done, a second callback can be scheduled using - * WeakCallbackInfo::SetSecondPassCallback. - */ - V8_INLINE void SetFinalizationCallback( - void* parameter, WeakCallbackInfo::Callback callback); -}; - -/** - * A traced handle without destructor that clears the handle. The embedder needs - * to ensure that the handle is not accessed once the V8 object has been - * reclaimed. This can happen when the handle is not passed through the - * EmbedderHeapTracer. For more details see BasicTracedReference. - * - * The reference assumes the embedder has precise knowledge about references at - * all times. In case V8 needs to separately handle on-stack references, the - * embedder is required to set the stack start through - * |EmbedderHeapTracer::SetStackStart|. - */ -template -class TracedReference : public BasicTracedReference { - public: - using BasicTracedReference::Reset; - - /** - * An empty TracedReference without storage cell. - */ - TracedReference() : BasicTracedReference() {} - - /** - * Construct a TracedReference from a Local. - * - * When the Local is non-empty, a new storage cell is created - * pointing to the same object. - */ - template - TracedReference(Isolate* isolate, Local that) : BasicTracedReference() { - this->val_ = this->New(isolate, that.val_, &this->val_, - BasicTracedReference::kWithoutDestructor); - static_assert(std::is_base_of::value, "type check"); - } - - /** - * Move constructor initializing TracedReference from an - * existing one. - */ - V8_INLINE TracedReference(TracedReference&& other) { - // Forward to operator=. - *this = std::move(other); - } - - /** - * Move constructor initializing TracedReference from an - * existing one. - */ - template - V8_INLINE TracedReference(TracedReference&& other) { - // Forward to operator=. - *this = std::move(other); - } - - /** - * Copy constructor initializing TracedReference from an - * existing one. - */ - V8_INLINE TracedReference(const TracedReference& other) { - // Forward to operator=; - *this = other; - } - - /** - * Copy constructor initializing TracedReference from an - * existing one. - */ - template - V8_INLINE TracedReference(const TracedReference& other) { - // Forward to operator=; - *this = other; - } - - /** - * Move assignment operator initializing TracedGlobal from an existing one. - */ - V8_INLINE TracedReference& operator=(TracedReference&& rhs); - - /** - * Move assignment operator initializing TracedGlobal from an existing one. - */ - template - V8_INLINE TracedReference& operator=(TracedReference&& rhs); - - /** - * Copy assignment operator initializing TracedGlobal from an existing one. - */ - V8_INLINE TracedReference& operator=(const TracedReference& rhs); - - /** - * Copy assignment operator initializing TracedGlobal from an existing one. - */ - template - V8_INLINE TracedReference& operator=(const TracedReference& rhs); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of other if other is non empty - */ - template - V8_INLINE void Reset(Isolate* isolate, const Local& other); - - template - V8_INLINE TracedReference& As() const { - return reinterpret_cast&>( - const_cast&>(*this)); - } -}; - - /** - * A stack-allocated class that governs a number of local handles. - * After a handle scope has been created, all local handles will be - * allocated within that handle scope until either the handle scope is - * deleted or another handle scope is created. If there is already a - * handle scope and a new one is created, all allocations will take - * place in the new handle scope until it is deleted. After that, - * new handles will again be allocated in the original handle scope. - * - * After the handle scope of a local handle has been deleted the - * garbage collector will no longer track the object stored in the - * handle and may deallocate it. The behavior of accessing a handle - * for which the handle scope has been deleted is undefined. - */ -class V8_EXPORT V8_NODISCARD HandleScope { - public: - explicit HandleScope(Isolate* isolate); - - ~HandleScope(); - - /** - * Counts the number of allocated handles. - */ - static int NumberOfHandles(Isolate* isolate); - - V8_INLINE Isolate* GetIsolate() const { - return reinterpret_cast(isolate_); - } - - HandleScope(const HandleScope&) = delete; - void operator=(const HandleScope&) = delete; - - protected: - V8_INLINE HandleScope() = default; - - void Initialize(Isolate* isolate); - - static internal::Address* CreateHandle(internal::Isolate* isolate, - internal::Address value); - - private: - // Declaring operator new and delete as deleted is not spec compliant. - // Therefore declare them private instead to disable dynamic alloc - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void*, size_t); - void operator delete[](void*, size_t); - - internal::Isolate* isolate_; - internal::Address* prev_next_; - internal::Address* prev_limit_; - - // Local::New uses CreateHandle with an Isolate* parameter. - template friend class Local; - - // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with - // a HeapObject in their shortcuts. - friend class Object; - friend class Context; -}; - -/** - * A HandleScope which first allocates a handle in the current scope - * which will be later filled with the escape value. - */ -class V8_EXPORT V8_NODISCARD EscapableHandleScope : public HandleScope { - public: - explicit EscapableHandleScope(Isolate* isolate); - V8_INLINE ~EscapableHandleScope() = default; - - /** - * Pushes the value into the previous scope and returns a handle to it. - * Cannot be called twice. - */ - template - V8_INLINE Local Escape(Local value) { - internal::Address* slot = - Escape(reinterpret_cast(*value)); - return Local(reinterpret_cast(slot)); - } - - template - V8_INLINE MaybeLocal EscapeMaybe(MaybeLocal value) { - return Escape(value.FromMaybe(Local())); - } - - EscapableHandleScope(const EscapableHandleScope&) = delete; - void operator=(const EscapableHandleScope&) = delete; - - private: - // Declaring operator new and delete as deleted is not spec compliant. - // Therefore declare them private instead to disable dynamic alloc - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void*, size_t); - void operator delete[](void*, size_t); - - internal::Address* Escape(internal::Address* escape_value); - internal::Address* escape_slot_; -}; - -/** - * A SealHandleScope acts like a handle scope in which no handle allocations - * are allowed. It can be useful for debugging handle leaks. - * Handles can be allocated within inner normal HandleScopes. - */ -class V8_EXPORT V8_NODISCARD SealHandleScope { - public: - explicit SealHandleScope(Isolate* isolate); - ~SealHandleScope(); - - SealHandleScope(const SealHandleScope&) = delete; - void operator=(const SealHandleScope&) = delete; - - private: - // Declaring operator new and delete as deleted is not spec compliant. - // Therefore declare them private instead to disable dynamic alloc - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void*, size_t); - void operator delete[](void*, size_t); - - internal::Isolate* const isolate_; - internal::Address* prev_limit_; - int prev_sealed_level_; -}; - -// --- Special objects --- - -/** - * The superclass of objects that can reside on V8's heap. - */ -class V8_EXPORT Data { - public: - /** - * Returns true if this data is a |v8::Value|. - */ - bool IsValue() const; - - /** - * Returns true if this data is a |v8::Module|. - */ - bool IsModule() const; - - /** - * Returns true if this data is a |v8::Private|. - */ - bool IsPrivate() const; - - /** - * Returns true if this data is a |v8::ObjectTemplate|. - */ - bool IsObjectTemplate() const; - - /** - * Returns true if this data is a |v8::FunctionTemplate|. - */ - bool IsFunctionTemplate() const; - - /** - * Returns true if this data is a |v8::Context|. - */ - bool IsContext() const; - - private: - Data(); -}; - -/** - * A container type that holds relevant metadata for module loading. - * - * This is passed back to the embedder as part of - * HostImportModuleDynamicallyCallback for module loading. - */ -class V8_EXPORT ScriptOrModule { - public: - /** - * The name that was passed by the embedder as ResourceName to the - * ScriptOrigin. This can be either a v8::String or v8::Undefined. - */ - Local GetResourceName(); - - /** - * The options that were passed by the embedder as HostDefinedOptions to - * the ScriptOrigin. - */ - Local GetHostDefinedOptions(); -}; - -/** - * An array to hold Primitive values. This is used by the embedder to - * pass host defined options to the ScriptOptions during compilation. - * - * This is passed back to the embedder as part of - * HostImportModuleDynamicallyCallback for module loading. - * - */ -class V8_EXPORT PrimitiveArray { - public: - static Local New(Isolate* isolate, int length); - int Length() const; - void Set(Isolate* isolate, int index, Local item); - Local Get(Isolate* isolate, int index); -}; - -/** - * The optional attributes of ScriptOrigin. - */ -class ScriptOriginOptions { - public: - V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false, - bool is_opaque = false, bool is_wasm = false, - bool is_module = false) - : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | - (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) | - (is_module ? kIsModule : 0)) {} - V8_INLINE ScriptOriginOptions(int flags) - : flags_(flags & - (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {} - - bool IsSharedCrossOrigin() const { - return (flags_ & kIsSharedCrossOrigin) != 0; - } - bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; } - bool IsWasm() const { return (flags_ & kIsWasm) != 0; } - bool IsModule() const { return (flags_ & kIsModule) != 0; } - - int Flags() const { return flags_; } - - private: - enum { - kIsSharedCrossOrigin = 1, - kIsOpaque = 1 << 1, - kIsWasm = 1 << 2, - kIsModule = 1 << 3 - }; - const int flags_; -}; - -/** - * The origin, within a file, of a script. - */ -class ScriptOrigin { - public: -#if defined(_MSC_VER) && _MSC_VER >= 1910 /* Disable on VS2015 */ - V8_DEPRECATED("Use constructor with primitive C++ types") -#endif - V8_INLINE explicit ScriptOrigin( - Local resource_name, Local resource_line_offset, - Local resource_column_offset, - Local resource_is_shared_cross_origin = Local(), - Local script_id = Local(), - Local source_map_url = Local(), - Local resource_is_opaque = Local(), - Local is_wasm = Local(), - Local is_module = Local(), - Local host_defined_options = Local()); -#if defined(_MSC_VER) && _MSC_VER >= 1910 /* Disable on VS2015 */ - V8_DEPRECATED("Use constructor that takes an isolate") -#endif - V8_INLINE explicit ScriptOrigin( - Local resource_name, int resource_line_offset = 0, - int resource_column_offset = 0, - bool resource_is_shared_cross_origin = false, int script_id = -1, - Local source_map_url = Local(), - bool resource_is_opaque = false, bool is_wasm = false, - bool is_module = false, - Local host_defined_options = Local()); - V8_INLINE explicit ScriptOrigin( - Isolate* isolate, Local resource_name, - int resource_line_offset = 0, int resource_column_offset = 0, - bool resource_is_shared_cross_origin = false, int script_id = -1, - Local source_map_url = Local(), - bool resource_is_opaque = false, bool is_wasm = false, - bool is_module = false, - Local host_defined_options = Local()); - - V8_INLINE Local ResourceName() const; - V8_DEPRECATED("Use getter with primitvie C++ types.") - V8_INLINE Local ResourceLineOffset() const; - V8_DEPRECATED("Use getter with primitvie C++ types.") - V8_INLINE Local ResourceColumnOffset() const; - V8_DEPRECATED("Use getter with primitvie C++ types.") - V8_INLINE Local ScriptID() const; - V8_INLINE int LineOffset() const; - V8_INLINE int ColumnOffset() const; - V8_INLINE int ScriptId() const; - V8_INLINE Local SourceMapUrl() const; - V8_INLINE Local HostDefinedOptions() const; - V8_INLINE ScriptOriginOptions Options() const { return options_; } - - private: - Isolate* isolate_; - Local resource_name_; - int resource_line_offset_; - int resource_column_offset_; - ScriptOriginOptions options_; - int script_id_; - Local source_map_url_; - Local host_defined_options_; -}; - -/** - * A compiled JavaScript script, not yet tied to a Context. - */ -class V8_EXPORT UnboundScript { - public: - /** - * Binds the script to the currently entered context. - */ - Local