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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // and include nested scopes into the "fast" iteration case as well. | 54 // and include nested scopes into the "fast" iteration case as well. |
55 bool ignore_nested_scopes = (option == IGNORE_NESTED_SCOPES); | 55 bool ignore_nested_scopes = (option == IGNORE_NESTED_SCOPES); |
56 bool collect_non_locals = (option == COLLECT_NON_LOCALS); | 56 bool collect_non_locals = (option == COLLECT_NON_LOCALS); |
57 if (!ignore_nested_scopes && shared_info->HasDebugInfo()) { | 57 if (!ignore_nested_scopes && shared_info->HasDebugInfo()) { |
58 // The source position at return is always the end of the function, | 58 // The source position at return is always the end of the function, |
59 // which is not consistent with the current scope chain. Therefore all | 59 // which is not consistent with the current scope chain. Therefore all |
60 // nested with, catch and block contexts are skipped, and we can only | 60 // nested with, catch and block contexts are skipped, and we can only |
61 // inspect the function scope. | 61 // inspect the function scope. |
62 // This can only happen if we set a break point inside right before the | 62 // This can only happen if we set a break point inside right before the |
63 // return, which requires a debug info to be available. | 63 // return, which requires a debug info to be available. |
| 64 Handle<DebugInfo> debug_info(shared_info->GetDebugInfo()); |
64 | 65 |
65 // Find the break point where execution has stopped. | 66 // Find the break point where execution has stopped. |
66 BreakLocation location = BreakLocation::FromFrame(GetFrame()); | 67 BreakLocation location = BreakLocation::FromFrame(debug_info, GetFrame()); |
67 | 68 |
68 ignore_nested_scopes = location.IsReturn(); | 69 ignore_nested_scopes = location.IsReturn(); |
69 } | 70 } |
70 | 71 |
71 if (ignore_nested_scopes) { | 72 if (ignore_nested_scopes) { |
72 if (scope_info->HasContext()) { | 73 if (scope_info->HasContext()) { |
73 context_ = Handle<Context>(context_->declaration_context(), isolate_); | 74 context_ = Handle<Context>(context_->declaration_context(), isolate_); |
74 } else { | 75 } else { |
75 while (context_->closure() == *function) { | 76 while (context_->closure() == *function) { |
76 context_ = Handle<Context>(context_->previous(), isolate_); | 77 context_ = Handle<Context>(context_->previous(), isolate_); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 857 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
857 if (beg_pos <= position && position < end_pos) { | 858 if (beg_pos <= position && position < end_pos) { |
858 GetNestedScopeChain(isolate, inner_scope, position); | 859 GetNestedScopeChain(isolate, inner_scope, position); |
859 return; | 860 return; |
860 } | 861 } |
861 } | 862 } |
862 } | 863 } |
863 | 864 |
864 } // namespace internal | 865 } // namespace internal |
865 } // namespace v8 | 866 } // namespace v8 |
OLD | NEW |