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

Unified Diff: src/debug/debug-scopes.cc

Issue 1957303002: [debugger] keep scope and context chain for hidden scopes in sync. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 4 years, 7 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/debug/debug-scopes.h ('k') | test/mjsunit/es6/regress/regress-468661.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug-scopes.cc
diff --git a/src/debug/debug-scopes.cc b/src/debug/debug-scopes.cc
index 7c6f944335baa6341fe3809b461fd4fab70fad31..c21b4e634292871148dcf131e8d5ef6e8a79052f 100644
--- a/src/debug/debug-scopes.cc
+++ b/src/debug/debug-scopes.cc
@@ -201,11 +201,15 @@ void ScopeIterator::Next() {
} else if (nested_scope_chain_.is_empty()) {
context_ = Handle<Context>(context_->previous(), isolate_);
} else {
- if (nested_scope_chain_.last().scope_info->HasContext()) {
- DCHECK(context_->previous() != NULL);
- context_ = Handle<Context>(context_->previous(), isolate_);
- }
- nested_scope_chain_.RemoveLast();
+ do {
+ if (nested_scope_chain_.last().scope_info->HasContext()) {
+ DCHECK(context_->previous() != NULL);
+ context_ = Handle<Context>(context_->previous(), isolate_);
+ }
+ nested_scope_chain_.RemoveLast();
+ if (nested_scope_chain_.is_empty()) break;
+ // Repeat to skip hidden scopes.
+ } while (nested_scope_chain_.last().is_hidden());
}
UnwrapEvaluationContext();
}
@@ -796,10 +800,16 @@ bool ScopeIterator::CopyContextExtensionToScopeObject(
void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope,
int position) {
- if (!scope->is_eval_scope() && !scope->is_hidden()) {
- nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate),
- scope->start_position(),
- scope->end_position()));
+ if (!scope->is_eval_scope()) {
+ if (scope->is_hidden()) {
+ // We need to add this chain element in case the scope has a context
+ // associated. We need to keep the scope chain and context chain in sync.
+ nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate)));
+ } else {
+ nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate),
+ scope->start_position(),
+ scope->end_position()));
+ }
}
for (int i = 0; i < scope->inner_scopes()->length(); i++) {
Scope* inner_scope = scope->inner_scopes()->at(i);
« no previous file with comments | « src/debug/debug-scopes.h ('k') | test/mjsunit/es6/regress/regress-468661.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698