@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.
Files changed (343) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/dist/node/include/acorn_version.h +6 -0
  4. package/dist/node/include/aliased_buffer-inl.h +244 -0
  5. package/dist/node/include/aliased_buffer.h +206 -0
  6. package/dist/node/include/aliased_struct-inl.h +54 -0
  7. package/dist/node/include/aliased_struct.h +63 -0
  8. package/dist/node/include/amaro_version.h +6 -0
  9. package/dist/node/include/async_context_frame.h +33 -0
  10. package/dist/node/include/async_wrap-inl.h +96 -0
  11. package/dist/node/include/async_wrap.h +243 -0
  12. package/dist/node/include/base_object-inl.h +335 -0
  13. package/dist/node/include/base_object.h +342 -0
  14. package/dist/node/include/base_object_types.h +74 -0
  15. package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
  16. package/dist/node/include/blob_serializer_deserializer.h +132 -0
  17. package/dist/node/include/callback_queue-inl.h +97 -0
  18. package/dist/node/include/callback_queue.h +79 -0
  19. package/dist/node/include/cares_wrap.h +447 -0
  20. package/dist/node/include/cjs_module_lexer_version.h +6 -0
  21. package/dist/node/include/cleanup_queue-inl.h +36 -0
  22. package/dist/node/include/cleanup_queue.h +79 -0
  23. package/dist/node/include/compile_cache.h +104 -0
  24. package/dist/node/include/connect_wrap.h +26 -0
  25. package/dist/node/include/connection_wrap.h +30 -0
  26. package/dist/node/include/cppgc/allocation.h +310 -0
  27. package/dist/node/include/cppgc/common.h +28 -0
  28. package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
  29. package/dist/node/include/cppgc/custom-space.h +97 -0
  30. package/dist/node/include/cppgc/default-platform.h +67 -0
  31. package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
  32. package/dist/node/include/cppgc/explicit-management.h +100 -0
  33. package/dist/node/include/cppgc/garbage-collected.h +106 -0
  34. package/dist/node/include/cppgc/heap-consistency.h +309 -0
  35. package/dist/node/include/cppgc/heap-handle.h +48 -0
  36. package/dist/node/include/cppgc/heap-state.h +82 -0
  37. package/dist/node/include/cppgc/heap-statistics.h +120 -0
  38. package/dist/node/include/cppgc/heap.h +202 -0
  39. package/dist/node/include/cppgc/internal/api-constants.h +87 -0
  40. package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
  41. package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
  42. package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
  43. package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
  44. package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
  45. package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
  46. package/dist/node/include/cppgc/internal/gc-info.h +148 -0
  47. package/dist/node/include/cppgc/internal/logging.h +50 -0
  48. package/dist/node/include/cppgc/internal/member-storage.h +256 -0
  49. package/dist/node/include/cppgc/internal/name-trait.h +137 -0
  50. package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
  51. package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
  52. package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
  53. package/dist/node/include/cppgc/liveness-broker.h +78 -0
  54. package/dist/node/include/cppgc/macros.h +35 -0
  55. package/dist/node/include/cppgc/member.h +629 -0
  56. package/dist/node/include/cppgc/name-provider.h +65 -0
  57. package/dist/node/include/cppgc/object-size-trait.h +58 -0
  58. package/dist/node/include/cppgc/persistent.h +377 -0
  59. package/dist/node/include/cppgc/platform.h +163 -0
  60. package/dist/node/include/cppgc/prefinalizer.h +75 -0
  61. package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
  62. package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
  63. package/dist/node/include/cppgc/source-location.h +16 -0
  64. package/dist/node/include/cppgc/testing.h +106 -0
  65. package/dist/node/include/cppgc/trace-trait.h +128 -0
  66. package/dist/node/include/cppgc/type-traits.h +271 -0
  67. package/dist/node/include/cppgc/visitor.h +504 -0
  68. package/dist/node/include/crypto/crypto_aes.h +88 -0
  69. package/dist/node/include/crypto/crypto_bio.h +193 -0
  70. package/dist/node/include/crypto/crypto_cipher.h +293 -0
  71. package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
  72. package/dist/node/include/crypto/crypto_clienthello.h +131 -0
  73. package/dist/node/include/crypto/crypto_common.h +64 -0
  74. package/dist/node/include/crypto/crypto_context.h +171 -0
  75. package/dist/node/include/crypto/crypto_dh.h +126 -0
  76. package/dist/node/include/crypto/crypto_dsa.h +52 -0
  77. package/dist/node/include/crypto/crypto_ec.h +164 -0
  78. package/dist/node/include/crypto/crypto_hash.h +91 -0
  79. package/dist/node/include/crypto/crypto_hkdf.h +61 -0
  80. package/dist/node/include/crypto/crypto_hmac.h +92 -0
  81. package/dist/node/include/crypto/crypto_keygen.h +299 -0
  82. package/dist/node/include/crypto/crypto_keys.h +392 -0
  83. package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
  84. package/dist/node/include/crypto/crypto_random.h +124 -0
  85. package/dist/node/include/crypto/crypto_rsa.h +136 -0
  86. package/dist/node/include/crypto/crypto_scrypt.h +85 -0
  87. package/dist/node/include/crypto/crypto_sig.h +165 -0
  88. package/dist/node/include/crypto/crypto_spkac.h +21 -0
  89. package/dist/node/include/crypto/crypto_timing.h +20 -0
  90. package/dist/node/include/crypto/crypto_tls.h +305 -0
  91. package/dist/node/include/crypto/crypto_util.h +725 -0
  92. package/dist/node/include/crypto/crypto_x509.h +140 -0
  93. package/dist/node/include/dataqueue/queue.h +306 -0
  94. package/dist/node/include/debug_utils-inl.h +278 -0
  95. package/dist/node/include/debug_utils.h +196 -0
  96. package/dist/node/include/diagnosticfilename-inl.h +33 -0
  97. package/dist/node/include/embedded_data.h +17 -0
  98. package/dist/node/include/encoding_binding.h +61 -0
  99. package/dist/node/include/env-inl.h +984 -0
  100. package/dist/node/include/env.h +1287 -0
  101. package/dist/node/include/env_properties.h +540 -0
  102. package/dist/node/include/handle_wrap.h +123 -0
  103. package/dist/node/include/histogram-inl.h +107 -0
  104. package/dist/node/include/histogram.h +279 -0
  105. package/dist/node/include/inspector/io_agent.h +30 -0
  106. package/dist/node/include/inspector/main_thread_interface.h +116 -0
  107. package/dist/node/include/inspector/network_agent.h +94 -0
  108. package/dist/node/include/inspector/network_inspector.h +45 -0
  109. package/dist/node/include/inspector/network_requests_buffer.h +195 -0
  110. package/dist/node/include/inspector/network_resource_manager.h +29 -0
  111. package/dist/node/include/inspector/node_json.h +24 -0
  112. package/dist/node/include/inspector/node_string.h +101 -0
  113. package/dist/node/include/inspector/protocol_helper.h +27 -0
  114. package/dist/node/include/inspector/runtime_agent.h +41 -0
  115. package/dist/node/include/inspector/target_agent.h +75 -0
  116. package/dist/node/include/inspector/tracing_agent.h +43 -0
  117. package/dist/node/include/inspector/worker_agent.h +40 -0
  118. package/dist/node/include/inspector/worker_inspector.h +124 -0
  119. package/dist/node/include/inspector_agent.h +165 -0
  120. package/dist/node/include/inspector_io.h +78 -0
  121. package/dist/node/include/inspector_profiler.h +149 -0
  122. package/dist/node/include/inspector_socket.h +60 -0
  123. package/dist/node/include/inspector_socket_server.h +110 -0
  124. package/dist/node/include/js_native_api.h +607 -0
  125. package/dist/node/include/js_native_api_types.h +226 -0
  126. package/dist/node/include/js_native_api_v8.h +485 -0
  127. package/dist/node/include/js_native_api_v8_internals.h +45 -0
  128. package/dist/node/include/js_stream.h +52 -0
  129. package/dist/node/include/json_utils.h +172 -0
  130. package/dist/node/include/large_pages/node_large_page.h +34 -0
  131. package/dist/node/include/libplatform/libplatform-export.h +29 -0
  132. package/dist/node/include/libplatform/libplatform.h +112 -0
  133. package/dist/node/include/libplatform/v8-tracing.h +333 -0
  134. package/dist/node/include/memory_tracker-inl.h +359 -0
  135. package/dist/node/include/memory_tracker.h +289 -0
  136. package/dist/node/include/module_wrap.h +216 -0
  137. package/dist/node/include/node.h +1593 -0
  138. package/dist/node/include/node_api.h +265 -0
  139. package/dist/node/include/node_api_internals.h +48 -0
  140. package/dist/node/include/node_api_types.h +56 -0
  141. package/dist/node/include/node_binding.h +161 -0
  142. package/dist/node/include/node_blob.h +159 -0
  143. package/dist/node/include/node_bob-inl.h +36 -0
  144. package/dist/node/include/node_bob.h +107 -0
  145. package/dist/node/include/node_buffer.h +92 -0
  146. package/dist/node/include/node_builtins.h +220 -0
  147. package/dist/node/include/node_config_file.h +46 -0
  148. package/dist/node/include/node_constants.h +82 -0
  149. package/dist/node/include/node_context_data.h +168 -0
  150. package/dist/node/include/node_contextify.h +204 -0
  151. package/dist/node/include/node_crypto.h +56 -0
  152. package/dist/node/include/node_debug.h +30 -0
  153. package/dist/node/include/node_dir.h +52 -0
  154. package/dist/node/include/node_dotenv.h +45 -0
  155. package/dist/node/include/node_errors.h +380 -0
  156. package/dist/node/include/node_exit_code.h +54 -0
  157. package/dist/node/include/node_external_reference.h +165 -0
  158. package/dist/node/include/node_file-inl.h +406 -0
  159. package/dist/node/include/node_file.h +537 -0
  160. package/dist/node/include/node_http2.h +1177 -0
  161. package/dist/node/include/node_http2_state.h +159 -0
  162. package/dist/node/include/node_http_common-inl.h +202 -0
  163. package/dist/node/include/node_http_common.h +535 -0
  164. package/dist/node/include/node_i18n.h +132 -0
  165. package/dist/node/include/node_internals.h +483 -0
  166. package/dist/node/include/node_main_instance.h +67 -0
  167. package/dist/node/include/node_mem-inl.h +113 -0
  168. package/dist/node/include/node_mem.h +45 -0
  169. package/dist/node/include/node_messaging.h +389 -0
  170. package/dist/node/include/node_metadata.h +164 -0
  171. package/dist/node/include/node_modules.h +91 -0
  172. package/dist/node/include/node_mutex.h +323 -0
  173. package/dist/node/include/node_object_wrap.h +132 -0
  174. package/dist/node/include/node_options-inl.h +490 -0
  175. package/dist/node/include/node_options.h +615 -0
  176. package/dist/node/include/node_perf.h +166 -0
  177. package/dist/node/include/node_perf_common.h +102 -0
  178. package/dist/node/include/node_platform.h +238 -0
  179. package/dist/node/include/node_process-inl.h +26 -0
  180. package/dist/node/include/node_process.h +112 -0
  181. package/dist/node/include/node_realm-inl.h +151 -0
  182. package/dist/node/include/node_realm.h +183 -0
  183. package/dist/node/include/node_report.h +43 -0
  184. package/dist/node/include/node_revert.h +82 -0
  185. package/dist/node/include/node_root_certs.h +3520 -0
  186. package/dist/node/include/node_sea.h +74 -0
  187. package/dist/node/include/node_shadow_realm.h +46 -0
  188. package/dist/node/include/node_snapshot_builder.h +57 -0
  189. package/dist/node/include/node_snapshotable.h +174 -0
  190. package/dist/node/include/node_sockaddr-inl.h +257 -0
  191. package/dist/node/include/node_sockaddr.h +394 -0
  192. package/dist/node/include/node_sqlite.h +270 -0
  193. package/dist/node/include/node_stat_watcher.h +73 -0
  194. package/dist/node/include/node_task_runner.h +92 -0
  195. package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
  196. package/dist/node/include/node_threadsafe_cow.h +105 -0
  197. package/dist/node/include/node_union_bytes.h +81 -0
  198. package/dist/node/include/node_url.h +96 -0
  199. package/dist/node/include/node_v8.h +77 -0
  200. package/dist/node/include/node_v8_platform-inl.h +185 -0
  201. package/dist/node/include/node_version.h +110 -0
  202. package/dist/node/include/node_wasi.h +184 -0
  203. package/dist/node/include/node_wasm_web_api.h +55 -0
  204. package/dist/node/include/node_watchdog.h +154 -0
  205. package/dist/node/include/node_webstorage.h +60 -0
  206. package/dist/node/include/node_worker.h +158 -0
  207. package/dist/node/include/path.h +33 -0
  208. package/dist/node/include/permission/addon_permission.h +31 -0
  209. package/dist/node/include/permission/child_process_permission.h +31 -0
  210. package/dist/node/include/permission/fs_permission.h +167 -0
  211. package/dist/node/include/permission/inspector_permission.h +31 -0
  212. package/dist/node/include/permission/permission.h +138 -0
  213. package/dist/node/include/permission/permission_base.h +65 -0
  214. package/dist/node/include/permission/wasi_permission.h +31 -0
  215. package/dist/node/include/permission/worker_permission.h +31 -0
  216. package/dist/node/include/pipe_wrap.h +80 -0
  217. package/dist/node/include/quic/application.h +159 -0
  218. package/dist/node/include/quic/bindingdata.h +272 -0
  219. package/dist/node/include/quic/cid.h +127 -0
  220. package/dist/node/include/quic/data.h +148 -0
  221. package/dist/node/include/quic/defs.h +245 -0
  222. package/dist/node/include/quic/endpoint.h +458 -0
  223. package/dist/node/include/quic/http3.h +15 -0
  224. package/dist/node/include/quic/logstream.h +81 -0
  225. package/dist/node/include/quic/packet.h +152 -0
  226. package/dist/node/include/quic/preferredaddress.h +72 -0
  227. package/dist/node/include/quic/session.h +443 -0
  228. package/dist/node/include/quic/sessionticket.h +108 -0
  229. package/dist/node/include/quic/streams.h +232 -0
  230. package/dist/node/include/quic/tlscontext.h +227 -0
  231. package/dist/node/include/quic/tokens.h +256 -0
  232. package/dist/node/include/quic/transportparams.h +165 -0
  233. package/dist/node/include/req_wrap-inl.h +171 -0
  234. package/dist/node/include/req_wrap.h +77 -0
  235. package/dist/node/include/spawn_sync.h +243 -0
  236. package/dist/node/include/stream_base-inl.h +173 -0
  237. package/dist/node/include/stream_base.h +478 -0
  238. package/dist/node/include/stream_pipe.h +76 -0
  239. package/dist/node/include/stream_wrap.h +132 -0
  240. package/dist/node/include/string_bytes.h +113 -0
  241. package/dist/node/include/string_decoder-inl.h +31 -0
  242. package/dist/node/include/string_decoder.h +49 -0
  243. package/dist/node/include/tcp_wrap.h +105 -0
  244. package/dist/node/include/threadpoolwork-inl.h +70 -0
  245. package/dist/node/include/timer_wrap-inl.h +32 -0
  246. package/dist/node/include/timer_wrap.h +85 -0
  247. package/dist/node/include/timers.h +70 -0
  248. package/dist/node/include/tracing/agent.h +195 -0
  249. package/dist/node/include/tracing/node_trace_buffer.h +83 -0
  250. package/dist/node/include/tracing/node_trace_writer.h +75 -0
  251. package/dist/node/include/tracing/trace_event.h +722 -0
  252. package/dist/node/include/tracing/trace_event_common.h +1109 -0
  253. package/dist/node/include/tracing/traced_value.h +129 -0
  254. package/dist/node/include/tty_wrap.h +65 -0
  255. package/dist/node/include/udp_wrap.h +230 -0
  256. package/dist/node/include/undici_version.h +6 -0
  257. package/dist/node/include/util-inl.h +700 -0
  258. package/dist/node/include/util.h +1021 -0
  259. package/dist/node/include/uv/aix.h +32 -0
  260. package/dist/node/include/uv/bsd.h +34 -0
  261. package/dist/node/include/uv/darwin.h +61 -0
  262. package/dist/node/include/uv/errno.h +483 -0
  263. package/dist/node/include/uv/linux.h +34 -0
  264. package/dist/node/include/uv/os390.h +33 -0
  265. package/dist/node/include/uv/posix.h +31 -0
  266. package/dist/node/include/uv/sunos.h +44 -0
  267. package/dist/node/include/uv/threadpool.h +37 -0
  268. package/dist/node/include/uv/tree.h +521 -0
  269. package/dist/node/include/uv/unix.h +512 -0
  270. package/dist/node/include/uv/version.h +43 -0
  271. package/dist/node/include/uv/win.h +698 -0
  272. package/dist/node/include/uv.h +1990 -0
  273. package/dist/node/include/v8-array-buffer.h +525 -0
  274. package/dist/node/include/v8-callbacks.h +462 -0
  275. package/dist/node/include/v8-container.h +183 -0
  276. package/dist/node/include/v8-context.h +485 -0
  277. package/dist/node/include/v8-cppgc.h +245 -0
  278. package/dist/node/include/v8-data.h +80 -0
  279. package/dist/node/include/v8-date.h +48 -0
  280. package/dist/node/include/v8-debug.h +168 -0
  281. package/dist/node/include/v8-embedder-heap.h +82 -0
  282. package/dist/node/include/v8-embedder-state-scope.h +52 -0
  283. package/dist/node/include/v8-exception.h +223 -0
  284. package/dist/node/include/v8-extension.h +62 -0
  285. package/dist/node/include/v8-external.h +37 -0
  286. package/dist/node/include/v8-fast-api-calls.h +984 -0
  287. package/dist/node/include/v8-forward.h +82 -0
  288. package/dist/node/include/v8-function-callback.h +607 -0
  289. package/dist/node/include/v8-function.h +140 -0
  290. package/dist/node/include/v8-handle-base.h +137 -0
  291. package/dist/node/include/v8-initialization.h +289 -0
  292. package/dist/node/include/v8-inspector-protocol.h +13 -0
  293. package/dist/node/include/v8-inspector.h +419 -0
  294. package/dist/node/include/v8-internal.h +1397 -0
  295. package/dist/node/include/v8-isolate.h +1767 -0
  296. package/dist/node/include/v8-json.h +47 -0
  297. package/dist/node/include/v8-local-handle.h +758 -0
  298. package/dist/node/include/v8-locker.h +138 -0
  299. package/dist/node/include/v8-maybe.h +160 -0
  300. package/dist/node/include/v8-memory-span.h +198 -0
  301. package/dist/node/include/v8-message.h +233 -0
  302. package/dist/node/include/v8-metrics.h +264 -0
  303. package/dist/node/include/v8-microtask-queue.h +157 -0
  304. package/dist/node/include/v8-microtask.h +28 -0
  305. package/dist/node/include/v8-object.h +824 -0
  306. package/dist/node/include/v8-persistent-handle.h +582 -0
  307. package/dist/node/include/v8-platform.h +1358 -0
  308. package/dist/node/include/v8-primitive-object.h +118 -0
  309. package/dist/node/include/v8-primitive.h +877 -0
  310. package/dist/node/include/v8-profiler.h +1302 -0
  311. package/dist/node/include/v8-promise.h +174 -0
  312. package/dist/node/include/v8-proxy.h +50 -0
  313. package/dist/node/include/v8-regexp.h +106 -0
  314. package/dist/node/include/v8-script.h +904 -0
  315. package/dist/node/include/v8-snapshot.h +266 -0
  316. package/dist/node/include/v8-source-location.h +92 -0
  317. package/dist/node/include/v8-statistics.h +238 -0
  318. package/dist/node/include/v8-template.h +1297 -0
  319. package/dist/node/include/v8-traced-handle.h +432 -0
  320. package/dist/node/include/v8-typed-array.h +390 -0
  321. package/dist/node/include/v8-unwinder-state.h +31 -0
  322. package/dist/node/include/v8-unwinder.h +132 -0
  323. package/dist/node/include/v8-util.h +665 -0
  324. package/dist/node/include/v8-value-serializer-version.h +24 -0
  325. package/dist/node/include/v8-value-serializer.h +316 -0
  326. package/dist/node/include/v8-value.h +655 -0
  327. package/dist/node/include/v8-version-string.h +38 -0
  328. package/dist/node/include/v8-version.h +20 -0
  329. package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
  330. package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
  331. package/dist/node/include/v8-wasm.h +201 -0
  332. package/dist/node/include/v8-weak-callback-info.h +80 -0
  333. package/dist/node/include/v8.h +88 -0
  334. package/dist/node/include/v8config.h +981 -0
  335. package/dist/node/include/zlib_version.h +6 -0
  336. package/dist/node/libnode.dll +0 -0
  337. package/dist/node/libnode.lib +0 -0
  338. package/dist/node/libnodebuildinfo.json +10 -0
  339. package/dist/node/link_node.lib +0 -0
  340. package/dist/node/link_node.node +0 -0
  341. package/index.js +5 -0
  342. package/libnode.release.json +8 -0
  343. package/package.json +29 -1
@@ -0,0 +1,104 @@
1
+ #ifndef SRC_COMPILE_CACHE_H_
2
+ #define SRC_COMPILE_CACHE_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include <cinttypes>
7
+ #include <memory>
8
+ #include <string>
9
+ #include <string_view>
10
+ #include <unordered_map>
11
+ #include "v8.h"
12
+
13
+ namespace node {
14
+ class Environment;
15
+
16
+ // TODO(joyeecheung): move it into a CacheHandler class.
17
+ enum class CachedCodeType : uint8_t {
18
+ kCommonJS = 0,
19
+ kESM,
20
+ };
21
+
22
+ struct CompileCacheEntry {
23
+ std::unique_ptr<v8::ScriptCompiler::CachedData> cache{nullptr};
24
+ uint32_t cache_key;
25
+ uint32_t code_hash;
26
+ uint32_t code_size;
27
+
28
+ std::string cache_filename;
29
+ std::string source_filename;
30
+ CachedCodeType type;
31
+ bool refreshed = false;
32
+ bool persisted = false;
33
+
34
+ // Copy the cache into a new store for V8 to consume. Caller takes
35
+ // ownership.
36
+ v8::ScriptCompiler::CachedData* CopyCache() const;
37
+ };
38
+
39
+ #define COMPILE_CACHE_STATUS(V) \
40
+ V(FAILED) /* Failed to enable the cache */ \
41
+ V(ENABLED) /* Was not enabled before, and now enabled. */ \
42
+ V(ALREADY_ENABLED) /* Was already enabled. */ \
43
+ V(DISABLED) /* Has been disabled by NODE_DISABLE_COMPILE_CACHE. */
44
+
45
+ enum class CompileCacheEnableStatus : uint8_t {
46
+ #define V(status) status,
47
+ COMPILE_CACHE_STATUS(V)
48
+ #undef V
49
+ };
50
+
51
+ struct CompileCacheEnableResult {
52
+ CompileCacheEnableStatus status;
53
+ std::string cache_directory;
54
+ std::string message; // Set in case of failure.
55
+ };
56
+
57
+ class CompileCacheHandler {
58
+ public:
59
+ explicit CompileCacheHandler(Environment* env);
60
+ CompileCacheEnableResult Enable(Environment* env, const std::string& dir);
61
+
62
+ void Persist();
63
+
64
+ CompileCacheEntry* GetOrInsert(v8::Local<v8::String> code,
65
+ v8::Local<v8::String> filename,
66
+ CachedCodeType type);
67
+ void MaybeSave(CompileCacheEntry* entry,
68
+ v8::Local<v8::Function> func,
69
+ bool rejected);
70
+ void MaybeSave(CompileCacheEntry* entry,
71
+ v8::Local<v8::Module> mod,
72
+ bool rejected);
73
+ std::string_view cache_dir() { return compile_cache_dir_; }
74
+
75
+ private:
76
+ void ReadCacheFile(CompileCacheEntry* entry);
77
+
78
+ template <typename T>
79
+ void MaybeSaveImpl(CompileCacheEntry* entry,
80
+ v8::Local<T> func_or_mod,
81
+ bool rejected);
82
+
83
+ template <typename... Args>
84
+ inline void Debug(const char* format, Args&&... args) const;
85
+
86
+ static constexpr size_t kMagicNumberOffset = 0;
87
+ static constexpr size_t kCodeSizeOffset = 1;
88
+ static constexpr size_t kCacheSizeOffset = 2;
89
+ static constexpr size_t kCodeHashOffset = 3;
90
+ static constexpr size_t kCacheHashOffset = 4;
91
+ static constexpr size_t kHeaderCount = 5;
92
+
93
+ v8::Isolate* isolate_ = nullptr;
94
+ bool is_debug_ = false;
95
+
96
+ std::string compile_cache_dir_;
97
+ std::unordered_map<uint32_t, std::unique_ptr<CompileCacheEntry>>
98
+ compiler_cache_store_;
99
+ };
100
+ } // namespace node
101
+
102
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
103
+
104
+ #endif // SRC_COMPILE_CACHE_H_
@@ -0,0 +1,26 @@
1
+ #ifndef SRC_CONNECT_WRAP_H_
2
+ #define SRC_CONNECT_WRAP_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "req_wrap-inl.h"
7
+ #include "async_wrap.h"
8
+
9
+ namespace node {
10
+
11
+ class ConnectWrap : public ReqWrap<uv_connect_t> {
12
+ public:
13
+ ConnectWrap(Environment* env,
14
+ v8::Local<v8::Object> req_wrap_obj,
15
+ AsyncWrap::ProviderType provider);
16
+
17
+ SET_NO_MEMORY_INFO()
18
+ SET_MEMORY_INFO_NAME(ConnectWrap)
19
+ SET_SELF_SIZE(ConnectWrap)
20
+ };
21
+
22
+ } // namespace node
23
+
24
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
25
+
26
+ #endif // SRC_CONNECT_WRAP_H_
@@ -0,0 +1,30 @@
1
+ #ifndef SRC_CONNECTION_WRAP_H_
2
+ #define SRC_CONNECTION_WRAP_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "stream_wrap.h"
7
+
8
+ namespace node {
9
+
10
+ class Environment;
11
+
12
+ template <typename WrapType, typename UVType>
13
+ class ConnectionWrap : public LibuvStreamWrap {
14
+ public:
15
+ static void OnConnection(uv_stream_t* handle, int status);
16
+ static void AfterConnect(uv_connect_t* req, int status);
17
+
18
+ protected:
19
+ ConnectionWrap(Environment* env,
20
+ v8::Local<v8::Object> object,
21
+ ProviderType provider);
22
+
23
+ UVType handle_;
24
+ };
25
+
26
+ } // namespace node
27
+
28
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
29
+
30
+ #endif // SRC_CONNECTION_WRAP_H_
@@ -0,0 +1,310 @@
1
+ // Copyright 2020 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_CPPGC_ALLOCATION_H_
6
+ #define INCLUDE_CPPGC_ALLOCATION_H_
7
+
8
+ #include <atomic>
9
+ #include <cstddef>
10
+ #include <cstdint>
11
+ #include <new>
12
+ #include <type_traits>
13
+ #include <utility>
14
+
15
+ #include "cppgc/custom-space.h"
16
+ #include "cppgc/internal/api-constants.h"
17
+ #include "cppgc/internal/gc-info.h"
18
+ #include "cppgc/type-traits.h"
19
+ #include "v8config.h" // NOLINT(build/include_directory)
20
+
21
+ #if defined(__has_attribute)
22
+ #if __has_attribute(assume_aligned)
23
+ #define CPPGC_DEFAULT_ALIGNED \
24
+ __attribute__((assume_aligned(api_constants::kDefaultAlignment)))
25
+ #define CPPGC_DOUBLE_WORD_ALIGNED \
26
+ __attribute__((assume_aligned(2 * api_constants::kDefaultAlignment)))
27
+ #endif // __has_attribute(assume_aligned)
28
+ #endif // defined(__has_attribute)
29
+
30
+ #if !defined(CPPGC_DEFAULT_ALIGNED)
31
+ #define CPPGC_DEFAULT_ALIGNED
32
+ #endif
33
+
34
+ #if !defined(CPPGC_DOUBLE_WORD_ALIGNED)
35
+ #define CPPGC_DOUBLE_WORD_ALIGNED
36
+ #endif
37
+
38
+ namespace cppgc {
39
+
40
+ /**
41
+ * AllocationHandle is used to allocate garbage-collected objects.
42
+ */
43
+ class AllocationHandle;
44
+
45
+ namespace internal {
46
+
47
+ // Similar to C++17 std::align_val_t;
48
+ enum class AlignVal : size_t {};
49
+
50
+ class V8_EXPORT MakeGarbageCollectedTraitInternal {
51
+ protected:
52
+ static inline void MarkObjectAsFullyConstructed(const void* payload) {
53
+ // See api_constants for an explanation of the constants.
54
+ std::atomic<uint16_t>* atomic_mutable_bitfield =
55
+ reinterpret_cast<std::atomic<uint16_t>*>(
56
+ const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
57
+ reinterpret_cast<const uint8_t*>(payload) -
58
+ api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
59
+ // It's safe to split use load+store here (instead of a read-modify-write
60
+ // operation), since it's guaranteed that this 16-bit bitfield is only
61
+ // modified by a single thread. This is cheaper in terms of code bloat (on
62
+ // ARM) and performance.
63
+ uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
64
+ value |= api_constants::kFullyConstructedBitMask;
65
+ atomic_mutable_bitfield->store(value, std::memory_order_release);
66
+ }
67
+
68
+ // Dispatch based on compile-time information.
69
+ //
70
+ // Default implementation is for a custom space with >`kDefaultAlignment` byte
71
+ // alignment.
72
+ template <typename GCInfoType, typename CustomSpace, size_t alignment>
73
+ struct AllocationDispatcher final {
74
+ static void* Invoke(AllocationHandle& handle, size_t size) {
75
+ static_assert(std::is_base_of<CustomSpaceBase, CustomSpace>::value,
76
+ "Custom space must inherit from CustomSpaceBase.");
77
+ static_assert(
78
+ !CustomSpace::kSupportsCompaction,
79
+ "Custom spaces that support compaction do not support allocating "
80
+ "objects with non-default (i.e. word-sized) alignment.");
81
+ return MakeGarbageCollectedTraitInternal::Allocate(
82
+ handle, size, static_cast<AlignVal>(alignment),
83
+ internal::GCInfoTrait<GCInfoType>::Index(), CustomSpace::kSpaceIndex);
84
+ }
85
+ };
86
+
87
+ // Fast path for regular allocations for the default space with
88
+ // `kDefaultAlignment` byte alignment.
89
+ template <typename GCInfoType>
90
+ struct AllocationDispatcher<GCInfoType, void,
91
+ api_constants::kDefaultAlignment>
92
+ final {
93
+ static void* Invoke(AllocationHandle& handle, size_t size) {
94
+ return MakeGarbageCollectedTraitInternal::Allocate(
95
+ handle, size, internal::GCInfoTrait<GCInfoType>::Index());
96
+ }
97
+ };
98
+
99
+ // Default space with >`kDefaultAlignment` byte alignment.
100
+ template <typename GCInfoType, size_t alignment>
101
+ struct AllocationDispatcher<GCInfoType, void, alignment> final {
102
+ static void* Invoke(AllocationHandle& handle, size_t size) {
103
+ return MakeGarbageCollectedTraitInternal::Allocate(
104
+ handle, size, static_cast<AlignVal>(alignment),
105
+ internal::GCInfoTrait<GCInfoType>::Index());
106
+ }
107
+ };
108
+
109
+ // Custom space with `kDefaultAlignment` byte alignment.
110
+ template <typename GCInfoType, typename CustomSpace>
111
+ struct AllocationDispatcher<GCInfoType, CustomSpace,
112
+ api_constants::kDefaultAlignment>
113
+ final {
114
+ static void* Invoke(AllocationHandle& handle, size_t size) {
115
+ static_assert(std::is_base_of<CustomSpaceBase, CustomSpace>::value,
116
+ "Custom space must inherit from CustomSpaceBase.");
117
+ return MakeGarbageCollectedTraitInternal::Allocate(
118
+ handle, size, internal::GCInfoTrait<GCInfoType>::Index(),
119
+ CustomSpace::kSpaceIndex);
120
+ }
121
+ };
122
+
123
+ private:
124
+ static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t,
125
+ GCInfoIndex);
126
+ static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&,
127
+ size_t, AlignVal,
128
+ GCInfoIndex);
129
+ static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t,
130
+ GCInfoIndex, CustomSpaceIndex);
131
+ static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&,
132
+ size_t, AlignVal, GCInfoIndex,
133
+ CustomSpaceIndex);
134
+
135
+ friend class HeapObjectHeader;
136
+ };
137
+
138
+ } // namespace internal
139
+
140
+ /**
141
+ * Base trait that provides utilities for advancers users that have custom
142
+ * allocation needs (e.g., overriding size). It's expected that users override
143
+ * MakeGarbageCollectedTrait (see below) and inherit from
144
+ * MakeGarbageCollectedTraitBase and make use of the low-level primitives
145
+ * offered to allocate and construct an object.
146
+ */
147
+ template <typename T>
148
+ class MakeGarbageCollectedTraitBase
149
+ : private internal::MakeGarbageCollectedTraitInternal {
150
+ private:
151
+ static_assert(internal::IsGarbageCollectedType<T>::value,
152
+ "T needs to be a garbage collected object");
153
+ static_assert(!IsGarbageCollectedWithMixinTypeV<T> ||
154
+ sizeof(T) <=
155
+ internal::api_constants::kLargeObjectSizeThreshold,
156
+ "GarbageCollectedMixin may not be a large object");
157
+
158
+ protected:
159
+ /**
160
+ * Allocates memory for an object of type T.
161
+ *
162
+ * \param handle AllocationHandle identifying the heap to allocate the object
163
+ * on.
164
+ * \param size The size that should be reserved for the object.
165
+ * \returns the memory to construct an object of type T on.
166
+ */
167
+ V8_INLINE static void* Allocate(AllocationHandle& handle, size_t size) {
168
+ static_assert(
169
+ std::is_base_of<typename T::ParentMostGarbageCollectedType, T>::value,
170
+ "U of GarbageCollected<U> must be a base of T. Check "
171
+ "GarbageCollected<T> base class inheritance.");
172
+ static constexpr size_t kWantedAlignment =
173
+ alignof(T) < internal::api_constants::kDefaultAlignment
174
+ ? internal::api_constants::kDefaultAlignment
175
+ : alignof(T);
176
+ static_assert(
177
+ kWantedAlignment <= internal::api_constants::kMaxSupportedAlignment,
178
+ "Requested alignment larger than alignof(std::max_align_t) bytes. "
179
+ "Please file a bug to possibly get this restriction lifted.");
180
+ return AllocationDispatcher<
181
+ typename internal::GCInfoFolding<
182
+ T, typename T::ParentMostGarbageCollectedType>::ResultType,
183
+ typename SpaceTrait<T>::Space, kWantedAlignment>::Invoke(handle, size);
184
+ }
185
+
186
+ /**
187
+ * Marks an object as fully constructed, resulting in precise handling by the
188
+ * garbage collector.
189
+ *
190
+ * \param payload The base pointer the object is allocated at.
191
+ */
192
+ V8_INLINE static void MarkObjectAsFullyConstructed(const void* payload) {
193
+ internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
194
+ payload);
195
+ }
196
+ };
197
+
198
+ /**
199
+ * Passed to MakeGarbageCollected to specify how many bytes should be appended
200
+ * to the allocated object.
201
+ *
202
+ * Example:
203
+ * \code
204
+ * class InlinedArray final : public GarbageCollected<InlinedArray> {
205
+ * public:
206
+ * explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}
207
+ * void Trace(Visitor*) const {}
208
+
209
+ * size_t size;
210
+ * char* byte_array;
211
+ * };
212
+ *
213
+ * auto* inlined_array = MakeGarbageCollected<InlinedArray(
214
+ * GetAllocationHandle(), AdditionalBytes(4), 4);
215
+ * for (size_t i = 0; i < 4; i++) {
216
+ * Process(inlined_array->byte_array[i]);
217
+ * }
218
+ * \endcode
219
+ */
220
+ struct AdditionalBytes {
221
+ constexpr explicit AdditionalBytes(size_t bytes) : value(bytes) {}
222
+ const size_t value;
223
+ };
224
+
225
+ /**
226
+ * Default trait class that specifies how to construct an object of type T.
227
+ * Advanced users may override how an object is constructed using the utilities
228
+ * that are provided through MakeGarbageCollectedTraitBase.
229
+ *
230
+ * Any trait overriding construction must
231
+ * - allocate through `MakeGarbageCollectedTraitBase<T>::Allocate`;
232
+ * - mark the object as fully constructed using
233
+ * `MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed`;
234
+ */
235
+ template <typename T>
236
+ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
237
+ public:
238
+ template <typename... Args>
239
+ static T* Call(AllocationHandle& handle, Args&&... args) {
240
+ void* memory =
241
+ MakeGarbageCollectedTraitBase<T>::Allocate(handle, sizeof(T));
242
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
243
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
244
+ return object;
245
+ }
246
+
247
+ template <typename... Args>
248
+ static T* Call(AllocationHandle& handle, AdditionalBytes additional_bytes,
249
+ Args&&... args) {
250
+ void* memory = MakeGarbageCollectedTraitBase<T>::Allocate(
251
+ handle, sizeof(T) + additional_bytes.value);
252
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
253
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
254
+ return object;
255
+ }
256
+ };
257
+
258
+ /**
259
+ * Allows users to specify a post-construction callback for specific types. The
260
+ * callback is invoked on the instance of type T right after it has been
261
+ * constructed. This can be useful when the callback requires a
262
+ * fully-constructed object to be able to dispatch to virtual methods.
263
+ */
264
+ template <typename T, typename = void>
265
+ struct PostConstructionCallbackTrait {
266
+ static void Call(T*) {}
267
+ };
268
+
269
+ /**
270
+ * Constructs a managed object of type T where T transitively inherits from
271
+ * GarbageCollected.
272
+ *
273
+ * \param args List of arguments with which an instance of T will be
274
+ * constructed.
275
+ * \returns an instance of type T.
276
+ */
277
+ template <typename T, typename... Args>
278
+ V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) {
279
+ T* object =
280
+ MakeGarbageCollectedTrait<T>::Call(handle, std::forward<Args>(args)...);
281
+ PostConstructionCallbackTrait<T>::Call(object);
282
+ return object;
283
+ }
284
+
285
+ /**
286
+ * Constructs a managed object of type T where T transitively inherits from
287
+ * GarbageCollected. Created objects will have additional bytes appended to
288
+ * it. Allocated memory would suffice for `sizeof(T) + additional_bytes`.
289
+ *
290
+ * \param additional_bytes Denotes how many bytes to append to T.
291
+ * \param args List of arguments with which an instance of T will be
292
+ * constructed.
293
+ * \returns an instance of type T.
294
+ */
295
+ template <typename T, typename... Args>
296
+ V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle,
297
+ AdditionalBytes additional_bytes,
298
+ Args&&... args) {
299
+ T* object = MakeGarbageCollectedTrait<T>::Call(handle, additional_bytes,
300
+ std::forward<Args>(args)...);
301
+ PostConstructionCallbackTrait<T>::Call(object);
302
+ return object;
303
+ }
304
+
305
+ } // namespace cppgc
306
+
307
+ #undef CPPGC_DEFAULT_ALIGNED
308
+ #undef CPPGC_DOUBLE_WORD_ALIGNED
309
+
310
+ #endif // INCLUDE_CPPGC_ALLOCATION_H_
@@ -0,0 +1,28 @@
1
+ // Copyright 2020 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_CPPGC_COMMON_H_
6
+ #define INCLUDE_CPPGC_COMMON_H_
7
+
8
+ #include "v8config.h" // NOLINT(build/include_directory)
9
+
10
+ namespace cppgc {
11
+
12
+ /**
13
+ * Indicator for the stack state of the embedder.
14
+ */
15
+ enum class EmbedderStackState {
16
+ /**
17
+ * Stack may contain interesting heap pointers.
18
+ */
19
+ kMayContainHeapPointers,
20
+ /**
21
+ * Stack does not contain any interesting heap pointers.
22
+ */
23
+ kNoHeapPointers,
24
+ };
25
+
26
+ } // namespace cppgc
27
+
28
+ #endif // INCLUDE_CPPGC_COMMON_H_