Index: src/runtime/runtime-debug.cc |
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc |
index d23d0e2322e983aa019cfa3364937df4cd52d324..7708b6f7a34d8e4698a2f9c8b1697c7b2fc5d263 100644 |
--- a/src/runtime/runtime-debug.cc |
+++ b/src/runtime/runtime-debug.cc |
@@ -1298,16 +1298,21 @@ class ScopeIterator { |
context_ = Handle<Context>(); |
return; |
} |
- if (scope_type == ScopeTypeScript) seen_script_scope_ = true; |
- if (nested_scope_chain_.is_empty()) { |
- if (scope_type == ScopeTypeScript) { |
- if (context_->IsScriptContext()) { |
- context_ = Handle<Context>(context_->previous(), isolate_); |
- } |
- CHECK(context_->IsNativeContext()); |
- } else { |
+ if (scope_type == ScopeTypeScript) { |
+ seen_script_scope_ = true; |
+ if (context_->IsScriptContext()) { |
context_ = Handle<Context>(context_->previous(), isolate_); |
} |
+ if (!nested_scope_chain_.is_empty()) { |
+ DCHECK_EQ(nested_scope_chain_.last()->scope_type(), SCRIPT_SCOPE); |
+ nested_scope_chain_.RemoveLast(); |
+ DCHECK(nested_scope_chain_.is_empty()); |
+ } |
+ CHECK(context_->IsNativeContext()); |
+ return; |
+ } |
+ if (nested_scope_chain_.is_empty()) { |
+ context_ = Handle<Context>(context_->previous(), isolate_); |
} else { |
if (nested_scope_chain_.last()->HasContext()) { |
DCHECK(context_->previous() != NULL); |