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/ast.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const Array& handler_types, | 128 const Array& handler_types, |
129 bool needs_stacktrace) { | 129 bool needs_stacktrace) { |
130 ASSERT(try_index >= 0); | 130 ASSERT(try_index >= 0); |
131 while (Length() <= try_index) { | 131 while (Length() <= try_index) { |
132 AddPlaceHolder(); | 132 AddPlaceHolder(); |
133 } | 133 } |
134 list_[try_index].outer_try_index = outer_try_index; | 134 list_[try_index].outer_try_index = outer_try_index; |
135 list_[try_index].pc_offset = pc_offset; | 135 list_[try_index].pc_offset = pc_offset; |
136 ASSERT(handler_types.IsZoneHandle()); | 136 ASSERT(handler_types.IsZoneHandle()); |
137 list_[try_index].handler_types = &handler_types; | 137 list_[try_index].handler_types = &handler_types; |
138 list_[try_index].needs_stacktrace = needs_stacktrace; | 138 list_[try_index].needs_stacktrace |= needs_stacktrace; |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 // Called by rethrows, to mark their enclosing handlers. | 142 // Called by rethrows, to mark their enclosing handlers. |
143 void SetNeedsStacktrace(intptr_t try_index) { | 143 void SetNeedsStacktrace(intptr_t try_index) { |
144 // Rethrows can be generated outside a try by the compiler. | 144 // Rethrows can be generated outside a try by the compiler. |
145 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 145 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
146 return; | 146 return; |
147 } | 147 } |
148 ASSERT((0 <= try_index) && (try_index < Length())); | 148 ASSERT(try_index >= 0); |
| 149 while (Length() <= try_index) { |
| 150 AddPlaceHolder(); |
| 151 } |
149 list_[try_index].needs_stacktrace = true; | 152 list_[try_index].needs_stacktrace = true; |
150 } | 153 } |
151 | 154 |
152 | 155 |
153 static bool ContainsDynamic(const Array& array) { | 156 static bool ContainsDynamic(const Array& array) { |
154 for (intptr_t i = 0; i < array.Length(); i++) { | 157 for (intptr_t i = 0; i < array.Length(); i++) { |
155 if (array.At(i) == Type::DynamicType()) { | 158 if (array.At(i) == Type::DynamicType()) { |
156 return true; | 159 return true; |
157 } | 160 } |
158 } | 161 } |
(...skipping 23 matching lines...) Expand all Loading... |
182 } | 185 } |
183 | 186 |
184 private: | 187 private: |
185 GrowableArray<struct HandlerDesc> list_; | 188 GrowableArray<struct HandlerDesc> list_; |
186 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 189 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
187 }; | 190 }; |
188 | 191 |
189 } // namespace dart | 192 } // namespace dart |
190 | 193 |
191 #endif // VM_CODE_DESCRIPTORS_H_ | 194 #endif // VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |