Commit e226632a authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Remove an unneeded lambda

The lambda used to do more work, now it's just a single function call.
Thus remove the lambda by inlining it into all callers.
Also, get rid of an unneeded parameter on {OnCompilationStopped}.

R=thibaudm@chromium.org

Bug: v8:10933
Change-Id: I2c5bc8dfab7abe47a69c1c3eeb5ec8dd02f503c1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2440524Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70281}
parent a81da102
...@@ -631,7 +631,7 @@ class CompilationStateImpl { ...@@ -631,7 +631,7 @@ class CompilationStateImpl {
int GetFreeCompileTaskId(); int GetFreeCompileTaskId();
int GetUnpublishedUnitsLimits(int task_id); int GetUnpublishedUnitsLimits(int task_id);
void OnCompilationStopped(int task_id, const WasmFeatures& detected); void OnCompilationStopped(const WasmFeatures& detected);
void PublishDetectedFeatures(Isolate*); void PublishDetectedFeatures(Isolate*);
// Ensure that a compilation job is running, and increase its concurrency if // Ensure that a compilation job is running, and increase its concurrency if
// needed. // needed.
...@@ -1274,12 +1274,6 @@ CompilationExecutionResult ExecuteCompilationUnits( ...@@ -1274,12 +1274,6 @@ CompilationExecutionResult ExecuteCompilationUnits(
WasmFeatures detected_features = WasmFeatures::None(); WasmFeatures detected_features = WasmFeatures::None();
auto stop = [&detected_features,
task_id](BackgroundCompileScope& compile_scope) {
compile_scope.compilation_state()->OnCompilationStopped(task_id,
detected_features);
};
// Preparation (synchronized): Initialize the fields above and get the first // Preparation (synchronized): Initialize the fields above and get the first
// compilation unit. // compilation unit.
{ {
...@@ -1293,10 +1287,7 @@ CompilationExecutionResult ExecuteCompilationUnits( ...@@ -1293,10 +1287,7 @@ CompilationExecutionResult ExecuteCompilationUnits(
unpublished_units_limit = unpublished_units_limit =
compilation_state->GetUnpublishedUnitsLimits(task_id); compilation_state->GetUnpublishedUnitsLimits(task_id);
unit = compilation_state->GetNextCompilationUnit(task_id, baseline_only); unit = compilation_state->GetNextCompilationUnit(task_id, baseline_only);
if (!unit) { if (!unit) return kNoMoreUnits;
stop(compile_scope);
return kNoMoreUnits;
}
} }
TRACE_COMPILE("ExecuteCompilationUnits (task id %d)\n", task_id); TRACE_COMPILE("ExecuteCompilationUnits (task id %d)\n", task_id);
...@@ -1352,20 +1343,20 @@ CompilationExecutionResult ExecuteCompilationUnits( ...@@ -1352,20 +1343,20 @@ CompilationExecutionResult ExecuteCompilationUnits(
{ {
BackgroundCompileScope compile_scope(token); BackgroundCompileScope compile_scope(token);
if (compile_scope.cancelled()) return kNoMoreUnits; if (compile_scope.cancelled()) return kNoMoreUnits;
if (!results_to_publish.back().succeeded()) { if (!results_to_publish.back().succeeded()) {
// Compile error.
compile_scope.compilation_state()->SetError();
stop(compile_scope);
compilation_failed = true; compilation_failed = true;
compile_scope.compilation_state()->SetError();
break; break;
} }
// Get next unit. // Yield or get next unit.
if (yield || if (yield ||
!(unit = compile_scope.compilation_state()->GetNextCompilationUnit( !(unit = compile_scope.compilation_state()->GetNextCompilationUnit(
task_id, baseline_only))) { task_id, baseline_only))) {
publish_results(&compile_scope); publish_results(&compile_scope);
stop(compile_scope); compile_scope.compilation_state()->OnCompilationStopped(
detected_features);
return yield ? kYield : kNoMoreUnits; return yield ? kYield : kNoMoreUnits;
} }
...@@ -3237,9 +3228,7 @@ int CompilationStateImpl::GetUnpublishedUnitsLimits(int task_id) { ...@@ -3237,9 +3228,7 @@ int CompilationStateImpl::GetUnpublishedUnitsLimits(int task_id) {
return std::max(10, min + (min * task_id / max_compile_concurrency_)); return std::max(10, min + (min * task_id / max_compile_concurrency_));
} }
void CompilationStateImpl::OnCompilationStopped(int task_id, void CompilationStateImpl::OnCompilationStopped(const WasmFeatures& detected) {
const WasmFeatures& detected) {
DCHECK_GE(max_compile_concurrency_, task_id);
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
detected_features_.Add(detected); detected_features_.Add(detected);
} }
......
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