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

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

Issue 575663002: Eliminate 99% of allocated ExceptionHandler objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/debugger.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 private: 68 private:
69 GrowableArray<struct PcDesc> list_; 69 GrowableArray<struct PcDesc> list_;
70 bool has_try_index_; 70 bool has_try_index_;
71 DISALLOW_COPY_AND_ASSIGN(DescriptorList); 71 DISALLOW_COPY_AND_ASSIGN(DescriptorList);
72 }; 72 };
73 73
74 74
75 class StackmapTableBuilder : public ZoneAllocated { 75 class StackmapTableBuilder : public ZoneAllocated {
76 public: 76 public:
77 explicit StackmapTableBuilder() 77 StackmapTableBuilder()
78 : stack_map_(Stackmap::ZoneHandle()), 78 : stack_map_(Stackmap::ZoneHandle()),
79 list_(GrowableObjectArray::ZoneHandle( 79 list_(GrowableObjectArray::ZoneHandle(
80 GrowableObjectArray::New(Heap::kOld))) { } 80 GrowableObjectArray::New(Heap::kOld))) { }
81 ~StackmapTableBuilder() { } 81 ~StackmapTableBuilder() { }
82 82
83 void AddEntry(intptr_t pc_offset, 83 void AddEntry(intptr_t pc_offset,
84 BitmapBuilder* bitmap, 84 BitmapBuilder* bitmap,
85 intptr_t register_bit_count); 85 intptr_t register_bit_count);
86 86
87 bool Verify(); 87 bool Verify();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (array.At(i) == Type::DynamicType()) { 155 if (array.At(i) == Type::DynamicType()) {
156 return true; 156 return true;
157 } 157 }
158 } 158 }
159 return false; 159 return false;
160 } 160 }
161 161
162 162
163 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) { 163 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
164 intptr_t num_handlers = Length(); 164 intptr_t num_handlers = Length();
165 if (num_handlers == 0) {
166 return Object::empty_exception_handlers().raw();
167 }
165 const ExceptionHandlers& handlers = 168 const ExceptionHandlers& handlers =
166 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); 169 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers));
167 for (intptr_t i = 0; i < num_handlers; i++) { 170 for (intptr_t i = 0; i < num_handlers; i++) {
168 // Assert that every element in the array has been initialized. 171 // Assert that every element in the array has been initialized.
169 ASSERT(list_[i].handler_types != NULL); 172 ASSERT(list_[i].handler_types != NULL);
170 bool has_catch_all = ContainsDynamic(*list_[i].handler_types); 173 bool has_catch_all = ContainsDynamic(*list_[i].handler_types);
171 handlers.SetHandlerInfo(i, 174 handlers.SetHandlerInfo(i,
172 list_[i].outer_try_index, 175 list_[i].outer_try_index,
173 (entry_point + list_[i].pc_offset), 176 (entry_point + list_[i].pc_offset),
174 list_[i].needs_stacktrace, 177 list_[i].needs_stacktrace,
175 has_catch_all); 178 has_catch_all);
176 handlers.SetHandledTypes(i, *list_[i].handler_types); 179 handlers.SetHandledTypes(i, *list_[i].handler_types);
177 } 180 }
178 return handlers.raw(); 181 return handlers.raw();
179 } 182 }
180 183
181 private: 184 private:
182 GrowableArray<struct HandlerDesc> list_; 185 GrowableArray<struct HandlerDesc> list_;
183 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); 186 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList);
184 }; 187 };
185 188
186 } // namespace dart 189 } // namespace dart
187 190
188 #endif // VM_CODE_DESCRIPTORS_H_ 191 #endif // VM_CODE_DESCRIPTORS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698