Commit f33cd98c authored by marja's avatar marja Committed by Commit bot

[scopes]: With --print-scopes, print preparsed scopes before destroying them.

BUG=v8:5516

Review-Url: https://codereview.chromium.org/2666053003
Cr-Commit-Position: refs/heads/master@{#42835}
parent a964fa29
...@@ -627,6 +627,7 @@ void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) { ...@@ -627,6 +627,7 @@ void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) {
#ifdef DEBUG #ifdef DEBUG
if (info->script_is_native() ? FLAG_print_builtin_scopes if (info->script_is_native() ? FLAG_print_builtin_scopes
: FLAG_print_scopes) { : FLAG_print_scopes) {
PrintF("Global scope:\n");
scope->Print(); scope->Print();
} }
scope->CheckScopePositions(); scope->CheckScopePositions();
...@@ -1424,6 +1425,12 @@ void DeclarationScope::AnalyzePartially( ...@@ -1424,6 +1425,12 @@ void DeclarationScope::AnalyzePartially(
CollectVariableData(preparsed_scope_data); CollectVariableData(preparsed_scope_data);
} }
} }
#ifdef DEBUG
if (FLAG_print_scopes) {
PrintF("Inner function scope:\n");
Print();
}
#endif
ResetAfterPreparsing(ast_node_factory->ast_value_factory(), false); ResetAfterPreparsing(ast_node_factory->ast_value_factory(), false);
...@@ -1509,6 +1516,10 @@ void PrintMap(int indent, const char* label, VariableMap* map, bool locals, ...@@ -1509,6 +1516,10 @@ void PrintMap(int indent, const char* label, VariableMap* map, bool locals,
for (VariableMap::Entry* p = map->Start(); p != nullptr; p = map->Next(p)) { for (VariableMap::Entry* p = map->Start(); p != nullptr; p = map->Next(p)) {
Variable* var = reinterpret_cast<Variable*>(p->value); Variable* var = reinterpret_cast<Variable*>(p->value);
if (var == function_var) continue; if (var == function_var) continue;
if (var == kDummyPreParserVariable ||
var == kDummyPreParserLexicalVariable) {
continue;
}
bool local = !IsDynamicVariableMode(var->mode()); bool local = !IsDynamicVariableMode(var->mode());
if ((locals ? local : !local) && if ((locals ? local : !local) &&
(var->is_used() || !var->IsUnallocated())) { (var->is_used() || !var->IsUnallocated())) {
......
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