| 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/code_descriptors.h" | 5 #include "vm/code_descriptors.h" |
| 6 | 6 |
| 7 namespace dart { | 7 namespace dart { |
| 8 | 8 |
| 9 void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, | 9 void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, |
| 10 intptr_t pc_offset, | 10 intptr_t pc_offset, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return Object::empty_exception_handlers().raw(); | 92 return Object::empty_exception_handlers().raw(); |
| 93 } | 93 } |
| 94 const ExceptionHandlers& handlers = | 94 const ExceptionHandlers& handlers = |
| 95 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); | 95 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); |
| 96 for (intptr_t i = 0; i < num_handlers; i++) { | 96 for (intptr_t i = 0; i < num_handlers; i++) { |
| 97 // Assert that every element in the array has been initialized. | 97 // Assert that every element in the array has been initialized. |
| 98 if (list_[i].handler_types == NULL) { | 98 if (list_[i].handler_types == NULL) { |
| 99 // Unreachable handler, entry not computed. | 99 // Unreachable handler, entry not computed. |
| 100 // Initialize it to some meaningful value. | 100 // Initialize it to some meaningful value. |
| 101 const bool has_catch_all = false; | 101 const bool has_catch_all = false; |
| 102 // Check it is uninitialized. |
| 102 ASSERT((list_[i].outer_try_index == -1) && | 103 ASSERT((list_[i].outer_try_index == -1) && |
| 103 (list_[i].pc_offset == -1)); // It is uninitialized. | 104 (list_[i].pc_offset == ExceptionHandlers::kInvalidPcOffset)); |
| 104 handlers.SetHandlerInfo(i, | 105 handlers.SetHandlerInfo(i, |
| 105 list_[i].outer_try_index, | 106 list_[i].outer_try_index, |
| 106 list_[i].pc_offset, | 107 list_[i].pc_offset, |
| 107 list_[i].needs_stacktrace, | 108 list_[i].needs_stacktrace, |
| 108 has_catch_all); | 109 has_catch_all); |
| 109 handlers.SetHandledTypes(i, Array::null_array()); | 110 handlers.SetHandledTypes(i, Array::null_array()); |
| 110 } else { | 111 } else { |
| 111 const bool has_catch_all = ContainsDynamic(*list_[i].handler_types); | 112 const bool has_catch_all = ContainsDynamic(*list_[i].handler_types); |
| 112 handlers.SetHandlerInfo(i, | 113 handlers.SetHandlerInfo(i, |
| 113 list_[i].outer_try_index, | 114 list_[i].outer_try_index, |
| 114 list_[i].pc_offset, | 115 list_[i].pc_offset, |
| 115 list_[i].needs_stacktrace, | 116 list_[i].needs_stacktrace, |
| 116 has_catch_all); | 117 has_catch_all); |
| 117 handlers.SetHandledTypes(i, *list_[i].handler_types); | 118 handlers.SetHandledTypes(i, *list_[i].handler_types); |
| 118 } | 119 } |
| 119 } | 120 } |
| 120 return handlers.raw(); | 121 return handlers.raw(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 | 124 |
| 124 } // namespace dart | 125 } // namespace dart |
| OLD | NEW |