Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: src/ast/scopes.cc

Issue 2650703003: [parser]: Skipping inner funcs / initial implemetation of storing scope analysis data from preparse… (Closed)
Patch Set: rebased - argh, forced to format build.gn Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/ast/scopes.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698