@kungfu-tech/libnode-win32-x64 0.0.0-bootstrap.0 → 22.22.3-kf.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/node/include/acorn_version.h +6 -0
- package/dist/node/include/aliased_buffer-inl.h +244 -0
- package/dist/node/include/aliased_buffer.h +206 -0
- package/dist/node/include/aliased_struct-inl.h +54 -0
- package/dist/node/include/aliased_struct.h +63 -0
- package/dist/node/include/amaro_version.h +6 -0
- package/dist/node/include/async_context_frame.h +33 -0
- package/dist/node/include/async_wrap-inl.h +96 -0
- package/dist/node/include/async_wrap.h +243 -0
- package/dist/node/include/base_object-inl.h +335 -0
- package/dist/node/include/base_object.h +342 -0
- package/dist/node/include/base_object_types.h +74 -0
- package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
- package/dist/node/include/blob_serializer_deserializer.h +132 -0
- package/dist/node/include/callback_queue-inl.h +97 -0
- package/dist/node/include/callback_queue.h +79 -0
- package/dist/node/include/cares_wrap.h +447 -0
- package/dist/node/include/cjs_module_lexer_version.h +6 -0
- package/dist/node/include/cleanup_queue-inl.h +36 -0
- package/dist/node/include/cleanup_queue.h +79 -0
- package/dist/node/include/compile_cache.h +104 -0
- package/dist/node/include/connect_wrap.h +26 -0
- package/dist/node/include/connection_wrap.h +30 -0
- package/dist/node/include/cppgc/allocation.h +310 -0
- package/dist/node/include/cppgc/common.h +28 -0
- package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
- package/dist/node/include/cppgc/custom-space.h +97 -0
- package/dist/node/include/cppgc/default-platform.h +67 -0
- package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
- package/dist/node/include/cppgc/explicit-management.h +100 -0
- package/dist/node/include/cppgc/garbage-collected.h +106 -0
- package/dist/node/include/cppgc/heap-consistency.h +309 -0
- package/dist/node/include/cppgc/heap-handle.h +48 -0
- package/dist/node/include/cppgc/heap-state.h +82 -0
- package/dist/node/include/cppgc/heap-statistics.h +120 -0
- package/dist/node/include/cppgc/heap.h +202 -0
- package/dist/node/include/cppgc/internal/api-constants.h +87 -0
- package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
- package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
- package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
- package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
- package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
- package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
- package/dist/node/include/cppgc/internal/gc-info.h +148 -0
- package/dist/node/include/cppgc/internal/logging.h +50 -0
- package/dist/node/include/cppgc/internal/member-storage.h +256 -0
- package/dist/node/include/cppgc/internal/name-trait.h +137 -0
- package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
- package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
- package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
- package/dist/node/include/cppgc/liveness-broker.h +78 -0
- package/dist/node/include/cppgc/macros.h +35 -0
- package/dist/node/include/cppgc/member.h +629 -0
- package/dist/node/include/cppgc/name-provider.h +65 -0
- package/dist/node/include/cppgc/object-size-trait.h +58 -0
- package/dist/node/include/cppgc/persistent.h +377 -0
- package/dist/node/include/cppgc/platform.h +163 -0
- package/dist/node/include/cppgc/prefinalizer.h +75 -0
- package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
- package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
- package/dist/node/include/cppgc/source-location.h +16 -0
- package/dist/node/include/cppgc/testing.h +106 -0
- package/dist/node/include/cppgc/trace-trait.h +128 -0
- package/dist/node/include/cppgc/type-traits.h +271 -0
- package/dist/node/include/cppgc/visitor.h +504 -0
- package/dist/node/include/crypto/crypto_aes.h +88 -0
- package/dist/node/include/crypto/crypto_bio.h +193 -0
- package/dist/node/include/crypto/crypto_cipher.h +293 -0
- package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
- package/dist/node/include/crypto/crypto_clienthello.h +131 -0
- package/dist/node/include/crypto/crypto_common.h +64 -0
- package/dist/node/include/crypto/crypto_context.h +171 -0
- package/dist/node/include/crypto/crypto_dh.h +126 -0
- package/dist/node/include/crypto/crypto_dsa.h +52 -0
- package/dist/node/include/crypto/crypto_ec.h +164 -0
- package/dist/node/include/crypto/crypto_hash.h +91 -0
- package/dist/node/include/crypto/crypto_hkdf.h +61 -0
- package/dist/node/include/crypto/crypto_hmac.h +92 -0
- package/dist/node/include/crypto/crypto_keygen.h +299 -0
- package/dist/node/include/crypto/crypto_keys.h +392 -0
- package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
- package/dist/node/include/crypto/crypto_random.h +124 -0
- package/dist/node/include/crypto/crypto_rsa.h +136 -0
- package/dist/node/include/crypto/crypto_scrypt.h +85 -0
- package/dist/node/include/crypto/crypto_sig.h +165 -0
- package/dist/node/include/crypto/crypto_spkac.h +21 -0
- package/dist/node/include/crypto/crypto_timing.h +20 -0
- package/dist/node/include/crypto/crypto_tls.h +305 -0
- package/dist/node/include/crypto/crypto_util.h +725 -0
- package/dist/node/include/crypto/crypto_x509.h +140 -0
- package/dist/node/include/dataqueue/queue.h +306 -0
- package/dist/node/include/debug_utils-inl.h +278 -0
- package/dist/node/include/debug_utils.h +196 -0
- package/dist/node/include/diagnosticfilename-inl.h +33 -0
- package/dist/node/include/embedded_data.h +17 -0
- package/dist/node/include/encoding_binding.h +61 -0
- package/dist/node/include/env-inl.h +984 -0
- package/dist/node/include/env.h +1287 -0
- package/dist/node/include/env_properties.h +540 -0
- package/dist/node/include/handle_wrap.h +123 -0
- package/dist/node/include/histogram-inl.h +107 -0
- package/dist/node/include/histogram.h +279 -0
- package/dist/node/include/inspector/io_agent.h +30 -0
- package/dist/node/include/inspector/main_thread_interface.h +116 -0
- package/dist/node/include/inspector/network_agent.h +94 -0
- package/dist/node/include/inspector/network_inspector.h +45 -0
- package/dist/node/include/inspector/network_requests_buffer.h +195 -0
- package/dist/node/include/inspector/network_resource_manager.h +29 -0
- package/dist/node/include/inspector/node_json.h +24 -0
- package/dist/node/include/inspector/node_string.h +101 -0
- package/dist/node/include/inspector/protocol_helper.h +27 -0
- package/dist/node/include/inspector/runtime_agent.h +41 -0
- package/dist/node/include/inspector/target_agent.h +75 -0
- package/dist/node/include/inspector/tracing_agent.h +43 -0
- package/dist/node/include/inspector/worker_agent.h +40 -0
- package/dist/node/include/inspector/worker_inspector.h +124 -0
- package/dist/node/include/inspector_agent.h +165 -0
- package/dist/node/include/inspector_io.h +78 -0
- package/dist/node/include/inspector_profiler.h +149 -0
- package/dist/node/include/inspector_socket.h +60 -0
- package/dist/node/include/inspector_socket_server.h +110 -0
- package/dist/node/include/js_native_api.h +607 -0
- package/dist/node/include/js_native_api_types.h +226 -0
- package/dist/node/include/js_native_api_v8.h +485 -0
- package/dist/node/include/js_native_api_v8_internals.h +45 -0
- package/dist/node/include/js_stream.h +52 -0
- package/dist/node/include/json_utils.h +172 -0
- package/dist/node/include/large_pages/node_large_page.h +34 -0
- package/dist/node/include/libplatform/libplatform-export.h +29 -0
- package/dist/node/include/libplatform/libplatform.h +112 -0
- package/dist/node/include/libplatform/v8-tracing.h +333 -0
- package/dist/node/include/memory_tracker-inl.h +359 -0
- package/dist/node/include/memory_tracker.h +289 -0
- package/dist/node/include/module_wrap.h +216 -0
- package/dist/node/include/node.h +1593 -0
- package/dist/node/include/node_api.h +265 -0
- package/dist/node/include/node_api_internals.h +48 -0
- package/dist/node/include/node_api_types.h +56 -0
- package/dist/node/include/node_binding.h +161 -0
- package/dist/node/include/node_blob.h +159 -0
- package/dist/node/include/node_bob-inl.h +36 -0
- package/dist/node/include/node_bob.h +107 -0
- package/dist/node/include/node_buffer.h +92 -0
- package/dist/node/include/node_builtins.h +220 -0
- package/dist/node/include/node_config_file.h +46 -0
- package/dist/node/include/node_constants.h +82 -0
- package/dist/node/include/node_context_data.h +168 -0
- package/dist/node/include/node_contextify.h +204 -0
- package/dist/node/include/node_crypto.h +56 -0
- package/dist/node/include/node_debug.h +30 -0
- package/dist/node/include/node_dir.h +52 -0
- package/dist/node/include/node_dotenv.h +45 -0
- package/dist/node/include/node_errors.h +380 -0
- package/dist/node/include/node_exit_code.h +54 -0
- package/dist/node/include/node_external_reference.h +165 -0
- package/dist/node/include/node_file-inl.h +406 -0
- package/dist/node/include/node_file.h +537 -0
- package/dist/node/include/node_http2.h +1177 -0
- package/dist/node/include/node_http2_state.h +159 -0
- package/dist/node/include/node_http_common-inl.h +202 -0
- package/dist/node/include/node_http_common.h +535 -0
- package/dist/node/include/node_i18n.h +132 -0
- package/dist/node/include/node_internals.h +483 -0
- package/dist/node/include/node_main_instance.h +67 -0
- package/dist/node/include/node_mem-inl.h +113 -0
- package/dist/node/include/node_mem.h +45 -0
- package/dist/node/include/node_messaging.h +389 -0
- package/dist/node/include/node_metadata.h +164 -0
- package/dist/node/include/node_modules.h +91 -0
- package/dist/node/include/node_mutex.h +323 -0
- package/dist/node/include/node_object_wrap.h +132 -0
- package/dist/node/include/node_options-inl.h +490 -0
- package/dist/node/include/node_options.h +615 -0
- package/dist/node/include/node_perf.h +166 -0
- package/dist/node/include/node_perf_common.h +102 -0
- package/dist/node/include/node_platform.h +238 -0
- package/dist/node/include/node_process-inl.h +26 -0
- package/dist/node/include/node_process.h +112 -0
- package/dist/node/include/node_realm-inl.h +151 -0
- package/dist/node/include/node_realm.h +183 -0
- package/dist/node/include/node_report.h +43 -0
- package/dist/node/include/node_revert.h +82 -0
- package/dist/node/include/node_root_certs.h +3520 -0
- package/dist/node/include/node_sea.h +74 -0
- package/dist/node/include/node_shadow_realm.h +46 -0
- package/dist/node/include/node_snapshot_builder.h +57 -0
- package/dist/node/include/node_snapshotable.h +174 -0
- package/dist/node/include/node_sockaddr-inl.h +257 -0
- package/dist/node/include/node_sockaddr.h +394 -0
- package/dist/node/include/node_sqlite.h +270 -0
- package/dist/node/include/node_stat_watcher.h +73 -0
- package/dist/node/include/node_task_runner.h +92 -0
- package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
- package/dist/node/include/node_threadsafe_cow.h +105 -0
- package/dist/node/include/node_union_bytes.h +81 -0
- package/dist/node/include/node_url.h +96 -0
- package/dist/node/include/node_v8.h +77 -0
- package/dist/node/include/node_v8_platform-inl.h +185 -0
- package/dist/node/include/node_version.h +110 -0
- package/dist/node/include/node_wasi.h +184 -0
- package/dist/node/include/node_wasm_web_api.h +55 -0
- package/dist/node/include/node_watchdog.h +154 -0
- package/dist/node/include/node_webstorage.h +60 -0
- package/dist/node/include/node_worker.h +158 -0
- package/dist/node/include/path.h +33 -0
- package/dist/node/include/permission/addon_permission.h +31 -0
- package/dist/node/include/permission/child_process_permission.h +31 -0
- package/dist/node/include/permission/fs_permission.h +167 -0
- package/dist/node/include/permission/inspector_permission.h +31 -0
- package/dist/node/include/permission/permission.h +138 -0
- package/dist/node/include/permission/permission_base.h +65 -0
- package/dist/node/include/permission/wasi_permission.h +31 -0
- package/dist/node/include/permission/worker_permission.h +31 -0
- package/dist/node/include/pipe_wrap.h +80 -0
- package/dist/node/include/quic/application.h +159 -0
- package/dist/node/include/quic/bindingdata.h +272 -0
- package/dist/node/include/quic/cid.h +127 -0
- package/dist/node/include/quic/data.h +148 -0
- package/dist/node/include/quic/defs.h +245 -0
- package/dist/node/include/quic/endpoint.h +458 -0
- package/dist/node/include/quic/http3.h +15 -0
- package/dist/node/include/quic/logstream.h +81 -0
- package/dist/node/include/quic/packet.h +152 -0
- package/dist/node/include/quic/preferredaddress.h +72 -0
- package/dist/node/include/quic/session.h +443 -0
- package/dist/node/include/quic/sessionticket.h +108 -0
- package/dist/node/include/quic/streams.h +232 -0
- package/dist/node/include/quic/tlscontext.h +227 -0
- package/dist/node/include/quic/tokens.h +256 -0
- package/dist/node/include/quic/transportparams.h +165 -0
- package/dist/node/include/req_wrap-inl.h +171 -0
- package/dist/node/include/req_wrap.h +77 -0
- package/dist/node/include/spawn_sync.h +243 -0
- package/dist/node/include/stream_base-inl.h +173 -0
- package/dist/node/include/stream_base.h +478 -0
- package/dist/node/include/stream_pipe.h +76 -0
- package/dist/node/include/stream_wrap.h +132 -0
- package/dist/node/include/string_bytes.h +113 -0
- package/dist/node/include/string_decoder-inl.h +31 -0
- package/dist/node/include/string_decoder.h +49 -0
- package/dist/node/include/tcp_wrap.h +105 -0
- package/dist/node/include/threadpoolwork-inl.h +70 -0
- package/dist/node/include/timer_wrap-inl.h +32 -0
- package/dist/node/include/timer_wrap.h +85 -0
- package/dist/node/include/timers.h +70 -0
- package/dist/node/include/tracing/agent.h +195 -0
- package/dist/node/include/tracing/node_trace_buffer.h +83 -0
- package/dist/node/include/tracing/node_trace_writer.h +75 -0
- package/dist/node/include/tracing/trace_event.h +722 -0
- package/dist/node/include/tracing/trace_event_common.h +1109 -0
- package/dist/node/include/tracing/traced_value.h +129 -0
- package/dist/node/include/tty_wrap.h +65 -0
- package/dist/node/include/udp_wrap.h +230 -0
- package/dist/node/include/undici_version.h +6 -0
- package/dist/node/include/util-inl.h +700 -0
- package/dist/node/include/util.h +1021 -0
- package/dist/node/include/uv/aix.h +32 -0
- package/dist/node/include/uv/bsd.h +34 -0
- package/dist/node/include/uv/darwin.h +61 -0
- package/dist/node/include/uv/errno.h +483 -0
- package/dist/node/include/uv/linux.h +34 -0
- package/dist/node/include/uv/os390.h +33 -0
- package/dist/node/include/uv/posix.h +31 -0
- package/dist/node/include/uv/sunos.h +44 -0
- package/dist/node/include/uv/threadpool.h +37 -0
- package/dist/node/include/uv/tree.h +521 -0
- package/dist/node/include/uv/unix.h +512 -0
- package/dist/node/include/uv/version.h +43 -0
- package/dist/node/include/uv/win.h +698 -0
- package/dist/node/include/uv.h +1990 -0
- package/dist/node/include/v8-array-buffer.h +525 -0
- package/dist/node/include/v8-callbacks.h +462 -0
- package/dist/node/include/v8-container.h +183 -0
- package/dist/node/include/v8-context.h +485 -0
- package/dist/node/include/v8-cppgc.h +245 -0
- package/dist/node/include/v8-data.h +80 -0
- package/dist/node/include/v8-date.h +48 -0
- package/dist/node/include/v8-debug.h +168 -0
- package/dist/node/include/v8-embedder-heap.h +82 -0
- package/dist/node/include/v8-embedder-state-scope.h +52 -0
- package/dist/node/include/v8-exception.h +223 -0
- package/dist/node/include/v8-extension.h +62 -0
- package/dist/node/include/v8-external.h +37 -0
- package/dist/node/include/v8-fast-api-calls.h +984 -0
- package/dist/node/include/v8-forward.h +82 -0
- package/dist/node/include/v8-function-callback.h +607 -0
- package/dist/node/include/v8-function.h +140 -0
- package/dist/node/include/v8-handle-base.h +137 -0
- package/dist/node/include/v8-initialization.h +289 -0
- package/dist/node/include/v8-inspector-protocol.h +13 -0
- package/dist/node/include/v8-inspector.h +419 -0
- package/dist/node/include/v8-internal.h +1397 -0
- package/dist/node/include/v8-isolate.h +1767 -0
- package/dist/node/include/v8-json.h +47 -0
- package/dist/node/include/v8-local-handle.h +758 -0
- package/dist/node/include/v8-locker.h +138 -0
- package/dist/node/include/v8-maybe.h +160 -0
- package/dist/node/include/v8-memory-span.h +198 -0
- package/dist/node/include/v8-message.h +233 -0
- package/dist/node/include/v8-metrics.h +264 -0
- package/dist/node/include/v8-microtask-queue.h +157 -0
- package/dist/node/include/v8-microtask.h +28 -0
- package/dist/node/include/v8-object.h +824 -0
- package/dist/node/include/v8-persistent-handle.h +582 -0
- package/dist/node/include/v8-platform.h +1358 -0
- package/dist/node/include/v8-primitive-object.h +118 -0
- package/dist/node/include/v8-primitive.h +877 -0
- package/dist/node/include/v8-profiler.h +1302 -0
- package/dist/node/include/v8-promise.h +174 -0
- package/dist/node/include/v8-proxy.h +50 -0
- package/dist/node/include/v8-regexp.h +106 -0
- package/dist/node/include/v8-script.h +904 -0
- package/dist/node/include/v8-snapshot.h +266 -0
- package/dist/node/include/v8-source-location.h +92 -0
- package/dist/node/include/v8-statistics.h +238 -0
- package/dist/node/include/v8-template.h +1297 -0
- package/dist/node/include/v8-traced-handle.h +432 -0
- package/dist/node/include/v8-typed-array.h +390 -0
- package/dist/node/include/v8-unwinder-state.h +31 -0
- package/dist/node/include/v8-unwinder.h +132 -0
- package/dist/node/include/v8-util.h +665 -0
- package/dist/node/include/v8-value-serializer-version.h +24 -0
- package/dist/node/include/v8-value-serializer.h +316 -0
- package/dist/node/include/v8-value.h +655 -0
- package/dist/node/include/v8-version-string.h +38 -0
- package/dist/node/include/v8-version.h +20 -0
- package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
- package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
- package/dist/node/include/v8-wasm.h +201 -0
- package/dist/node/include/v8-weak-callback-info.h +80 -0
- package/dist/node/include/v8.h +88 -0
- package/dist/node/include/v8config.h +981 -0
- package/dist/node/include/zlib_version.h +6 -0
- package/dist/node/libnode.dll +0 -0
- package/dist/node/libnode.lib +0 -0
- package/dist/node/libnodebuildinfo.json +10 -0
- package/dist/node/link_node.lib +0 -0
- package/dist/node/link_node.node +0 -0
- package/index.js +5 -0
- package/libnode.release.json +8 -0
- package/package.json +29 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright 2021 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_V8_FORWARD_H_
|
|
6
|
+
#define INCLUDE_V8_FORWARD_H_
|
|
7
|
+
|
|
8
|
+
// This header is intended to be used by headers that pass around V8 types,
|
|
9
|
+
// either by pointer or using Local<Type>. The full definitions can be included
|
|
10
|
+
// either via v8.h or the more fine-grained headers.
|
|
11
|
+
|
|
12
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
13
|
+
|
|
14
|
+
namespace v8 {
|
|
15
|
+
|
|
16
|
+
class AccessorSignature;
|
|
17
|
+
class Array;
|
|
18
|
+
class ArrayBuffer;
|
|
19
|
+
class ArrayBufferView;
|
|
20
|
+
class BigInt;
|
|
21
|
+
class BigInt64Array;
|
|
22
|
+
class BigIntObject;
|
|
23
|
+
class BigUint64Array;
|
|
24
|
+
class Boolean;
|
|
25
|
+
class BooleanObject;
|
|
26
|
+
class Context;
|
|
27
|
+
class DataView;
|
|
28
|
+
class Data;
|
|
29
|
+
class Date;
|
|
30
|
+
class DictionaryTemplate;
|
|
31
|
+
class Extension;
|
|
32
|
+
class External;
|
|
33
|
+
class FixedArray;
|
|
34
|
+
class Float32Array;
|
|
35
|
+
class Float64Array;
|
|
36
|
+
class Function;
|
|
37
|
+
template <class F>
|
|
38
|
+
class FunctionCallbackInfo;
|
|
39
|
+
class FunctionTemplate;
|
|
40
|
+
class Int16Array;
|
|
41
|
+
class Int32;
|
|
42
|
+
class Int32Array;
|
|
43
|
+
class Int8Array;
|
|
44
|
+
class Integer;
|
|
45
|
+
class Isolate;
|
|
46
|
+
class Map;
|
|
47
|
+
class Module;
|
|
48
|
+
class Name;
|
|
49
|
+
class Number;
|
|
50
|
+
class NumberObject;
|
|
51
|
+
class Object;
|
|
52
|
+
class ObjectTemplate;
|
|
53
|
+
class Platform;
|
|
54
|
+
class Primitive;
|
|
55
|
+
class Private;
|
|
56
|
+
class Promise;
|
|
57
|
+
class Proxy;
|
|
58
|
+
class RegExp;
|
|
59
|
+
class Script;
|
|
60
|
+
class Set;
|
|
61
|
+
class SharedArrayBuffer;
|
|
62
|
+
class Signature;
|
|
63
|
+
class String;
|
|
64
|
+
class StringObject;
|
|
65
|
+
class Symbol;
|
|
66
|
+
class SymbolObject;
|
|
67
|
+
class Template;
|
|
68
|
+
class TryCatch;
|
|
69
|
+
class TypedArray;
|
|
70
|
+
class Uint16Array;
|
|
71
|
+
class Uint32;
|
|
72
|
+
class Uint32Array;
|
|
73
|
+
class Uint8Array;
|
|
74
|
+
class Uint8ClampedArray;
|
|
75
|
+
class UnboundModuleScript;
|
|
76
|
+
class Value;
|
|
77
|
+
class WasmMemoryObject;
|
|
78
|
+
class WasmModuleObject;
|
|
79
|
+
|
|
80
|
+
} // namespace v8
|
|
81
|
+
|
|
82
|
+
#endif // INCLUDE_V8_FORWARD_H_
|
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
// Copyright 2021 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_V8_FUNCTION_CALLBACK_H_
|
|
6
|
+
#define INCLUDE_V8_FUNCTION_CALLBACK_H_
|
|
7
|
+
|
|
8
|
+
#include <cstdint>
|
|
9
|
+
#include <limits>
|
|
10
|
+
|
|
11
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
12
|
+
#include "v8-primitive.h" // NOLINT(build/include_directory)
|
|
13
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
14
|
+
|
|
15
|
+
namespace v8 {
|
|
16
|
+
|
|
17
|
+
template <typename T>
|
|
18
|
+
class BasicTracedReference;
|
|
19
|
+
template <typename T>
|
|
20
|
+
class Global;
|
|
21
|
+
class Object;
|
|
22
|
+
class Value;
|
|
23
|
+
|
|
24
|
+
namespace internal {
|
|
25
|
+
class FunctionCallbackArguments;
|
|
26
|
+
class PropertyCallbackArguments;
|
|
27
|
+
class Builtins;
|
|
28
|
+
} // namespace internal
|
|
29
|
+
|
|
30
|
+
namespace debug {
|
|
31
|
+
class ConsoleCallArguments;
|
|
32
|
+
} // namespace debug
|
|
33
|
+
|
|
34
|
+
template <typename T>
|
|
35
|
+
class ReturnValue {
|
|
36
|
+
public:
|
|
37
|
+
template <class S>
|
|
38
|
+
V8_INLINE ReturnValue(const ReturnValue<S>& that) : value_(that.value_) {
|
|
39
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
|
40
|
+
}
|
|
41
|
+
// Local setters
|
|
42
|
+
template <typename S>
|
|
43
|
+
V8_INLINE void Set(const Global<S>& handle);
|
|
44
|
+
template <typename S>
|
|
45
|
+
V8_INLINE void SetNonEmpty(const Global<S>& handle);
|
|
46
|
+
template <typename S>
|
|
47
|
+
V8_INLINE void Set(const BasicTracedReference<S>& handle);
|
|
48
|
+
template <typename S>
|
|
49
|
+
V8_INLINE void SetNonEmpty(const BasicTracedReference<S>& handle);
|
|
50
|
+
template <typename S>
|
|
51
|
+
V8_INLINE void Set(const Local<S> handle);
|
|
52
|
+
template <typename S>
|
|
53
|
+
V8_INLINE void SetNonEmpty(const Local<S> handle);
|
|
54
|
+
// Fast primitive setters
|
|
55
|
+
V8_INLINE void Set(bool value);
|
|
56
|
+
V8_INLINE void Set(double i);
|
|
57
|
+
V8_INLINE void Set(int32_t i);
|
|
58
|
+
V8_INLINE void Set(uint32_t i);
|
|
59
|
+
V8_INLINE void Set(uint16_t);
|
|
60
|
+
// Fast JS primitive setters
|
|
61
|
+
V8_INLINE void SetNull();
|
|
62
|
+
V8_INLINE void SetUndefined();
|
|
63
|
+
V8_INLINE void SetEmptyString();
|
|
64
|
+
// Convenience getter for Isolate
|
|
65
|
+
V8_INLINE Isolate* GetIsolate() const;
|
|
66
|
+
|
|
67
|
+
// Pointer setter: Uncompilable to prevent inadvertent misuse.
|
|
68
|
+
template <typename S>
|
|
69
|
+
V8_INLINE void Set(S* whatever);
|
|
70
|
+
|
|
71
|
+
// Getter. Creates a new Local<> so it comes with a certain performance
|
|
72
|
+
// hit. If the ReturnValue was not yet set, this will return the undefined
|
|
73
|
+
// value.
|
|
74
|
+
V8_INLINE Local<Value> Get() const;
|
|
75
|
+
|
|
76
|
+
private:
|
|
77
|
+
template <class F>
|
|
78
|
+
friend class ReturnValue;
|
|
79
|
+
template <class F>
|
|
80
|
+
friend class FunctionCallbackInfo;
|
|
81
|
+
template <class F>
|
|
82
|
+
friend class PropertyCallbackInfo;
|
|
83
|
+
template <class F, class G, class H>
|
|
84
|
+
friend class PersistentValueMapBase;
|
|
85
|
+
V8_INLINE void SetInternal(internal::Address value);
|
|
86
|
+
// Setting the hole value has different meanings depending on the usage:
|
|
87
|
+
// - for function template callbacks it means that the callback returns
|
|
88
|
+
// the undefined value,
|
|
89
|
+
// - for property getter callbacks is means that the callback returns
|
|
90
|
+
// the undefined value (for property setter callbacks the value returned
|
|
91
|
+
// is ignored),
|
|
92
|
+
// - for interceptor callbacks it means that the request was not handled.
|
|
93
|
+
V8_INLINE void SetTheHole();
|
|
94
|
+
V8_INLINE explicit ReturnValue(internal::Address* slot);
|
|
95
|
+
|
|
96
|
+
// See FunctionCallbackInfo.
|
|
97
|
+
static constexpr int kIsolateValueIndex = -2;
|
|
98
|
+
|
|
99
|
+
internal::Address* value_;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The argument information given to function call callbacks. This
|
|
104
|
+
* class provides access to information about the context of the call,
|
|
105
|
+
* including the receiver, the number and values of arguments, and
|
|
106
|
+
* the holder of the function.
|
|
107
|
+
*/
|
|
108
|
+
template <typename T>
|
|
109
|
+
class FunctionCallbackInfo {
|
|
110
|
+
public:
|
|
111
|
+
/** The number of available arguments. */
|
|
112
|
+
V8_INLINE int Length() const;
|
|
113
|
+
/**
|
|
114
|
+
* Accessor for the available arguments. Returns `undefined` if the index
|
|
115
|
+
* is out of bounds.
|
|
116
|
+
*/
|
|
117
|
+
V8_INLINE Local<Value> operator[](int i) const;
|
|
118
|
+
/** Returns the receiver. This corresponds to the "this" value. */
|
|
119
|
+
V8_INLINE Local<Object> This() const;
|
|
120
|
+
/**
|
|
121
|
+
* If the callback was created without a Signature, this is the same
|
|
122
|
+
* value as This(). If there is a signature, and the signature didn't match
|
|
123
|
+
* This() but one of its hidden prototypes, this will be the respective
|
|
124
|
+
* hidden prototype.
|
|
125
|
+
*
|
|
126
|
+
* Note that this is not the prototype of This() on which the accessor
|
|
127
|
+
* referencing this callback was found (which in V8 internally is often
|
|
128
|
+
* referred to as holder [sic]).
|
|
129
|
+
*/
|
|
130
|
+
V8_INLINE Local<Object> Holder() const;
|
|
131
|
+
/** For construct calls, this returns the "new.target" value. */
|
|
132
|
+
V8_INLINE Local<Value> NewTarget() const;
|
|
133
|
+
/** Indicates whether this is a regular call or a construct call. */
|
|
134
|
+
V8_INLINE bool IsConstructCall() const;
|
|
135
|
+
/** The data argument specified when creating the callback. */
|
|
136
|
+
V8_INLINE Local<Value> Data() const;
|
|
137
|
+
/** The current Isolate. */
|
|
138
|
+
V8_INLINE Isolate* GetIsolate() const;
|
|
139
|
+
/** The ReturnValue for the call. */
|
|
140
|
+
V8_INLINE ReturnValue<T> GetReturnValue() const;
|
|
141
|
+
|
|
142
|
+
private:
|
|
143
|
+
friend class internal::FunctionCallbackArguments;
|
|
144
|
+
friend class internal::CustomArguments<FunctionCallbackInfo>;
|
|
145
|
+
friend class debug::ConsoleCallArguments;
|
|
146
|
+
|
|
147
|
+
static constexpr int kHolderIndex = 0;
|
|
148
|
+
static constexpr int kIsolateIndex = 1;
|
|
149
|
+
static constexpr int kUnusedIndex = 2;
|
|
150
|
+
static constexpr int kReturnValueIndex = 3;
|
|
151
|
+
static constexpr int kDataIndex = 4;
|
|
152
|
+
static constexpr int kNewTargetIndex = 5;
|
|
153
|
+
static constexpr int kArgsLength = 6;
|
|
154
|
+
|
|
155
|
+
static constexpr int kArgsLengthWithReceiver = kArgsLength + 1;
|
|
156
|
+
|
|
157
|
+
// Codegen constants:
|
|
158
|
+
static constexpr int kSize = 3 * internal::kApiSystemPointerSize;
|
|
159
|
+
static constexpr int kImplicitArgsOffset = 0;
|
|
160
|
+
static constexpr int kValuesOffset =
|
|
161
|
+
kImplicitArgsOffset + internal::kApiSystemPointerSize;
|
|
162
|
+
static constexpr int kLengthOffset =
|
|
163
|
+
kValuesOffset + internal::kApiSystemPointerSize;
|
|
164
|
+
|
|
165
|
+
static constexpr int kThisValuesIndex = -1;
|
|
166
|
+
static_assert(ReturnValue<Value>::kIsolateValueIndex ==
|
|
167
|
+
kIsolateIndex - kReturnValueIndex);
|
|
168
|
+
|
|
169
|
+
V8_INLINE FunctionCallbackInfo(internal::Address* implicit_args,
|
|
170
|
+
internal::Address* values, int length);
|
|
171
|
+
internal::Address* implicit_args_;
|
|
172
|
+
internal::Address* values_;
|
|
173
|
+
int length_;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The information passed to a property callback about the context
|
|
178
|
+
* of the property access.
|
|
179
|
+
*/
|
|
180
|
+
template <typename T>
|
|
181
|
+
class PropertyCallbackInfo {
|
|
182
|
+
public:
|
|
183
|
+
/**
|
|
184
|
+
* \return The isolate of the property access.
|
|
185
|
+
*/
|
|
186
|
+
V8_INLINE Isolate* GetIsolate() const;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* \return The data set in the configuration, i.e., in
|
|
190
|
+
* `NamedPropertyHandlerConfiguration` or
|
|
191
|
+
* `IndexedPropertyHandlerConfiguration.`
|
|
192
|
+
*/
|
|
193
|
+
V8_INLINE Local<Value> Data() const;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* \return The receiver. In many cases, this is the object on which the
|
|
197
|
+
* property access was intercepted. When using
|
|
198
|
+
* `Reflect.get`, `Function.prototype.call`, or similar functions, it is the
|
|
199
|
+
* object passed in as receiver or thisArg.
|
|
200
|
+
*
|
|
201
|
+
* \code
|
|
202
|
+
* void GetterCallback(Local<Name> name,
|
|
203
|
+
* const v8::PropertyCallbackInfo<v8::Value>& info) {
|
|
204
|
+
* auto context = info.GetIsolate()->GetCurrentContext();
|
|
205
|
+
*
|
|
206
|
+
* v8::Local<v8::Value> a_this =
|
|
207
|
+
* info.This()
|
|
208
|
+
* ->GetRealNamedProperty(context, v8_str("a"))
|
|
209
|
+
* .ToLocalChecked();
|
|
210
|
+
* v8::Local<v8::Value> a_holder =
|
|
211
|
+
* info.Holder()
|
|
212
|
+
* ->GetRealNamedProperty(context, v8_str("a"))
|
|
213
|
+
* .ToLocalChecked();
|
|
214
|
+
*
|
|
215
|
+
* CHECK(v8_str("r")->Equals(context, a_this).FromJust());
|
|
216
|
+
* CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
|
|
217
|
+
*
|
|
218
|
+
* info.GetReturnValue().Set(name);
|
|
219
|
+
* }
|
|
220
|
+
*
|
|
221
|
+
* v8::Local<v8::FunctionTemplate> templ =
|
|
222
|
+
* v8::FunctionTemplate::New(isolate);
|
|
223
|
+
* templ->InstanceTemplate()->SetHandler(
|
|
224
|
+
* v8::NamedPropertyHandlerConfiguration(GetterCallback));
|
|
225
|
+
* LocalContext env;
|
|
226
|
+
* env->Global()
|
|
227
|
+
* ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
|
|
228
|
+
* .ToLocalChecked()
|
|
229
|
+
* ->NewInstance(env.local())
|
|
230
|
+
* .ToLocalChecked())
|
|
231
|
+
* .FromJust();
|
|
232
|
+
*
|
|
233
|
+
* CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");
|
|
234
|
+
* \endcode
|
|
235
|
+
*/
|
|
236
|
+
V8_INLINE Local<Object> This() const;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* \return The object in the prototype chain of the receiver that has the
|
|
240
|
+
* interceptor. Suppose you have `x` and its prototype is `y`, and `y`
|
|
241
|
+
* has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`.
|
|
242
|
+
* The Holder() could be a hidden object (the global object, rather
|
|
243
|
+
* than the global proxy).
|
|
244
|
+
*
|
|
245
|
+
* \note For security reasons, do not pass the object back into the runtime.
|
|
246
|
+
*/
|
|
247
|
+
V8_INLINE Local<Object> Holder() const;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* \return The return value of the callback.
|
|
251
|
+
* Can be changed by calling Set().
|
|
252
|
+
* \code
|
|
253
|
+
* info.GetReturnValue().Set(...)
|
|
254
|
+
* \endcode
|
|
255
|
+
*
|
|
256
|
+
*/
|
|
257
|
+
V8_INLINE ReturnValue<T> GetReturnValue() const;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* \return True if the intercepted function should throw if an error occurs.
|
|
261
|
+
* Usually, `true` corresponds to `'use strict'`.
|
|
262
|
+
*
|
|
263
|
+
* \note Always `false` when intercepting `Reflect.set()`
|
|
264
|
+
* independent of the language mode.
|
|
265
|
+
*/
|
|
266
|
+
V8_INLINE bool ShouldThrowOnError() const;
|
|
267
|
+
|
|
268
|
+
private:
|
|
269
|
+
friend class MacroAssembler;
|
|
270
|
+
friend class internal::PropertyCallbackArguments;
|
|
271
|
+
friend class internal::CustomArguments<PropertyCallbackInfo>;
|
|
272
|
+
static constexpr int kShouldThrowOnErrorIndex = 0;
|
|
273
|
+
static constexpr int kHolderIndex = 1;
|
|
274
|
+
static constexpr int kIsolateIndex = 2;
|
|
275
|
+
static constexpr int kUnusedIndex = 3;
|
|
276
|
+
static constexpr int kReturnValueIndex = 4;
|
|
277
|
+
static constexpr int kDataIndex = 5;
|
|
278
|
+
static constexpr int kThisIndex = 6;
|
|
279
|
+
static constexpr int kArgsLength = 7;
|
|
280
|
+
|
|
281
|
+
static constexpr int kSize = 1 * internal::kApiSystemPointerSize;
|
|
282
|
+
|
|
283
|
+
V8_INLINE explicit PropertyCallbackInfo(internal::Address* args)
|
|
284
|
+
: args_(args) {}
|
|
285
|
+
|
|
286
|
+
internal::Address* args_;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
using FunctionCallback = void (*)(const FunctionCallbackInfo<Value>& info);
|
|
290
|
+
|
|
291
|
+
// --- Implementation ---
|
|
292
|
+
|
|
293
|
+
template <typename T>
|
|
294
|
+
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
|
|
295
|
+
|
|
296
|
+
template <typename T>
|
|
297
|
+
void ReturnValue<T>::SetInternal(internal::Address value) {
|
|
298
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
299
|
+
using I = internal::Internals;
|
|
300
|
+
// Ensure that the upper 32-bits are not modified. Compiler should be
|
|
301
|
+
// able to optimize this to a store of a lower 32-bits of the value.
|
|
302
|
+
// This is fine since the callback can return only JavaScript values which
|
|
303
|
+
// are either Smis or heap objects allocated in the main cage.
|
|
304
|
+
*value_ = I::DecompressTaggedField(*value_, I::CompressTagged(value));
|
|
305
|
+
#else
|
|
306
|
+
*value_ = value;
|
|
307
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
template <typename T>
|
|
311
|
+
template <typename S>
|
|
312
|
+
void ReturnValue<T>::Set(const Global<S>& handle) {
|
|
313
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
|
314
|
+
if (V8_UNLIKELY(handle.IsEmpty())) {
|
|
315
|
+
SetTheHole();
|
|
316
|
+
} else {
|
|
317
|
+
SetInternal(handle.ptr());
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
template <typename T>
|
|
322
|
+
template <typename S>
|
|
323
|
+
void ReturnValue<T>::SetNonEmpty(const Global<S>& handle) {
|
|
324
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
|
325
|
+
#ifdef V8_ENABLE_CHECKS
|
|
326
|
+
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
|
327
|
+
#endif // V8_ENABLE_CHECKS
|
|
328
|
+
SetInternal(handle.ptr());
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
template <typename T>
|
|
332
|
+
template <typename S>
|
|
333
|
+
void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
|
|
334
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
|
335
|
+
if (V8_UNLIKELY(handle.IsEmpty())) {
|
|
336
|
+
SetTheHole();
|
|
337
|
+
} else {
|
|
338
|
+
SetInternal(handle.ptr());
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
template <typename T>
|
|
343
|
+
template <typename S>
|
|
344
|
+
void ReturnValue<T>::SetNonEmpty(const BasicTracedReference<S>& handle) {
|
|
345
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
|
346
|
+
#ifdef V8_ENABLE_CHECKS
|
|
347
|
+
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
|
348
|
+
#endif // V8_ENABLE_CHECKS
|
|
349
|
+
SetInternal(handle.ptr());
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
template <typename T>
|
|
353
|
+
template <typename S>
|
|
354
|
+
void ReturnValue<T>::Set(const Local<S> handle) {
|
|
355
|
+
static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
|
|
356
|
+
"type check");
|
|
357
|
+
if (V8_UNLIKELY(handle.IsEmpty())) {
|
|
358
|
+
SetTheHole();
|
|
359
|
+
} else {
|
|
360
|
+
SetInternal(handle.ptr());
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
template <typename T>
|
|
365
|
+
template <typename S>
|
|
366
|
+
void ReturnValue<T>::SetNonEmpty(const Local<S> handle) {
|
|
367
|
+
static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
|
|
368
|
+
"type check");
|
|
369
|
+
#ifdef V8_ENABLE_CHECKS
|
|
370
|
+
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
|
371
|
+
#endif // V8_ENABLE_CHECKS
|
|
372
|
+
SetInternal(handle.ptr());
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
template <typename T>
|
|
376
|
+
void ReturnValue<T>::Set(double i) {
|
|
377
|
+
static_assert(std::is_base_of<T, Number>::value, "type check");
|
|
378
|
+
SetNonEmpty(Number::New(GetIsolate(), i));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
template <typename T>
|
|
382
|
+
void ReturnValue<T>::Set(int32_t i) {
|
|
383
|
+
static_assert(std::is_base_of<T, Integer>::value, "type check");
|
|
384
|
+
using I = internal::Internals;
|
|
385
|
+
if (V8_LIKELY(I::IsValidSmi(i))) {
|
|
386
|
+
SetInternal(I::IntToSmi(i));
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
SetNonEmpty(Integer::New(GetIsolate(), i));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
template <typename T>
|
|
393
|
+
void ReturnValue<T>::Set(uint32_t i) {
|
|
394
|
+
static_assert(std::is_base_of<T, Integer>::value, "type check");
|
|
395
|
+
// Can't simply use INT32_MAX here for whatever reason.
|
|
396
|
+
bool fits_into_int32_t = (i & (1U << 31)) == 0;
|
|
397
|
+
if (V8_LIKELY(fits_into_int32_t)) {
|
|
398
|
+
Set(static_cast<int32_t>(i));
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
SetNonEmpty(Integer::NewFromUnsigned(GetIsolate(), i));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
template <typename T>
|
|
405
|
+
void ReturnValue<T>::Set(uint16_t i) {
|
|
406
|
+
static_assert(std::is_base_of<T, Integer>::value, "type check");
|
|
407
|
+
using I = internal::Internals;
|
|
408
|
+
static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::min()));
|
|
409
|
+
static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::max()));
|
|
410
|
+
SetInternal(I::IntToSmi(i));
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
template <typename T>
|
|
414
|
+
void ReturnValue<T>::Set(bool value) {
|
|
415
|
+
static_assert(std::is_base_of<T, Boolean>::value, "type check");
|
|
416
|
+
using I = internal::Internals;
|
|
417
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
418
|
+
#ifdef V8_ENABLE_CHECKS
|
|
419
|
+
internal::PerformCastCheck(
|
|
420
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
|
421
|
+
#endif // V8_ENABLE_CHECKS
|
|
422
|
+
SetInternal(value ? I::StaticReadOnlyRoot::kTrueValue
|
|
423
|
+
: I::StaticReadOnlyRoot::kFalseValue);
|
|
424
|
+
#else
|
|
425
|
+
int root_index;
|
|
426
|
+
if (value) {
|
|
427
|
+
root_index = I::kTrueValueRootIndex;
|
|
428
|
+
} else {
|
|
429
|
+
root_index = I::kFalseValueRootIndex;
|
|
430
|
+
}
|
|
431
|
+
*value_ = I::GetRoot(GetIsolate(), root_index);
|
|
432
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
template <typename T>
|
|
436
|
+
void ReturnValue<T>::SetTheHole() {
|
|
437
|
+
using I = internal::Internals;
|
|
438
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
439
|
+
SetInternal(I::StaticReadOnlyRoot::kTheHoleValue);
|
|
440
|
+
#else
|
|
441
|
+
*value_ = I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex);
|
|
442
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
template <typename T>
|
|
446
|
+
void ReturnValue<T>::SetNull() {
|
|
447
|
+
static_assert(std::is_base_of<T, Primitive>::value, "type check");
|
|
448
|
+
using I = internal::Internals;
|
|
449
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
450
|
+
#ifdef V8_ENABLE_CHECKS
|
|
451
|
+
internal::PerformCastCheck(
|
|
452
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
|
453
|
+
#endif // V8_ENABLE_CHECKS
|
|
454
|
+
SetInternal(I::StaticReadOnlyRoot::kNullValue);
|
|
455
|
+
#else
|
|
456
|
+
*value_ = I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
|
|
457
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
template <typename T>
|
|
461
|
+
void ReturnValue<T>::SetUndefined() {
|
|
462
|
+
static_assert(std::is_base_of<T, Primitive>::value, "type check");
|
|
463
|
+
using I = internal::Internals;
|
|
464
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
465
|
+
#ifdef V8_ENABLE_CHECKS
|
|
466
|
+
internal::PerformCastCheck(
|
|
467
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
|
468
|
+
#endif // V8_ENABLE_CHECKS
|
|
469
|
+
SetInternal(I::StaticReadOnlyRoot::kUndefinedValue);
|
|
470
|
+
#else
|
|
471
|
+
*value_ = I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
|
|
472
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
template <typename T>
|
|
476
|
+
void ReturnValue<T>::SetEmptyString() {
|
|
477
|
+
static_assert(std::is_base_of<T, String>::value, "type check");
|
|
478
|
+
using I = internal::Internals;
|
|
479
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
480
|
+
#ifdef V8_ENABLE_CHECKS
|
|
481
|
+
internal::PerformCastCheck(
|
|
482
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
|
483
|
+
#endif // V8_ENABLE_CHECKS
|
|
484
|
+
SetInternal(I::StaticReadOnlyRoot::kEmptyString);
|
|
485
|
+
#else
|
|
486
|
+
*value_ = I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
|
|
487
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
template <typename T>
|
|
491
|
+
Isolate* ReturnValue<T>::GetIsolate() const {
|
|
492
|
+
return *reinterpret_cast<Isolate**>(&value_[kIsolateValueIndex]);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
template <typename T>
|
|
496
|
+
Local<Value> ReturnValue<T>::Get() const {
|
|
497
|
+
using I = internal::Internals;
|
|
498
|
+
#if V8_STATIC_ROOTS_BOOL
|
|
499
|
+
if (I::is_identical(*value_, I::StaticReadOnlyRoot::kTheHoleValue)) {
|
|
500
|
+
#else
|
|
501
|
+
if (*value_ == I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) {
|
|
502
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
|
503
|
+
return Undefined(GetIsolate());
|
|
504
|
+
}
|
|
505
|
+
return Local<Value>::New(GetIsolate(),
|
|
506
|
+
internal::ValueHelper::SlotAsValue<Value>(value_));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
template <typename T>
|
|
510
|
+
template <typename S>
|
|
511
|
+
void ReturnValue<T>::Set(S* whatever) {
|
|
512
|
+
static_assert(sizeof(S) < 0, "incompilable to prevent inadvertent misuse");
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
template <typename T>
|
|
516
|
+
FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Address* implicit_args,
|
|
517
|
+
internal::Address* values,
|
|
518
|
+
int length)
|
|
519
|
+
: implicit_args_(implicit_args), values_(values), length_(length) {}
|
|
520
|
+
|
|
521
|
+
template <typename T>
|
|
522
|
+
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
|
|
523
|
+
// values_ points to the first argument (not the receiver).
|
|
524
|
+
if (i < 0 || length_ <= i) return Undefined(GetIsolate());
|
|
525
|
+
return Local<Value>::FromSlot(values_ + i);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
template <typename T>
|
|
529
|
+
Local<Object> FunctionCallbackInfo<T>::This() const {
|
|
530
|
+
// values_ points to the first argument (not the receiver).
|
|
531
|
+
return Local<Object>::FromSlot(values_ + kThisValuesIndex);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
template <typename T>
|
|
535
|
+
Local<Object> FunctionCallbackInfo<T>::Holder() const {
|
|
536
|
+
return Local<Object>::FromSlot(&implicit_args_[kHolderIndex]);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
template <typename T>
|
|
540
|
+
Local<Value> FunctionCallbackInfo<T>::NewTarget() const {
|
|
541
|
+
return Local<Value>::FromSlot(&implicit_args_[kNewTargetIndex]);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
template <typename T>
|
|
545
|
+
Local<Value> FunctionCallbackInfo<T>::Data() const {
|
|
546
|
+
return Local<Value>::FromSlot(&implicit_args_[kDataIndex]);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
template <typename T>
|
|
550
|
+
Isolate* FunctionCallbackInfo<T>::GetIsolate() const {
|
|
551
|
+
return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
template <typename T>
|
|
555
|
+
ReturnValue<T> FunctionCallbackInfo<T>::GetReturnValue() const {
|
|
556
|
+
return ReturnValue<T>(&implicit_args_[kReturnValueIndex]);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
template <typename T>
|
|
560
|
+
bool FunctionCallbackInfo<T>::IsConstructCall() const {
|
|
561
|
+
return !NewTarget()->IsUndefined();
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
template <typename T>
|
|
565
|
+
int FunctionCallbackInfo<T>::Length() const {
|
|
566
|
+
return length_;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
template <typename T>
|
|
570
|
+
Isolate* PropertyCallbackInfo<T>::GetIsolate() const {
|
|
571
|
+
return *reinterpret_cast<Isolate**>(&args_[kIsolateIndex]);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
template <typename T>
|
|
575
|
+
Local<Value> PropertyCallbackInfo<T>::Data() const {
|
|
576
|
+
return Local<Value>::FromSlot(&args_[kDataIndex]);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
template <typename T>
|
|
580
|
+
Local<Object> PropertyCallbackInfo<T>::This() const {
|
|
581
|
+
return Local<Object>::FromSlot(&args_[kThisIndex]);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
template <typename T>
|
|
585
|
+
Local<Object> PropertyCallbackInfo<T>::Holder() const {
|
|
586
|
+
return Local<Object>::FromSlot(&args_[kHolderIndex]);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
template <typename T>
|
|
590
|
+
ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const {
|
|
591
|
+
return ReturnValue<T>(&args_[kReturnValueIndex]);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
template <typename T>
|
|
595
|
+
bool PropertyCallbackInfo<T>::ShouldThrowOnError() const {
|
|
596
|
+
using I = internal::Internals;
|
|
597
|
+
if (args_[kShouldThrowOnErrorIndex] !=
|
|
598
|
+
I::IntToSmi(I::kInferShouldThrowMode)) {
|
|
599
|
+
return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow);
|
|
600
|
+
}
|
|
601
|
+
return v8::internal::ShouldThrowOnError(
|
|
602
|
+
reinterpret_cast<v8::internal::Isolate*>(GetIsolate()));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
} // namespace v8
|
|
606
|
+
|
|
607
|
+
#endif // INCLUDE_V8_FUNCTION_CALLBACK_H_
|