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

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') | 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 a0b23234166506e9ca328677d6056071d55dce64..1fd8ef1c564c341b893c0375f7485a7fcba32b82 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -852,7 +852,7 @@ void DeclarationScope::AllocateVariables(ParseInfo* info) {
ResolveVariablesRecursively(info);
// 3) Allocate variables.
- AllocateVariablesRecursively();
+ AllocateVariablesRecursively(info->isolate());
}
@@ -941,15 +941,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);
@@ -1590,15 +1581,9 @@ void ModuleScope::AllocateModuleVariables() {
}
}
-void Scope::AllocateVariablesRecursively() {
+void Scope::AllocateVariablesRecursively(Isolate* isolate) {
DCHECK(!already_resolved_);
DCHECK_EQ(0, num_stack_slots_);
-
- // Allocate variables for inner scopes.
- for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
- scope->AllocateVariablesRecursively();
- }
-
DCHECK(!already_resolved_);
DCHECK_EQ(Context::MIN_CONTEXT_SLOTS, num_heap_slots_);
@@ -1631,6 +1616,15 @@ void Scope::AllocateVariablesRecursively() {
// Allocation done.
DCHECK(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
+
+ // Create ScopeInfo.
+ DCHECK(scope_info_.is_null());
+ scope_info_ = ScopeInfo::Create(isolate, zone(), this);
+
+ // Allocate variables for inner scopes.
+ for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
+ scope->AllocateVariablesRecursively(isolate);
adamk 2016/08/26 18:41:08 For stack-allocated block-scoped variables, this m
+ }
}
« no previous file with comments | « src/ast/scopes.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698