mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
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.
This commit is contained in:
parent
86c3c4f343
commit
795ecfa146
4 changed files with 230 additions and 62 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue