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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_descriptors.h
===================================================================
--- runtime/vm/code_descriptors.h (revision 6234)
+++ runtime/vm/code_descriptors.h (working copy)
@@ -111,6 +111,52 @@
DISALLOW_COPY_AND_ASSIGN(StackmapBuilder);
};
+
+class ExceptionHandlerList : public ZoneAllocated {
+ public:
+ struct HandlerDesc {
+ intptr_t try_index; // Try block index handled by the handler.
+ intptr_t pc_offset; // Handler PC offset value.
+ };
+
+ ExceptionHandlerList() : list_() {}
+
+ intptr_t Length() const {
+ return list_.length();
+ }
+
+ intptr_t TryIndex(int index) const {
+ return list_[index].try_index;
+ }
+ intptr_t PcOffset(int index) const {
+ return list_[index].pc_offset;
+ }
+ void SetPcOffset(int index, intptr_t handler_pc) {
+ list_[index].pc_offset = handler_pc;
+ }
+
+ void AddHandler(intptr_t try_index, intptr_t pc_offset) {
+ struct HandlerDesc data;
+ data.try_index = try_index;
+ data.pc_offset = pc_offset;
+ list_.Add(data);
+ }
+
+ RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
+ intptr_t num_handlers = Length();
+ const ExceptionHandlers& handlers =
+ ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers));
+ for (intptr_t i = 0; i < num_handlers; i++) {
+ handlers.SetHandlerEntry(i, TryIndex(i), (entry_point + PcOffset(i)));
+ }
+ return handlers.raw();
+ }
+
+ private:
+ GrowableArray<struct HandlerDesc> list_;
+ DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList);
+};
+
} // namespace dart
#endif // VM_CODE_DESCRIPTORS_H_
« 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