Commit 7fcf658a authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser] Skipping inner funcs: make the flag experimental.

The feature is not quite ready for getting ClusterFuzzed.

BUG=v8:5516

Change-Id: I90a42f950727c8ecf46cb2987c9a459b2ba1f5a7
Reviewed-on: https://chromium-review.googlesource.com/480400
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarDaniel Vogelheim <vogelheim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44693}
parent e6590a37
...@@ -612,7 +612,7 @@ void DeclarationScope::HoistSloppyBlockFunctions(AstNodeFactory* factory) { ...@@ -612,7 +612,7 @@ void DeclarationScope::HoistSloppyBlockFunctions(AstNodeFactory* factory) {
Variable* var = DeclareVariableName(name, VAR); Variable* var = DeclareVariableName(name, VAR);
if (var != kDummyPreParserVariable && if (var != kDummyPreParserVariable &&
var != kDummyPreParserLexicalVariable) { var != kDummyPreParserLexicalVariable) {
DCHECK(FLAG_preparser_scope_analysis); DCHECK(FLAG_experimental_preparser_scope_analysis);
var->set_maybe_assigned(); var->set_maybe_assigned();
} }
} }
...@@ -662,7 +662,7 @@ void DeclarationScope::Analyze(ParseInfo* info, Isolate* isolate, ...@@ -662,7 +662,7 @@ void DeclarationScope::Analyze(ParseInfo* info, Isolate* isolate,
scope->set_should_eager_compile(); scope->set_should_eager_compile();
if (scope->must_use_preparsed_scope_data_) { if (scope->must_use_preparsed_scope_data_) {
DCHECK(FLAG_preparser_scope_analysis); DCHECK(FLAG_experimental_preparser_scope_analysis);
DCHECK_NOT_NULL(info->preparsed_scope_data()); DCHECK_NOT_NULL(info->preparsed_scope_data());
DCHECK_EQ(scope->scope_type_, ScopeType::FUNCTION_SCOPE); DCHECK_EQ(scope->scope_type_, ScopeType::FUNCTION_SCOPE);
info->preparsed_scope_data()->RestoreData(scope); info->preparsed_scope_data()->RestoreData(scope);
...@@ -1044,7 +1044,7 @@ Variable* DeclarationScope::DeclareParameterName( ...@@ -1044,7 +1044,7 @@ Variable* DeclarationScope::DeclareParameterName(
if (name == ast_value_factory->arguments_string()) { if (name == ast_value_factory->arguments_string()) {
has_arguments_parameter_ = true; has_arguments_parameter_ = true;
} }
if (FLAG_preparser_scope_analysis) { if (FLAG_experimental_preparser_scope_analysis) {
Variable* var = Declare(zone(), name, VAR); Variable* var = Declare(zone(), name, VAR);
params_.Add(var, zone()); params_.Add(var, zone());
return var; return var;
...@@ -1205,7 +1205,7 @@ Variable* Scope::DeclareVariableName(const AstRawString* name, ...@@ -1205,7 +1205,7 @@ Variable* Scope::DeclareVariableName(const AstRawString* name,
DCHECK(scope_info_.is_null()); DCHECK(scope_info_.is_null());
// Declare the variable in the declaration scope. // Declare the variable in the declaration scope.
if (FLAG_preparser_scope_analysis) { if (FLAG_experimental_preparser_scope_analysis) {
Variable* var = LookupLocal(name); Variable* var = LookupLocal(name);
DCHECK_NE(var, kDummyPreParserLexicalVariable); DCHECK_NE(var, kDummyPreParserLexicalVariable);
DCHECK_NE(var, kDummyPreParserVariable); DCHECK_NE(var, kDummyPreParserVariable);
...@@ -1552,7 +1552,8 @@ void DeclarationScope::AnalyzePartially( ...@@ -1552,7 +1552,8 @@ void DeclarationScope::AnalyzePartially(
arguments_ = nullptr; arguments_ = nullptr;
} }
if (FLAG_preparser_scope_analysis && preparsed_scope_data->Producing()) { if (FLAG_experimental_preparser_scope_analysis &&
preparsed_scope_data->Producing()) {
// Store the information needed for allocating the locals of this scope // Store the information needed for allocating the locals of this scope
// and its inner scopes. // and its inner scopes.
preparsed_scope_data->SaveData(this); preparsed_scope_data->SaveData(this);
...@@ -2257,7 +2258,8 @@ void ModuleScope::AllocateModuleVariables() { ...@@ -2257,7 +2258,8 @@ void ModuleScope::AllocateModuleVariables() {
void Scope::AllocateVariablesRecursively() { void Scope::AllocateVariablesRecursively() {
DCHECK(!already_resolved_); DCHECK(!already_resolved_);
DCHECK_IMPLIES(!FLAG_preparser_scope_analysis, num_stack_slots_ == 0); DCHECK_IMPLIES(!FLAG_experimental_preparser_scope_analysis,
num_stack_slots_ == 0);
// Don't allocate variables of preparsed scopes. // Don't allocate variables of preparsed scopes.
if (is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed()) { if (is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed()) {
......
...@@ -1082,7 +1082,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { ...@@ -1082,7 +1082,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
ParseInfo parse_info(handle(function->shared())); ParseInfo parse_info(handle(function->shared()));
Zone compile_zone(isolate->allocator(), ZONE_NAME); Zone compile_zone(isolate->allocator(), ZONE_NAME);
CompilationInfo info(&compile_zone, &parse_info, isolate, function); CompilationInfo info(&compile_zone, &parse_info, isolate, function);
if (FLAG_preparser_scope_analysis) { if (FLAG_experimental_preparser_scope_analysis) {
Handle<SharedFunctionInfo> shared(function->shared()); Handle<SharedFunctionInfo> shared(function->shared());
Handle<Script> script(Script::cast(function->shared()->script())); Handle<Script> script(Script::cast(function->shared()->script()));
if (script->HasPreparsedScopeData()) { if (script->HasPreparsedScopeData()) {
...@@ -1181,7 +1181,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { ...@@ -1181,7 +1181,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
if (!script.is_null()) { if (!script.is_null()) {
script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); script->set_compilation_state(Script::COMPILATION_STATE_COMPILED);
if (FLAG_preparser_scope_analysis) { if (FLAG_experimental_preparser_scope_analysis) {
Handle<FixedUint32Array> data( Handle<FixedUint32Array> data(
parse_info->preparsed_scope_data()->Serialize(isolate)); parse_info->preparsed_scope_data()->Serialize(isolate));
script->set_preparsed_scope_data(*data); script->set_preparsed_scope_data(*data);
......
...@@ -945,9 +945,9 @@ DEFINE_BOOL(lazy_inner_functions, true, "enable lazy parsing inner functions") ...@@ -945,9 +945,9 @@ DEFINE_BOOL(lazy_inner_functions, true, "enable lazy parsing inner functions")
DEFINE_BOOL(aggressive_lazy_inner_functions, false, DEFINE_BOOL(aggressive_lazy_inner_functions, false,
"even lazier inner function parsing") "even lazier inner function parsing")
DEFINE_IMPLICATION(aggressive_lazy_inner_functions, lazy_inner_functions) DEFINE_IMPLICATION(aggressive_lazy_inner_functions, lazy_inner_functions)
DEFINE_BOOL(preparser_scope_analysis, false, DEFINE_BOOL(experimental_preparser_scope_analysis, false,
"perform scope analysis for preparsed inner functions") "perform scope analysis for preparsed inner functions")
DEFINE_IMPLICATION(preparser_scope_analysis, lazy_inner_functions) DEFINE_IMPLICATION(experimental_preparser_scope_analysis, lazy_inner_functions)
// simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc // simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc
DEFINE_BOOL(trace_sim, false, "Trace simulator execution") DEFINE_BOOL(trace_sim, false, "Trace simulator execution")
......
...@@ -2860,7 +2860,7 @@ Parser::LazyParsingResult Parser::SkipFunction(FunctionKind kind, ...@@ -2860,7 +2860,7 @@ Parser::LazyParsingResult Parser::SkipFunction(FunctionKind kind,
// FIXME(marja): There are 3 ways to skip functions now. Unify them. // FIXME(marja): There are 3 ways to skip functions now. Unify them.
if (preparsed_scope_data_->Consuming()) { if (preparsed_scope_data_->Consuming()) {
DCHECK(FLAG_preparser_scope_analysis); DCHECK(FLAG_experimental_preparser_scope_analysis);
const PreParseData::FunctionData& data = const PreParseData::FunctionData& data =
preparsed_scope_data_->FindFunction(function_scope->start_position()); preparsed_scope_data_->FindFunction(function_scope->start_position());
if (data.is_valid()) { if (data.is_valid()) {
......
...@@ -215,7 +215,8 @@ PreParser::PreParseResult PreParser::PreParseFunction( ...@@ -215,7 +215,8 @@ PreParser::PreParseResult PreParser::PreParseFunction(
// function var since the arguments object masks 'function arguments'. // function var since the arguments object masks 'function arguments'.
function_scope->DeclareArguments(ast_value_factory()); function_scope->DeclareArguments(ast_value_factory());
if (FLAG_preparser_scope_analysis && preparsed_scope_data_ != nullptr) { if (FLAG_experimental_preparser_scope_analysis &&
preparsed_scope_data_ != nullptr) {
preparsed_scope_data_->AddFunction( preparsed_scope_data_->AddFunction(
scope()->start_position(), scope()->start_position(),
PreParseData::FunctionData( PreParseData::FunctionData(
...@@ -354,7 +355,8 @@ PreParser::Expression PreParser::ParseFunctionLiteral( ...@@ -354,7 +355,8 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
} }
} }
if (FLAG_preparser_scope_analysis && preparsed_scope_data_ != nullptr) { if (FLAG_experimental_preparser_scope_analysis &&
preparsed_scope_data_ != nullptr) {
preparsed_scope_data_->AddFunction( preparsed_scope_data_->AddFunction(
start_position, start_position,
PreParseData::FunctionData( PreParseData::FunctionData(
...@@ -416,7 +418,7 @@ void PreParser::DeclareAndInitializeVariables( ...@@ -416,7 +418,7 @@ void PreParser::DeclareAndInitializeVariables(
declaration_descriptor->scope->RemoveUnresolved(variable); declaration_descriptor->scope->RemoveUnresolved(variable);
Variable* var = scope()->DeclareVariableName( Variable* var = scope()->DeclareVariableName(
variable->raw_name(), declaration_descriptor->mode); variable->raw_name(), declaration_descriptor->mode);
if (FLAG_preparser_scope_analysis) { if (FLAG_experimental_preparser_scope_analysis) {
MarkLoopVariableAsAssigned(declaration_descriptor->scope, var); MarkLoopVariableAsAssigned(declaration_descriptor->scope, var);
// This is only necessary if there is an initializer, but we don't have // This is only necessary if there is an initializer, but we don't have
// that information here. Consequently, the preparser sometimes says // that information here. Consequently, the preparser sometimes says
......
...@@ -28,7 +28,7 @@ enum SkipTests { ...@@ -28,7 +28,7 @@ enum SkipTests {
TEST(PreParserScopeAnalysis) { TEST(PreParserScopeAnalysis) {
i::FLAG_lazy_inner_functions = true; i::FLAG_lazy_inner_functions = true;
i::FLAG_preparser_scope_analysis = true; i::FLAG_experimental_preparser_scope_analysis = true;
i::Isolate* isolate = CcTest::i_isolate(); i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --preparser-scope-analysis // Flags: --experimental-preparser-scope-analysis
(function TestBasicSkipping() { (function TestBasicSkipping() {
var result = 0; var result = 0;
......
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