| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Currently it takes too much time to find nested scopes due to script | 53 // Currently it takes too much time to find nested scopes due to script |
| 54 // parsing. Sometimes we want to run the ScopeIterator as fast as possible | 54 // parsing. Sometimes we want to run the ScopeIterator as fast as possible |
| 55 // (for example, while collecting async call stacks on every | 55 // (for example, while collecting async call stacks on every |
| 56 // addEventListener call), even if we drop some nested scopes. | 56 // addEventListener call), even if we drop some nested scopes. |
| 57 // Later we may optimize getting the nested scopes (cache the result?) | 57 // Later we may optimize getting the nested scopes (cache the result?) |
| 58 // and include nested scopes into the "fast" iteration case as well. | 58 // and include nested scopes into the "fast" iteration case as well. |
| 59 bool ignore_nested_scopes = (option == IGNORE_NESTED_SCOPES); | 59 bool ignore_nested_scopes = (option == IGNORE_NESTED_SCOPES); |
| 60 bool collect_non_locals = (option == COLLECT_NON_LOCALS); | 60 bool collect_non_locals = (option == COLLECT_NON_LOCALS); |
| 61 if (!ignore_nested_scopes && shared_info->HasDebugInfo() && | 61 if (!ignore_nested_scopes && shared_info->HasBreakInfo() && |
| 62 frame_inspector_ != nullptr) { | 62 frame_inspector_ != nullptr) { |
| 63 // The source position at return is always the end of the function, | 63 // The source position at return is always the end of the function, |
| 64 // which is not consistent with the current scope chain. Therefore all | 64 // which is not consistent with the current scope chain. Therefore all |
| 65 // nested with, catch and block contexts are skipped, and we can only | 65 // nested with, catch and block contexts are skipped, and we can only |
| 66 // inspect the function scope. | 66 // inspect the function scope. |
| 67 // This can only happen if we set a break point inside right before the | 67 // This can only happen if we set a break point inside right before the |
| 68 // return, which requires a debug info to be available. | 68 // return, which requires a debug info to be available. |
| 69 Handle<DebugInfo> debug_info(shared_info->GetDebugInfo()); | 69 Handle<DebugInfo> debug_info(shared_info->GetDebugInfo()); |
| 70 | 70 |
| 71 // Find the break point where execution has stopped. | 71 // Find the break point where execution has stopped. |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 926 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
| 927 if (beg_pos <= position && position < end_pos) { | 927 if (beg_pos <= position && position < end_pos) { |
| 928 GetNestedScopeChain(isolate, inner_scope, position); | 928 GetNestedScopeChain(isolate, inner_scope, position); |
| 929 return; | 929 return; |
| 930 } | 930 } |
| 931 } | 931 } |
| 932 } | 932 } |
| 933 | 933 |
| 934 } // namespace internal | 934 } // namespace internal |
| 935 } // namespace v8 | 935 } // namespace v8 |
| OLD | NEW |