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

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

Issue 2251713002: [Compiler] Add compile to CompilerDispatcherJob. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_compilerdispatcher
Patch Set: Address comments Created 4 years, 4 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
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ff3035d4c558618370fb7fdec6ce218a06fd1a21 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,64 @@ 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;
+
+ uintptr_t stack_limit =
+ reinterpret_cast<uintptr_t>(&stack_limit) - max_stack_size_ * KB;
+ compile_job_->set_stack_limit(stack_limit);
+
+ 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 +210,7 @@ void CompilerDispatcherJob::ResetOnMainThread() {
unicode_cache_.reset();
character_stream_.reset();
parse_info_.reset();
+ compile_info_.reset();
zone_.reset();
if (!source_.is_null()) {
@@ -169,8 +226,6 @@ void CompilerDispatcherJob::InternalizeParsingResult() {
DCHECK(status() == CompileJobStatus::kParsed ||
status() == CompileJobStatus::kFailed);
- HandleScope scope(isolate_);
rmcilroy 2016/08/22 13:27:08 I've removed this HandleScope because the handles
-
// 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;
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698