summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc')
-rw-r--r--deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc35
1 files changed, 29 insertions, 6 deletions
diff --git a/deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc b/deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc
index cb1a70b1fa..e365e301d1 100644
--- a/deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc
+++ b/deps/v8/src/compiler-dispatcher/compiler-dispatcher.cc
@@ -27,7 +27,23 @@ bool DoNextStepOnMainThread(Isolate* isolate, CompilerDispatcherJob* job,
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompilerDispatcherForgroundStep");
- job->StepNextOnMainThread(isolate);
+ switch (job->status()) {
+ case CompilerDispatcherJob::Status::kInitial:
+ job->PrepareOnMainThread(isolate);
+ break;
+ case CompilerDispatcherJob::Status::kPrepared:
+ job->Compile(false);
+ break;
+ case CompilerDispatcherJob::Status::kCompiled:
+ job->FinalizeOnMainThread(isolate);
+ break;
+ case CompilerDispatcherJob::Status::kHasErrorsToReport:
+ job->ReportErrorsOnMainThread(isolate);
+ break;
+ case CompilerDispatcherJob::Status::kFailed:
+ case CompilerDispatcherJob::Status::kDone:
+ UNREACHABLE();
+ }
DCHECK_EQ(job->IsFailed(), isolate->has_pending_exception());
if (job->IsFailed() && exception_handling == ExceptionHandling::kSwallow) {
@@ -37,10 +53,16 @@ bool DoNextStepOnMainThread(Isolate* isolate, CompilerDispatcherJob* job,
}
void DoNextStepOnBackgroundThread(CompilerDispatcherJob* job) {
- DCHECK(job->CanStepNextOnAnyThread());
+ DCHECK(job->NextStepCanRunOnAnyThread());
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompilerDispatcherBackgroundStep");
- job->StepNextOnBackgroundThread();
+ switch (job->status()) {
+ case CompilerDispatcherJob::Status::kPrepared:
+ job->Compile(true);
+ break;
+ default:
+ UNREACHABLE();
+ }
}
// Theoretically we get 50ms of idle time max, however it's unlikely that
@@ -484,7 +506,7 @@ void CompilerDispatcher::ScheduleAbortTask() {
void CompilerDispatcher::ConsiderJobForBackgroundProcessing(
CompilerDispatcherJob* job) {
- if (!job->CanStepNextOnAnyThread()) return;
+ if (!job->NextStepCanRunOnAnyThread()) return;
{
base::LockGuard<base::Mutex> lock(&mutex_);
pending_background_jobs_.insert(job);
@@ -667,7 +689,8 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::InsertJob(
CompilerDispatcherJob* inserted_job = it->second.get();
// Maps unoptimized jobs' SFIs to their job id.
- if (inserted_job->type() == CompilerDispatcherJob::kUnoptimizedCompile) {
+ if (inserted_job->type() ==
+ CompilerDispatcherJob::Type::kUnoptimizedCompile) {
Handle<SharedFunctionInfo> shared =
inserted_job->AsUnoptimizedCompileJob()->shared();
if (!shared.is_null()) {
@@ -684,7 +707,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveJob(
job->ResetOnMainThread(isolate_);
// Unmaps unoptimized jobs' SFIs to their job id.
- if (job->type() == CompilerDispatcherJob::kUnoptimizedCompile) {
+ if (job->type() == CompilerDispatcherJob::Type::kUnoptimizedCompile) {
Handle<SharedFunctionInfo> shared =
job->AsUnoptimizedCompileJob()->shared();
if (!shared.is_null()) {