Commit 415fd8d8 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

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

Commit f37d7264 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/569180Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46650}
parent c445e1e9
......@@ -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_ &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment