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

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

Issue 11883023: Collect debugging info for catch clauses (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « runtime/vm/ast.h ('k') | runtime/vm/flow_graph_builder.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/code_generator.h" 8 #include "vm/code_generator.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 Stackmap& stack_map_; 92 Stackmap& stack_map_;
93 GrowableObjectArray& list_; 93 GrowableObjectArray& list_;
94 DISALLOW_COPY_AND_ASSIGN(StackmapTableBuilder); 94 DISALLOW_COPY_AND_ASSIGN(StackmapTableBuilder);
95 }; 95 };
96 96
97 97
98 class ExceptionHandlerList : public ZoneAllocated { 98 class ExceptionHandlerList : public ZoneAllocated {
99 public: 99 public:
100 struct HandlerDesc { 100 struct HandlerDesc {
101 intptr_t try_index; // Try block index handled by the handler. 101 intptr_t try_index; // Try block index handled by the handler.
102 intptr_t pc_offset; // Handler PC offset value. 102 intptr_t outer_try_index; // Try block in which this try block is nested.
103 intptr_t pc_offset; // Handler PC offset value.
104 const Array* handler_types; // Catch clause guards.
103 }; 105 };
104 106
105 ExceptionHandlerList() : list_() {} 107 ExceptionHandlerList() : list_() {}
106 108
107 intptr_t Length() const { 109 intptr_t Length() const {
108 return list_.length(); 110 return list_.length();
109 } 111 }
110 112
111 intptr_t TryIndex(int index) const { 113 intptr_t TryIndex(int index) const {
112 return list_[index].try_index; 114 return list_[index].try_index;
113 } 115 }
116 intptr_t OuterTryIndex(int index) const {
117 return list_[index].outer_try_index;
118 }
114 intptr_t PcOffset(int index) const { 119 intptr_t PcOffset(int index) const {
115 return list_[index].pc_offset; 120 return list_[index].pc_offset;
116 } 121 }
122 const Array& HandlerTypes(int index) const {
123 return *list_[index].handler_types;
124 }
117 void SetPcOffset(int index, intptr_t handler_pc) { 125 void SetPcOffset(int index, intptr_t handler_pc) {
118 list_[index].pc_offset = handler_pc; 126 list_[index].pc_offset = handler_pc;
119 } 127 }
120 128
121 void AddHandler(intptr_t try_index, intptr_t pc_offset) { 129 void AddHandler(intptr_t try_index,
130 intptr_t outer_try_index,
131 intptr_t pc_offset,
132 const Array& handler_types) {
122 struct HandlerDesc data; 133 struct HandlerDesc data;
123 data.try_index = try_index; 134 data.try_index = try_index;
135 data.outer_try_index = outer_try_index;
124 data.pc_offset = pc_offset; 136 data.pc_offset = pc_offset;
137 ASSERT(handler_types.IsZoneHandle());
138 data.handler_types = &handler_types;
125 list_.Add(data); 139 list_.Add(data);
126 } 140 }
127 141
128 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) { 142 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
129 intptr_t num_handlers = Length(); 143 intptr_t num_handlers = Length();
130 const ExceptionHandlers& handlers = 144 const ExceptionHandlers& handlers =
131 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); 145 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers));
132 for (intptr_t i = 0; i < num_handlers; i++) { 146 for (intptr_t i = 0; i < num_handlers; i++) {
133 handlers.SetHandlerEntry(i, TryIndex(i), (entry_point + PcOffset(i))); 147 handlers.SetHandlerInfo(i, TryIndex(i), OuterTryIndex(i),
148 (entry_point + PcOffset(i)));
149 handlers.SetHandledTypes(i, HandlerTypes(i));
134 } 150 }
135 return handlers.raw(); 151 return handlers.raw();
136 } 152 }
137 153
138 private: 154 private:
139 GrowableArray<struct HandlerDesc> list_; 155 GrowableArray<struct HandlerDesc> list_;
140 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); 156 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList);
141 }; 157 };
142 158
143 } // namespace dart 159 } // namespace dart
144 160
145 #endif // VM_CODE_DESCRIPTORS_H_ 161 #endif // VM_CODE_DESCRIPTORS_H_
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698