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

Side by Side Diff: src/debug/debug-scopes.cc

Issue 2281073002: Create ScopeInfos while analyzing the Scope chain (Closed)
Patch Set: rebase Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/crankshaft/x87/lithium-codegen-x87.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/debug/debug-scopes.h" 5 #include "src/debug/debug-scopes.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } else { 108 } else {
109 // Inner function. 109 // Inner function.
110 info.reset(new ParseInfo(&zone, function)); 110 info.reset(new ParseInfo(&zone, function));
111 } 111 }
112 if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) { 112 if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) {
113 DeclarationScope* scope = info->literal()->scope(); 113 DeclarationScope* scope = info->literal()->scope();
114 if (!ignore_nested_scopes || collect_non_locals) { 114 if (!ignore_nested_scopes || collect_non_locals) {
115 CollectNonLocals(info.get(), scope); 115 CollectNonLocals(info.get(), scope);
116 } 116 }
117 if (!ignore_nested_scopes) { 117 if (!ignore_nested_scopes) {
118 scope->AllocateVariables(info.get()); 118 DeclarationScope::AnalyzeForDebugger(info.get());
119 RetrieveScopeChain(scope); 119 RetrieveScopeChain(scope);
120 } 120 }
121 } else if (!ignore_nested_scopes) { 121 } else if (!ignore_nested_scopes) {
122 // A failed reparse indicates that the preparser has diverged from the 122 // A failed reparse indicates that the preparser has diverged from the
123 // parser or that the preparse data given to the initial parse has been 123 // parser or that the preparse data given to the initial parse has been
124 // faulty. We fail in debug mode but in release mode we only provide the 124 // faulty. We fail in debug mode but in release mode we only provide the
125 // information we get from the context chain but nothing about 125 // information we get from the context chain but nothing about
126 // completely stack allocated scopes or stack allocated locals. 126 // completely stack allocated scopes or stack allocated locals.
127 // Or it could be due to stack overflow. 127 // Or it could be due to stack overflow.
128 DCHECK(isolate_->has_pending_exception()); 128 DCHECK(isolate_->has_pending_exception());
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope, 811 void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope,
812 int position) { 812 int position) {
813 if (scope->is_function_scope()) { 813 if (scope->is_function_scope()) {
814 // Do not collect scopes of nested inner functions inside the current one. 814 // Do not collect scopes of nested inner functions inside the current one.
815 Handle<JSFunction> function = frame_inspector_->GetFunction(); 815 Handle<JSFunction> function = frame_inspector_->GetFunction();
816 if (scope->end_position() < function->shared()->end_position()) return; 816 if (scope->end_position() < function->shared()->end_position()) return;
817 } 817 }
818 if (scope->is_hidden()) { 818 if (scope->is_hidden()) {
819 // We need to add this chain element in case the scope has a context 819 // We need to add this chain element in case the scope has a context
820 // associated. We need to keep the scope chain and context chain in sync. 820 // associated. We need to keep the scope chain and context chain in sync.
821 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate))); 821 nested_scope_chain_.Add(ExtendedScopeInfo(scope->scope_info()));
822 } else { 822 } else {
823 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate), 823 nested_scope_chain_.Add(ExtendedScopeInfo(
824 scope->start_position(), 824 scope->scope_info(), scope->start_position(), scope->end_position()));
825 scope->end_position()));
826 } 825 }
827 for (Scope* inner_scope = scope->inner_scope(); inner_scope != nullptr; 826 for (Scope* inner_scope = scope->inner_scope(); inner_scope != nullptr;
828 inner_scope = inner_scope->sibling()) { 827 inner_scope = inner_scope->sibling()) {
829 int beg_pos = inner_scope->start_position(); 828 int beg_pos = inner_scope->start_position();
830 int end_pos = inner_scope->end_position(); 829 int end_pos = inner_scope->end_position();
831 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); 830 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden());
832 if (beg_pos <= position && position < end_pos) { 831 if (beg_pos <= position && position < end_pos) {
833 GetNestedScopeChain(isolate, inner_scope, position); 832 GetNestedScopeChain(isolate, inner_scope, position);
834 return; 833 return;
835 } 834 }
836 } 835 }
837 } 836 }
838 837
839 } // namespace internal 838 } // namespace internal
840 } // namespace v8 839 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/x87/lithium-codegen-x87.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698