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

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

Issue 23691024: If a rethrow is encountered in the catch block, then its handler must be marked that it needs stack… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/flow_graph_builder.h » ('j') | runtime/vm/intermediate_language.h » ('J')
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/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 while (Length() <= try_index) { 129 while (Length() <= try_index) {
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
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
138 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) { 151 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
139 intptr_t num_handlers = Length(); 152 intptr_t num_handlers = Length();
140 const ExceptionHandlers& handlers = 153 const ExceptionHandlers& handlers =
141 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); 154 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers));
142 for (intptr_t i = 0; i < num_handlers; i++) { 155 for (intptr_t i = 0; i < num_handlers; i++) {
143 // Assert that every element in the array has been initialized. 156 // Assert that every element in the array has been initialized.
144 ASSERT(list_[i].handler_types != NULL); 157 ASSERT(list_[i].handler_types != NULL);
145 handlers.SetHandlerInfo(i, 158 handlers.SetHandlerInfo(i,
146 list_[i].outer_try_index, 159 list_[i].outer_try_index,
147 (entry_point + list_[i].pc_offset), 160 (entry_point + list_[i].pc_offset),
148 list_[i].needs_stacktrace); 161 list_[i].needs_stacktrace);
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_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | runtime/vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698