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

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

Issue 2679193004: [Compiler] Ensure we enter the correct context for compiler-dispatcher jobs. (Closed)
Patch Set: Rebase Created 3 years, 10 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 986a822093ff4fa2dcb81da13ec13f9915a158b5..8ef5f6e2ab469a978b694f2eefb2b1ba602e2293 100644
--- a/src/compiler-dispatcher/compiler-dispatcher-job.cc
+++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc
@@ -69,6 +69,8 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
: status_(CompileJobStatus::kInitial),
isolate_(isolate),
tracer_(tracer),
+ context_(Handle<Context>::cast(
+ isolate_->global_handles()->Create(isolate->context()))),
shared_(Handle<SharedFunctionInfo>::cast(
isolate_->global_handles()->Create(*shared))),
max_stack_size_(max_stack_size),
@@ -93,6 +95,8 @@ CompilerDispatcherJob::CompilerDispatcherJob(
: status_(CompileJobStatus::kAnalyzed),
isolate_(isolate),
tracer_(tracer),
+ context_(Handle<Context>::cast(
+ isolate_->global_handles()->Create(isolate->context()))),
shared_(Handle<SharedFunctionInfo>::cast(
isolate_->global_handles()->Create(*shared))),
max_stack_size_(max_stack_size),
@@ -117,6 +121,7 @@ CompilerDispatcherJob::~CompilerDispatcherJob() {
DCHECK(status_ == CompileJobStatus::kInitial ||
status_ == CompileJobStatus::kDone);
i::GlobalHandles::Destroy(Handle<Object>::cast(shared_).location());
+ i::GlobalHandles::Destroy(Handle<Object>::cast(context_).location());
}
bool CompilerDispatcherJob::IsAssociatedWith(
@@ -386,11 +391,14 @@ bool CompilerDispatcherJob::FinalizeCompilingOnMainThread() {
static_cast<void*>(this));
}
- if (compile_job_->state() == CompilationJob::State::kFailed ||
- !Compiler::FinalizeCompilationJob(compile_job_.release())) {
- if (!isolate_->has_pending_exception()) isolate_->StackOverflow();
- status_ = CompileJobStatus::kFailed;
- return false;
+ {
+ HandleScope scope(isolate_);
+ if (compile_job_->state() == CompilationJob::State::kFailed ||
+ !Compiler::FinalizeCompilationJob(compile_job_.release())) {
+ if (!isolate_->has_pending_exception()) isolate_->StackOverflow();
+ status_ = CompileJobStatus::kFailed;
+ return false;
+ }
}
compile_job_.reset();
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698