Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index 157712b548b574165ba919d4451904c147c3fa4b..cc7a975c16cd8c8d09b0839723b9762505a20714 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -15,6 +15,7 @@ |
#include "src/objects/module-info.h" |
#include "src/objects/scope-info.h" |
#include "src/parsing/parse-info.h" |
+#include "src/parsing/preparsed-scope-data.h" |
namespace v8 { |
namespace internal { |
@@ -1377,7 +1378,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; |
@@ -1398,6 +1401,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); |
@@ -2151,6 +2161,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; |