|
1 | 1 | use super::module_host::{EventStatus, ModuleHost, ModuleInfo, NoSuchModule}; |
2 | 2 | use super::scheduler::SchedulerStarter; |
| 3 | +use super::v8::V8Runtime; |
3 | 4 | use super::wasmtime::WasmtimeRuntime; |
4 | 5 | use super::{Scheduler, UpdateDatabaseResult}; |
5 | 6 | use crate::database_logger::DatabaseLogger; |
@@ -106,12 +107,14 @@ pub struct HostController { |
106 | 107 |
|
107 | 108 | struct HostRuntimes { |
108 | 109 | wasmtime: WasmtimeRuntime, |
| 110 | + v8: V8Runtime, |
109 | 111 | } |
110 | 112 |
|
111 | 113 | impl HostRuntimes { |
112 | 114 | fn new(data_dir: Option<&ServerDataDir>) -> Arc<Self> { |
113 | 115 | let wasmtime = WasmtimeRuntime::new(data_dir); |
114 | | - Arc::new(Self { wasmtime }) |
| 116 | + let v8 = V8Runtime::new(); |
| 117 | + Arc::new(Self { wasmtime, v8 }) |
115 | 118 | } |
116 | 119 | } |
117 | 120 |
|
@@ -668,19 +671,23 @@ async fn make_module_host( |
668 | 671 | // threads, but those aren't for computation. Also, wasmtime uses rayon |
669 | 672 | // to run compilation in parallel, so it'll need to run stuff in rayon anyway. |
670 | 673 | asyncify(move || { |
| 674 | + let mcc = ModuleCreationContext { |
| 675 | + replica_ctx, |
| 676 | + scheduler, |
| 677 | + program: &program, |
| 678 | + energy_monitor, |
| 679 | + }; |
671 | 680 | let module_host = match host_type { |
672 | 681 | HostType::Wasm => { |
673 | | - let mcc = ModuleCreationContext { |
674 | | - replica_ctx, |
675 | | - scheduler, |
676 | | - program: &program, |
677 | | - energy_monitor, |
678 | | - }; |
679 | 682 | let start = Instant::now(); |
680 | 683 | let actor = runtimes.wasmtime.make_actor(mcc)?; |
681 | 684 | trace!("wasmtime::make_actor blocked for {:?}", start.elapsed()); |
682 | 685 | ModuleHost::new(actor, unregister, core) |
683 | 686 | } |
| 687 | + HostType::Js => { |
| 688 | + let actor = runtimes.v8.make_actor(mcc)?; |
| 689 | + ModuleHost::new(actor, unregister) |
| 690 | + } |
684 | 691 | }; |
685 | 692 | Ok((program, module_host)) |
686 | 693 | }) |
|
0 commit comments