summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
authorIgor Zinkovsky <igor@deno.com>2024-04-17 07:19:55 -0700
committerGitHub <noreply@github.com>2024-04-17 07:19:55 -0700
commitb3d7df55357ea6fc6f5141b64a9638ddb39b0f63 (patch)
tree0ca14140c7e080ed3367a7352bbaf3ed5f7a0f48 /cli/worker.rs
parent9acbf90b06bf79dd6e4cf2428b3566da009bed65 (diff)
perf: v8 code cache (#23081)
This PR enables V8 code cache for ES modules and for `require` scripts through `op_eval_context`. Code cache artifacts are transparently stored and fetched using sqlite db and are passed to V8. `--no-code-cache` can be used to disable. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 070671e60..7dbb9b177 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -22,6 +22,7 @@ use deno_core::PollEventLoopOptions;
use deno_core::SharedArrayBufferStore;
use deno_core::SourceMapGetter;
use deno_lockfile::Lockfile;
+use deno_runtime::code_cache;
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
use deno_runtime::deno_fs;
use deno_runtime::deno_node;
@@ -140,6 +141,7 @@ struct SharedWorkerState {
enable_future_features: bool,
disable_deprecated_api_warning: bool,
verbose_deprecated_api_warning: bool,
+ code_cache: Option<Arc<dyn code_cache::CodeCache>>,
}
impl SharedWorkerState {
@@ -411,6 +413,7 @@ impl CliMainWorkerFactory {
enable_future_features: bool,
disable_deprecated_api_warning: bool,
verbose_deprecated_api_warning: bool,
+ code_cache: Option<Arc<dyn code_cache::CodeCache>>,
) -> Self {
Self {
shared: Arc::new(SharedWorkerState {
@@ -434,6 +437,7 @@ impl CliMainWorkerFactory {
enable_future_features,
disable_deprecated_api_warning,
verbose_deprecated_api_warning,
+ code_cache,
}),
}
}
@@ -628,6 +632,7 @@ impl CliMainWorkerFactory {
stdio,
feature_checker,
skip_op_registration: shared.options.skip_op_registration,
+ v8_code_cache: shared.code_cache.clone(),
};
let mut worker = MainWorker::bootstrap_from_options(