diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-11-12 20:52:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 04:52:59 +0000 |
commit | 1ef617e8f3d48098e69e222b6eb6fe981aeca1c3 (patch) | |
tree | 8ab4fab5b5b248d51575e874f240c16fba4ae268 /runtime/worker.rs | |
parent | 39223f709bcb86069f3aa8eab7a4be80304128e6 (diff) |
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
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 7 |
1 files changed, 4 insertions, 3 deletions
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(); |