From 03fd15956fe507b7877e769cd51a57cc2efdd44a Mon Sep 17 00:00:00 2001 From: Victor Gomes Date: Wed, 16 Mar 2022 13:18:12 +0100 Subject: [PATCH] [baseline] Don't install if debugger has call hooks We check if debugger needs to hook into every call when we enqueue the function to batch and when we compile, but we do not check it when we install it (that is, set_baseline_code), which is done in the main thread. Bug: v8:12713 Change-Id: I81ba221caed1060976e8865174d392a861f2ab24 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3528988 Commit-Queue: Victor Gomes Auto-Submit: Victor Gomes Reviewed-by: Michael Lippautz Commit-Queue: Michael Lippautz Cr-Commit-Position: refs/heads/main@{#79500} --- src/baseline/baseline-batch-compiler.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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_));