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

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

Issue 2187273002: Merged: [debugger] Scope iterator should not visit inner function literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.3
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-621361.js » ('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 "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 Handle<String> key(String::cast(keys->get(i))); 779 Handle<String> key(String::cast(keys->get(i)));
780 Handle<Object> value = 780 Handle<Object> value =
781 Object::GetPropertyOrElement(extension, key).ToHandleChecked(); 781 Object::GetPropertyOrElement(extension, key).ToHandleChecked();
782 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, key, value, NONE) 782 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, key, value, NONE)
783 .Check(); 783 .Check();
784 } 784 }
785 } 785 }
786 786
787 void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope, 787 void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope,
788 int position) { 788 int position) {
789 if (scope->is_function_scope()) {
790 // Do not collect scopes of nested inner functions inside the current one.
791 Handle<JSFunction> function = frame_inspector_->GetFunction();
792 if (scope->end_position() < function->shared()->end_position()) return;
793 }
789 if (scope->is_hidden()) { 794 if (scope->is_hidden()) {
790 // We need to add this chain element in case the scope has a context 795 // We need to add this chain element in case the scope has a context
791 // associated. We need to keep the scope chain and context chain in sync. 796 // associated. We need to keep the scope chain and context chain in sync.
792 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate))); 797 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate)));
793 } else { 798 } else {
794 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate), 799 nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate),
795 scope->start_position(), 800 scope->start_position(),
796 scope->end_position())); 801 scope->end_position()));
797 } 802 }
798 for (int i = 0; i < scope->inner_scopes()->length(); i++) { 803 for (int i = 0; i < scope->inner_scopes()->length(); i++) {
799 Scope* inner_scope = scope->inner_scopes()->at(i); 804 Scope* inner_scope = scope->inner_scopes()->at(i);
800 int beg_pos = inner_scope->start_position(); 805 int beg_pos = inner_scope->start_position();
801 int end_pos = inner_scope->end_position(); 806 int end_pos = inner_scope->end_position();
802 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); 807 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden());
803 if (beg_pos <= position && position < end_pos) { 808 if (beg_pos <= position && position < end_pos) {
804 GetNestedScopeChain(isolate, inner_scope, position); 809 GetNestedScopeChain(isolate, inner_scope, position);
805 return; 810 return;
806 } 811 }
807 } 812 }
808 } 813 }
809 814
810 } // namespace internal 815 } // namespace internal
811 } // namespace v8 816 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-621361.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698