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 b602c5bfceba5901cb70daca30a6d3e9d5b032ac..21e30c8d4c2bae906f4266b56af6f3d57397ce56 100644 |
--- a/src/compiler-dispatcher/compiler-dispatcher-job.cc |
+++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc |
@@ -138,11 +138,6 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() { |
DeferredHandleScope 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; |
- if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_)); |
- |
Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); |
Handle<Script> script(Script::cast(shared->script()), isolate_); |
@@ -150,9 +145,17 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() { |
parse_info_->set_context(handle(function_->context(), isolate_)); |
parse_info_->set_shared_info(handle(function_->shared(), isolate_)); |
- // Do the parsing tasks which need to be done on the main thread. This will |
- // also handle parse errors. |
- parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr); |
+ { |
+ // Create a canonical handle scope if compiling ignition bytecode. This is |
+ // required by the constant array builder to de-duplicate objects without |
+ // dereferencing handles. |
+ std::unique_ptr<CanonicalHandleScope> canonical; |
+ if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_)); |
+ |
+ // Do the parsing tasks which need to be done on the main thread. This |
+ // will also handle parse errors. |
+ parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr); |
+ } |
parser_->HandleSourceURLComments(isolate_, script); |
parse_info_->set_character_stream(nullptr); |
@@ -173,16 +176,9 @@ bool CompilerDispatcherJob::PrepareToCompileOnMainThread() { |
compile_info_.reset(new CompilationInfo(parse_info_.get(), function_)); |
DeferredHandleScope scope(isolate_); |
- { |
- // 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())) { |
- compile_job_.reset( |
- Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get())); |
- } |
+ if (Compiler::Analyze(parse_info_.get())) { |
+ compile_job_.reset( |
+ Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get())); |
} |
compile_info_->set_deferred_handles(scope.Detach()); |