Chromium Code Reviews| 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
|
| + } |
| } |