From 1ef617e8f3d48098e69e222b6eb6fe981aeca1c3 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sun, 12 Nov 2023 20:52:59 -0800 Subject: perf: lazy bootstrap options - first pass (#21164) Move most runtime options to be lazily loaded. Constant options will be covered in a different PR. Towards https://github.com/denoland/deno/issues/21133 --- runtime/worker.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'runtime/worker.rs') diff --git a/runtime/worker.rs b/runtime/worker.rs index d551af782..9a9802c12 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -264,7 +264,7 @@ impl MainWorker { ) -> Self { let bootstrap_options = options.bootstrap.clone(); let mut worker = Self::from_options(main_module, permissions, options); - worker.bootstrap(&bootstrap_options); + worker.bootstrap(bootstrap_options); worker } @@ -380,6 +380,7 @@ impl MainWorker { ops::signal::deno_signal::init_ops_and_esm(), ops::tty::deno_tty::init_ops_and_esm(), ops::http::deno_http_runtime::init_ops_and_esm(), + ops::bootstrap::deno_bootstrap::init_ops_and_esm(), deno_permissions_worker::init_ops_and_esm( permissions, enable_testing_features, @@ -454,7 +455,6 @@ impl MainWorker { let inspector = js_runtime.inspector(); op_state.borrow_mut().put(inspector); } - let bootstrap_fn_global = { let context = js_runtime.main_context(); let scope = &mut js_runtime.handle_scope(); @@ -486,7 +486,8 @@ impl MainWorker { } } - pub fn bootstrap(&mut self, options: &BootstrapOptions) { + pub fn bootstrap(&mut self, options: BootstrapOptions) { + self.js_runtime.op_state().borrow_mut().put(options.clone()); let scope = &mut self.js_runtime.handle_scope(); let args = options.as_v8(scope); let bootstrap_fn = self.bootstrap_fn_global.take().unwrap(); -- cgit v1.2.3