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

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

Issue 9949020: Move HandlerList to shared ExceptionHandlerList. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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_generator_ia32.h » ('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/globals.h" 8 #include "vm/globals.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 intptr_t Length() const { return list_.Length(); } 104 intptr_t Length() const { return list_.Length(); }
105 RawStackmap* Map(int index) const; 105 RawStackmap* Map(int index) const;
106 106
107 BitmapBuilder* builder_; 107 BitmapBuilder* builder_;
108 Code& code_; 108 Code& code_;
109 Stackmap& stack_map_; 109 Stackmap& stack_map_;
110 GrowableObjectArray& list_; 110 GrowableObjectArray& list_;
111 DISALLOW_COPY_AND_ASSIGN(StackmapBuilder); 111 DISALLOW_COPY_AND_ASSIGN(StackmapBuilder);
112 }; 112 };
113 113
114
115 class ExceptionHandlerList : public ZoneAllocated {
116 public:
117 struct HandlerDesc {
118 intptr_t try_index; // Try block index handled by the handler.
119 intptr_t pc_offset; // Handler PC offset value.
120 };
121
122 ExceptionHandlerList() : list_() {}
123
124 intptr_t Length() const {
125 return list_.length();
126 }
127
128 intptr_t TryIndex(int index) const {
129 return list_[index].try_index;
130 }
131 intptr_t PcOffset(int index) const {
132 return list_[index].pc_offset;
133 }
134 void SetPcOffset(int index, intptr_t handler_pc) {
135 list_[index].pc_offset = handler_pc;
136 }
137
138 void AddHandler(intptr_t try_index, intptr_t pc_offset) {
139 struct HandlerDesc data;
140 data.try_index = try_index;
141 data.pc_offset = pc_offset;
142 list_.Add(data);
143 }
144
145 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
146 intptr_t num_handlers = Length();
147 const ExceptionHandlers& handlers =
148 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers));
149 for (intptr_t i = 0; i < num_handlers; i++) {
150 handlers.SetHandlerEntry(i, TryIndex(i), (entry_point + PcOffset(i)));
151 }
152 return handlers.raw();
153 }
154
155 private:
156 GrowableArray<struct HandlerDesc> list_;
157 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList);
158 };
159
114 } // namespace dart 160 } // namespace dart
115 161
116 #endif // VM_CODE_DESCRIPTORS_H_ 162 #endif // VM_CODE_DESCRIPTORS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698