Commit 07aea442 authored by bradnelson's avatar bradnelson Committed by Commit bot

[wasm] Add a flag to enable/disable async compile.

Adding a flag to explicitly enable/disable async compile.
Will cherrypick this to M59.
Separately will land a change to re-enable this by default.

BUG=v8:6264
R=mtrofin@chromium.org,ahaas@chromium.org,hablich@chromium.org

Review-Url: https://codereview.chromium.org/2820553003
Cr-Commit-Position: refs/heads/master@{#44653}
parent 8faf3d6f
......@@ -534,6 +534,8 @@ DEFINE_BOOL(wasm_disable_structured_cloning, false,
"disable WASM structured cloning")
DEFINE_INT(wasm_num_compilation_tasks, 10,
"number of parallel compilation tasks for wasm")
DEFINE_BOOL(wasm_async_compilation, false,
"enable actual asynchronous compilation for WebAssembly.compile")
// Parallel compilation confuses turbo_stats, force single threaded.
DEFINE_VALUE_IMPLICATION(turbo_stats, wasm_num_compilation_tasks, 0)
DEFINE_UINT(wasm_max_mem_pages, v8::internal::wasm::kV8MaxWasmMemoryPages,
......
......@@ -3038,6 +3038,20 @@ class AsyncCompileJob {
void wasm::AsyncCompile(Isolate* isolate, Handle<JSPromise> promise,
const ModuleWireBytes& bytes) {
if (!FLAG_wasm_async_compilation) {
ErrorThrower thrower(isolate, "WasmCompile");
// Compile the module.
MaybeHandle<WasmModuleObject> module_object =
SyncCompile(isolate, &thrower, bytes);
if (thrower.error()) {
RejectPromise(isolate, handle(isolate->context()), &thrower, promise);
return;
}
Handle<WasmModuleObject> module = module_object.ToHandleChecked();
ResolvePromise(isolate, handle(isolate->context()), promise, module);
return;
}
// Make a copy of the wire bytes in case the user program changes them
// during asynchronous compilation.
std::unique_ptr<byte[]> copy(new byte[bytes.length()]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment