[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: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#76136}
This commit is contained in:
parent
d314be6730
commit
9b19cc5ca2
@ -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",
|
||||
|
4
BUILD.gn
4
BUILD.gn
@ -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);
|
||||
|
@ -1,3 +1,4 @@
|
||||
jkummerow@chromium.org
|
||||
leszeks@chromium.org
|
||||
rmcilroy@chromium.org
|
||||
victorgomes@chromium.org
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/compiler-dispatcher/compiler-dispatcher.h"
|
||||
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/base/platform/time.h"
|
||||
@ -21,13 +21,14 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
CompilerDispatcher::Job::Job(BackgroundCompileTask* task_arg)
|
||||
LazyCompileDispatcher::Job::Job(BackgroundCompileTask* task_arg)
|
||||
: task(task_arg), has_run(false), aborted(false) {}
|
||||
|
||||
CompilerDispatcher::Job::~Job() = default;
|
||||
LazyCompileDispatcher::Job::~Job() = default;
|
||||
|
||||
CompilerDispatcher::CompilerDispatcher(Isolate* isolate, Platform* platform,
|
||||
size_t max_stack_size)
|
||||
LazyCompileDispatcher::LazyCompileDispatcher(Isolate* isolate,
|
||||
Platform* platform,
|
||||
size_t max_stack_size)
|
||||
: isolate_(isolate),
|
||||
worker_thread_runtime_call_stats_(
|
||||
isolate->counters()->worker_thread_runtime_call_stats()),
|
||||
@ -47,20 +48,20 @@ CompilerDispatcher::CompilerDispatcher(Isolate* isolate, Platform* platform,
|
||||
block_for_testing_(false),
|
||||
semaphore_for_testing_(0) {
|
||||
if (trace_compiler_dispatcher_ && !IsEnabled()) {
|
||||
PrintF("CompilerDispatcher: dispatcher is disabled\n");
|
||||
PrintF("LazyCompileDispatcher: dispatcher is disabled\n");
|
||||
}
|
||||
}
|
||||
|
||||
CompilerDispatcher::~CompilerDispatcher() {
|
||||
// AbortAll must be called before CompilerDispatcher is destroyed.
|
||||
LazyCompileDispatcher::~LazyCompileDispatcher() {
|
||||
// AbortAll must be called before LazyCompileDispatcher is destroyed.
|
||||
CHECK(task_manager_->canceled());
|
||||
}
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> CompilerDispatcher::Enqueue(
|
||||
base::Optional<LazyCompileDispatcher::JobId> LazyCompileDispatcher::Enqueue(
|
||||
const ParseInfo* outer_parse_info, const AstRawString* function_name,
|
||||
const FunctionLiteral* function_literal) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherEnqueue");
|
||||
"V8.LazyCompilerDispatcherEnqueue");
|
||||
RCS_SCOPE(isolate_, RuntimeCallCounterId::kCompileEnqueueOnDispatcher);
|
||||
|
||||
if (!IsEnabled()) return base::nullopt;
|
||||
@ -72,8 +73,9 @@ base::Optional<CompilerDispatcher::JobId> CompilerDispatcher::Enqueue(
|
||||
JobMap::const_iterator it = InsertJob(std::move(job));
|
||||
JobId id = it->first;
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: enqueued job %zu for function literal id %d\n",
|
||||
id, function_literal->function_literal_id());
|
||||
PrintF(
|
||||
"LazyCompileDispatcher: enqueued job %zu for function literal id %d\n",
|
||||
id, function_literal->function_literal_id());
|
||||
}
|
||||
|
||||
// Post a a background worker task to perform the compilation on the worker
|
||||
@ -86,23 +88,26 @@ base::Optional<CompilerDispatcher::JobId> CompilerDispatcher::Enqueue(
|
||||
return base::make_optional(id);
|
||||
}
|
||||
|
||||
bool CompilerDispatcher::IsEnabled() const { return FLAG_compiler_dispatcher; }
|
||||
bool LazyCompileDispatcher::IsEnabled() const {
|
||||
return FLAG_lazy_compile_dispatcher;
|
||||
}
|
||||
|
||||
bool CompilerDispatcher::IsEnqueued(Handle<SharedFunctionInfo> function) const {
|
||||
bool LazyCompileDispatcher::IsEnqueued(
|
||||
Handle<SharedFunctionInfo> function) const {
|
||||
if (jobs_.empty()) return false;
|
||||
return GetJobFor(function) != jobs_.end();
|
||||
}
|
||||
|
||||
bool CompilerDispatcher::IsEnqueued(JobId job_id) const {
|
||||
bool LazyCompileDispatcher::IsEnqueued(JobId job_id) const {
|
||||
return jobs_.find(job_id) != jobs_.end();
|
||||
}
|
||||
|
||||
void CompilerDispatcher::RegisterSharedFunctionInfo(
|
||||
void LazyCompileDispatcher::RegisterSharedFunctionInfo(
|
||||
JobId job_id, SharedFunctionInfo function) {
|
||||
DCHECK_NE(jobs_.find(job_id), jobs_.end());
|
||||
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: registering ");
|
||||
PrintF("LazyCompileDispatcher: registering ");
|
||||
function.ShortPrint();
|
||||
PrintF(" with job id %zu\n", job_id);
|
||||
}
|
||||
@ -127,9 +132,9 @@ void CompilerDispatcher::RegisterSharedFunctionInfo(
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerDispatcher::WaitForJobIfRunningOnBackground(Job* job) {
|
||||
void LazyCompileDispatcher::WaitForJobIfRunningOnBackground(Job* job) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherWaitForBackgroundJob");
|
||||
"V8.LazyCompilerDispatcherWaitForBackgroundJob");
|
||||
RCS_SCOPE(isolate_, RuntimeCallCounterId::kCompileWaitForDispatcher);
|
||||
|
||||
base::MutexGuard lock(&mutex_);
|
||||
@ -146,12 +151,12 @@ void CompilerDispatcher::WaitForJobIfRunningOnBackground(Job* job) {
|
||||
DCHECK(running_background_jobs_.find(job) == running_background_jobs_.end());
|
||||
}
|
||||
|
||||
bool CompilerDispatcher::FinishNow(Handle<SharedFunctionInfo> function) {
|
||||
bool LazyCompileDispatcher::FinishNow(Handle<SharedFunctionInfo> function) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherFinishNow");
|
||||
"V8.LazyCompilerDispatcherFinishNow");
|
||||
RCS_SCOPE(isolate_, RuntimeCallCounterId::kCompileFinishNowOnDispatcher);
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: finishing ");
|
||||
PrintF("LazyCompileDispatcher: finishing ");
|
||||
function->ShortPrint();
|
||||
PrintF(" now\n");
|
||||
}
|
||||
@ -176,9 +181,9 @@ bool CompilerDispatcher::FinishNow(Handle<SharedFunctionInfo> function) {
|
||||
return success;
|
||||
}
|
||||
|
||||
void CompilerDispatcher::AbortJob(JobId job_id) {
|
||||
void LazyCompileDispatcher::AbortJob(JobId job_id) {
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: aborted job %zu\n", job_id);
|
||||
PrintF("LazyCompileDispatcher: aborted job %zu\n", job_id);
|
||||
}
|
||||
JobMap::const_iterator job_it = jobs_.find(job_id);
|
||||
Job* job = job_it->second.get();
|
||||
@ -194,13 +199,13 @@ void CompilerDispatcher::AbortJob(JobId job_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerDispatcher::AbortAll() {
|
||||
void LazyCompileDispatcher::AbortAll() {
|
||||
task_manager_->TryAbortAll();
|
||||
|
||||
for (auto& it : jobs_) {
|
||||
WaitForJobIfRunningOnBackground(it.second.get());
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: aborted job %zu\n", it.first);
|
||||
PrintF("LazyCompileDispatcher: aborted job %zu\n", it.first);
|
||||
}
|
||||
}
|
||||
jobs_.clear();
|
||||
@ -214,7 +219,7 @@ void CompilerDispatcher::AbortAll() {
|
||||
task_manager_->CancelAndWait();
|
||||
}
|
||||
|
||||
CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::GetJobFor(
|
||||
LazyCompileDispatcher::JobMap::const_iterator LazyCompileDispatcher::GetJobFor(
|
||||
Handle<SharedFunctionInfo> shared) const {
|
||||
JobId* job_id_ptr = shared_to_unoptimized_job_id_.Find(shared);
|
||||
JobMap::const_iterator job = jobs_.end();
|
||||
@ -224,7 +229,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::GetJobFor(
|
||||
return job;
|
||||
}
|
||||
|
||||
void CompilerDispatcher::ScheduleIdleTaskFromAnyThread(
|
||||
void LazyCompileDispatcher::ScheduleIdleTaskFromAnyThread(
|
||||
const base::MutexGuard&) {
|
||||
if (!taskrunner_->IdleTasksEnabled()) return;
|
||||
if (idle_task_scheduled_) return;
|
||||
@ -235,9 +240,9 @@ void CompilerDispatcher::ScheduleIdleTaskFromAnyThread(
|
||||
[this](double deadline_in_seconds) { DoIdleWork(deadline_in_seconds); }));
|
||||
}
|
||||
|
||||
void CompilerDispatcher::ScheduleMoreWorkerTasksIfNeeded() {
|
||||
void LazyCompileDispatcher::ScheduleMoreWorkerTasksIfNeeded() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherScheduleMoreWorkerTasksIfNeeded");
|
||||
"V8.LazyCompilerDispatcherScheduleMoreWorkerTasksIfNeeded");
|
||||
{
|
||||
base::MutexGuard lock(&mutex_);
|
||||
if (pending_background_jobs_.empty()) return;
|
||||
@ -250,9 +255,9 @@ void CompilerDispatcher::ScheduleMoreWorkerTasksIfNeeded() {
|
||||
MakeCancelableTask(task_manager_.get(), [this] { DoBackgroundWork(); }));
|
||||
}
|
||||
|
||||
void CompilerDispatcher::DoBackgroundWork() {
|
||||
void LazyCompileDispatcher::DoBackgroundWork() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherDoBackgroundWork");
|
||||
"V8.LazyCompilerDispatcherDoBackgroundWork");
|
||||
for (;;) {
|
||||
Job* job = nullptr;
|
||||
{
|
||||
@ -272,7 +277,7 @@ void CompilerDispatcher::DoBackgroundWork() {
|
||||
}
|
||||
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: doing background work\n");
|
||||
PrintF("LazyCompileDispatcher: doing background work\n");
|
||||
}
|
||||
|
||||
job->task->Run();
|
||||
@ -303,22 +308,22 @@ void CompilerDispatcher::DoBackgroundWork() {
|
||||
// deleted.
|
||||
}
|
||||
|
||||
void CompilerDispatcher::DoIdleWork(double deadline_in_seconds) {
|
||||
void LazyCompileDispatcher::DoIdleWork(double deadline_in_seconds) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||
"V8.CompilerDispatcherDoIdleWork");
|
||||
"V8.LazyCompilerDispatcherDoIdleWork");
|
||||
{
|
||||
base::MutexGuard lock(&mutex_);
|
||||
idle_task_scheduled_ = false;
|
||||
}
|
||||
|
||||
if (trace_compiler_dispatcher_) {
|
||||
PrintF("CompilerDispatcher: received %0.1lfms of idle time\n",
|
||||
PrintF("LazyCompileDispatcher: received %0.1lfms of idle time\n",
|
||||
(deadline_in_seconds - platform_->MonotonicallyIncreasingTime()) *
|
||||
static_cast<double>(base::Time::kMillisecondsPerSecond));
|
||||
}
|
||||
while (deadline_in_seconds > platform_->MonotonicallyIncreasingTime()) {
|
||||
// Find a job which is pending finalization and has a shared function info
|
||||
CompilerDispatcher::JobMap::const_iterator it;
|
||||
LazyCompileDispatcher::JobMap::const_iterator it;
|
||||
{
|
||||
base::MutexGuard lock(&mutex_);
|
||||
for (it = jobs_.cbegin(); it != jobs_.cend(); ++it) {
|
||||
@ -351,7 +356,7 @@ void CompilerDispatcher::DoIdleWork(double deadline_in_seconds) {
|
||||
}
|
||||
}
|
||||
|
||||
CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::InsertJob(
|
||||
LazyCompileDispatcher::JobMap::const_iterator LazyCompileDispatcher::InsertJob(
|
||||
std::unique_ptr<Job> job) {
|
||||
bool added;
|
||||
JobMap::const_iterator it;
|
||||
@ -361,8 +366,8 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::InsertJob(
|
||||
return it;
|
||||
}
|
||||
|
||||
CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveJob(
|
||||
CompilerDispatcher::JobMap::const_iterator it) {
|
||||
LazyCompileDispatcher::JobMap::const_iterator LazyCompileDispatcher::RemoveJob(
|
||||
LazyCompileDispatcher::JobMap::const_iterator it) {
|
||||
Job* job = it->second.get();
|
||||
|
||||
DCHECK_EQ(running_background_jobs_.find(job), running_background_jobs_.end());
|
@ -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"
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/compiler-dispatcher/compiler-dispatcher.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "include/v8-platform.h"
|
||||
@ -13,6 +11,7 @@
|
||||
#include "src/ast/scopes.h"
|
||||
#include "src/base/platform/semaphore.h"
|
||||
#include "src/codegen/compiler.h"
|
||||
#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
|
||||
#include "src/flags/flags.h"
|
||||
#include "src/handles/handles.h"
|
||||
#include "src/init/v8.h"
|
||||
@ -27,17 +26,18 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
class CompilerDispatcherTestFlags {
|
||||
class LazyCompilerDispatcherTestFlags {
|
||||
public:
|
||||
CompilerDispatcherTestFlags(const CompilerDispatcherTestFlags&) = delete;
|
||||
CompilerDispatcherTestFlags& operator=(const CompilerDispatcherTestFlags&) =
|
||||
LazyCompilerDispatcherTestFlags(const LazyCompilerDispatcherTestFlags&) =
|
||||
delete;
|
||||
LazyCompilerDispatcherTestFlags& operator=(
|
||||
const LazyCompilerDispatcherTestFlags&) = delete;
|
||||
static void SetFlagsForTest() {
|
||||
CHECK_NULL(save_flags_);
|
||||
save_flags_ = new SaveFlags();
|
||||
FLAG_single_threaded = true;
|
||||
FlagList::EnforceFlagImplications();
|
||||
FLAG_compiler_dispatcher = true;
|
||||
FLAG_lazy_compile_dispatcher = true;
|
||||
FLAG_finalize_streaming_on_background = false;
|
||||
}
|
||||
|
||||
@ -51,28 +51,30 @@ class CompilerDispatcherTestFlags {
|
||||
static SaveFlags* save_flags_;
|
||||
};
|
||||
|
||||
SaveFlags* CompilerDispatcherTestFlags::save_flags_ = nullptr;
|
||||
SaveFlags* LazyCompilerDispatcherTestFlags::save_flags_ = nullptr;
|
||||
|
||||
class CompilerDispatcherTest : public TestWithNativeContext {
|
||||
class LazyCompilerDispatcherTest : public TestWithNativeContext {
|
||||
public:
|
||||
CompilerDispatcherTest() = default;
|
||||
~CompilerDispatcherTest() override = default;
|
||||
CompilerDispatcherTest(const CompilerDispatcherTest&) = delete;
|
||||
CompilerDispatcherTest& operator=(const CompilerDispatcherTest&) = delete;
|
||||
LazyCompilerDispatcherTest() = default;
|
||||
~LazyCompilerDispatcherTest() override = default;
|
||||
LazyCompilerDispatcherTest(const LazyCompilerDispatcherTest&) = delete;
|
||||
LazyCompilerDispatcherTest& operator=(const LazyCompilerDispatcherTest&) =
|
||||
delete;
|
||||
|
||||
static void SetUpTestCase() {
|
||||
CompilerDispatcherTestFlags::SetFlagsForTest();
|
||||
LazyCompilerDispatcherTestFlags::SetFlagsForTest();
|
||||
TestWithNativeContext::SetUpTestCase();
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
TestWithNativeContext::TearDownTestCase();
|
||||
CompilerDispatcherTestFlags::RestoreFlags();
|
||||
LazyCompilerDispatcherTestFlags::RestoreFlags();
|
||||
}
|
||||
|
||||
static base::Optional<CompilerDispatcher::JobId> EnqueueUnoptimizedCompileJob(
|
||||
CompilerDispatcher* dispatcher, Isolate* isolate,
|
||||
Handle<SharedFunctionInfo> shared) {
|
||||
static base::Optional<LazyCompileDispatcher::JobId>
|
||||
EnqueueUnoptimizedCompileJob(LazyCompileDispatcher* dispatcher,
|
||||
Isolate* isolate,
|
||||
Handle<SharedFunctionInfo> shared) {
|
||||
UnoptimizedCompileState state(isolate);
|
||||
std::unique_ptr<ParseInfo> outer_parse_info =
|
||||
test::OuterParseInfoForShared(isolate, shared, &state);
|
||||
@ -333,22 +335,22 @@ class MockPlatform : public v8::Platform {
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_F(CompilerDispatcherTest, Construct) {
|
||||
TEST_F(LazyCompilerDispatcherTest, Construct) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, IsEnqueued) {
|
||||
TEST_F(LazyCompilerDispatcherTest, IsEnqueued) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
ASSERT_FALSE(dispatcher.IsEnqueued(shared));
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
|
||||
ASSERT_TRUE(job_id);
|
||||
@ -368,15 +370,15 @@ TEST_F(CompilerDispatcherTest, IsEnqueued) {
|
||||
platform.ClearWorkerTasks();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, FinishNow) {
|
||||
TEST_F(LazyCompilerDispatcherTest, FinishNow) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id, *shared);
|
||||
|
||||
@ -391,16 +393,16 @@ TEST_F(CompilerDispatcherTest, FinishNow) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, CompileAndFinalize) {
|
||||
TEST_F(LazyCompilerDispatcherTest, CompileAndFinalize) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
ASSERT_FALSE(platform.IdleTaskPending());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
ASSERT_TRUE(platform.WorkerTasksPending());
|
||||
|
||||
@ -426,16 +428,16 @@ TEST_F(CompilerDispatcherTest, CompileAndFinalize) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, IdleTaskNoIdleTime) {
|
||||
TEST_F(LazyCompilerDispatcherTest, IdleTaskNoIdleTime) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
ASSERT_FALSE(platform.IdleTaskPending());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id, *shared);
|
||||
|
||||
@ -468,9 +470,9 @@ TEST_F(CompilerDispatcherTest, IdleTaskNoIdleTime) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) {
|
||||
TEST_F(LazyCompilerDispatcherTest, IdleTaskSmallIdleTime) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared_1 =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
@ -479,9 +481,9 @@ TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) {
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared_2->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_1 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_1 =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_1);
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_2 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_2 =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2);
|
||||
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id_1, *shared_1);
|
||||
@ -518,9 +520,9 @@ TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, IdleTaskException) {
|
||||
TEST_F(LazyCompilerDispatcherTest, IdleTaskException) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, 50);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, 50);
|
||||
|
||||
std::string raw_script("(x) { var a = ");
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
@ -534,7 +536,7 @@ TEST_F(CompilerDispatcherTest, IdleTaskException) {
|
||||
test::CreateSharedFunctionInfo(i_isolate(), script);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id, *shared);
|
||||
|
||||
@ -549,15 +551,15 @@ TEST_F(CompilerDispatcherTest, IdleTaskException) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, FinishNowWithWorkerTask) {
|
||||
TEST_F(LazyCompilerDispatcherTest, FinishNowWithWorkerTask) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id, *shared);
|
||||
|
||||
@ -582,9 +584,9 @@ TEST_F(CompilerDispatcherTest, FinishNowWithWorkerTask) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, IdleTaskMultipleJobs) {
|
||||
TEST_F(LazyCompilerDispatcherTest, IdleTaskMultipleJobs) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared_1 =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
@ -593,9 +595,9 @@ TEST_F(CompilerDispatcherTest, IdleTaskMultipleJobs) {
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared_2->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_1 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_1 =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_1);
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_2 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_2 =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2);
|
||||
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id_1, *shared_1);
|
||||
@ -617,9 +619,9 @@ TEST_F(CompilerDispatcherTest, IdleTaskMultipleJobs) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, FinishNowException) {
|
||||
TEST_F(LazyCompilerDispatcherTest, FinishNowException) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, 50);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, 50);
|
||||
|
||||
std::string raw_script("(x) { var a = ");
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
@ -633,7 +635,7 @@ TEST_F(CompilerDispatcherTest, FinishNowException) {
|
||||
test::CreateSharedFunctionInfo(i_isolate(), script);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id, *shared);
|
||||
|
||||
@ -649,15 +651,15 @@ TEST_F(CompilerDispatcherTest, FinishNowException) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, AbortJobNotStarted) {
|
||||
TEST_F(LazyCompilerDispatcherTest, AbortJobNotStarted) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
|
||||
ASSERT_EQ(dispatcher.jobs_.size(), 1u);
|
||||
@ -679,15 +681,15 @@ TEST_F(CompilerDispatcherTest, AbortJobNotStarted) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, AbortJobAlreadyStarted) {
|
||||
TEST_F(LazyCompilerDispatcherTest, AbortJobAlreadyStarted) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared);
|
||||
|
||||
ASSERT_EQ(dispatcher.jobs_.size(), 1u);
|
||||
@ -744,10 +746,10 @@ TEST_F(CompilerDispatcherTest, AbortJobAlreadyStarted) {
|
||||
dispatcher.AbortAll();
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, CompileLazyFinishesDispatcherJob) {
|
||||
TEST_F(LazyCompilerDispatcherTest, CompileLazyFinishesDispatcherJob) {
|
||||
// Use the real dispatcher so that CompileLazy checks the same one for
|
||||
// enqueued functions.
|
||||
CompilerDispatcher* dispatcher = i_isolate()->compiler_dispatcher();
|
||||
LazyCompileDispatcher* dispatcher = i_isolate()->lazy_compile_dispatcher();
|
||||
|
||||
const char raw_script[] = "function lazy() { return 42; }; lazy;";
|
||||
test::ScriptResource* script =
|
||||
@ -756,7 +758,7 @@ TEST_F(CompilerDispatcherTest, CompileLazyFinishesDispatcherJob) {
|
||||
Handle<SharedFunctionInfo> shared(f->shared(), i_isolate());
|
||||
ASSERT_FALSE(shared->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id =
|
||||
EnqueueUnoptimizedCompileJob(dispatcher, i_isolate(), shared);
|
||||
dispatcher->RegisterSharedFunctionInfo(*job_id, *shared);
|
||||
|
||||
@ -767,10 +769,10 @@ TEST_F(CompilerDispatcherTest, CompileLazyFinishesDispatcherJob) {
|
||||
ASSERT_FALSE(dispatcher->IsEnqueued(shared));
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, CompileLazy2FinishesDispatcherJob) {
|
||||
TEST_F(LazyCompilerDispatcherTest, CompileLazy2FinishesDispatcherJob) {
|
||||
// Use the real dispatcher so that CompileLazy checks the same one for
|
||||
// enqueued functions.
|
||||
CompilerDispatcher* dispatcher = i_isolate()->compiler_dispatcher();
|
||||
LazyCompileDispatcher* dispatcher = i_isolate()->lazy_compile_dispatcher();
|
||||
|
||||
const char raw_source_2[] = "function lazy2() { return 42; }; lazy2;";
|
||||
test::ScriptResource* source_2 =
|
||||
@ -786,11 +788,11 @@ TEST_F(CompilerDispatcherTest, CompileLazy2FinishesDispatcherJob) {
|
||||
Handle<SharedFunctionInfo> shared_1(lazy1->shared(), i_isolate());
|
||||
ASSERT_FALSE(shared_1->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_1 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_1 =
|
||||
EnqueueUnoptimizedCompileJob(dispatcher, i_isolate(), shared_1);
|
||||
dispatcher->RegisterSharedFunctionInfo(*job_id_1, *shared_1);
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_2 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_2 =
|
||||
EnqueueUnoptimizedCompileJob(dispatcher, i_isolate(), shared_2);
|
||||
dispatcher->RegisterSharedFunctionInfo(*job_id_2, *shared_2);
|
||||
|
||||
@ -804,9 +806,9 @@ TEST_F(CompilerDispatcherTest, CompileLazy2FinishesDispatcherJob) {
|
||||
ASSERT_FALSE(dispatcher->IsEnqueued(shared_2));
|
||||
}
|
||||
|
||||
TEST_F(CompilerDispatcherTest, CompileMultipleOnBackgroundThread) {
|
||||
TEST_F(LazyCompilerDispatcherTest, CompileMultipleOnBackgroundThread) {
|
||||
MockPlatform platform;
|
||||
CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
LazyCompileDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size);
|
||||
|
||||
Handle<SharedFunctionInfo> shared_1 =
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
@ -816,11 +818,11 @@ TEST_F(CompilerDispatcherTest, CompileMultipleOnBackgroundThread) {
|
||||
test::CreateSharedFunctionInfo(i_isolate(), nullptr);
|
||||
ASSERT_FALSE(shared_2->is_compiled());
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_1 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_1 =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_1);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id_1, *shared_1);
|
||||
|
||||
base::Optional<CompilerDispatcher::JobId> job_id_2 =
|
||||
base::Optional<LazyCompileDispatcher::JobId> job_id_2 =
|
||||
EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2);
|
||||
dispatcher.RegisterSharedFunctionInfo(*job_id_2, *shared_2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user