Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher.cc

Issue 2625413004: [compiler-dispatcher] make it so that we can always parse on bg threads (Closed)
Patch Set: updates Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler-dispatcher/compiler-dispatcher.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher.h"
6 6
7 #include "include/v8-platform.h" 7 #include "include/v8-platform.h"
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/base/platform/time.h" 9 #include "src/base/platform/time.h"
10 #include "src/cancelable-task.h" 10 #include "src/cancelable-task.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 return job->status() != CompileJobStatus::kFailed; 62 return job->status() != CompileJobStatus::kFailed;
63 } 63 }
64 64
65 bool IsFinished(CompilerDispatcherJob* job) { 65 bool IsFinished(CompilerDispatcherJob* job) {
66 return job->status() == CompileJobStatus::kDone || 66 return job->status() == CompileJobStatus::kDone ||
67 job->status() == CompileJobStatus::kFailed; 67 job->status() == CompileJobStatus::kFailed;
68 } 68 }
69 69
70 bool CanRunOnAnyThread(CompilerDispatcherJob* job) { 70 bool CanRunOnAnyThread(CompilerDispatcherJob* job) {
71 return (job->status() == CompileJobStatus::kReadyToParse && 71 return job->status() == CompileJobStatus::kReadyToParse ||
72 job->can_parse_on_background_thread()) || 72 job->status() == CompileJobStatus::kReadyToCompile;
73 (job->status() == CompileJobStatus::kReadyToCompile &&
74 job->can_compile_on_background_thread());
75 } 73 }
76 74
77 void DoNextStepOnBackgroundThread(CompilerDispatcherJob* job) { 75 void DoNextStepOnBackgroundThread(CompilerDispatcherJob* job) {
78 DCHECK(CanRunOnAnyThread(job)); 76 DCHECK(CanRunOnAnyThread(job));
79 switch (job->status()) { 77 switch (job->status()) {
80 case CompileJobStatus::kReadyToParse: 78 case CompileJobStatus::kReadyToParse:
81 job->Parse(); 79 job->Parse();
82 break; 80 break;
83 81
84 case CompileJobStatus::kReadyToCompile: 82 case CompileJobStatus::kReadyToCompile:
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 220
223 CompilerDispatcher::~CompilerDispatcher() { 221 CompilerDispatcher::~CompilerDispatcher() {
224 // To avoid crashing in unit tests due to unfished jobs. 222 // To avoid crashing in unit tests due to unfished jobs.
225 AbortAll(BlockingBehavior::kBlock); 223 AbortAll(BlockingBehavior::kBlock);
226 task_manager_->CancelAndWait(); 224 task_manager_->CancelAndWait();
227 } 225 }
228 226
229 bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) { 227 bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) {
230 if (!IsEnabled()) return false; 228 if (!IsEnabled()) return false;
231 229
230 DCHECK(FLAG_ignition);
231
232 if (memory_pressure_level_.Value() != MemoryPressureLevel::kNone) { 232 if (memory_pressure_level_.Value() != MemoryPressureLevel::kNone) {
233 return false; 233 return false;
234 } 234 }
235 235
236 { 236 {
237 base::LockGuard<base::Mutex> lock(&mutex_); 237 base::LockGuard<base::Mutex> lock(&mutex_);
238 if (abort_) return false; 238 if (abort_) return false;
239 } 239 }
240 240
241 // We only handle functions (no eval / top-level code / wasm) that are 241 // We only handle functions (no eval / top-level code / wasm) that are
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 lock.reset(); 622 lock.reset();
623 DoNextStepOnMainThread(isolate_, job->second.get(), 623 DoNextStepOnMainThread(isolate_, job->second.get(),
624 ExceptionHandling::kSwallow); 624 ExceptionHandling::kSwallow);
625 } 625 }
626 } 626 }
627 if (jobs_.size() > too_long_jobs) ScheduleIdleTaskIfNeeded(); 627 if (jobs_.size() > too_long_jobs) ScheduleIdleTaskIfNeeded();
628 } 628 }
629 629
630 } // namespace internal 630 } // namespace internal
631 } // namespace v8 631 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher.h ('k') | src/compiler-dispatcher/compiler-dispatcher-job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698