diff --git a/src/baseline/baseline-batch-compiler.cc b/src/baseline/baseline-batch-compiler.cc index 566551e98b..e0f528bcbe 100644 --- a/src/baseline/baseline-batch-compiler.cc +++ b/src/baseline/baseline-batch-compiler.cc @@ -27,6 +27,12 @@ namespace v8 { namespace internal { namespace baseline { +static bool CanCompileWithConcurrentBaseline(SharedFunctionInfo shared, + Isolate* isolate) { + return !shared.is_compiled() || shared.HasBaselineCode() || + !CanCompileWithBaseline(isolate, shared); +} + class BaselineCompilerTask { public: BaselineCompilerTask(Isolate* isolate, PersistentHandles* handles, @@ -60,8 +66,7 @@ class BaselineCompilerTask { } // Don't install the code if the bytecode has been flushed or has // already some baseline code installed. - if (!shared_function_info_->is_compiled() || - shared_function_info_->HasBaselineCode()) { + if (!CanCompileWithConcurrentBaseline(*shared_function_info_, isolate)) { return; } shared_function_info_->set_baseline_code(ToCodeT(*code), kReleaseStore); @@ -102,7 +107,7 @@ class BaselineBatchCompilerJob { if (!maybe_sfi.GetHeapObjectIfWeak(&obj)) continue; // Skip functions where the bytecode has been flushed. SharedFunctionInfo shared = SharedFunctionInfo::cast(obj); - if (ShouldSkipFunction(shared, isolate)) continue; + if (CanCompileWithConcurrentBaseline(shared, isolate)) continue; tasks_.emplace_back(isolate, handles_.get(), shared); } if (FLAG_trace_baseline_concurrent_compilation) { @@ -112,11 +117,6 @@ class BaselineBatchCompilerJob { } } - static bool ShouldSkipFunction(SharedFunctionInfo shared, Isolate* isolate) { - return !shared.is_compiled() || shared.HasBaselineCode() || - !CanCompileWithBaseline(isolate, shared); - } - // Executed in the background thread. void Compile(LocalIsolate* local_isolate) { local_isolate->heap()->AttachPersistentHandles(std::move(handles_));