[wasm] Reuse callback trigger logic for empty modules

Instead of hard-coding the logic for empty modules, just re-use the
{TriggerCallbacks} method. This will also ensure that the
{finished_events_} set will be populated correctly, such that callbacks
added later will still receive the events.

R=ahaas@chromium.org

Bug: chromium:1101340
Change-Id: I6641f23dc0459d0b6591bb03cc8c1b99dcaa90ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2351669
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69368}
This commit is contained in:
Clemens Backes 2020-08-12 17:21:55 +02:00 committed by Commit Bot
parent c374682cc9
commit ed2aeeb87b

View File

@ -2602,18 +2602,7 @@ void CompilationStateImpl::InitializeCompilationProgress(bool lazy_module,
// Trigger callbacks if module needs no baseline or top tier compilation. This
// can be the case for an empty or fully lazy module.
if (outstanding_baseline_units_ == 0) {
for (auto& callback : callbacks_) {
callback(CompilationEvent::kFinishedBaselineCompilation);
}
if (outstanding_top_tier_functions_ == 0) {
for (auto& callback : callbacks_) {
callback(CompilationEvent::kFinishedTopTierCompilation);
}
// Clear the callbacks because no more events will be delivered.
callbacks_.clear();
}
}
TriggerCallbacks();
}
void CompilationStateImpl::InitializeRecompilation(