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

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

Issue 2650883002: Reland: [Compiler] Enable handles created during parsing and scope analysis to be deferred. (Closed)
Patch Set: Remove unused variable 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
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/handles.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 793b02d2614817de99a5784448b8d4ca102e0827..986a822093ff4fa2dcb81da13ec13f9915a158b5 100644
--- a/src/compiler-dispatcher/compiler-dispatcher-job.cc
+++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc
@@ -84,26 +84,27 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
}
}
-CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
- CompilerDispatcherTracer* tracer,
- Handle<SharedFunctionInfo> shared,
- FunctionLiteral* literal,
- size_t max_stack_size)
+CompilerDispatcherJob::CompilerDispatcherJob(
+ Isolate* isolate, CompilerDispatcherTracer* tracer,
+ Handle<SharedFunctionInfo> shared, FunctionLiteral* literal,
+ std::shared_ptr<Zone> parse_zone,
+ std::shared_ptr<DeferredHandles> parse_handles,
+ std::shared_ptr<DeferredHandles> compile_handles, 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),
- parse_info_(
- new ParseInfo(Handle<Script>(Script::cast(shared->script())))),
+ parse_info_(new ParseInfo(shared_)),
+ parse_zone_(parse_zone),
compile_info_(new CompilationInfo(parse_info_->zone(), 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());
+ parse_info_->set_deferred_handles(parse_handles);
+ compile_info_->set_deferred_handles(compile_handles);
+
if (trace_compiler_dispatcher_jobs_) {
PrintF("CompilerDispatcherJob[%p] created for ", static_cast<void*>(this));
shared_->ShortPrint();
@@ -276,17 +277,19 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
wrapper_ = Handle<String>::null();
}
+ Handle<Script> script(Script::cast(shared_->script()), isolate_);
+ parse_info_->set_script(script);
if (parse_info_->literal() == nullptr) {
+ parser_->ReportErrors(isolate_, script);
status_ = CompileJobStatus::kFailed;
} else {
status_ = CompileJobStatus::kReadyToAnalyze;
}
+ parser_->UpdateStatistics(isolate_, script);
DeferredHandleScope scope(isolate_);
{
- Handle<Script> script(Script::cast(shared_->script()), isolate_);
-
- parse_info_->set_script(script);
+ parse_info_->ReopenHandlesInNewHandleScope();
Handle<ScopeInfo> outer_scope_info(
handle(ScopeInfo::cast(shared_->outer_scope_info())));
if (outer_scope_info->length() > 0) {
@@ -294,9 +297,8 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
}
parse_info_->set_shared_info(shared_);
- // 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);
+ // Internalize ast values on the main thread.
+ parse_info_->ast_value_factory()->Internalize(isolate_);
parser_->HandleSourceURLComments(isolate_, script);
parse_info_->set_character_stream(nullptr);
@@ -305,7 +307,7 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
unicode_cache_.reset();
character_stream_.reset();
}
- handles_from_parsing_.reset(scope.Detach());
+ parse_info_->set_deferred_handles(scope.Detach());
return status_ != CompileJobStatus::kFailed;
}
@@ -393,7 +395,7 @@ bool CompilerDispatcherJob::FinalizeCompilingOnMainThread() {
compile_job_.reset();
compile_info_.reset();
- handles_from_parsing_.reset();
+ parse_zone_.reset();
parse_info_.reset();
status_ = CompileJobStatus::kDone;
@@ -409,10 +411,10 @@ void CompilerDispatcherJob::ResetOnMainThread() {
compile_job_.reset();
compile_info_.reset();
+ parse_zone_.reset();
parser_.reset();
unicode_cache_.reset();
character_stream_.reset();
- handles_from_parsing_.reset();
parse_info_.reset();
if (!source_.is_null()) {
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698