[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: Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/master@{#44693}
This commit is contained in:
parent
e6590a37ba
commit
7fcf658a7b
@ -612,7 +612,7 @@ void DeclarationScope::HoistSloppyBlockFunctions(AstNodeFactory* factory) {
|
||||
Variable* var = DeclareVariableName(name, VAR);
|
||||
if (var != kDummyPreParserVariable &&
|
||||
var != kDummyPreParserLexicalVariable) {
|
||||
DCHECK(FLAG_preparser_scope_analysis);
|
||||
DCHECK(FLAG_experimental_preparser_scope_analysis);
|
||||
var->set_maybe_assigned();
|
||||
}
|
||||
}
|
||||
@ -662,7 +662,7 @@ void DeclarationScope::Analyze(ParseInfo* info, Isolate* isolate,
|
||||
scope->set_should_eager_compile();
|
||||
|
||||
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_EQ(scope->scope_type_, ScopeType::FUNCTION_SCOPE);
|
||||
info->preparsed_scope_data()->RestoreData(scope);
|
||||
@ -1044,7 +1044,7 @@ Variable* DeclarationScope::DeclareParameterName(
|
||||
if (name == ast_value_factory->arguments_string()) {
|
||||
has_arguments_parameter_ = true;
|
||||
}
|
||||
if (FLAG_preparser_scope_analysis) {
|
||||
if (FLAG_experimental_preparser_scope_analysis) {
|
||||
Variable* var = Declare(zone(), name, VAR);
|
||||
params_.Add(var, zone());
|
||||
return var;
|
||||
@ -1205,7 +1205,7 @@ Variable* Scope::DeclareVariableName(const AstRawString* name,
|
||||
DCHECK(scope_info_.is_null());
|
||||
|
||||
// Declare the variable in the declaration scope.
|
||||
if (FLAG_preparser_scope_analysis) {
|
||||
if (FLAG_experimental_preparser_scope_analysis) {
|
||||
Variable* var = LookupLocal(name);
|
||||
DCHECK_NE(var, kDummyPreParserLexicalVariable);
|
||||
DCHECK_NE(var, kDummyPreParserVariable);
|
||||
@ -1552,7 +1552,8 @@ void DeclarationScope::AnalyzePartially(
|
||||
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
|
||||
// and its inner scopes.
|
||||
preparsed_scope_data->SaveData(this);
|
||||
@ -2257,7 +2258,8 @@ void ModuleScope::AllocateModuleVariables() {
|
||||
|
||||
void Scope::AllocateVariablesRecursively() {
|
||||
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.
|
||||
if (is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed()) {
|
||||
|
@ -1082,7 +1082,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
Zone compile_zone(isolate->allocator(), ZONE_NAME);
|
||||
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<Script> script(Script::cast(function->shared()->script()));
|
||||
if (script->HasPreparsedScopeData()) {
|
||||
@ -1181,7 +1181,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
||||
|
||||
if (!script.is_null()) {
|
||||
script->set_compilation_state(Script::COMPILATION_STATE_COMPILED);
|
||||
if (FLAG_preparser_scope_analysis) {
|
||||
if (FLAG_experimental_preparser_scope_analysis) {
|
||||
Handle<FixedUint32Array> data(
|
||||
parse_info->preparsed_scope_data()->Serialize(isolate));
|
||||
script->set_preparsed_scope_data(*data);
|
||||
|
@ -945,9 +945,9 @@ 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)
|
||||
DEFINE_BOOL(preparser_scope_analysis, false,
|
||||
DEFINE_BOOL(experimental_preparser_scope_analysis, false,
|
||||
"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
|
||||
DEFINE_BOOL(trace_sim, false, "Trace simulator execution")
|
||||
|
@ -2860,7 +2860,7 @@ Parser::LazyParsingResult Parser::SkipFunction(FunctionKind kind,
|
||||
|
||||
// FIXME(marja): There are 3 ways to skip functions now. Unify them.
|
||||
if (preparsed_scope_data_->Consuming()) {
|
||||
DCHECK(FLAG_preparser_scope_analysis);
|
||||
DCHECK(FLAG_experimental_preparser_scope_analysis);
|
||||
const PreParseData::FunctionData& data =
|
||||
preparsed_scope_data_->FindFunction(function_scope->start_position());
|
||||
if (data.is_valid()) {
|
||||
|
@ -215,7 +215,8 @@ PreParser::PreParseResult PreParser::PreParseFunction(
|
||||
// function var since the arguments object masks 'function arguments'.
|
||||
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(
|
||||
scope()->start_position(),
|
||||
PreParseData::FunctionData(
|
||||
@ -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(
|
||||
start_position,
|
||||
PreParseData::FunctionData(
|
||||
@ -416,7 +418,7 @@ void PreParser::DeclareAndInitializeVariables(
|
||||
declaration_descriptor->scope->RemoveUnresolved(variable);
|
||||
Variable* var = scope()->DeclareVariableName(
|
||||
variable->raw_name(), declaration_descriptor->mode);
|
||||
if (FLAG_preparser_scope_analysis) {
|
||||
if (FLAG_experimental_preparser_scope_analysis) {
|
||||
MarkLoopVariableAsAssigned(declaration_descriptor->scope, var);
|
||||
// This is only necessary if there is an initializer, but we don't have
|
||||
// that information here. Consequently, the preparser sometimes says
|
||||
|
@ -28,7 +28,7 @@ enum SkipTests {
|
||||
|
||||
TEST(PreParserScopeAnalysis) {
|
||||
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::Factory* factory = isolate->factory();
|
||||
i::HandleScope scope(isolate);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --preparser-scope-analysis
|
||||
// Flags: --experimental-preparser-scope-analysis
|
||||
|
||||
(function TestBasicSkipping() {
|
||||
var result = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user