Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index b61bcdab556680547248aa2e7b454cfd9b3c39d5..304bafab5cea18d0d30d28de42fb72c09e7aa546 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -14,6 +14,7 @@ |
#include "src/objects-inl.h" |
#include "src/objects/module-info.h" |
#include "src/parsing/parse-info.h" |
+#include "src/parsing/preparsed-scope-data.h" |
namespace v8 { |
namespace internal { |
@@ -1376,7 +1377,9 @@ void DeclarationScope::ResetAfterPreparsing(AstValueFactory* ast_value_factory, |
was_lazily_parsed_ = !aborted; |
} |
-void DeclarationScope::AnalyzePartially(AstNodeFactory* ast_node_factory) { |
+void DeclarationScope::AnalyzePartially( |
+ AstNodeFactory* ast_node_factory, |
+ PreParsedScopeData* preparsed_scope_data) { |
DCHECK(!force_eager_compilation_); |
VariableProxy* unresolved = nullptr; |
@@ -1397,6 +1400,13 @@ void DeclarationScope::AnalyzePartially(AstNodeFactory* ast_node_factory) { |
!(MustAllocate(arguments_) && !has_arguments_parameter_)) { |
arguments_ = nullptr; |
} |
+ |
+ if (FLAG_preparser_scope_analysis) { |
+ // Decide context allocation for the locals and parameters and store the |
+ // info away. |
+ AllocateVariablesRecursively(); |
+ CollectVariableData(preparsed_scope_data); |
+ } |
} |
ResetAfterPreparsing(ast_node_factory->ast_value_factory(), false); |
@@ -2150,6 +2160,16 @@ void Scope::AllocateDebuggerScopeInfos(Isolate* isolate, |
} |
} |
+void Scope::CollectVariableData(PreParsedScopeData* data) { |
+ PreParsedScopeData::ScopeScope scope_scope(data, scope_type(), |
+ start_position(), end_position()); |
+ // TODO(marja): Add data about the variables. |
+ |
+ for (Scope* inner = inner_scope_; inner != nullptr; inner = inner->sibling_) { |
+ inner->CollectVariableData(data); |
+ } |
+} |
+ |
int Scope::StackLocalCount() const { |
Variable* function = |
is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |