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()); | |
65 | 64 |
66 // Find the break point where execution has stopped. | 65 // Find the break point where execution has stopped. |
67 BreakLocation location = BreakLocation::FromFrame(debug_info, GetFrame()); | 66 BreakLocation location = BreakLocation::FromFrame(GetFrame()); |
68 | 67 |
69 ignore_nested_scopes = location.IsReturn(); | 68 ignore_nested_scopes = location.IsReturn(); |
70 } | 69 } |
71 | 70 |
72 if (ignore_nested_scopes) { | 71 if (ignore_nested_scopes) { |
73 if (scope_info->HasContext()) { | 72 if (scope_info->HasContext()) { |
74 context_ = Handle<Context>(context_->declaration_context(), isolate_); | 73 context_ = Handle<Context>(context_->declaration_context(), isolate_); |
75 } else { | 74 } else { |
76 while (context_->closure() == *function) { | 75 while (context_->closure() == *function) { |
77 context_ = Handle<Context>(context_->previous(), isolate_); | 76 context_ = Handle<Context>(context_->previous(), isolate_); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 856 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
858 if (beg_pos <= position && position < end_pos) { | 857 if (beg_pos <= position && position < end_pos) { |
859 GetNestedScopeChain(isolate, inner_scope, position); | 858 GetNestedScopeChain(isolate, inner_scope, position); |
860 return; | 859 return; |
861 } | 860 } |
862 } | 861 } |
863 } | 862 } |
864 | 863 |
865 } // namespace internal | 864 } // namespace internal |
866 } // namespace v8 | 865 } // namespace v8 |
OLD | NEW |