Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: runtime/vm/code_descriptors.h

Issue 1002933002: Fix issue 22800: Unreachable exception handlers do not have their handler types initialized. Initia… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/code_descriptors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 static bool ContainsDynamic(const Array& array) { 156 static bool ContainsDynamic(const Array& array) {
157 for (intptr_t i = 0; i < array.Length(); i++) { 157 for (intptr_t i = 0; i < array.Length(); i++) {
158 if (array.At(i) == Type::DynamicType()) { 158 if (array.At(i) == Type::DynamicType()) {
159 return true; 159 return true;
160 } 160 }
161 } 161 }
162 return false; 162 return false;
163 } 163 }
164 164
165 165 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) const;
166 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
167 intptr_t num_handlers = Length();
168 if (num_handlers == 0) {
169 return Object::empty_exception_handlers().raw();
170 }
171 const ExceptionHandlers& handlers =
172 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers));
173 for (intptr_t i = 0; i < num_handlers; i++) {
174 // Assert that every element in the array has been initialized.
175 ASSERT(list_[i].handler_types != NULL);
176 bool has_catch_all = ContainsDynamic(*list_[i].handler_types);
177 handlers.SetHandlerInfo(i,
178 list_[i].outer_try_index,
179 list_[i].pc_offset,
180 list_[i].needs_stacktrace,
181 has_catch_all);
182 handlers.SetHandledTypes(i, *list_[i].handler_types);
183 }
184 return handlers.raw();
185 }
186 166
187 private: 167 private:
188 GrowableArray<struct HandlerDesc> list_; 168 GrowableArray<struct HandlerDesc> list_;
189 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); 169 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList);
190 }; 170 };
191 171
192 } // namespace dart 172 } // namespace dart
193 173
194 #endif // VM_CODE_DESCRIPTORS_H_ 174 #endif // VM_CODE_DESCRIPTORS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698