Skip to content

Commit

Permalink
chore: upgrade rusty_v8 to 0.48.1 (denoland#15310)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Aug 15, 2022
1 parent 18dcc64 commit 5a4f84a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/tests/testdata/worker_close_in_wasm_reactions.js.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Error: CompileError: WebAssembly.compile(): expected string length @+10
Error: CompileError: WebAssembly.compile(): expected length: @+10
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ serde_json = { version = "1.0.79", features = ["preserve_order"] }
serde_v8 = { version = "0.58.0", path = "../serde_v8" }
sourcemap = "=6.0.1"
url = { version = "2.2.2", features = ["serde"] }
v8 = { version = "0.47.1", default-features = false }
v8 = { version = "0.48.1", default-features = false }

[[example]]
name = "http_bench_json_ops"
Expand Down
16 changes: 16 additions & 0 deletions core/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ pub fn set_func_raw(
obj.set(scope, key.into(), val.into());
}

pub extern "C" fn wasm_async_resolve_promise_callback(
_isolate: *mut v8::Isolate,
context: v8::Local<v8::Context>,
resolver: v8::Local<v8::PromiseResolver>,
compilation_result: v8::Local<v8::Value>,
success: v8::WasmAsyncSuccess,
) {
// SAFETY: `CallbackScope` can be safely constructed from `Local<Context>`
let scope = &mut unsafe { v8::CallbackScope::new(context) };
if success == v8::WasmAsyncSuccess::Success {
resolver.resolve(scope, compilation_result).unwrap();
} else {
resolver.reject(scope, compilation_result).unwrap();
}
}

pub extern "C" fn host_import_module_dynamically_callback(
context: v8::Local<v8::Context>,
_host_defined_options: v8::Local<v8::Data>,
Expand Down
13 changes: 8 additions & 5 deletions core/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,6 @@ fn v8_init(
static ICU_DATA: IcuData = IcuData(*include_bytes!("icudtl.dat"));
v8::icu::set_common_data_71(&ICU_DATA.0).unwrap();

let v8_platform = v8_platform
.unwrap_or_else(|| v8::new_default_platform(0, false).make_shared());
v8::V8::initialize_platform(v8_platform);
v8::V8::initialize();

let flags = concat!(
" --experimental-wasm-threads",
" --wasm-test-streaming",
Expand All @@ -248,6 +243,11 @@ fn v8_init(
} else {
v8::V8::set_flags_from_string(flags);
}

let v8_platform = v8_platform
.unwrap_or_else(|| v8::new_default_platform(0, false).make_shared());
v8::V8::initialize_platform(v8_platform);
v8::V8::initialize();
}

#[derive(Default)]
Expand Down Expand Up @@ -516,6 +516,9 @@ impl JsRuntime {
isolate.set_host_import_module_dynamically_callback(
bindings::host_import_module_dynamically_callback,
);
isolate.set_wasm_async_resolve_promise_callback(
bindings::wasm_async_resolve_promise_callback,
);
isolate
}

Expand Down
2 changes: 1 addition & 1 deletion serde_v8/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ derive_more = "0.99.17"
serde = { version = "1.0.136", features = ["derive"] }
serde_bytes = "0.11"
smallvec = { version = "1.8", features = ["union"] }
v8 = { version = "0.47.1", default-features = false }
v8 = { version = "0.48.1", default-features = false }

[dev-dependencies]
bencher = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions tools/wpt/expectation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,8 @@
],
"is.tentative.any.html": true,
"is.tentative.any.worker.html": true,
"toString.tentative.any.html": false,
"toString.tentative.any.worker.html": false,
"toString.tentative.any.html": true,
"toString.tentative.any.worker.html": true,
"type.tentative.any.html": false,
"type.tentative.any.worker.html": false
},
Expand Down

0 comments on commit 5a4f84a

Please sign in to comment.