#include "src/compiler-dispatcher/lazy-compile-dispatcher.h"
#include <atomic>
#include "include/v8-platform.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/time.h"
#include "src/codegen/compiler.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/flags/flags.h"
#include "src/heap/parked-scope.h"
#include "src/logging/counters.h"
#include "src/logging/runtime-call-stats-scope.h"
#include "src/objects/instance-type.h"
#include "src/objects/objects-inl.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/scanner.h"
#include "src/tasks/cancelable-task.h"
#include "src/tasks/task-utils.h"
#include "src/zone/zone-list-inl.h"
namespace v8 {
namespace internal {
static constexpr int kMaxOpportunisticFinalizeTimeMs = …;
class LazyCompileDispatcher::JobTask : public v8::JobTask { … };
LazyCompileDispatcher::Job::Job(std::unique_ptr<BackgroundCompileTask> task)
: … { … }
LazyCompileDispatcher::Job::~Job() = default;
LazyCompileDispatcher::LazyCompileDispatcher(Isolate* isolate,
Platform* platform,
size_t max_stack_size)
: … { … }
LazyCompileDispatcher::~LazyCompileDispatcher() { … }
namespace {
void SetUncompiledDataJobPointer(LocalIsolate* isolate,
DirectHandle<SharedFunctionInfo> shared_info,
Address job_address) { … }
}
void LazyCompileDispatcher::Enqueue(
LocalIsolate* isolate, Handle<SharedFunctionInfo> shared_info,
std::unique_ptr<Utf16CharacterStream> character_stream) { … }
bool LazyCompileDispatcher::IsEnqueued(
DirectHandle<SharedFunctionInfo> shared) const { … }
void LazyCompileDispatcher::WaitForJobIfRunningOnBackground(
Job* job, const base::MutexGuard& lock) { … }
bool LazyCompileDispatcher::FinishNow(
DirectHandle<SharedFunctionInfo> function) { … }
void LazyCompileDispatcher::AbortJob(
DirectHandle<SharedFunctionInfo> shared_info) { … }
void LazyCompileDispatcher::AbortAll() { … }
LazyCompileDispatcher::Job* LazyCompileDispatcher::GetJobFor(
DirectHandle<SharedFunctionInfo> shared, const base::MutexGuard&) const { … }
void LazyCompileDispatcher::ScheduleIdleTaskFromAnyThread(
const base::MutexGuard&) { … }
void LazyCompileDispatcher::DoBackgroundWork(JobDelegate* delegate) { … }
LazyCompileDispatcher::Job* LazyCompileDispatcher::PopSingleFinalizeJob() { … }
bool LazyCompileDispatcher::FinalizeSingleJob() { … }
void LazyCompileDispatcher::DoIdleWork(double deadline_in_seconds) { … }
void LazyCompileDispatcher::DeleteJob(Job* job) { … }
void LazyCompileDispatcher::DeleteJob(Job* job, const base::MutexGuard&) { … }
#ifdef DEBUG
void LazyCompileDispatcher::VerifyBackgroundTaskCount(const base::MutexGuard&) { … }
#endif
}
}