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

Unified Diff: src/ast/scopes.cc

Issue 2281073002: Create ScopeInfos while analyzing the Scope chain (Closed)
Patch Set: updates Created 4 years, 4 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/compiler.cc » ('j') | src/debug/debug-scopes.cc » ('J')
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 129cbceaf5bef5c1104efa1332481c23582f7ce3..59be90d9c6d7676ee1e5275107392e2cc0e07322 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -811,14 +811,10 @@ void Scope::CollectVariables(ZoneList<Variable*>* stack_locals,
}
void DeclarationScope::AllocateVariables(ParseInfo* info) {
- // 1) Propagate scope information.
PropagateScopeInfo();
-
- // 2) Resolve variables.
ResolveVariablesRecursively(info);
-
- // 3) Allocate variables.
AllocateVariablesRecursively();
+ AllocateScopeInfosRecursively(info);
}
@@ -907,15 +903,6 @@ DeclarationScope* Scope::GetReceiverScope() {
return scope->AsDeclarationScope();
}
-
-
-Handle<ScopeInfo> Scope::GetScopeInfo(Isolate* isolate) {
- if (scope_info_.is_null()) {
- scope_info_ = ScopeInfo::Create(isolate, zone(), this);
- }
- return scope_info_;
-}
-
Handle<StringSet> DeclarationScope::CollectNonLocals(
ParseInfo* info, Handle<StringSet> non_locals) {
VariableProxy* free_variables = FetchFreeVariables(this, info);
@@ -1599,6 +1586,15 @@ void Scope::AllocateVariablesRecursively() {
DCHECK(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
}
+void Scope::AllocateScopeInfosRecursively(ParseInfo* info) {
+ DCHECK(scope_info_.is_null());
marja 2016/08/29 10:49:30 Discussed offline: maybe we should create ScopeInf
+ scope_info_ = ScopeInfo::Create(info->isolate(), zone(), this);
Toon Verwaest 2016/08/29 11:46:25 Wut? We pass along info just to get the isolate?
jochen (gone - plz use gerrit) 2016/08/29 12:15:25 Eventually, I'd like get the ScopeInfo of the oute
+
+ // Allocate ScopeInfos for inner scopes.
+ for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
+ scope->AllocateScopeInfosRecursively(info);
+ }
+}
int Scope::StackLocalCount() const {
Variable* function =
« no previous file with comments | « src/ast/scopes.h ('k') | src/compiler.cc » ('j') | src/debug/debug-scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698