@encharm/cws 4.5.3 → 4.6.0

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.
Files changed (288) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/CLAUDE.md +81 -0
  3. package/README.md +10 -3
  4. package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
  5. package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
  6. package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
  7. package/dist/bindings/cws_darwin_arm64_node147.node +0 -0
  8. package/dist/bindings/cws_linux_arm64_node115.node +0 -0
  9. package/dist/bindings/cws_linux_arm64_node127.node +0 -0
  10. package/dist/bindings/cws_linux_arm64_node137.node +0 -0
  11. package/dist/bindings/cws_linux_arm64_node147.node +0 -0
  12. package/dist/bindings/cws_linux_x64_node115.node +0 -0
  13. package/dist/bindings/cws_linux_x64_node127.node +0 -0
  14. package/dist/bindings/cws_linux_x64_node137.node +0 -0
  15. package/dist/bindings/cws_linux_x64_node147.node +0 -0
  16. package/dist/bindings/cws_win32_x64_node115.node +0 -0
  17. package/dist/bindings/cws_win32_x64_node127.node +0 -0
  18. package/dist/bindings/cws_win32_x64_node137.node +0 -0
  19. package/dist/bindings/cws_win32_x64_node147.node +0 -0
  20. package/package.json +1 -1
  21. package/src/Addon.cpp +2 -1
  22. package/src/Addon.h +70 -14
  23. package/src/Hub.h +1 -0
  24. package/src/Networking.h +11 -0
  25. package/src/Socket.h +201 -6
  26. package/src/WebSocket.cpp +4 -1
  27. package/src/cSNode.cpp +2 -0
  28. package/src/cSNode.h +4 -0
  29. package/src/headers/26/acorn_version.h +6 -0
  30. package/src/headers/26/aliased_buffer-inl.h +264 -0
  31. package/src/headers/26/aliased_buffer.h +205 -0
  32. package/src/headers/26/aliased_struct-inl.h +143 -0
  33. package/src/headers/26/aliased_struct.h +248 -0
  34. package/src/headers/26/amaro_version.h +6 -0
  35. package/src/headers/26/async_context_frame.h +33 -0
  36. package/src/headers/26/async_wrap-inl.h +123 -0
  37. package/src/headers/26/async_wrap.h +254 -0
  38. package/src/headers/26/base_object-inl.h +333 -0
  39. package/src/headers/26/base_object.h +339 -0
  40. package/src/headers/26/base_object_types.h +76 -0
  41. package/src/headers/26/blob_serializer_deserializer-inl.h +385 -0
  42. package/src/headers/26/blob_serializer_deserializer.h +142 -0
  43. package/src/headers/26/builtin_info.h +57 -0
  44. package/src/headers/26/callback_queue-inl.h +97 -0
  45. package/src/headers/26/callback_queue.h +79 -0
  46. package/src/headers/26/cares_wrap.h +475 -0
  47. package/src/headers/26/cleanup_queue-inl.h +36 -0
  48. package/src/headers/26/cleanup_queue.h +79 -0
  49. package/src/headers/26/compile_cache.h +134 -0
  50. package/src/headers/26/connect_wrap.h +26 -0
  51. package/src/headers/26/connection_wrap.h +30 -0
  52. package/src/headers/26/cppgc_helpers-inl.h +69 -0
  53. package/src/headers/26/cppgc_helpers.h +162 -0
  54. package/src/headers/26/crypto/crypto_aes.h +107 -0
  55. package/src/headers/26/crypto/crypto_argon2.h +88 -0
  56. package/src/headers/26/crypto/crypto_bio.h +193 -0
  57. package/src/headers/26/crypto/crypto_chacha20_poly1305.h +62 -0
  58. package/src/headers/26/crypto/crypto_cipher.h +291 -0
  59. package/src/headers/26/crypto/crypto_common.h +48 -0
  60. package/src/headers/26/crypto/crypto_context.h +219 -0
  61. package/src/headers/26/crypto/crypto_dh.h +104 -0
  62. package/src/headers/26/crypto/crypto_dsa.h +50 -0
  63. package/src/headers/26/crypto/crypto_ec.h +102 -0
  64. package/src/headers/26/crypto/crypto_hash.h +157 -0
  65. package/src/headers/26/crypto/crypto_hkdf.h +62 -0
  66. package/src/headers/26/crypto/crypto_hmac.h +92 -0
  67. package/src/headers/26/crypto/crypto_kem.h +131 -0
  68. package/src/headers/26/crypto/crypto_keygen.h +382 -0
  69. package/src/headers/26/crypto/crypto_keys.h +366 -0
  70. package/src/headers/26/crypto/crypto_kmac.h +79 -0
  71. package/src/headers/26/crypto/crypto_pbkdf2.h +76 -0
  72. package/src/headers/26/crypto/crypto_pqc.h +39 -0
  73. package/src/headers/26/crypto/crypto_random.h +127 -0
  74. package/src/headers/26/crypto/crypto_rsa.h +108 -0
  75. package/src/headers/26/crypto/crypto_scrypt.h +85 -0
  76. package/src/headers/26/crypto/crypto_sig.h +159 -0
  77. package/src/headers/26/crypto/crypto_spkac.h +21 -0
  78. package/src/headers/26/crypto/crypto_timing.h +20 -0
  79. package/src/headers/26/crypto/crypto_tls.h +342 -0
  80. package/src/headers/26/crypto/crypto_turboshake.h +105 -0
  81. package/src/headers/26/crypto/crypto_util.h +775 -0
  82. package/src/headers/26/crypto/crypto_x509.h +140 -0
  83. package/src/headers/26/dataqueue/queue.h +311 -0
  84. package/src/headers/26/debug_utils-inl.h +291 -0
  85. package/src/headers/26/debug_utils.h +200 -0
  86. package/src/headers/26/diagnosticfilename-inl.h +33 -0
  87. package/src/headers/26/embedded_data.h +17 -0
  88. package/src/headers/26/encoding_binding.h +59 -0
  89. package/src/headers/26/env-inl.h +956 -0
  90. package/src/headers/26/env.h +1294 -0
  91. package/src/headers/26/env_properties.h +562 -0
  92. package/src/headers/26/ffi/data.h +30 -0
  93. package/src/headers/26/ffi/fast.h +96 -0
  94. package/src/headers/26/ffi/jit_memory.h +26 -0
  95. package/src/headers/26/ffi/types.h +99 -0
  96. package/src/headers/26/handle_wrap.h +123 -0
  97. package/src/headers/26/histogram-inl.h +211 -0
  98. package/src/headers/26/histogram.h +474 -0
  99. package/src/headers/26/inspector/dom_storage_agent.h +68 -0
  100. package/src/headers/26/inspector/inspector_object_utils.h +38 -0
  101. package/src/headers/26/inspector/io_agent.h +30 -0
  102. package/src/headers/26/inspector/main_thread_interface.h +116 -0
  103. package/src/headers/26/inspector/network_agent.h +110 -0
  104. package/src/headers/26/inspector/network_inspector.h +45 -0
  105. package/src/headers/26/inspector/network_requests_buffer.h +195 -0
  106. package/src/headers/26/inspector/network_resource_manager.h +29 -0
  107. package/src/headers/26/inspector/node_json.h +24 -0
  108. package/src/headers/26/inspector/node_string.h +101 -0
  109. package/src/headers/26/inspector/notification_emitter.h +38 -0
  110. package/src/headers/26/inspector/protocol_helper.h +27 -0
  111. package/src/headers/26/inspector/runtime_agent.h +41 -0
  112. package/src/headers/26/inspector/storage_agent.h +33 -0
  113. package/src/headers/26/inspector/target_agent.h +59 -0
  114. package/src/headers/26/inspector/target_manager.h +70 -0
  115. package/src/headers/26/inspector/tracing_agent.h +43 -0
  116. package/src/headers/26/inspector/worker_agent.h +40 -0
  117. package/src/headers/26/inspector/worker_inspector.h +124 -0
  118. package/src/headers/26/inspector_agent.h +168 -0
  119. package/src/headers/26/inspector_io.h +78 -0
  120. package/src/headers/26/inspector_profiler.h +149 -0
  121. package/src/headers/26/inspector_socket.h +60 -0
  122. package/src/headers/26/inspector_socket_server.h +110 -0
  123. package/src/headers/26/js_native_api.h +634 -0
  124. package/src/headers/26/js_native_api_types.h +244 -0
  125. package/src/headers/26/js_native_api_v8.h +485 -0
  126. package/src/headers/26/js_native_api_v8_internals.h +45 -0
  127. package/src/headers/26/js_stream.h +57 -0
  128. package/src/headers/26/json_utils.h +172 -0
  129. package/src/headers/26/large_pages/node_large_page.h +34 -0
  130. package/src/headers/26/lru_cache-inl.h +69 -0
  131. package/src/headers/26/memory_tracker-inl.h +461 -0
  132. package/src/headers/26/memory_tracker.h +341 -0
  133. package/src/headers/26/module_wrap.h +231 -0
  134. package/src/headers/26/ncrypto.h +2008 -0
  135. package/src/headers/26/node.h +1693 -0
  136. package/src/headers/26/node_api.h +265 -0
  137. package/src/headers/26/node_api_internals.h +48 -0
  138. package/src/headers/26/node_api_types.h +58 -0
  139. package/src/headers/26/node_binding.h +170 -0
  140. package/src/headers/26/node_blob.h +160 -0
  141. package/src/headers/26/node_bob-inl.h +36 -0
  142. package/src/headers/26/node_bob.h +107 -0
  143. package/src/headers/26/node_buffer.h +92 -0
  144. package/src/headers/26/node_builtins.h +239 -0
  145. package/src/headers/26/node_concepts.h +46 -0
  146. package/src/headers/26/node_config_file.h +77 -0
  147. package/src/headers/26/node_constants.h +82 -0
  148. package/src/headers/26/node_context_data.h +171 -0
  149. package/src/headers/26/node_contextify.h +261 -0
  150. package/src/headers/26/node_crypto.h +66 -0
  151. package/src/headers/26/node_debug.h +30 -0
  152. package/src/headers/26/node_diagnostics_channel.h +121 -0
  153. package/src/headers/26/node_dir.h +52 -0
  154. package/src/headers/26/node_dotenv.h +45 -0
  155. package/src/headers/26/node_errors.h +378 -0
  156. package/src/headers/26/node_exit_code.h +54 -0
  157. package/src/headers/26/node_external_reference.h +171 -0
  158. package/src/headers/26/node_ffi.h +212 -0
  159. package/src/headers/26/node_file-inl.h +421 -0
  160. package/src/headers/26/node_file.h +561 -0
  161. package/src/headers/26/node_file_utils.h +39 -0
  162. package/src/headers/26/node_hash.h +212 -0
  163. package/src/headers/26/node_http2.h +1202 -0
  164. package/src/headers/26/node_http2_state.h +159 -0
  165. package/src/headers/26/node_http_common-inl.h +199 -0
  166. package/src/headers/26/node_http_common.h +535 -0
  167. package/src/headers/26/node_i18n.h +132 -0
  168. package/src/headers/26/node_internals.h +485 -0
  169. package/src/headers/26/node_locks.h +184 -0
  170. package/src/headers/26/node_main_instance.h +67 -0
  171. package/src/headers/26/node_mem-inl.h +113 -0
  172. package/src/headers/26/node_mem.h +45 -0
  173. package/src/headers/26/node_messaging.h +389 -0
  174. package/src/headers/26/node_metadata.h +172 -0
  175. package/src/headers/26/node_modules.h +102 -0
  176. package/src/headers/26/node_mutex.h +323 -0
  177. package/src/headers/26/node_object_wrap.h +145 -0
  178. package/src/headers/26/node_options-inl.h +524 -0
  179. package/src/headers/26/node_options.h +710 -0
  180. package/src/headers/26/node_perf.h +167 -0
  181. package/src/headers/26/node_perf_common.h +103 -0
  182. package/src/headers/26/node_platform.h +290 -0
  183. package/src/headers/26/node_process-inl.h +26 -0
  184. package/src/headers/26/node_process.h +112 -0
  185. package/src/headers/26/node_profiling.h +38 -0
  186. package/src/headers/26/node_realm-inl.h +156 -0
  187. package/src/headers/26/node_realm.h +236 -0
  188. package/src/headers/26/node_report.h +43 -0
  189. package/src/headers/26/node_revert.h +82 -0
  190. package/src/headers/26/node_root_certs.h +2937 -0
  191. package/src/headers/26/node_sea.h +101 -0
  192. package/src/headers/26/node_shadow_realm.h +46 -0
  193. package/src/headers/26/node_snapshot_builder.h +57 -0
  194. package/src/headers/26/node_snapshotable.h +167 -0
  195. package/src/headers/26/node_sockaddr-inl.h +248 -0
  196. package/src/headers/26/node_sockaddr.h +459 -0
  197. package/src/headers/26/node_sqlite.h +607 -0
  198. package/src/headers/26/node_stat_watcher.h +73 -0
  199. package/src/headers/26/node_task_runner.h +92 -0
  200. package/src/headers/26/node_threadsafe_cow-inl.h +54 -0
  201. package/src/headers/26/node_threadsafe_cow.h +105 -0
  202. package/src/headers/26/node_union_bytes.h +81 -0
  203. package/src/headers/26/node_url.h +101 -0
  204. package/src/headers/26/node_url_pattern.h +118 -0
  205. package/src/headers/26/node_v8.h +78 -0
  206. package/src/headers/26/node_v8_embedder.h +26 -0
  207. package/src/headers/26/node_v8_platform-inl.h +96 -0
  208. package/src/headers/26/node_version.h +116 -0
  209. package/src/headers/26/node_wasi.h +184 -0
  210. package/src/headers/26/node_wasm_web_api.h +55 -0
  211. package/src/headers/26/node_watchdog.h +164 -0
  212. package/src/headers/26/node_webstorage.h +62 -0
  213. package/src/headers/26/node_worker.h +162 -0
  214. package/src/headers/26/path.h +36 -0
  215. package/src/headers/26/permission/boolean_permission.h +50 -0
  216. package/src/headers/26/permission/fs_permission.h +192 -0
  217. package/src/headers/26/permission/permission.h +155 -0
  218. package/src/headers/26/permission/permission_base.h +79 -0
  219. package/src/headers/26/pipe_wrap.h +80 -0
  220. package/src/headers/26/quic/application.h +279 -0
  221. package/src/headers/26/quic/arena.h +373 -0
  222. package/src/headers/26/quic/bindingdata.h +440 -0
  223. package/src/headers/26/quic/cid.h +127 -0
  224. package/src/headers/26/quic/data.h +358 -0
  225. package/src/headers/26/quic/defs.h +417 -0
  226. package/src/headers/26/quic/endpoint.h +519 -0
  227. package/src/headers/26/quic/guard.h +5 -0
  228. package/src/headers/26/quic/http3.h +25 -0
  229. package/src/headers/26/quic/packet.h +166 -0
  230. package/src/headers/26/quic/preferredaddress.h +72 -0
  231. package/src/headers/26/quic/session.h +770 -0
  232. package/src/headers/26/quic/session_manager.h +107 -0
  233. package/src/headers/26/quic/sessionticket.h +110 -0
  234. package/src/headers/26/quic/streams.h +518 -0
  235. package/src/headers/26/quic/tlscontext.h +353 -0
  236. package/src/headers/26/quic/tokens.h +263 -0
  237. package/src/headers/26/quic/transportparams.h +184 -0
  238. package/src/headers/26/req_wrap-inl.h +175 -0
  239. package/src/headers/26/req_wrap.h +79 -0
  240. package/src/headers/26/spawn_sync.h +243 -0
  241. package/src/headers/26/stream_base-inl.h +170 -0
  242. package/src/headers/26/stream_base.h +487 -0
  243. package/src/headers/26/stream_pipe.h +76 -0
  244. package/src/headers/26/stream_wrap.h +137 -0
  245. package/src/headers/26/string_bytes.h +114 -0
  246. package/src/headers/26/string_decoder-inl.h +31 -0
  247. package/src/headers/26/string_decoder.h +49 -0
  248. package/src/headers/26/tcp_wrap.h +138 -0
  249. package/src/headers/26/threadpoolwork-inl.h +70 -0
  250. package/src/headers/26/timer_wrap-inl.h +32 -0
  251. package/src/headers/26/timer_wrap.h +87 -0
  252. package/src/headers/26/timers.h +70 -0
  253. package/src/headers/26/tracing/agent.h +125 -0
  254. package/src/headers/26/tracing/agent_legacy.h +146 -0
  255. package/src/headers/26/tracing/agent_perfetto.h +145 -0
  256. package/src/headers/26/tracing/node_trace_buffer.h +91 -0
  257. package/src/headers/26/tracing/node_trace_writer.h +79 -0
  258. package/src/headers/26/tracing/trace_event.h +27 -0
  259. package/src/headers/26/tracing/trace_event_helper.h +40 -0
  260. package/src/headers/26/tracing/trace_event_legacy.h +1113 -0
  261. package/src/headers/26/tracing/trace_event_legacy_inl.h +711 -0
  262. package/src/headers/26/tracing/trace_event_perfetto.h +47 -0
  263. package/src/headers/26/tracing/traced_value.h +167 -0
  264. package/src/headers/26/tty_wrap.h +65 -0
  265. package/src/headers/26/udp_wrap.h +231 -0
  266. package/src/headers/26/undici_version.h +6 -0
  267. package/src/headers/26/util-inl.h +788 -0
  268. package/src/headers/26/util.h +1207 -0
  269. package/src/headers/26/v8-cpp-heap-external.h +56 -0
  270. package/src/headers/26/v8-external-memory-accounter.h +60 -0
  271. package/src/headers/26/v8-fast-api-calls.h +784 -0
  272. package/src/headers/26/v8-inspector-protocol.h +13 -0
  273. package/src/headers/26/v8-inspector.h +458 -0
  274. package/src/headers/26/v8-metrics.h +273 -0
  275. package/src/headers/26/v8-trace-categories.h +28 -0
  276. package/src/headers/26/v8-unwinder-state.h +30 -0
  277. package/src/headers/26/v8-util.h +549 -0
  278. package/src/headers/26/v8-value-serializer-version.h +24 -0
  279. package/src/headers/26/v8-version-string.h +38 -0
  280. package/src/headers/26/v8-wasm-trap-handler-posix.h +31 -0
  281. package/src/headers/26/v8-wasm-trap-handler-win.h +28 -0
  282. package/src/headers/26/zlib_version.h +6 -0
  283. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Info.plist +0 -20
  284. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Resources/DWARF/cws_darwin_arm64_node115.node +0 -0
  285. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Resources/Relocations/aarch64/cws_darwin_arm64_node115.node.yml +0 -931
  286. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Info.plist +0 -20
  287. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Resources/DWARF/cws_darwin_arm64_node127.node +0 -0
  288. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Resources/Relocations/aarch64/cws_darwin_arm64_node127.node.yml +0 -931
