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/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 bool collect_non_locals = (option == COLLECT_NON_LOCALS); | 51 bool collect_non_locals = (option == COLLECT_NON_LOCALS); |
52 if (!ignore_nested_scopes && shared_info->HasDebugInfo()) { | 52 if (!ignore_nested_scopes && shared_info->HasDebugInfo()) { |
53 // The source position at return is always the end of the function, | 53 // The source position at return is always the end of the function, |
54 // which is not consistent with the current scope chain. Therefore all | 54 // which is not consistent with the current scope chain. Therefore all |
55 // nested with, catch and block contexts are skipped, and we can only | 55 // nested with, catch and block contexts are skipped, and we can only |
56 // inspect the function scope. | 56 // inspect the function scope. |
57 // This can only happen if we set a break point inside right before the | 57 // This can only happen if we set a break point inside right before the |
58 // return, which requires a debug info to be available. | 58 // return, which requires a debug info to be available. |
59 Handle<DebugInfo> debug_info(shared_info->GetDebugInfo()); | 59 Handle<DebugInfo> debug_info(shared_info->GetDebugInfo()); |
60 | 60 |
61 // PC points to the instruction after the current one, possibly a break | |
62 // location as well. So the "- 1" to exclude it from the search. | |
63 Address call_pc = GetFrame()->pc() - 1; | |
64 | |
65 // Find the break point where execution has stopped. | 61 // Find the break point where execution has stopped. |
66 BreakLocation location = BreakLocation::FromAddress(debug_info, call_pc); | 62 BreakLocation location = BreakLocation::FromFrame(debug_info, GetFrame()); |
67 | 63 |
68 ignore_nested_scopes = location.IsReturn(); | 64 ignore_nested_scopes = location.IsReturn(); |
69 } | 65 } |
70 | 66 |
71 if (ignore_nested_scopes) { | 67 if (ignore_nested_scopes) { |
72 if (scope_info->HasContext()) { | 68 if (scope_info->HasContext()) { |
73 context_ = Handle<Context>(context_->declaration_context(), isolate_); | 69 context_ = Handle<Context>(context_->declaration_context(), isolate_); |
74 } else { | 70 } else { |
75 while (context_->closure() == *function) { | 71 while (context_->closure() == *function) { |
76 context_ = Handle<Context>(context_->previous(), isolate_); | 72 context_ = Handle<Context>(context_->previous(), isolate_); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 isolate_, value, Object::GetPropertyOrElement(extension, key), false); | 812 isolate_, value, Object::GetPropertyOrElement(extension, key), false); |
817 RETURN_ON_EXCEPTION_VALUE( | 813 RETURN_ON_EXCEPTION_VALUE( |
818 isolate_, JSObject::SetOwnPropertyIgnoreAttributes( | 814 isolate_, JSObject::SetOwnPropertyIgnoreAttributes( |
819 scope_object, key, value, NONE), false); | 815 scope_object, key, value, NONE), false); |
820 } | 816 } |
821 return true; | 817 return true; |
822 } | 818 } |
823 | 819 |
824 } // namespace internal | 820 } // namespace internal |
825 } // namespace v8 | 821 } // namespace v8 |
OLD | NEW |