| 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/ast.h" |
| 8 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 9 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| 10 #include "vm/growable_array.h" | 11 #include "vm/growable_array.h" |
| 11 #include "vm/object.h" | 12 #include "vm/object.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 class DescriptorList : public ZoneAllocated { | 16 class DescriptorList : public ZoneAllocated { |
| 16 public: | 17 public: |
| 17 struct PcDesc { | 18 struct PcDesc { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 AddPlaceHolder(); | 130 AddPlaceHolder(); |
| 130 } | 131 } |
| 131 list_[try_index].outer_try_index = outer_try_index; | 132 list_[try_index].outer_try_index = outer_try_index; |
| 132 list_[try_index].pc_offset = pc_offset; | 133 list_[try_index].pc_offset = pc_offset; |
| 133 ASSERT(handler_types.IsZoneHandle()); | 134 ASSERT(handler_types.IsZoneHandle()); |
| 134 list_[try_index].handler_types = &handler_types; | 135 list_[try_index].handler_types = &handler_types; |
| 135 list_[try_index].needs_stacktrace = needs_stacktrace; | 136 list_[try_index].needs_stacktrace = needs_stacktrace; |
| 136 } | 137 } |
| 137 | 138 |
| 138 | 139 |
| 140 // Called by rethrows, to mark their enclosing handlers. |
| 141 void SetNeedsStacktrace(intptr_t try_index) { |
| 142 // Rethrows can be generated outside a try by the compiler. |
| 143 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 144 return; |
| 145 } |
| 146 ASSERT((0 <= try_index) && (try_index < Length())); |
| 147 list_[try_index].needs_stacktrace = true; |
| 148 } |
| 149 |
| 150 |
| 139 static bool ContainsDynamic(const Array& array) { | 151 static bool ContainsDynamic(const Array& array) { |
| 140 for (intptr_t i = 0; i < array.Length(); i++) { | 152 for (intptr_t i = 0; i < array.Length(); i++) { |
| 141 if (array.At(i) == Type::DynamicType()) { | 153 if (array.At(i) == Type::DynamicType()) { |
| 142 return true; | 154 return true; |
| 143 } | 155 } |
| 144 } | 156 } |
| 145 return false; | 157 return false; |
| 146 } | 158 } |
| 147 | 159 |
| 148 | 160 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 165 } | 177 } |
| 166 | 178 |
| 167 private: | 179 private: |
| 168 GrowableArray<struct HandlerDesc> list_; | 180 GrowableArray<struct HandlerDesc> list_; |
| 169 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 181 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
| 170 }; | 182 }; |
| 171 | 183 |
| 172 } // namespace dart | 184 } // namespace dart |
| 173 | 185 |
| 174 #endif // VM_CODE_DESCRIPTORS_H_ | 186 #endif // VM_CODE_DESCRIPTORS_H_ |
| OLD | NEW |