[wasm] Lazily compile tiered-down modules

If the debugger is enabled while we compile a new Wasm module, we were
still eagerly adding baseline compilation units for all functions. This
is inconsistent with what we do if the module is already created when
the debugger is enabled. It's also inconsistent with the default
compilation strategy, which is lazy nowadays.

Thus this CL removes the outdated code. The runtime function for lazy
compilation already has all necessary logic in place to generate debug
code lazily.

R=ahaas@chromium.org

Bug: v8:13224
Change-Id: I30bebeb751e1a4c7f03a93844f9263bf0e8692df
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4152950
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85263}
This commit is contained in:
Clemens Backes 2023-01-10 20:55:40 +01:00 committed by V8 LUCI CQ
parent 35694f6da0
commit 5f54f6f916

View File

@ -1017,11 +1017,6 @@ class CompilationUnitBuilder {
tiering_units_.emplace_back(func_index, tier, kNotForDebugging);
}
void AddDebugUnit(int func_index) {
baseline_units_.emplace_back(func_index, ExecutionTier::kLiftoff,
kForDebugging);
}
bool Commit() {
if (baseline_units_.empty() && tiering_units_.empty() &&
js_to_wasm_wrapper_units_.empty()) {
@ -3152,12 +3147,7 @@ void CompilationStateImpl::AddCompilationUnitInternal(
void CompilationStateImpl::InitializeCompilationUnits(
std::unique_ptr<CompilationUnitBuilder> builder) {
int offset = native_module_->module()->num_imported_functions;
if (native_module_->IsInDebugState()) {
for (size_t i = 0; i < compilation_progress_.size(); ++i) {
int func_index = offset + static_cast<int>(i);
builder->AddDebugUnit(func_index);
}
} else {
{
base::MutexGuard guard(&callbacks_mutex_);
for (size_t i = 0, e = compilation_progress_.size(); i < e; ++i) {