PreParsing inner functions: Make inner functions less lazy.

Especially, make non-declaration type inner functions eagerly
parsed. Then we still have a chance to compile them eagerly if we see ()
after the function.

BUG=v8:5501

Review-Url: https://codereview.chromium.org/2583843002
Cr-Commit-Position: refs/heads/master@{#41762}
This commit is contained in:
marja 2016-12-16 05:34:30 -08:00 committed by Commit bot
parent d2d6da0354
commit f37d726435
2 changed files with 12 additions and 2 deletions

View File

@ -855,6 +855,9 @@ DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
DEFINE_BOOL(trace_parse, false, "trace parsing and preparsing")
DEFINE_BOOL(trace_preparse, false, "trace preparsing decisions")
DEFINE_BOOL(lazy_inner_functions, true, "enable lazy parsing inner functions")
DEFINE_BOOL(aggressive_lazy_inner_functions, false,
"even lazier inner function parsing")
DEFINE_IMPLICATION(aggressive_lazy_inner_functions, lazy_inner_functions)
// simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc
DEFINE_BOOL(trace_sim, false, "Trace simulator execution")

View File

@ -2612,11 +2612,18 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// will migrate unresolved variable into a Scope in the main Zone.
// TODO(marja): Refactor parsing modes: simplify this.
bool use_temp_zone =
(FLAG_lazy_inner_functions
(FLAG_aggressive_lazy_inner_functions
? can_preparse
: (is_lazy_top_level_function ||
(allow_lazy_ && function_type == FunctionLiteral::kDeclaration &&
(parse_lazily() &&
function_type == FunctionLiteral::kDeclaration &&
eager_compile_hint == FunctionLiteral::kShouldLazyCompile)));
DCHECK_IMPLIES(
(is_lazy_top_level_function ||
(parse_lazily() && function_type == FunctionLiteral::kDeclaration &&
eager_compile_hint == FunctionLiteral::kShouldLazyCompile)),
can_preparse);
bool is_lazy_inner_function =
use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function;