| Index: src/ast/scopes.cc
|
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
|
| index 73c243b6250c21e4adccb99288be13b8b803707e..bc26f1da9ac7984cbf1c05be61e9dbe0698e9f24 100644
|
| --- a/src/ast/scopes.cc
|
| +++ b/src/ast/scopes.cc
|
| @@ -399,7 +399,7 @@ int Scope::num_parameters() const {
|
| return is_declaration_scope() ? AsDeclarationScope()->num_parameters() : 0;
|
| }
|
|
|
| -void Scope::Analyze(ParseInfo* info) {
|
| +void DeclarationScope::Analyze(ParseInfo* info) {
|
| DCHECK(info->literal() != NULL);
|
| DeclarationScope* scope = info->literal()->scope();
|
|
|
| @@ -411,7 +411,7 @@ void Scope::Analyze(ParseInfo* info) {
|
| scope->outer_scope()->scope_type() == SCRIPT_SCOPE ||
|
| scope->outer_scope()->already_resolved_);
|
|
|
| - scope->AllocateVariables(info);
|
| + scope->AllocateVariables(info, false /* for_debugger */);
|
|
|
| #ifdef DEBUG
|
| if (info->script_is_native() ? FLAG_print_builtin_scopes
|
| @@ -423,6 +423,21 @@ void Scope::Analyze(ParseInfo* info) {
|
| #endif
|
| }
|
|
|
| +void DeclarationScope::AnalyzeForDebugger(ParseInfo* info) {
|
| + DCHECK(info->literal() != NULL);
|
| + DeclarationScope* scope = info->literal()->scope();
|
| +
|
| + // We are compiling one of three cases:
|
| + // 1) top-level code,
|
| + // 2) a function/eval/module on the top-level
|
| + // 3) a function/eval in a scope that was already resolved.
|
| + DCHECK(scope->scope_type() == SCRIPT_SCOPE ||
|
| + scope->outer_scope()->scope_type() == SCRIPT_SCOPE ||
|
| + scope->outer_scope()->already_resolved_);
|
| +
|
| + scope->AllocateVariables(info, true /* for_debugger */);
|
| +}
|
| +
|
| void DeclarationScope::DeclareThis(AstValueFactory* ast_value_factory) {
|
| DCHECK(!already_resolved_);
|
| DCHECK(is_declaration_scope());
|
| @@ -877,18 +892,13 @@ Declaration* Scope::CheckLexDeclarationsConflictingWith(
|
| return nullptr;
|
| }
|
|
|
| -void DeclarationScope::AllocateVariables(ParseInfo* info) {
|
| - // 1) Propagate scope information.
|
| +void DeclarationScope::AllocateVariables(ParseInfo* info, bool for_debugger) {
|
| PropagateScopeInfo();
|
| -
|
| - // 2) Resolve variables.
|
| ResolveVariablesRecursively(info);
|
| -
|
| - // 3) Allocate variables.
|
| AllocateVariablesRecursively();
|
| + AllocateScopeInfosRecursively(info->isolate(), for_debugger);
|
| }
|
|
|
| -
|
| bool Scope::AllowsLazyParsing() const {
|
| // If we are inside a block scope, we must parse eagerly to find out how
|
| // to allocate variables on the block scope. At this point, declarations may
|
| @@ -974,15 +984,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);
|
| @@ -1642,6 +1643,17 @@ void Scope::AllocateVariablesRecursively() {
|
| DCHECK(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
|
| }
|
|
|
| +void Scope::AllocateScopeInfosRecursively(Isolate* isolate, bool for_debugger) {
|
| + DCHECK(scope_info_.is_null());
|
| + if (for_debugger || NeedsScopeInfo()) {
|
| + scope_info_ = ScopeInfo::Create(isolate, zone(), this);
|
| + }
|
| +
|
| + // Allocate ScopeInfos for inner scopes.
|
| + for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
|
| + scope->AllocateScopeInfosRecursively(isolate, for_debugger);
|
| + }
|
| +}
|
|
|
| int Scope::StackLocalCount() const {
|
| Variable* function =
|
|
|