| 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 526aba0307993c22dec1673124e81af36328c5b3..c7ab7ff89b79ddd1e5da4ce649df9de50ad20e78 100644
|
| --- a/src/compiler-dispatcher/compiler-dispatcher-job.cc
|
| +++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc
|
| @@ -67,6 +67,7 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
|
| }
|
| parse_info_.reset(new ParseInfo(zone_.get()));
|
| parse_info_->set_isolate(isolate_);
|
| + parse_info_->set_shared_info(shared);
|
| parse_info_->set_character_stream(character_stream_.get());
|
| parse_info_->set_lazy();
|
| parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
|
| @@ -134,9 +135,60 @@ void CompilerDispatcherJob::FinalizeParsingOnMainThread() {
|
|
|
| InternalizeParsingResult();
|
|
|
| + status_ = CompileJobStatus::kReadyToAnalyse;
|
| +}
|
| +
|
| +void CompilerDispatcherJob::PrepareToCompileOnMainThread() {
|
| + DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
|
| + DCHECK(status() == CompileJobStatus::kReadyToAnalyse);
|
| +
|
| + compile_info_.reset(new CompilationInfo(parse_info_.get(), function_));
|
| +
|
| + // Create a canonical handle scope before ast numbering if compiling bytecode.
|
| + // This is required for off-thread bytecode generation.
|
| + std::unique_ptr<CanonicalHandleScope> canonical;
|
| + if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_));
|
| +
|
| + if (!Compiler::Analyze(parse_info_.get())) {
|
| + status_ = CompileJobStatus::kFailed;
|
| + return;
|
| + }
|
| + compile_job_.reset(
|
| + Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get()));
|
| + if (!compile_job_.get()) {
|
| + status_ = CompileJobStatus::kFailed;
|
| + return;
|
| + }
|
| +
|
| status_ = CompileJobStatus::kReadyToCompile;
|
| }
|
|
|
| +void CompilerDispatcherJob::Compile() {
|
| + DCHECK(status() == CompileJobStatus::kReadyToCompile);
|
| + DisallowHeapAllocation no_allocation;
|
| + DisallowHandleAllocation no_handles;
|
| + DisallowHandleDereference no_deref;
|
| +
|
| + if (compile_job_->ExecuteJob() != CompilationJob::SUCCEEDED) {
|
| + status_ = CompileJobStatus::kFailed;
|
| + return;
|
| + }
|
| +
|
| + status_ = CompileJobStatus::kCompiled;
|
| +}
|
| +
|
| +void CompilerDispatcherJob::FinalizeCompilingOnMainThread() {
|
| + DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
|
| + DCHECK(status() == CompileJobStatus::kCompiled);
|
| +
|
| + if (!Compiler::FinalizeCompilationJob(compile_job_.release())) {
|
| + status_ = CompileJobStatus::kFailed;
|
| + return;
|
| + }
|
| +
|
| + status_ = CompileJobStatus::kDone;
|
| +}
|
| +
|
| void CompilerDispatcherJob::ReportErrorsOnMainThread() {
|
| DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
|
| DCHECK(status() == CompileJobStatus::kFailed);
|
| @@ -154,6 +206,7 @@ void CompilerDispatcherJob::ResetOnMainThread() {
|
| unicode_cache_.reset();
|
| character_stream_.reset();
|
| parse_info_.reset();
|
| + compile_info_.reset();
|
| zone_.reset();
|
|
|
| if (!source_.is_null()) {
|
| @@ -169,8 +222,6 @@ void CompilerDispatcherJob::InternalizeParsingResult() {
|
| DCHECK(status() == CompileJobStatus::kParsed ||
|
| status() == CompileJobStatus::kFailed);
|
|
|
| - HandleScope scope(isolate_);
|
| -
|
| // Create a canonical handle scope before internalizing parsed values if
|
| // compiling bytecode. This is required for off-thread bytecode generation.
|
| std::unique_ptr<CanonicalHandleScope> canonical;
|
|
|