Chromium Code Reviews| Index: src/ast/scopes.cc |
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
| index b61bcdab556680547248aa2e7b454cfd9b3c39d5..72d9713ca6d6c8dc6df90ec784873b56453b1693 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) { |
|
vogelheim
2017/01/25 10:00:17
DCHECK_EQ(FLAG_preparser_scope_analysis, preparsed
marja
2017/01/25 10:21:26
It's not, since PreParsedScopeData always exists (
|
| 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(); |
| + GetAllocationData(preparsed_scope_data); |
| + } |
| } |
| ResetAfterPreparsing(ast_node_factory->ast_value_factory(), false); |
| @@ -2150,6 +2160,15 @@ void Scope::AllocateDebuggerScopeInfos(Isolate* isolate, |
| } |
| } |
| +void Scope::GetAllocationData(PreParsedScopeData* data) { |
|
vogelheim
2017/01/25 10:00:18
naming nitpick: This doesn't really get anything..
marja
2017/01/25 10:21:26
Went for CollectVariableData (no "FromInenrScopes"
|
| + PreParsedScopeData::ScopeData scope_data(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->GetAllocationData(data); |
| + } |
|
vogelheim
2017/01/25 10:00:18
nitpick: I found this code a bit weird to read...
marja
2017/01/25 10:21:26
Acknowledged.
|
| +} |
| + |
| int Scope::StackLocalCount() const { |
| Variable* function = |
| is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |