Commit 04319318 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Fix non-determinism with --predictable

For invalid modules, the {kFinishedExportWrappers} event and the
validation error can happen in any order. Make the order deterministic
for predictable mode.

R=clemensb@chromium.org

Bug: v8:10936
Change-Id: Ib5b1e5a1a3af901a81bc37919b5aff4e5c237579
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2424134Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70086}
parent cb758969
......@@ -1614,9 +1614,12 @@ void CompileNativeModule(Isolate* isolate,
return;
}
Impl(native_module->compilation_state())
->FinalizeJSToWasmWrappers(isolate, native_module->module(),
export_wrappers_out);
if (!FLAG_predictable) {
// For predictable mode, do not finalize wrappers yet to make sure we catch
// validation errors first.
compilation_state->FinalizeJSToWasmWrappers(
isolate, native_module->module(), export_wrappers_out);
}
compilation_state->WaitForCompilationEvent(
CompilationEvent::kFinishedBaselineCompilation);
......@@ -1628,6 +1631,9 @@ void CompileNativeModule(Isolate* isolate,
ValidateSequentially(wasm_module, native_module.get(), isolate->counters(),
isolate->allocator(), thrower, lazy_module);
CHECK(thrower->error());
} else if (FLAG_predictable) {
compilation_state->FinalizeJSToWasmWrappers(
isolate, native_module->module(), export_wrappers_out);
}
}
......
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