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

Unified Diff: src/compiler.cc

Issue 2579973002: Don't compile inner functions when compiling via the dispatcher (Closed)
Patch Set: added comment Created 4 years 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 a45d7aacc9679079ac36e6efcd14557f63600057..d3aaa69cdeb5c2713cd23ae080591e338e9f73b8 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -366,7 +366,8 @@ bool ShouldUseIgnition(CompilationInfo* info) {
return shared->PassesFilter(FLAG_ignition_filter);
}
-CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) {
+CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info,
+ LazyCompilationMode mode) {
// Function should have been parsed and analyzed before creating a compilation
// job.
DCHECK_NOT_NULL(info->literal());
@@ -374,9 +375,9 @@ CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) {
EnsureFeedbackMetadata(info);
if (ShouldUseIgnition(info)) {
- return interpreter::Interpreter::NewCompilationJob(info);
+ return interpreter::Interpreter::NewCompilationJob(info, mode);
} else {
- return FullCodeGenerator::NewCompilationJob(info);
+ return FullCodeGenerator::NewCompilationJob(info, mode);
}
}
@@ -439,7 +440,8 @@ bool GenerateUnoptimizedCode(CompilationInfo* info) {
}
}
- std::unique_ptr<CompilationJob> job(GetUnoptimizedCompilationJob(info));
+ std::unique_ptr<CompilationJob> job(
+ GetUnoptimizedCompilationJob(info, LazyCompilationMode::kIfRequested));
if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false;
if (job->ExecuteJob() != CompilationJob::SUCCEEDED) return false;
if (FinalizeUnoptimizedCompilationJob(job.get()) !=
@@ -1564,10 +1566,9 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForStreamedScript(
return result;
}
-
Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
FunctionLiteral* literal, Handle<Script> script,
- CompilationInfo* outer_info) {
+ CompilationInfo* outer_info, LazyCompilationMode mode) {
// Precondition: code has been parsed and scopes have been analyzed.
Isolate* isolate = outer_info->isolate();
MaybeHandle<SharedFunctionInfo> maybe_existing;
@@ -1619,7 +1620,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
// This is especially important for generators. We must not replace the
// code for generators, as there may be suspended generator objects.
if (!result->is_compiled()) {
- if (!literal->ShouldEagerCompile()) {
+ if (mode == LazyCompilationMode::kAlways ||
+ !literal->ShouldEagerCompile()) {
info.SetCode(isolate->builtins()->CompileLazy());
Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
if (outer_scope) {
@@ -1692,9 +1694,9 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
}
CompilationJob* Compiler::PrepareUnoptimizedCompilationJob(
- CompilationInfo* info) {
+ CompilationInfo* info, LazyCompilationMode mode) {
VMState<COMPILER> state(info->isolate());
- std::unique_ptr<CompilationJob> job(GetUnoptimizedCompilationJob(info));
+ std::unique_ptr<CompilationJob> job(GetUnoptimizedCompilationJob(info, mode));
if (job->PrepareJob() != CompilationJob::SUCCEEDED) {
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698