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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return Array::MakeArray(list_); | 77 return Array::MakeArray(list_); |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 RawStackmap* StackmapTableBuilder::MapAt(intptr_t index) const { | 81 RawStackmap* StackmapTableBuilder::MapAt(intptr_t index) const { |
82 Stackmap& map = Stackmap::Handle(); | 82 Stackmap& map = Stackmap::Handle(); |
83 map ^= list_.At(index); | 83 map ^= list_.At(index); |
84 return map.raw(); | 84 return map.raw(); |
85 } | 85 } |
86 | 86 |
| 87 |
| 88 RawExceptionHandlers* ExceptionHandlerList::FinalizeExceptionHandlers( |
| 89 uword entry_point) const { |
| 90 intptr_t num_handlers = Length(); |
| 91 if (num_handlers == 0) { |
| 92 return Object::empty_exception_handlers().raw(); |
| 93 } |
| 94 const ExceptionHandlers& handlers = |
| 95 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); |
| 96 for (intptr_t i = 0; i < num_handlers; i++) { |
| 97 // Assert that every element in the array has been initialized. |
| 98 if (list_[i].handler_types == NULL) { |
| 99 // Unreachable handler, entry not computed. |
| 100 // Initialize it to some meaningful value. |
| 101 const bool has_catch_all = false; |
| 102 ASSERT((list_[i].outer_try_index == -1) && |
| 103 (list_[i].pc_offset == -1)); // It is uninitialized. |
| 104 handlers.SetHandlerInfo(i, |
| 105 list_[i].outer_try_index, |
| 106 list_[i].pc_offset, |
| 107 list_[i].needs_stacktrace, |
| 108 has_catch_all); |
| 109 handlers.SetHandledTypes(i, Array::null_array()); |
| 110 } else { |
| 111 const bool has_catch_all = ContainsDynamic(*list_[i].handler_types); |
| 112 handlers.SetHandlerInfo(i, |
| 113 list_[i].outer_try_index, |
| 114 list_[i].pc_offset, |
| 115 list_[i].needs_stacktrace, |
| 116 has_catch_all); |
| 117 handlers.SetHandledTypes(i, *list_[i].handler_types); |
| 118 } |
| 119 } |
| 120 return handlers.raw(); |
| 121 } |
| 122 |
| 123 |
87 } // namespace dart | 124 } // namespace dart |
OLD | NEW |