| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/debugger.h" | 5 #include "vm/debugger.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "platform/address_sanitizer.h" | 9 #include "platform/address_sanitizer.h" |
| 10 | 10 |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 799 |
| 800 | 800 |
| 801 bool ActivationFrame::HandlesException(const Instance& exc_obj) { | 801 bool ActivationFrame::HandlesException(const Instance& exc_obj) { |
| 802 intptr_t try_index = TryIndex(); | 802 intptr_t try_index = TryIndex(); |
| 803 if (try_index < 0) { | 803 if (try_index < 0) { |
| 804 return false; | 804 return false; |
| 805 } | 805 } |
| 806 ExceptionHandlers& handlers = ExceptionHandlers::Handle(); | 806 ExceptionHandlers& handlers = ExceptionHandlers::Handle(); |
| 807 Array& handled_types = Array::Handle(); | 807 Array& handled_types = Array::Handle(); |
| 808 AbstractType& type = Type::Handle(); | 808 AbstractType& type = Type::Handle(); |
| 809 const TypeArguments& no_instantiator = TypeArguments::Handle(); | |
| 810 const bool is_async = | 809 const bool is_async = |
| 811 function().IsAsyncClosure() || function().IsAsyncGenClosure(); | 810 function().IsAsyncClosure() || function().IsAsyncGenClosure(); |
| 812 handlers = code().exception_handlers(); | 811 handlers = code().exception_handlers(); |
| 813 ASSERT(!handlers.IsNull()); | 812 ASSERT(!handlers.IsNull()); |
| 814 intptr_t num_handlers_checked = 0; | 813 intptr_t num_handlers_checked = 0; |
| 815 while (try_index != CatchClauseNode::kInvalidTryIndex) { | 814 while (try_index != CatchClauseNode::kInvalidTryIndex) { |
| 816 // Detect circles in the exception handler data. | 815 // Detect circles in the exception handler data. |
| 817 num_handlers_checked++; | 816 num_handlers_checked++; |
| 818 ASSERT(num_handlers_checked <= handlers.num_entries()); | 817 ASSERT(num_handlers_checked <= handlers.num_entries()); |
| 819 // Only consider user written handlers for async methods. | 818 // Only consider user written handlers for async methods. |
| 820 if (!is_async || !handlers.IsGenerated(try_index)) { | 819 if (!is_async || !handlers.IsGenerated(try_index)) { |
| 821 handled_types = handlers.GetHandledTypes(try_index); | 820 handled_types = handlers.GetHandledTypes(try_index); |
| 822 const intptr_t num_types = handled_types.Length(); | 821 const intptr_t num_types = handled_types.Length(); |
| 823 for (intptr_t k = 0; k < num_types; k++) { | 822 for (intptr_t k = 0; k < num_types; k++) { |
| 824 type ^= handled_types.At(k); | 823 type ^= handled_types.At(k); |
| 825 ASSERT(!type.IsNull()); | 824 ASSERT(!type.IsNull()); |
| 826 // Uninstantiated types are not added to ExceptionHandlers data. | 825 // Uninstantiated types are not added to ExceptionHandlers data. |
| 827 ASSERT(type.IsInstantiated()); | 826 ASSERT(type.IsInstantiated()); |
| 828 if (type.IsMalformed()) { | 827 if (type.IsMalformed()) { |
| 829 continue; | 828 continue; |
| 830 } | 829 } |
| 831 if (type.IsDynamicType()) { | 830 if (type.IsDynamicType()) { |
| 832 return true; | 831 return true; |
| 833 } | 832 } |
| 834 if (exc_obj.IsInstanceOf(type, no_instantiator, NULL)) { | 833 if (exc_obj.IsInstanceOf(type, Object::null_type_arguments(), NULL)) { |
| 835 return true; | 834 return true; |
| 836 } | 835 } |
| 837 } | 836 } |
| 838 } | 837 } |
| 839 try_index = handlers.OuterTryIndex(try_index); | 838 try_index = handlers.OuterTryIndex(try_index); |
| 840 } | 839 } |
| 841 return false; | 840 return false; |
| 842 } | 841 } |
| 843 | 842 |
| 844 | 843 |
| (...skipping 3288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4133 | 4132 |
| 4134 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4133 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 4135 ASSERT(bpt->next() == NULL); | 4134 ASSERT(bpt->next() == NULL); |
| 4136 bpt->set_next(code_breakpoints_); | 4135 bpt->set_next(code_breakpoints_); |
| 4137 code_breakpoints_ = bpt; | 4136 code_breakpoints_ = bpt; |
| 4138 } | 4137 } |
| 4139 | 4138 |
| 4140 #endif // !PRODUCT | 4139 #endif // !PRODUCT |
| 4141 | 4140 |
| 4142 } // namespace dart | 4141 } // namespace dart |
| OLD | NEW |