Commit 763be7fd authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Delay tier-down of unfinished modules

If a module is not fully (baseline) compiled yet, we cannot reliably
tier it down, because we might not have the wire bytes for all functions
available (in streaming compilation). After baseline compilation
finished, we already check if we need to tier down, and do it then.
Hence we can just skip any tier-down of unfinished modules.

We cannot easily test this in V8 stand-alone, as inspector-test can only
execute one command at a time, so we cannot trigger asynchronous
compilation and then enable the debugger while this is running.

R=thibaudm@chromium.org

Change-Id: I250162a8d3c20599cacebff2f4f540ff6f8b1946
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2953298Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75117}
parent 50117080
......@@ -163,6 +163,7 @@ WasmCompilationResult WasmCompilationUnit::ExecuteFunctionCompilation(
WasmFeatures* detected) {
auto* func = &env->module->functions[func_index_];
Vector<const uint8_t> code = wire_bytes_storage->GetCode(func->code);
DCHECK_LT(0, code.size());
wasm::FunctionBody func_body{func->sig, func->code.offset(), code.begin(),
code.end()};
......
......@@ -2137,6 +2137,11 @@ bool NativeModule::IsTieredDown() {
}
void NativeModule::RecompileForTiering() {
// If baseline compilation is not finished yet, we do not tier down now. This
// would be tricky because not all code is guaranteed to be available yet.
// Instead, we tier down after streaming compilation finished.
if (!compilation_state_->baseline_compilation_finished()) return;
// Read the tiering state under the lock, then trigger recompilation after
// releasing the lock. If the tiering state was changed when the triggered
// compilation units finish, code installation will handle that correctly.
......
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