@@ -0,0 +1,167 @@
1
+ #ifndef SRC_NODE_PERF_H_
2
+ #define SRC_NODE_PERF_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "base_object-inl.h"
7
+ #include "histogram.h"
8
+ #include "node.h"
9
+ #include "node_internals.h"
10
+ #include "node_perf_common.h"
11
+
12
+ #include "v8.h"
13
+ #include "uv.h"
14
+
15
+ #include <string>
16
+
17
+ namespace node {
18
+
19
+ class Environment;
20
+ class ExternalReferenceRegistry;
21
+
22
+ namespace performance {
23
+
24
+ inline const char* GetPerformanceMilestoneName(
25
+ PerformanceMilestone milestone) {
26
+ switch (milestone) {
27
+ #define V(name, label) case NODE_PERFORMANCE_MILESTONE_##name: return label;
28
+ NODE_PERFORMANCE_MILESTONES(V)
29
+ #undef V
30
+ default:
31
+ UNREACHABLE();
32
+ }
33
+ }
34
+
35
+ inline PerformanceMilestone ToPerformanceMilestoneEnum(const char* str) {
36
+ #define V(name, label) \
37
+ if (strcmp(str, label) == 0) return NODE_PERFORMANCE_MILESTONE_##name;
38
+ NODE_PERFORMANCE_MILESTONES(V)
39
+ #undef V
40
+ return NODE_PERFORMANCE_MILESTONE_INVALID;
41
+ }
42
+
43
+ inline const char* GetPerformanceEntryTypeName(
44
+ PerformanceEntryType type) {
45
+ switch (type) {
46
+ #define V(name, label) case NODE_PERFORMANCE_ENTRY_TYPE_##name: return label;
47
+ NODE_PERFORMANCE_ENTRY_TYPES(V)
48
+ #undef V
49
+ default:
50
+ UNREACHABLE();
51
+ }
52
+ }
53
+
54
+ inline PerformanceEntryType ToPerformanceEntryTypeEnum(
55
+ const char* type) {
56
+ #define V(name, label) \
57
+ if (strcmp(type, label) == 0) return NODE_PERFORMANCE_ENTRY_TYPE_##name;
58
+ NODE_PERFORMANCE_ENTRY_TYPES(V)
59
+ #undef V
60
+ return NODE_PERFORMANCE_ENTRY_TYPE_INVALID;
61
+ }
62
+
63
+ enum PerformanceGCKind {
64
+ NODE_PERFORMANCE_GC_MAJOR = v8::GCType::kGCTypeMarkSweepCompact,
65
+ NODE_PERFORMANCE_GC_MINOR = v8::GCType::kGCTypeScavenge,
66
+ NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP = v8::GCType::kGCTypeMinorMarkSweep,
67
+ NODE_PERFORMANCE_GC_INCREMENTAL = v8::GCType::kGCTypeIncrementalMarking,
68
+ NODE_PERFORMANCE_GC_WEAKCB = v8::GCType::kGCTypeProcessWeakCallbacks
69
+ };
70
+
71
+ enum PerformanceGCFlags {
72
+ NODE_PERFORMANCE_GC_FLAGS_NO =
73
+ v8::GCCallbackFlags::kNoGCCallbackFlags,
74
+ NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED =
75
+ v8::GCCallbackFlags::kGCCallbackFlagConstructRetainedObjectInfos,
76
+ NODE_PERFORMANCE_GC_FLAGS_FORCED =
77
+ v8::GCCallbackFlags::kGCCallbackFlagForced,
78
+ NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING =
79
+ v8::GCCallbackFlags::kGCCallbackFlagSynchronousPhantomCallbackProcessing,
80
+ NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE =
81
+ v8::GCCallbackFlags::kGCCallbackFlagCollectAllAvailableGarbage,
82
+ NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY =
83
+ v8::GCCallbackFlags::kGCCallbackFlagCollectAllExternalMemory,
84
+ NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE =
85
+ v8::GCCallbackFlags::kGCCallbackScheduleIdleGarbageCollection
86
+ };
87
+
88
+ template <typename Traits>
89
+ struct PerformanceEntry {
90
+ using Details = typename Traits::Details;
91
+ std::string name;
92
+ double start_time;
93
+ double duration;
94
+ Details details;
95
+
96
+ PerformanceEntry(
97
+ const std::string& name_,
98
+ double start_time_,
99
+ double duration_,
100
+ const Details& details_)
101
+ : name(name_),
102
+ start_time(start_time_),
103
+ duration(duration_),
104
+ details(details_) {}
105
+
106
+ static v8::MaybeLocal<v8::Object> GetDetails(
107
+ Environment* env,
108
+ const PerformanceEntry<Traits>& entry) {
109
+ return Traits::GetDetails(env, entry);
110
+ }
111
+
112
+ void Notify(Environment* env) {
113
+ v8::HandleScope handle_scope(env->isolate());
114
+ v8::Context::Scope scope(env->context());
115
+ AliasedUint32Array& observers = env->performance_state()->observers;
116
+ if (env->performance_entry_callback().IsEmpty() ||
117
+ !observers[Traits::kType]) {
118
+ return;
119
+ }
120
+
121
+ v8::Local<v8::Object> detail;
122
+ if (!Traits::GetDetails(env, *this).ToLocal(&detail)) {
123
+ // TODO(@jasnell): Handle the error here
124
+ return;
125
+ }
126
+
127
+ v8::Local<v8::Value> argv[] = {
128
+ OneByteString(env->isolate(), name),
129
+ OneByteString(env->isolate(),
130
+ GetPerformanceEntryTypeName(Traits::kType)),
131
+ v8::Number::New(env->isolate(), start_time),
132
+ v8::Number::New(env->isolate(), duration),
133
+ detail};
134
+
135
+ node::MakeSyncCallback(
136
+ env->isolate(),
137
+ env->context()->Global(),
138
+ env->performance_entry_callback(),
139
+ arraysize(argv),
140
+ argv);
141
+ }
142
+ };
143
+
144
+ struct GCPerformanceEntryTraits {
145
+ static constexpr PerformanceEntryType kType =
146
+ NODE_PERFORMANCE_ENTRY_TYPE_GC;
147
+ struct Details {
148
+ PerformanceGCKind kind;
149
+ PerformanceGCFlags flags;
150
+
151
+ Details(PerformanceGCKind kind_, PerformanceGCFlags flags_)
152
+ : kind(kind_), flags(flags_) {}
153
+ };
154
+
155
+ static v8::MaybeLocal<v8::Object> GetDetails(
156
+ Environment* env,
157
+ const PerformanceEntry<GCPerformanceEntryTraits>& entry);
158
+ };
159
+
160
+ using GCPerformanceEntry = PerformanceEntry<GCPerformanceEntryTraits>;
161
+
162
+ } // namespace performance
163
+ } // namespace node
164
+
165
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
166
+
167
+ #endif // SRC_NODE_PERF_H_
@@ -0,0 +1,103 @@
1
+ #ifndef SRC_NODE_PERF_COMMON_H_
2
+ #define SRC_NODE_PERF_COMMON_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "aliased_buffer.h"
7
+ #include "node.h"
8
+ #include "uv.h"
9
+ #include "v8.h"
10
+
11
+ #include <algorithm>
12
+ #include <iostream>
13
+ #include <map>
14
+ #include <string>
15
+
16
+ namespace node {
17
+ namespace performance {
18
+
19
+ #define PERFORMANCE_NOW() uv_hrtime()
20
+
21
+ // These occur before the environment is created. Cache them
22
+ // here and add them to the milestones when the env is init'd.
23
+ extern const uint64_t performance_process_start;
24
+ extern const double performance_process_start_timestamp;
25
+ extern uint64_t performance_v8_start;
26
+
27
+ #define NODE_PERFORMANCE_MILESTONES(V) \
28
+ V(TIME_ORIGIN_TIMESTAMP, "timeOriginTimestamp") \
29
+ V(TIME_ORIGIN, "timeOrigin") \
30
+ V(ENVIRONMENT, "environment") \
31
+ V(NODE_START, "nodeStart") \
32
+ V(V8_START, "v8Start") \
33
+ V(LOOP_START, "loopStart") \
34
+ V(LOOP_EXIT, "loopExit") \
35
+ V(BOOTSTRAP_COMPLETE, "bootstrapComplete")
36
+
37
+ #define NODE_PERFORMANCE_ENTRY_TYPES(V) \
38
+ V(GC, "gc") \
39
+ V(HTTP, "http") \
40
+ V(HTTP2, "http2") \
41
+ V(NET, "net") \
42
+ V(DNS, "dns") \
43
+ V(QUIC, "quic")
44
+
45
+ enum PerformanceMilestone {
46
+ #define V(name, _) NODE_PERFORMANCE_MILESTONE_##name,
47
+ NODE_PERFORMANCE_MILESTONES(V)
48
+ #undef V
49
+ NODE_PERFORMANCE_MILESTONE_INVALID
50
+ };
51
+
52
+ enum PerformanceEntryType {
53
+ #define V(name, _) NODE_PERFORMANCE_ENTRY_TYPE_##name,
54
+ NODE_PERFORMANCE_ENTRY_TYPES(V)
55
+ #undef V
56
+ NODE_PERFORMANCE_ENTRY_TYPE_INVALID
57
+ };
58
+
59
+ class PerformanceState {
60
+ public:
61
+ struct SerializeInfo {
62
+ AliasedBufferIndex root;
63
+ AliasedBufferIndex milestones;
64
+ AliasedBufferIndex observers;
65
+ };
66
+
67
+ explicit PerformanceState(v8::Isolate* isolate,
68
+ uint64_t time_origin,
69
+ double time_origin_timestamp,
70
+ const SerializeInfo* info);
71
+ SerializeInfo Serialize(v8::Local<v8::Context> context,
72
+ v8::SnapshotCreator* creator);
73
+ void Deserialize(v8::Local<v8::Context> context,
74
+ uint64_t time_origin,
75
+ double time_origin_timestamp);
76
+ friend std::ostream& operator<<(std::ostream& o, const SerializeInfo& i);
77
+
78
+ AliasedUint8Array root;
79
+ AliasedFloat64Array milestones;
80
+ AliasedUint32Array observers;
81
+
82
+ uint64_t performance_last_gc_start_mark = 0;
83
+ uint16_t current_gc_type = 0;
84
+
85
+ void Mark(enum PerformanceMilestone milestone,
86
+ uint64_t ts = PERFORMANCE_NOW());
87
+
88
+ private:
89
+ void Initialize(uint64_t time_origin, double time_origin_timestamp);
90
+ void ResetMilestones();
91
+ struct performance_state_internal {
92
+ // doubles first so that they are always sizeof(double)-aligned
93
+ double milestones[NODE_PERFORMANCE_MILESTONE_INVALID];
94
+ uint32_t observers[NODE_PERFORMANCE_ENTRY_TYPE_INVALID];
95
+ };
96
+ };
97
+
98
+ } // namespace performance
99
+ } // namespace node
100
+
101
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
102
+
103
+ #endif // SRC_NODE_PERF_COMMON_H_
@@ -0,0 +1,290 @@
1
+ #ifndef SRC_NODE_PLATFORM_H_
2
+ #define SRC_NODE_PLATFORM_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include <concepts>
7
+ #include <functional>
8
+ #include <queue>
9
+ #include <type_traits>
10
+ #include <unordered_map>
11
+ #include <vector>
12
+
13
+ #include "libplatform/libplatform.h"
14
+ #include "node.h"
15
+ #include "node_mutex.h"
16
+ #include "uv.h"
17
+
18
+ namespace node {
19
+
20
+ class NodePlatform;
21
+ class IsolateData;
22
+ class PerIsolatePlatformData;
23
+
24
+ template <typename T>
25
+ concept has_priority = requires(T t) { t.priority; };
26
+
27
+ template <class T>
28
+ class TaskQueue {
29
+ public:
30
+ class Locked {
31
+ public:
32
+ void Push(std::unique_ptr<T> task, bool outstanding = false);
33
+ std::unique_ptr<T> Pop();
34
+ std::unique_ptr<T> BlockingPop();
35
+ void NotifyOfOutstandingCompletion();
36
+ void BlockingDrain();
37
+ void Stop();
38
+ // All queued tasks, in the order Pop() would have returned them.
39
+ std::vector<std::unique_ptr<T>> PopAll();
40
+
41
+ private:
42
+ friend class TaskQueue;
43
+ explicit Locked(TaskQueue* queue);
44
+
45
+ TaskQueue* queue_;
46
+ Mutex::ScopedLock lock_;
47
+ };
48
+
49
+ TaskQueue();
50
+ ~TaskQueue() = default;
51
+
52
+ Locked Lock() { return Locked(this); }
53
+
54
+ private:
55
+ struct Item {
56
+ std::unique_ptr<T> task;
57
+ uint64_t sequence;
58
+ };
59
+ // Higher priority first if the entry type has one; posting order otherwise
60
+ // and among equal priorities (a sequence number breaks the tie).
61
+ struct ItemCompare {
62
+ bool operator()(const Item& a, const Item& b) const {
63
+ if constexpr (has_priority<T>) {
64
+ if (a.task->priority != b.task->priority) {
65
+ return a.task->priority < b.task->priority;
66
+ }
67
+ }
68
+ return a.sequence > b.sequence;
69
+ }
70
+ };
71
+ using PriorityQueue =
72
+ std::priority_queue<Item, std::vector<Item>, ItemCompare>;
73
+
74
+ std::unique_ptr<T> PopTask();
75
+
76
+ Mutex lock_;
77
+ ConditionVariable tasks_available_;
78
+ ConditionVariable outstanding_tasks_drained_;
79
+ int outstanding_tasks_;
80
+ bool stopped_;
81
+ uint64_t next_sequence_ = 0;
82
+ PriorityQueue task_queue_;
83
+ };
84
+
85
+ struct TaskQueueEntry {
86
+ std::unique_ptr<v8::Task> task;
87
+ v8::TaskPriority priority;
88
+ TaskQueueEntry(std::unique_ptr<v8::Task> t, v8::TaskPriority p)
89
+ : task(std::move(t)), priority(p) {}
90
+ inline bool is_outstanding() const {
91
+ return priority == v8::TaskPriority::kUserBlocking;
92
+ }
93
+ };
94
+
95
+ struct DelayedTask {
96
+ std::unique_ptr<v8::Task> task;
97
+ v8::TaskPriority priority;
98
+ uv_timer_t timer;
99
+ double timeout;
100
+ std::shared_ptr<PerIsolatePlatformData> platform_data;
101
+ };
102
+
103
+ enum class PlatformDebugLogLevel {
104
+ kNone = 0,
105
+ kMinimal = 1,
106
+ kVerbose = 2,
107
+ };
108
+
109
+ // This acts as the foreground task runner for a given Isolate.
110
+ class PerIsolatePlatformData
111
+ : public IsolatePlatformDelegate,
112
+ public v8::TaskRunner,
113
+ public std::enable_shared_from_this<PerIsolatePlatformData> {
114
+ public:
115
+ PerIsolatePlatformData(
116
+ v8::Isolate* isolate,
117
+ uv_loop_t* loop,
118
+ PlatformDebugLogLevel debug_log_level = PlatformDebugLogLevel::kNone);
119
+ ~PerIsolatePlatformData() override;
120
+
121
+ std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner() override;
122
+ bool IdleTasksEnabled() override { return false; }
123
+
124
+ // Non-nestable tasks are treated like regular tasks.
125
+ bool NonNestableTasksEnabled() const override { return true; }
126
+ bool NonNestableDelayedTasksEnabled() const override { return true; }
127
+
128
+ void AddShutdownCallback(void (*callback)(void*), void* data);
129
+ void Shutdown();
130
+
131
+ // Returns true if work was dispatched or executed. New tasks that are
132
+ // posted during flushing of the queue are postponed until the next
133
+ // flushing.
134
+ bool FlushForegroundTasksInternal();
135
+
136
+ const uv_loop_t* event_loop() const { return loop_; }
137
+
138
+ private:
139
+ // v8::TaskRunner implementation.
140
+ void PostTaskImpl(std::unique_ptr<v8::Task> task,
141
+ const v8::SourceLocation& location) override;
142
+ void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task,
143
+ double delay_in_seconds,
144
+ const v8::SourceLocation& location) override;
145
+ void PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task,
146
+ const v8::SourceLocation& location) override;
147
+ void PostNonNestableTaskImpl(std::unique_ptr<v8::Task> task,
148
+ const v8::SourceLocation& location) override;
149
+ void PostNonNestableDelayedTaskImpl(
150
+ std::unique_ptr<v8::Task> task,
151
+ double delay_in_seconds,
152
+ const v8::SourceLocation& location) override;
153
+
154
+ void DeleteFromScheduledTasks(DelayedTask* task);
155
+ void DecreaseHandleCount();
156
+
157
+ static void FlushTasks(uv_async_t* handle);
158
+ void RunForegroundTask(std::unique_ptr<v8::Task> task);
159
+ static void RunForegroundTask(uv_timer_t* timer);
160
+
161
+ uv_async_t* flush_tasks_ = nullptr;
162
+
163
+ struct ShutdownCallback {
164
+ void (*cb)(void*);
165
+ void* data;
166
+ };
167
+ typedef std::vector<ShutdownCallback> ShutdownCbList;
168
+ ShutdownCbList shutdown_callbacks_;
169
+ // shared_ptr to self to keep this object alive during shutdown.
170
+ std::shared_ptr<PerIsolatePlatformData> self_reference_;
171
+ uint32_t uv_handle_count_ = 1; // 1 = flush_tasks_
172
+
173
+ v8::Isolate* const isolate_;
174
+ uv_loop_t* const loop_;
175
+
176
+ // When acquiring locks for both task queues, lock foreground_tasks_
177
+ // first then foreground_delayed_tasks_ to avoid deadlocks.
178
+ TaskQueue<TaskQueueEntry> foreground_tasks_;
179
+ TaskQueue<DelayedTask> foreground_delayed_tasks_;
180
+
181
+ // Use a custom deleter because libuv needs to close the handle first.
182
+ typedef std::unique_ptr<DelayedTask, void (*)(DelayedTask*)>
183
+ DelayedTaskPointer;
184
+ std::vector<DelayedTaskPointer> scheduled_delayed_tasks_;
185
+ PlatformDebugLogLevel debug_log_level_ = PlatformDebugLogLevel::kNone;
186
+ };
187
+
188
+ // This acts as the single worker thread task runner for all Isolates.
189
+ class WorkerThreadsTaskRunner {
190
+ public:
191
+ explicit WorkerThreadsTaskRunner(int thread_pool_size,
192
+ PlatformDebugLogLevel debug_log_level);
193
+
194
+ void PostTask(v8::TaskPriority priority,
195
+ std::unique_ptr<v8::Task> task,
196
+ const v8::SourceLocation& location);
197
+ void PostDelayedTask(v8::TaskPriority priority,
198
+ std::unique_ptr<v8::Task> task,
199
+ const v8::SourceLocation& location,
200
+ double delay_in_seconds);
201
+
202
+ void BlockingDrain();
203
+ void Shutdown();
204
+
205
+ int NumberOfWorkerThreads() const;
206
+
207
+ private:
208
+ // A queue shared by all threads. The consumers are the worker threads which
209
+ // take tasks from it to run in PlatformWorkerThread(). The producers can be
210
+ // any thread. Both the foreground thread and the worker threads can push
211
+ // tasks into the queue via v8::Platform::PostTaskOnWorkerThread() which
212
+ // eventually calls PostTask() on this class. When any thread calls
213
+ // v8::Platform::PostDelayedTaskOnWorkerThread(), the DelayedTaskScheduler
214
+ // thread will schedule a timer that pushes the delayed tasks back into this
215
+ // queue when the timer expires.
216
+ TaskQueue<TaskQueueEntry> pending_worker_tasks_;
217
+
218
+ class DelayedTaskScheduler;
219
+ std::unique_ptr<DelayedTaskScheduler> delayed_task_scheduler_;
220
+
221
+ std::vector<std::unique_ptr<uv_thread_t>> threads_;
222
+ PlatformDebugLogLevel debug_log_level_ = PlatformDebugLogLevel::kNone;
223
+ };
224
+
225
+ class NodePlatform : public MultiIsolatePlatform {
226
+ public:
227
+ NodePlatform(int thread_pool_size,
228
+ v8::TracingController* tracing_controller,
229
+ v8::PageAllocator* page_allocator = nullptr);
230
+ ~NodePlatform() override;
231
+
232
+ void DrainTasks(v8::Isolate* isolate) override;
233
+ void Shutdown();
234
+
235
+ // v8::Platform implementation.
236
+ int NumberOfWorkerThreads() override;
237
+ void PostTaskOnWorkerThreadImpl(v8::TaskPriority priority,
238
+ std::unique_ptr<v8::Task> task,
239
+ const v8::SourceLocation& location) override;
240
+ void PostDelayedTaskOnWorkerThreadImpl(
241
+ v8::TaskPriority priority,
242
+ std::unique_ptr<v8::Task> task,
243
+ double delay_in_seconds,
244
+ const v8::SourceLocation& location) override;
245
+ bool IdleTasksEnabled(v8::Isolate* isolate) override;
246
+ double MonotonicallyIncreasingTime() override;
247
+ double CurrentClockTimeMillis() override;
248
+ v8::TracingController* GetTracingController() override;
249
+ bool FlushForegroundTasks(v8::Isolate* isolate) override;
250
+ std::unique_ptr<v8::JobHandle> CreateJobImpl(
251
+ v8::TaskPriority priority,
252
+ std::unique_ptr<v8::JobTask> job_task,
253
+ const v8::SourceLocation& location) override;
254
+
255
+ void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override;
256
+ void RegisterIsolate(v8::Isolate* isolate,
257
+ IsolatePlatformDelegate* delegate) override;
258
+
259
+ void UnregisterIsolate(v8::Isolate* isolate) override;
260
+ void AddIsolateFinishedCallback(v8::Isolate* isolate,
261
+ void (*callback)(void*),
262
+ void* data) override;
263
+
264
+ std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
265
+ v8::Isolate* isolate, v8::TaskPriority priority) override;
266
+
267
+ Platform::StackTracePrinter GetStackTracePrinter() override;
268
+ v8::PageAllocator* GetPageAllocator() override;
269
+
270
+ private:
271
+ IsolatePlatformDelegate* ForIsolate(v8::Isolate* isolate);
272
+ std::shared_ptr<PerIsolatePlatformData> ForNodeIsolate(v8::Isolate* isolate);
273
+
274
+ Mutex per_isolate_mutex_;
275
+ using DelegatePair = std::pair<IsolatePlatformDelegate*,
276
+ std::shared_ptr<PerIsolatePlatformData>>;
277
+ std::unordered_map<v8::Isolate*, DelegatePair> per_isolate_;
278
+
279
+ v8::TracingController* tracing_controller_;
280
+ v8::PageAllocator* page_allocator_;
281
+ std::shared_ptr<WorkerThreadsTaskRunner> worker_thread_task_runner_;
282
+ bool has_shut_down_ = false;
283
+ PlatformDebugLogLevel debug_log_level_ = PlatformDebugLogLevel::kNone;
284
+ };
285
+
286
+ } // namespace node
287
+
288
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
289
+
290
+ #endif // SRC_NODE_PLATFORM_H_
@@ -0,0 +1,26 @@
1
+ #ifndef SRC_NODE_PROCESS_INL_H_
2
+ #define SRC_NODE_PROCESS_INL_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "node_process.h"
7
+ #include "v8.h"
8
+ #include "debug_utils-inl.h"
9
+
10
+ namespace node {
11
+
12
+ // Call process.emitWarning(str), fmt is a snprintf() format string
13
+ template <typename... Args>
14
+ inline v8::Maybe<bool> ProcessEmitWarning(Environment* env,
15
+ const char* fmt,
16
+ Args&&... args) {
17
+ std::string warning = SPrintF(fmt, std::forward<Args>(args)...);
18
+
19
+ return ProcessEmitWarningGeneric(env, warning.c_str());
20
+ }
21
+
22
+ } // namespace node
23
+
24
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
25
+
26
+ #endif // SRC_NODE_PROCESS_INL_H_
@@ -0,0 +1,112 @@
1
+ #ifndef SRC_NODE_PROCESS_H_
2
+ #define SRC_NODE_PROCESS_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "node_debug.h"
7
+ #include "node_snapshotable.h"
8
+ #include "v8-fast-api-calls.h"
9
+ #include "v8.h"
10
+
11
+ namespace node {
12
+
13
+ class Environment;
14
+ class IsolateData;
15
+ class MemoryTracker;
16
+ class ExternalReferenceRegistry;
17
+ class Realm;
18
+
19
+ void CreateEnvProxyTemplate(IsolateData* isolate_data);
20
+
21
+ // Most of the time, it's best to use `console.error` to write
22
+ // to the process.stderr stream. However, in some cases, such as
23
+ // when debugging the stream.Writable class or the process.nextTick
24
+ // function, it is useful to bypass JavaScript entirely.
25
+ void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
26
+
27
+ v8::MaybeLocal<v8::Value> ProcessEmit(Environment* env,
28
+ std::string_view event,
29
+ v8::Local<v8::Value> message);
30
+
31
+ v8::Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
32
+ std::string_view warning,
33
+ std::string_view type = "",
34
+ std::string_view code = "");
35
+
36
+ template <typename... Args>
37
+ inline v8::Maybe<bool> ProcessEmitWarning(Environment* env,
38
+ const char* fmt,
39
+ Args&&... args);
40
+
41
+ v8::Maybe<void> ProcessEmitWarningSync(Environment* env,
42
+ std::string_view message);
43
+ v8::Maybe<bool> ProcessEmitExperimentalWarning(Environment* env,
44
+ const std::string& warning);
45
+ v8::Maybe<bool> ProcessEmitDeprecationWarning(
46
+ Environment* env,
47
+ const std::string& warning,
48
+ std::string_view deprecation_code);
49
+
50
+ v8::MaybeLocal<v8::Object> CreateProcessObject(Realm* env);
51
+ void PatchProcessObject(const v8::FunctionCallbackInfo<v8::Value>& args);
52
+
53
+ namespace process {
54
+ class BindingData : public SnapshotableObject {
55
+ public:
56
+ struct InternalFieldInfo : public node::InternalFieldInfoBase {
57
+ AliasedBufferIndex hrtime_buffer;
58
+ };
59
+
60
+ static void AddMethods(v8::Isolate* isolate,
61
+ v8::Local<v8::ObjectTemplate> target);
62
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
63
+
64
+ SERIALIZABLE_OBJECT_METHODS()
65
+ SET_BINDING_ID(process_binding_data)
66
+
67
+ BindingData(Realm* realm,
68
+ v8::Local<v8::Object> object,
69
+ InternalFieldInfo* info = nullptr);
70
+
71
+ void MemoryInfo(MemoryTracker* tracker) const override;
72
+ SET_MEMORY_INFO_NAME(BindingData)
73
+ SET_SELF_SIZE(BindingData)
74
+
75
+ static BindingData* FromV8Value(v8::Local<v8::Value> receiver);
76
+ static void HrtimeImpl(BindingData* receiver);
77
+
78
+ static void FastHrtime(v8::Local<v8::Value> receiver) {
79
+ TRACK_V8_FAST_API_CALL("process.hrtime");
80
+ HrtimeImpl(FromV8Value(receiver));
81
+ }
82
+
83
+ static void SlowHrtime(const v8::FunctionCallbackInfo<v8::Value>& args);
84
+
85
+ static void HrtimeBigIntImpl(BindingData* receiver);
86
+
87
+ static void FastHrtimeBigInt(v8::Local<v8::Value> receiver) {
88
+ TRACK_V8_FAST_API_CALL("process.hrtimeBigInt");
89
+ HrtimeBigIntImpl(FromV8Value(receiver));
90
+ }
91
+
92
+ static void SlowHrtimeBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
93
+
94
+ static void LoadEnvFile(const v8::FunctionCallbackInfo<v8::Value>& args);
95
+
96
+ private:
97
+ // Buffer length in uint32.
98
+ static constexpr size_t kHrTimeBufferLength = 3;
99
+ AliasedUint32Array hrtime_buffer_;
100
+ InternalFieldInfo* internal_field_info_ = nullptr;
101
+
102
+ // These need to be static so that we have their addresses available to
103
+ // register as external references in the snapshot at environment creation
104
+ // time.
105
+ static v8::CFunction fast_hrtime_;
106
+ static v8::CFunction fast_hrtime_bigint_;
107
+ };
108
+
109
+ } // namespace process
110
+ } // namespace node
111
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
112
+ #endif // SRC_NODE_PROCESS_H_