Commit 4c48ca25 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

Reland "[baseline] Add max threads flags for CSP"

Moved DEFINE_UINT after the #ifdef block, so it is also defined
for Mac arm64.

This is a reland of 6aadf0e0

Original change's description:
> [baseline] Add max threads flags for CSP
>
> Bug: v8:12054
> Change-Id: I49238fe673858b60c2a2a935ed1f45f465269216
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3308707
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> Reviewed-by: Camillo Bruni <cbruni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#78187}

Bug: v8:12054
Change-Id: Ica352b2f099fff875411c0e1915bcddb4ca48061
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3310800Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78192}
parent 8820094a
......@@ -9,6 +9,8 @@
#include "src/flags/flags.h"
#if ENABLE_SPARKPLUG
#include <algorithm>
#include "src/baseline/baseline-compiler.h"
#include "src/codegen/compiler.h"
#include "src/execution/isolate.h"
......@@ -181,6 +183,10 @@ class ConcurrentBaselineCompiler {
}
size_t GetMaxConcurrency(size_t worker_count) const override {
size_t max_threads = FLAG_concurrent_sparkplug_max_threads;
if (max_threads > 0) {
return std::min(max_threads, incoming_queue_->size());
}
return incoming_queue_->size();
}
......
......@@ -713,6 +713,9 @@ DEFINE_WEAK_IMPLICATION(future, concurrent_sparkplug)
DEFINE_NEG_IMPLICATION(predictable, concurrent_sparkplug)
DEFINE_NEG_IMPLICATION(single_threaded, concurrent_sparkplug)
#endif
DEFINE_UINT(
concurrent_sparkplug_max_threads, 0,
"max number of threads that concurrent Sparkplug can use (0 for unbounded)")
#else
DEFINE_BOOL(baseline_batch_compilation, false, "batch compile Sparkplug code")
DEFINE_BOOL_READONLY(concurrent_sparkplug, false,
......
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