From ed2aeeb87b62544fdedfa6c8d37af4358f0922f7 Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Wed, 12 Aug 2020 17:21:55 +0200 Subject: [PATCH] [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 Commit-Queue: Clemens Backes Cr-Commit-Position: refs/heads/master@{#69368} --- src/wasm/module-compiler.cc | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc index 3ba0a60408..e201892b64 100644 --- a/src/wasm/module-compiler.cc +++ b/src/wasm/module-compiler.cc @@ -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(