diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-28 10:27:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 10:27:17 +0200 |
commit | 795ecfa146c7b6c49be4b11f7064b2b5500296ff (patch) | |
tree | bbb0ad501db4abafa8dc2a6287162a13c231bd9c /runtime/worker.rs | |
parent | 86c3c4f34397a29c2bf1847bddfea562a2369a4f (diff) |
refactor(runtime): manual serialization of bootstrap data (#18448)
This commit changes how data required to bootstrap main and worker
runtime is serialized.
Instead of relying on serde_v8 and using JSON object,
we're doing manual serialization to a "v8::Array". This limits number
of V8 strings that need to be serialized by 16.
It also made it clear that some data could be obtained during
snapshotting instead of during bootstrap.
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index 42874f209..a8fd6b1da 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -361,13 +361,12 @@ impl MainWorker { pub fn bootstrap(&mut self, options: &BootstrapOptions) { let scope = &mut self.js_runtime.handle_scope(); - let options_v8 = - deno_core::serde_v8::to_v8(scope, options.as_json()).unwrap(); + let args = options.as_v8(scope); let bootstrap_fn = self.bootstrap_fn_global.take().unwrap(); let bootstrap_fn = v8::Local::new(scope, bootstrap_fn); let undefined = v8::undefined(scope); bootstrap_fn - .call(scope, undefined.into(), &[options_v8]) + .call(scope, undefined.into(), &[args.into()]) .unwrap(); } |