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

Unified Diff: src/compiler.cc

Issue 2399833002: Teach Scopes whether they will end up being lazily compiled or not (Closed)
Patch Set: updates 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 ec402fa82209339f2bddfcee9066b7e17ef90763..6c9f764728cf2d43743c5f50f489a7e6934810df 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1431,6 +1431,7 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG,
&unoptimized);
}
+ info->parse_info()->set_will_serialize(false);
marja 2016/10/07 08:25:59 Comment suggestion: We reuse the same ParseInfo i
jochen (gone - plz use gerrit) 2016/10/07 08:34:37 I moved the code it but further up and added a com
return true;
}
@@ -1775,31 +1776,12 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
if (outer_info->will_serialize()) info.PrepareForSerializing();
if (outer_info->is_debug()) info.MarkAsDebug();
- // Determine if the function can be lazily compiled. This is necessary to
- // allow some of our builtin JS files to be lazily compiled. These
- // builtins cannot be handled lazily by the parser, since we have to know
- // if a function uses the special natives syntax, which is something the
- // parser records.
- // If the debugger requests compilation for break points, we cannot be
- // aggressive about lazy compilation, because it might trigger compilation
- // of functions without an outer context when setting a breakpoint through
- // Debug::FindSharedFunctionInfoInScript.
- bool allow_lazy = literal->AllowsLazyCompilation() && !info.is_debug();
- bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile();
-
- // Consider compiling eagerly when targeting the code cache.
- lazy &= !(FLAG_serialize_eager && info.will_serialize());
-
- // Consider compiling eagerly when compiling bytecode for Ignition.
- lazy &=
- !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled());
-
// Generate code
TimerEventScope<TimerEventCompileCode> timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
- if (lazy) {
+ if (!literal->ShouldEagerCompile()) {
info.SetCode(isolate->builtins()->CompileLazy());
Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
if (outer_scope) {
@@ -1809,8 +1791,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
// Code generation will ensure that the feedback vector is present and
// appropriately sized.
DCHECK(!info.code().is_null());
- if (literal->should_eager_compile() &&
- literal->should_be_used_once_hint()) {
+ if (literal->ShouldEagerCompile() && literal->should_be_used_once_hint()) {
marja 2016/10/07 08:25:59 Wait, isn't this always true now, since we are in
jochen (gone - plz use gerrit) 2016/10/07 08:34:37 I removed the ShouldEagerCompilePart()
info.code()->MarkToBeExecutedOnce(isolate);
}
// Update the shared function info with the scope info.

Powered by Google App Engine
This is Rietveld 408576698