| 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 #ifndef VM_CODE_DESCRIPTORS_H_ | 5 #ifndef VM_CODE_DESCRIPTORS_H_ |
| 6 #define VM_CODE_DESCRIPTORS_H_ | 6 #define VM_CODE_DESCRIPTORS_H_ |
| 7 | 7 |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 while (Length() <= try_index) { | 128 while (Length() <= try_index) { |
| 129 AddPlaceHolder(); | 129 AddPlaceHolder(); |
| 130 } | 130 } |
| 131 list_[try_index].outer_try_index = outer_try_index; | 131 list_[try_index].outer_try_index = outer_try_index; |
| 132 list_[try_index].pc_offset = pc_offset; | 132 list_[try_index].pc_offset = pc_offset; |
| 133 ASSERT(handler_types.IsZoneHandle()); | 133 ASSERT(handler_types.IsZoneHandle()); |
| 134 list_[try_index].handler_types = &handler_types; | 134 list_[try_index].handler_types = &handler_types; |
| 135 list_[try_index].needs_stacktrace = needs_stacktrace; | 135 list_[try_index].needs_stacktrace = needs_stacktrace; |
| 136 } | 136 } |
| 137 | 137 |
| 138 |
| 139 static bool ContainsDynamic(const Array& array) { |
| 140 for (intptr_t i = 0; i < array.Length(); i++) { |
| 141 if (array.At(i) == Type::DynamicType()) { |
| 142 return true; |
| 143 } |
| 144 } |
| 145 return false; |
| 146 } |
| 147 |
| 148 |
| 138 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) { | 149 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) { |
| 139 intptr_t num_handlers = Length(); | 150 intptr_t num_handlers = Length(); |
| 140 const ExceptionHandlers& handlers = | 151 const ExceptionHandlers& handlers = |
| 141 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); | 152 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); |
| 142 for (intptr_t i = 0; i < num_handlers; i++) { | 153 for (intptr_t i = 0; i < num_handlers; i++) { |
| 143 // Assert that every element in the array has been initialized. | 154 // Assert that every element in the array has been initialized. |
| 144 ASSERT(list_[i].handler_types != NULL); | 155 ASSERT(list_[i].handler_types != NULL); |
| 156 bool has_catch_all = ContainsDynamic(*list_[i].handler_types); |
| 145 handlers.SetHandlerInfo(i, | 157 handlers.SetHandlerInfo(i, |
| 146 list_[i].outer_try_index, | 158 list_[i].outer_try_index, |
| 147 (entry_point + list_[i].pc_offset), | 159 (entry_point + list_[i].pc_offset), |
| 148 list_[i].needs_stacktrace); | 160 list_[i].needs_stacktrace, |
| 161 has_catch_all); |
| 149 handlers.SetHandledTypes(i, *list_[i].handler_types); | 162 handlers.SetHandledTypes(i, *list_[i].handler_types); |
| 150 } | 163 } |
| 151 return handlers.raw(); | 164 return handlers.raw(); |
| 152 } | 165 } |
| 153 | 166 |
| 154 private: | 167 private: |
| 155 GrowableArray<struct HandlerDesc> list_; | 168 GrowableArray<struct HandlerDesc> list_; |
| 156 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 169 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
| 157 }; | 170 }; |
| 158 | 171 |
| 159 } // namespace dart | 172 } // namespace dart |
| 160 | 173 |
| 161 #endif // VM_CODE_DESCRIPTORS_H_ | 174 #endif // VM_CODE_DESCRIPTORS_H_ |
| OLD | NEW |