Revert "[maglev] Destroy jobs on BG thread"

This reverts commit 8623fd473b.

Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20no-concurrent-marking/12508/overview

Original change's description:
> [maglev] Destroy jobs on BG thread
>
> Maglev job destruction is suprisingly expensive, taking up roughly a
> third of total finalization time. Rather than destroying jobs as part of
> finalization, re-post them to the concurrent dispatcher to be destroyed
> in the background
>
> Bug: v8:7700
> Change-Id: I450d8a7b49737504c2aaebbfa7754e0ae15e7f05
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4111238
> Reviewed-by: Victor Gomes <victorgomes@chromium.org>
> Auto-Submit: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#84970}

Bug: v8:7700
Change-Id: I797a34529652c814b11cd13309b2d3a5ff68266e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4115747
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84977}
This commit is contained in:
Manos Koukoutos 2022-12-21 14:18:03 +00:00 committed by V8 LUCI CQ
parent 9869766097
commit 3a232e7ab8
2 changed files with 2 additions and 19 deletions

View File

@ -158,7 +158,6 @@ class MaglevConcurrentDispatcher::JobTask final : public v8::JobTask {
LocalIsolate local_isolate(isolate(), ThreadKind::kBackground);
DCHECK(local_isolate.heap()->IsParked());
bool job_was_executed = false;
while (!incoming_queue()->IsEmpty() && !delegate->ShouldYield()) {
std::unique_ptr<MaglevCompilationJob> job;
if (!incoming_queue()->Dequeue(&job)) break;
@ -169,32 +168,20 @@ class MaglevConcurrentDispatcher::JobTask final : public v8::JobTask {
RuntimeCallStats* rcs = nullptr; // TODO(v8:7700): Implement.
CompilationJob::Status status = job->ExecuteJob(rcs, &local_isolate);
if (status == CompilationJob::SUCCEEDED) {
job_was_executed = true;
outgoing_queue()->Enqueue(std::move(job));
}
}
if (job_was_executed) {
isolate()->stack_guard()->RequestInstallMaglevCode();
}
// Maglev jobs aren't cheap to destruct, so destroy them here in the
// background thread rather than on the main thread.
while (!destruction_queue()->IsEmpty() && !delegate->ShouldYield()) {
std::unique_ptr<MaglevCompilationJob> job;
if (!destruction_queue()->Dequeue(&job)) break;
DCHECK_NOT_NULL(job);
job.reset();
}
isolate()->stack_guard()->RequestInstallMaglevCode();
}
size_t GetMaxConcurrency(size_t) const override {
return incoming_queue()->size() + destruction_queue()->size();
return incoming_queue()->size();
}
private:
Isolate* isolate() const { return dispatcher_->isolate_; }
QueueT* incoming_queue() const { return &dispatcher_->incoming_queue_; }
QueueT* outgoing_queue() const { return &dispatcher_->outgoing_queue_; }
QueueT* destruction_queue() const { return &dispatcher_->destruction_queue_; }
MaglevConcurrentDispatcher* const dispatcher_;
const Handle<JSFunction> function_;
@ -237,9 +224,6 @@ void MaglevConcurrentDispatcher::FinalizeFinishedJobs() {
"V8.MaglevConcurrentFinalize", job.get(),
TRACE_EVENT_FLAG_FLOW_IN);
Compiler::FinalizeMaglevCompilationJob(job.get(), isolate_);
// Maglev jobs aren't cheap to destruct, so re-enqueue them for destruction
// on a background thread.
destruction_queue_.Enqueue(std::move(job));
}
}

View File

@ -100,7 +100,6 @@ class MaglevConcurrentDispatcher final {
std::unique_ptr<JobHandle> job_handle_;
QueueT incoming_queue_;
QueueT outgoing_queue_;
QueueT destruction_queue_;
};
} // namespace maglev