[parser] Do not treat methods or accessors as possibly-immediately-invoked

Commit f37d726435 limited inner function
parsing to function declarations, to allow function expressions to
be eagerly-compiled if the parser discovered that they are immediately
invoked. But it's not only declarations that won't be immediately invoked:
methods and accessors are in the same boat, and should be treated the same.

This patch reverses the logic to exclude function expressions from inner
lazy treatment, thus making both function declarations and methods/accessors
inner-lazy-parseable.

Bug: v8:5501
Change-Id: I71a57667e52fcb917362ba629667c4c84ae29011
Reviewed-on: https://chromium-review.googlesource.com/569180
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46650}
This commit is contained in:
Adam Klein 2017-07-12 17:23:37 -07:00 committed by Commit Bot
parent c445e1e96b
commit 415fd8d8d1

View File

@ -2627,7 +2627,9 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
const bool is_lazy_top_level_function = is_lazy && is_top_level;
const bool is_lazy_inner_function = is_lazy && !is_top_level;
const bool is_eager_top_level_function = !is_lazy && is_top_level;
const bool is_declaration = function_type == FunctionLiteral::kDeclaration;
const bool is_expression =
function_type == FunctionLiteral::kAnonymousExpression ||
function_type == FunctionLiteral::kNamedExpression;
RuntimeCallTimerScope runtime_timer(
runtime_call_stats_,
@ -2654,7 +2656,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
const bool should_preparse_inner =
parse_lazily() && FLAG_lazy_inner_functions && is_lazy_inner_function &&
(is_declaration || FLAG_aggressive_lazy_inner_functions);
(!is_expression || FLAG_aggressive_lazy_inner_functions);
bool should_use_parse_task =
FLAG_use_parse_tasks && parse_lazily() && compiler_dispatcher_ &&