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

Unified Diff: src/compiler.cc

Issue 2399463008: Create multiple compilation jobs for ignition if compiling multiple literals (Closed)
Patch Set: Created 4 years, 2 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.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 5d0b22fd0c7d12433fe7d1e6d2e5ab84e9ff7752..f56519c631d36dea79cf4283a5e444ae52d481f1 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -346,7 +346,8 @@ bool ShouldUseIgnition(CompilationInfo* info) {
return info->shared_info()->PassesFilter(FLAG_ignition_filter);
}
-CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) {
+std::vector<std::unique_ptr<CompilationJob>> GetUnoptimizedCompilationJob(
+ CompilationInfo* info) {
// Function should have been parsed and analyzed before creating a compilation
// job.
DCHECK_NOT_NULL(info->literal());
@@ -356,7 +357,11 @@ CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) {
if (ShouldUseIgnition(info)) {
return interpreter::Interpreter::NewCompilationJob(info);
} else {
- return FullCodeGenerator::NewCompilationJob(info);
+ std::unique_ptr<CompilationJob> job(
+ FullCodeGenerator::NewCompilationJob(info));
+ std::vector<std::unique_ptr<CompilationJob>> result;
+ result.push_back(std::move(job));
+ return result;
}
}
@@ -373,11 +378,15 @@ bool GenerateUnoptimizedCode(CompilationInfo* info) {
}
}
- std::unique_ptr<CompilationJob> job(GetUnoptimizedCompilationJob(info));
- if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false;
- if (job->ExecuteJob() != CompilationJob::SUCCEEDED) return false;
- if (job->FinalizeJob() != CompilationJob::SUCCEEDED) return false;
- job->RecordUnoptimizedCompilationStats();
+ std::vector<std::unique_ptr<CompilationJob>> jobs(
+ GetUnoptimizedCompilationJob(info));
+ for (auto& job : jobs) {
+ if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false;
+ if (job->ExecuteJob() != CompilationJob::SUCCEEDED) return false;
+ if (job->FinalizeJob() != CompilationJob::SUCCEEDED) return false;
+ job->RecordUnoptimizedCompilationStats();
+ job.reset();
+ }
return true;
}
@@ -1715,10 +1724,9 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForStreamedScript(
return result;
}
-
Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
FunctionLiteral* literal, Handle<Script> script,
- CompilationInfo* outer_info) {
+ CompilationInfo* outer_info, ShouldCompile should_compile) {
// Precondition: code has been parsed and scopes have been analyzed.
Isolate* isolate = outer_info->isolate();
MaybeHandle<SharedFunctionInfo> maybe_existing;
@@ -1746,6 +1754,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
if (!outer_info->is_debug() || existing->HasDebugCode()) {
return existing;
}
+ } else if (should_compile == ShouldCompile::kNever) {
+ return existing;
}
}
@@ -1775,7 +1785,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
- if (!literal->ShouldEagerCompile()) {
+ if (!literal->ShouldEagerCompile() ||
+ should_compile == ShouldCompile::kNever) {
info.SetCode(isolate->builtins()->CompileLazy());
Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
if (outer_scope) {
@@ -1843,14 +1854,18 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
return GetOptimizedCode(function, NOT_CONCURRENT, osr_ast_id, osr_frame);
}
-CompilationJob* Compiler::PrepareUnoptimizedCompilationJob(
- CompilationInfo* info) {
+std::vector<std::unique_ptr<CompilationJob>>
+Compiler::PrepareUnoptimizedCompilationJob(CompilationInfo* info) {
VMState<COMPILER> state(info->isolate());
- std::unique_ptr<CompilationJob> job(GetUnoptimizedCompilationJob(info));
- if (job->PrepareJob() != CompilationJob::SUCCEEDED) {
- return nullptr;
+ std::vector<std::unique_ptr<CompilationJob>> jobs(
+ GetUnoptimizedCompilationJob(info));
+ for (auto& job : jobs) {
+ if (job->PrepareJob() != CompilationJob::SUCCEEDED) {
+ std::vector<std::unique_ptr<CompilationJob>> result;
+ return result;
+ }
}
- return job.release();
+ return jobs;
}
bool Compiler::FinalizeCompilationJob(CompilationJob* raw_job) {

Powered by Google App Engine
This is Rietveld 408576698