OLD | NEW |
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // and include nested scopes into the "fast" iteration case as well. | 51 // and include nested scopes into the "fast" iteration case as well. |
52 bool ignore_nested_scopes = (option == IGNORE_NESTED_SCOPES); | 52 bool ignore_nested_scopes = (option == IGNORE_NESTED_SCOPES); |
53 bool collect_non_locals = (option == COLLECT_NON_LOCALS); | 53 bool collect_non_locals = (option == COLLECT_NON_LOCALS); |
54 if (!ignore_nested_scopes && shared_info->HasDebugInfo()) { | 54 if (!ignore_nested_scopes && shared_info->HasDebugInfo()) { |
55 // The source position at return is always the end of the function, | 55 // The source position at return is always the end of the function, |
56 // which is not consistent with the current scope chain. Therefore all | 56 // which is not consistent with the current scope chain. Therefore all |
57 // nested with, catch and block contexts are skipped, and we can only | 57 // nested with, catch and block contexts are skipped, and we can only |
58 // inspect the function scope. | 58 // inspect the function scope. |
59 // This can only happen if we set a break point inside right before the | 59 // This can only happen if we set a break point inside right before the |
60 // return, which requires a debug info to be available. | 60 // return, which requires a debug info to be available. |
61 Handle<DebugInfo> debug_info(shared_info->GetDebugInfo()); | |
62 | 61 |
63 // Find the break point where execution has stopped. | 62 // Find the break point where execution has stopped. |
64 BreakLocation location = BreakLocation::FromFrame(debug_info, GetFrame()); | 63 BreakLocation location = BreakLocation::FromFrame(GetFrame()); |
65 | 64 |
66 ignore_nested_scopes = location.IsReturn(); | 65 ignore_nested_scopes = location.IsReturn(); |
67 } | 66 } |
68 | 67 |
69 if (ignore_nested_scopes) { | 68 if (ignore_nested_scopes) { |
70 if (scope_info->HasContext()) { | 69 if (scope_info->HasContext()) { |
71 context_ = Handle<Context>(context_->declaration_context(), isolate_); | 70 context_ = Handle<Context>(context_->declaration_context(), isolate_); |
72 } else { | 71 } else { |
73 while (context_->closure() == *function) { | 72 while (context_->closure() == *function) { |
74 context_ = Handle<Context>(context_->previous(), isolate_); | 73 context_ = Handle<Context>(context_->previous(), isolate_); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 802 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
804 if (beg_pos <= position && position < end_pos) { | 803 if (beg_pos <= position && position < end_pos) { |
805 GetNestedScopeChain(isolate, inner_scope, position); | 804 GetNestedScopeChain(isolate, inner_scope, position); |
806 return; | 805 return; |
807 } | 806 } |
808 } | 807 } |
809 } | 808 } |
810 | 809 |
811 } // namespace internal | 810 } // namespace internal |
812 } // namespace v8 | 811 } // namespace v8 |
OLD | NEW |