Commit 9b19cc5c authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[cleanup] Rename CompilerDispatcher

We would like to use the name CompilerDispatcher for dispatcher base
class to be used by Sparkplug and OptimizingCompileDispatcher.

Bug: v8:12054
Change-Id: Id69955101c1f46fc2f79b6f77b05c92ed8a31edb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3077150
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76136}
parent d314be67
......@@ -1048,8 +1048,8 @@ filegroup(
"src/common/message-template.h",
"src/common/ptr-compr-inl.h",
"src/common/ptr-compr.h",
"src/compiler-dispatcher/compiler-dispatcher.cc",
"src/compiler-dispatcher/compiler-dispatcher.h",
"src/compiler-dispatcher/lazy-compile-dispatcher.cc",
"src/compiler-dispatcher/lazy-compile-dispatcher.h",
"src/compiler-dispatcher/optimizing-compile-dispatcher.cc",
"src/compiler-dispatcher/optimizing-compile-dispatcher.h",
"src/date/date.cc",
......
......@@ -2496,7 +2496,7 @@ v8_header_set("v8_internal_headers") {
"src/common/message-template.h",
"src/common/ptr-compr-inl.h",
"src/common/ptr-compr.h",
"src/compiler-dispatcher/compiler-dispatcher.h",
"src/compiler-dispatcher/lazy-compile-dispatcher.h",
"src/compiler-dispatcher/optimizing-compile-dispatcher.h",
"src/compiler/access-builder.h",
"src/compiler/access-info.h",
......@@ -3799,7 +3799,7 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/turbo-assembler.cc",
"src/codegen/unoptimized-compilation-info.cc",
"src/common/assert-scope.cc",
"src/compiler-dispatcher/compiler-dispatcher.cc",
"src/compiler-dispatcher/lazy-compile-dispatcher.cc",
"src/compiler-dispatcher/optimizing-compile-dispatcher.cc",
"src/date/date.cc",
"src/date/dateparser.cc",
......
......@@ -34,7 +34,7 @@
#include "src/common/assert-scope.h"
#include "src/common/external-pointer.h"
#include "src/common/globals.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
#include "src/date/date.h"
#include "src/debug/liveedit.h"
#include "src/deoptimizer/deoptimizer.h"
......
......@@ -24,7 +24,7 @@
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/common/message-template.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
#include "src/compiler/pipeline.h"
#include "src/debug/debug.h"
......@@ -1285,10 +1285,10 @@ void FinalizeUnoptimizedScriptCompilation(
UnoptimizedCompileState::ParallelTasks* parallel_tasks =
compile_state->parallel_tasks();
if (parallel_tasks) {
CompilerDispatcher* dispatcher = parallel_tasks->dispatcher();
LazyCompileDispatcher* dispatcher = parallel_tasks->dispatcher();
for (auto& it : *parallel_tasks) {
FunctionLiteral* literal = it.first;
CompilerDispatcher::JobId job_id = it.second;
LazyCompileDispatcher::JobId job_id = it.second;
MaybeHandle<SharedFunctionInfo> maybe_shared_for_task =
Script::FindSharedFunctionInfo(script, isolate, literal);
Handle<SharedFunctionInfo> shared_for_task;
......@@ -1812,7 +1812,7 @@ bool Compiler::Compile(Isolate* isolate, Handle<SharedFunctionInfo> shared_info,
ParseInfo parse_info(isolate, flags, &compile_state);
// Check if the compiler dispatcher has shared_info enqueued for compile.
CompilerDispatcher* dispatcher = isolate->compiler_dispatcher();
LazyCompileDispatcher* dispatcher = isolate->lazy_compile_dispatcher();
if (dispatcher->IsEnqueued(shared_info)) {
if (!dispatcher->FinishNow(shared_info)) {
return FailWithPendingException(isolate, script, &parse_info, flag);
......
jkummerow@chromium.org
leszeks@chromium.org
rmcilroy@chromium.org
victorgomes@chromium.org
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_
#define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_
#ifndef V8_COMPILER_DISPATCHER_LAZY_COMPILE_DISPATCHER_H_
#define V8_COMPILER_DISPATCHER_LAZY_COMPILE_DISPATCHER_H_
#include <cstdint>
#include <map>
......@@ -34,7 +34,6 @@ class AstValueFactory;
class BackgroundCompileTask;
class CancelableTaskManager;
class UnoptimizedCompileJob;
class CompilerDispatcherTracer;
class FunctionLiteral;
class Isolate;
class ParseInfo;
......@@ -46,8 +45,8 @@ class Zone;
template <typename T>
class Handle;
// The CompilerDispatcher uses a combination of idle tasks and background tasks
// to parse and compile lazily parsed functions.
// The LazyCompileDispatcher uses a combination of idle tasks and background
// tasks to parse and compile lazily parsed functions.
//
// As both parsing and compilation currently requires a preparation and
// finalization step that happens on the main thread, every task has to be
......@@ -55,32 +54,32 @@ class Handle;
// can then be parsed or compiled on either background threads, or during idle
// time. Last, it has to be finalized during idle time again.
//
// CompilerDispatcher::jobs_ maintains the list of all CompilerDispatcherJobs
// the CompilerDispatcher knows about.
// LazyCompileDispatcher::jobs_ maintains the list of all
// LazyCompilerDispatcherJobs the LazyCompileDispatcher knows about.
//
// CompilerDispatcher::pending_background_jobs_ contains the set of
// CompilerDispatcherJobs that can be processed on a background thread.
// LazyCompileDispatcher::pending_background_jobs_ contains the set of
// LazyCompilerDispatcherJobs that can be processed on a background thread.
//
// CompilerDispatcher::running_background_jobs_ contains the set of
// CompilerDispatcherJobs that are currently being processed on a background
// LazyCompileDispatcher::running_background_jobs_ contains the set of
// LazyCompilerDispatcherJobs that are currently being processed on a background
// thread.
//
// CompilerDispatcher::DoIdleWork tries to advance as many jobs out of jobs_ as
// possible during idle time. If a job can't be advanced, but is suitable for
// LazyCompileDispatcher::DoIdleWork tries to advance as many jobs out of jobs_
// as possible during idle time. If a job can't be advanced, but is suitable for
// background processing, it fires off background threads.
//
// CompilerDispatcher::DoBackgroundWork advances one of the pending jobs, and
// then spins of another idle task to potentially do the final step on the main
// thread.
class V8_EXPORT_PRIVATE CompilerDispatcher {
// LazyCompileDispatcher::DoBackgroundWork advances one of the pending jobs,
// and then spins of another idle task to potentially do the final step on the
// main thread.
class V8_EXPORT_PRIVATE LazyCompileDispatcher {
public:
using JobId = uintptr_t;
CompilerDispatcher(Isolate* isolate, Platform* platform,
size_t max_stack_size);
CompilerDispatcher(const CompilerDispatcher&) = delete;
CompilerDispatcher& operator=(const CompilerDispatcher&) = delete;
~CompilerDispatcher();
LazyCompileDispatcher(Isolate* isolate, Platform* platform,
size_t max_stack_size);
LazyCompileDispatcher(const LazyCompileDispatcher&) = delete;
LazyCompileDispatcher& operator=(const LazyCompileDispatcher&) = delete;
~LazyCompileDispatcher();
// Returns true if the compiler dispatcher is enabled.
bool IsEnabled() const;
......@@ -109,14 +108,14 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
void AbortAll();
private:
FRIEND_TEST(CompilerDispatcherTest, IdleTaskNoIdleTime);
FRIEND_TEST(CompilerDispatcherTest, IdleTaskSmallIdleTime);
FRIEND_TEST(CompilerDispatcherTest, FinishNowWithWorkerTask);
FRIEND_TEST(CompilerDispatcherTest, AbortJobNotStarted);
FRIEND_TEST(CompilerDispatcherTest, AbortJobAlreadyStarted);
FRIEND_TEST(CompilerDispatcherTest, AsyncAbortAllPendingWorkerTask);
FRIEND_TEST(CompilerDispatcherTest, AsyncAbortAllRunningWorkerTask);
FRIEND_TEST(CompilerDispatcherTest, CompileMultipleOnBackgroundThread);
FRIEND_TEST(LazyCompilerDispatcherTest, IdleTaskNoIdleTime);
FRIEND_TEST(LazyCompilerDispatcherTest, IdleTaskSmallIdleTime);
FRIEND_TEST(LazyCompilerDispatcherTest, FinishNowWithWorkerTask);
FRIEND_TEST(LazyCompilerDispatcherTest, AbortJobNotStarted);
FRIEND_TEST(LazyCompilerDispatcherTest, AbortJobAlreadyStarted);
FRIEND_TEST(LazyCompilerDispatcherTest, AsyncAbortAllPendingWorkerTask);
FRIEND_TEST(LazyCompilerDispatcherTest, AsyncAbortAllRunningWorkerTask);
FRIEND_TEST(LazyCompilerDispatcherTest, CompileMultipleOnBackgroundThread);
struct Job {
explicit Job(BackgroundCompileTask* task_arg);
......@@ -202,4 +201,4 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_
#endif // V8_COMPILER_DISPATCHER_LAZY_COMPILE_DISPATCHER_H_
......@@ -32,7 +32,7 @@
#include "src/codegen/flush-instruction-cache.h"
#include "src/common/assert-scope.h"
#include "src/common/ptr-compr.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
#include "src/date/date.h"
#include "src/debug/debug-frames.h"
......@@ -3633,8 +3633,8 @@ bool Isolate::Init(SnapshotData* startup_snapshot_data,
string_table_.reset(new StringTable(this));
bigint_processor_ = bigint::Processor::New(new BigIntPlatform(this));
compiler_dispatcher_ =
new CompilerDispatcher(this, V8::GetCurrentPlatform(), FLAG_stack_size);
compiler_dispatcher_ = new LazyCompileDispatcher(
this, V8::GetCurrentPlatform(), FLAG_stack_size);
baseline_batch_compiler_ = new baseline::BaselineBatchCompiler(this);
// Enable logging before setting up the heap
......
......@@ -82,7 +82,6 @@ class CodeTracer;
class CommonFrame;
class CompilationCache;
class CompilationStatistics;
class CompilerDispatcher;
class Counters;
class Debug;
class Deoptimizer;
......@@ -93,6 +92,7 @@ class HandleScopeImplementer;
class HeapObjectToIndexHashMap;
class HeapProfiler;
class InnerPointerToCodeCache;
class LazyCompileDispatcher;
class LocalIsolate;
class Logger;
class MaterializedObjectStore;
......@@ -1628,7 +1628,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
AccountingAllocator* allocator() { return allocator_; }
CompilerDispatcher* compiler_dispatcher() const {
LazyCompileDispatcher* lazy_compile_dispatcher() const {
return compiler_dispatcher_;
}
......@@ -2098,7 +2098,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
// through all compilations (and thus all JSHeapBroker instances).
Zone* compiler_zone_ = nullptr;
CompilerDispatcher* compiler_dispatcher_ = nullptr;
LazyCompileDispatcher* compiler_dispatcher_ = nullptr;
baseline::BaselineBatchCompiler* baseline_batch_compiler_ = nullptr;
using InterruptEntry = std::pair<InterruptCallback, void*>;
......
......@@ -1475,10 +1475,10 @@ DEFINE_BOOL(compilation_cache, true, "enable compilation cache")
DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
// compiler-dispatcher.cc
// lazy-compile-dispatcher.cc
DEFINE_BOOL(parallel_compile_tasks, false, "enable parallel compile tasks")
DEFINE_BOOL(compiler_dispatcher, false, "enable compiler dispatcher")
DEFINE_IMPLICATION(parallel_compile_tasks, compiler_dispatcher)
DEFINE_BOOL(lazy_compile_dispatcher, false, "enable compiler dispatcher")
DEFINE_IMPLICATION(parallel_compile_tasks, lazy_compile_dispatcher)
DEFINE_BOOL(trace_compiler_dispatcher, false,
"trace compiler dispatcher activity")
......@@ -2069,7 +2069,7 @@ DEFINE_NEG_IMPLICATION(predictable, memory_reducer)
// before. Audit them, and remove any unneeded implications.
DEFINE_IMPLICATION(predictable, single_threaded_gc)
DEFINE_NEG_IMPLICATION(predictable, concurrent_recompilation)
DEFINE_NEG_IMPLICATION(predictable, compiler_dispatcher)
DEFINE_NEG_IMPLICATION(predictable, lazy_compile_dispatcher)
DEFINE_NEG_IMPLICATION(predictable, stress_concurrent_inlining)
DEFINE_BOOL(predictable_gc_schedule, false,
......@@ -2087,7 +2087,7 @@ DEFINE_NEG_IMPLICATION(predictable_gc_schedule, memory_reducer)
DEFINE_BOOL(single_threaded, false, "disable the use of background tasks")
DEFINE_IMPLICATION(single_threaded, single_threaded_gc)
DEFINE_NEG_IMPLICATION(single_threaded, concurrent_recompilation)
DEFINE_NEG_IMPLICATION(single_threaded, compiler_dispatcher)
DEFINE_NEG_IMPLICATION(single_threaded, lazy_compile_dispatcher)
DEFINE_NEG_IMPLICATION(single_threaded, stress_concurrent_inlining)
//
......
......@@ -9,7 +9,7 @@
#include "src/ast/ast.h"
#include "src/base/logging.h"
#include "src/common/globals.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
#include "src/heap/heap-inl.h"
#include "src/logging/counters.h"
#include "src/logging/log.h"
......@@ -168,9 +168,10 @@ UnoptimizedCompileState::UnoptimizedCompileState(Isolate* isolate)
allocator_(isolate->allocator()),
ast_string_constants_(isolate->ast_string_constants()),
logger_(isolate->logger()),
parallel_tasks_(isolate->compiler_dispatcher()->IsEnabled()
? new ParallelTasks(isolate->compiler_dispatcher())
: nullptr) {}
parallel_tasks_(
isolate->lazy_compile_dispatcher()->IsEnabled()
? new ParallelTasks(isolate->lazy_compile_dispatcher())
: nullptr) {}
UnoptimizedCompileState::UnoptimizedCompileState(
const UnoptimizedCompileState& other) V8_NOEXCEPT
......@@ -332,7 +333,7 @@ void ParseInfo::CheckFlagsForFunctionFromScript(Script script) {
void UnoptimizedCompileState::ParallelTasks::Enqueue(
ParseInfo* outer_parse_info, const AstRawString* function_name,
FunctionLiteral* literal) {
base::Optional<CompilerDispatcher::JobId> job_id =
base::Optional<LazyCompileDispatcher::JobId> job_id =
dispatcher_->Enqueue(outer_parse_info, function_name, literal);
if (job_id) {
enqueued_jobs_.emplace_front(std::make_pair(literal, *job_id));
......
......@@ -31,7 +31,7 @@ class AccountingAllocator;
class AstRawString;
class AstStringConstants;
class AstValueFactory;
class CompilerDispatcher;
class LazyCompileDispatcher;
class DeclarationScope;
class FunctionLiteral;
class RuntimeCallStats;
......@@ -155,8 +155,8 @@ class V8_EXPORT_PRIVATE UnoptimizedCompileState {
class ParallelTasks {
public:
explicit ParallelTasks(CompilerDispatcher* compiler_dispatcher)
: dispatcher_(compiler_dispatcher) {
explicit ParallelTasks(LazyCompileDispatcher* lazy_compile_dispatcher)
: dispatcher_(lazy_compile_dispatcher) {
DCHECK_NOT_NULL(dispatcher_);
}
......@@ -169,10 +169,10 @@ class V8_EXPORT_PRIVATE UnoptimizedCompileState {
EnqueuedJobsIterator begin() { return enqueued_jobs_.begin(); }
EnqueuedJobsIterator end() { return enqueued_jobs_.end(); }
CompilerDispatcher* dispatcher() { return dispatcher_; }
LazyCompileDispatcher* dispatcher() { return dispatcher_; }
private:
CompilerDispatcher* dispatcher_;
LazyCompileDispatcher* dispatcher_;
std::forward_list<std::pair<FunctionLiteral*, uintptr_t>> enqueued_jobs_;
};
......
......@@ -17,7 +17,7 @@
#include "src/codegen/bailout-reason.h"
#include "src/common/globals.h"
#include "src/common/message-template.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
#include "src/logging/counters.h"
#include "src/logging/log.h"
#include "src/logging/runtime-call-stats-scope.h"
......
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