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

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

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Changes based on review commnets Created 4 years 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
Index: src/debug/debug-scopes.cc
diff --git a/src/debug/debug-scopes.cc b/src/debug/debug-scopes.cc
index cb0b5e1c40eaf07591e5667514873846590aab1a..f1f1be5137ce2066fdba561d5863e56a0fcdffc5 100644
--- a/src/debug/debug-scopes.cc
+++ b/src/debug/debug-scopes.cc
@@ -271,7 +271,7 @@ ScopeIterator::ScopeType ScopeIterator::Type() {
DCHECK(!scope_info->HasContext() || context_->IsBlockContext());
return ScopeTypeBlock;
case EVAL_SCOPE:
- DCHECK(!scope_info->HasContext() || context_->IsFunctionContext());
+ DCHECK(!scope_info->HasContext() || context_->IsEvalContext());
return ScopeTypeEval;
}
UNREACHABLE();
@@ -282,7 +282,7 @@ ScopeIterator::ScopeType ScopeIterator::Type() {
// fake it.
return seen_script_scope_ ? ScopeTypeGlobal : ScopeTypeScript;
}
- if (context_->IsFunctionContext()) {
+ if (context_->IsFunctionContext() || context_->IsEvalContext()) {
return ScopeTypeClosure;
}
if (context_->IsCatchContext()) {
@@ -374,10 +374,9 @@ Handle<ScopeInfo> ScopeIterator::CurrentScopeInfo() {
DCHECK(!Done());
if (!nested_scope_chain_.is_empty()) {
return nested_scope_chain_.last().scope_info;
- } else if (context_->IsBlockContext()) {
+ } else if (context_->IsBlockContext() || context_->IsFunctionContext() ||
+ context_->IsEvalContext()) {
return Handle<ScopeInfo>(context_->scope_info());
- } else if (context_->IsFunctionContext()) {
- return Handle<ScopeInfo>(context_->closure()->shared()->scope_info());
}
return Handle<ScopeInfo>::null();
}
@@ -529,7 +528,7 @@ MaybeHandle<JSObject> ScopeIterator::MaterializeLocalScope() {
// context.
Handle<JSObject> ScopeIterator::MaterializeClosure() {
Handle<Context> context = CurrentContext();
- DCHECK(context->IsFunctionContext());
+ DCHECK(context->IsFunctionContext() || context->IsEvalContext());
Handle<SharedFunctionInfo> shared(context->closure()->shared());
Handle<ScopeInfo> scope_info(shared->scope_info());
@@ -727,7 +726,7 @@ bool ScopeIterator::SetInnerScopeVariableValue(Handle<String> variable_name,
// This method copies structure of MaterializeClosure method above.
bool ScopeIterator::SetClosureVariableValue(Handle<String> variable_name,
Handle<Object> new_value) {
- DCHECK(CurrentContext()->IsFunctionContext());
+ DCHECK(CurrentContext()->IsFunctionContext() || context_->IsEvalContext());
Michael Starzinger 2016/12/15 09:42:59 nit: s/context_/CurrentContext()/
Dan Ehrenberg 2016/12/15 23:51:50 Done.
return SetContextVariableValue(CurrentScopeInfo(), CurrentContext(),
variable_name, new_value);
}

Powered by Google App Engine
This is Rietveld 408576698