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

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

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: relax dchecks Created 4 years, 1 month 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 c84d32ae7da7e2ecd89c072a72f38d81a5bd0dd5..fbdb0ec32cb2d7ae57931d91239f145220eacabc 100644
--- a/src/debug/debug-scopes.cc
+++ b/src/debug/debug-scopes.cc
@@ -272,7 +272,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();
@@ -283,7 +283,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()) {
@@ -377,7 +377,7 @@ Handle<ScopeInfo> ScopeIterator::CurrentScopeInfo() {
return nested_scope_chain_.last().scope_info;
} else if (context_->IsBlockContext()) {
return Handle<ScopeInfo>(context_->scope_info());
- } else if (context_->IsFunctionContext()) {
+ } else if (context_->IsFunctionContext() || context_->IsEvalContext()) {
adamk 2016/11/12 00:26:05 Again, it seems like this is duplicating logic fro
Dan Ehrenberg 2016/12/07 05:41:26 Done.
return Handle<ScopeInfo>(context_->closure()->shared()->scope_info());
}
return Handle<ScopeInfo>::null();
@@ -530,7 +530,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());
@@ -728,7 +728,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());
return SetContextVariableValue(CurrentScopeInfo(), CurrentContext(),
variable_name, new_value);
}

Powered by Google App Engine
This is Rietveld 408576698