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

Unified Diff: src/compiler-dispatcher/compiler-dispatcher-job.cc

Issue 2611313002: [complier] Enable parallel eager inner function compilation with compiler dispatcher. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler-dispatcher/compiler-dispatcher-job.cc
diff --git a/src/compiler-dispatcher/compiler-dispatcher-job.cc b/src/compiler-dispatcher/compiler-dispatcher-job.cc
index 30493908447b8eaf5ae16a89e642519a76bf2eaf..6bbb1835f5d68cc26bdab8ba7d71f12dd9368d0e 100644
--- a/src/compiler-dispatcher/compiler-dispatcher-job.cc
+++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc
@@ -66,7 +66,8 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
CompilerDispatcherTracer* tracer,
Handle<SharedFunctionInfo> shared,
size_t max_stack_size)
- : isolate_(isolate),
+ : status_(CompileJobStatus::kInitial),
+ isolate_(isolate),
tracer_(tracer),
shared_(Handle<SharedFunctionInfo>::cast(
isolate_->global_handles()->Create(*shared))),
@@ -79,7 +80,35 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
if (trace_compiler_dispatcher_jobs_) {
PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this));
shared_->ShortPrint();
- PrintF("\n");
+ PrintF(" in initial state.\n");
+ }
+}
+
+CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
+ CompilerDispatcherTracer* tracer,
+ Handle<SharedFunctionInfo> shared,
+ FunctionLiteral* literal,
+ size_t max_stack_size)
+ : status_(CompileJobStatus::kAnalyzed),
+ isolate_(isolate),
+ tracer_(tracer),
+ shared_(Handle<SharedFunctionInfo>::cast(
+ isolate_->global_handles()->Create(*shared))),
+ max_stack_size_(max_stack_size),
+ zone_(new Zone(isolate->allocator(), ZONE_NAME)),
+ parse_info_(new ParseInfo(
+ zone_.get(), Handle<Script>(Script::cast(shared->script())))),
+ compile_info_(
+ new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null())),
+ trace_compiler_dispatcher_jobs_(FLAG_trace_compiler_dispatcher_jobs) {
+ parse_info_->set_literal(literal);
+ parse_info_->set_shared_info(shared);
+ parse_info_->set_function_literal_id(shared->function_literal_id());
+ parse_info_->set_language_mode(literal->scope()->language_mode());
+ if (trace_compiler_dispatcher_jobs_) {
+ PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this));
+ shared_->ShortPrint();
+ PrintF(" in Analyzed state.\n");
}
}
@@ -252,7 +281,7 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
if (parse_info_->literal() == nullptr) {
status_ = CompileJobStatus::kFailed;
} else {
- status_ = CompileJobStatus::kReadyToAnalyse;
+ status_ = CompileJobStatus::kReadyToAnalyze;
}
DeferredHandleScope scope(isolate_);
@@ -283,25 +312,38 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
return status_ != CompileJobStatus::kFailed;
}
-bool CompilerDispatcherJob::PrepareToCompileOnMainThread() {
+bool CompilerDispatcherJob::AnalyzeOnMainThread() {
DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
- DCHECK(status() == CompileJobStatus::kReadyToAnalyse);
- COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kPrepareToCompile);
+ DCHECK(status() == CompileJobStatus::kReadyToAnalyze);
+ COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kAnalyze);
if (trace_compiler_dispatcher_jobs_) {
- PrintF("CompilerDispatcherJob[%p]: Preparing to compile\n",
- static_cast<void*>(this));
+ PrintF("CompilerDispatcherJob[%p]: Analyzing\n", static_cast<void*>(this));
}
compile_info_.reset(
new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null()));
DeferredHandleScope scope(isolate_);
- if (Compiler::Analyze(parse_info_.get())) {
- compile_job_.reset(
- Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get()));
+ {
+ if (Compiler::Analyze(parse_info_.get())) {
+ status_ = CompileJobStatus::kAnalyzed;
+ } else {
+ status_ = CompileJobStatus::kFailed;
+ if (!isolate_->has_pending_exception()) isolate_->StackOverflow();
+ }
}
compile_info_->set_deferred_handles(scope.Detach());
+ return status_ != CompileJobStatus::kFailed;
+}
+
+bool CompilerDispatcherJob::PrepareToCompileOnMainThread() {
+ DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
+ DCHECK(status() == CompileJobStatus::kAnalyzed);
+ COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kPrepareToCompile);
+
+ compile_job_.reset(
+ Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get()));
if (!compile_job_.get()) {
if (!isolate_->has_pending_exception()) isolate_->StackOverflow();
status_ = CompileJobStatus::kFailed;
@@ -401,7 +443,10 @@ double CompilerDispatcherJob::EstimateRuntimeOfNextStepInMs() const {
case CompileJobStatus::kParsed:
return tracer_->EstimateFinalizeParsingInMs();
- case CompileJobStatus::kReadyToAnalyse:
+ case CompileJobStatus::kReadyToAnalyze:
+ return tracer_->EstimateAnalyzeInMs();
+
+ case CompileJobStatus::kAnalyzed:
return tracer_->EstimatePrepareToCompileInMs();
case CompileJobStatus::kReadyToCompile:
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/compiler-dispatcher/compiler-dispatcher-tracer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698