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

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
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 129cbceaf5bef5c1104efa1332481c23582f7ce3..108d238287067a80603e328b7fc96204bd44dc1c 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.
jochen (gone - plz use gerrit) 2016/08/29 09:15:48 // Do foo. foo();
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());
+ scope_info_ = ScopeInfo::Create(info->isolate(), zone(), this);
jochen (gone - plz use gerrit) 2016/08/29 09:15:48 the debugger wants all scopes anyways.
+
+ // Allocate variables for inner scopes.
marja 2016/08/29 09:26:25 This comment is a copy-paste error.
+ for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
+ scope->AllocateScopeInfosRecursively(info);
+ }
+}
int Scope::StackLocalCount() const {
Variable* function =

Powered by Google App Engine
This is Rietveld 408576698