Commit 801d62d2 authored by Wiktor Garbacz's avatar Wiktor Garbacz Committed by Commit Bot

[parser] Parse tasks: skip functions using preparse data.

BUG=v8:6093

Change-Id: Icdc0706a3af23fbf538021a7e80fedaf0b5ae866
Reviewed-on: https://chromium-review.googlesource.com/453699
Commit-Queue: Wiktor Garbacz <wiktorg@google.com>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43784}
parent 5f21f612
......@@ -2788,6 +2788,31 @@ Parser::LazyParsingResult Parser::SkipFunction(
cached_parse_data_->Reject();
}
if (FLAG_use_parse_tasks && !is_inner_function &&
reusable_preparser()->preparse_data()) {
// All top-level functions are already preparsed and parser tasks for eager
// functions are already created. Use data gathered during the preparse step
// to skip the function.
PreParseData::FunctionData data =
reusable_preparser()->preparse_data()->GetTopLevelFunctionData(
function_scope->start_position());
if (data.is_valid()) {
if (FLAG_trace_parse_tasks) {
PrintF("Skipping top level func @ %d : %d using preparse data\n",
data.start, data.end);
}
function_scope->set_end_position(data.end);
scanner()->SeekForward(data.end - 1);
Expect(Token::RBRACE, CHECK_OK_VALUE(kLazyParsingComplete));
*num_parameters = data.num_parameters;
*function_length = data.function_length;
*has_duplicate_parameters = data.has_duplicate_parameters;
*expected_property_count = data.expected_property_count;
SkipFunctionLiterals(data.num_inner_functions);
return kLazyParsingComplete;
}
}
// With no cached data, we partially parse the function, without building an
// AST. This gathers the data needed to build a lazy function.
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse");
......
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