OLD | NEW |
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 RUNTIME_VM_CODE_DESCRIPTORS_H_ | 5 #ifndef RUNTIME_VM_CODE_DESCRIPTORS_H_ |
6 #define RUNTIME_VM_CODE_DESCRIPTORS_H_ | 6 #define RUNTIME_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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 private: | 56 private: |
57 GrowableArray<uint8_t> encoded_data_; | 57 GrowableArray<uint8_t> encoded_data_; |
58 | 58 |
59 intptr_t prev_pc_offset; | 59 intptr_t prev_pc_offset; |
60 intptr_t prev_token_pos; | 60 intptr_t prev_token_pos; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); | 62 DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); |
63 }; | 63 }; |
64 | 64 |
65 | 65 |
66 class StackmapTableBuilder : public ZoneAllocated { | 66 class StackMapTableBuilder : public ZoneAllocated { |
67 public: | 67 public: |
68 StackmapTableBuilder() | 68 StackMapTableBuilder() |
69 : stack_map_(Stackmap::ZoneHandle()), | 69 : stack_map_(StackMap::ZoneHandle()), |
70 list_(GrowableObjectArray::ZoneHandle( | 70 list_(GrowableObjectArray::ZoneHandle( |
71 GrowableObjectArray::New(Heap::kOld))) {} | 71 GrowableObjectArray::New(Heap::kOld))) {} |
72 ~StackmapTableBuilder() {} | 72 ~StackMapTableBuilder() {} |
73 | 73 |
74 void AddEntry(intptr_t pc_offset, | 74 void AddEntry(intptr_t pc_offset, |
75 BitmapBuilder* bitmap, | 75 BitmapBuilder* bitmap, |
76 intptr_t register_bit_count); | 76 intptr_t register_bit_count); |
77 | 77 |
78 bool Verify(); | 78 bool Verify(); |
79 | 79 |
80 RawArray* FinalizeStackmaps(const Code& code); | 80 RawArray* FinalizeStackMaps(const Code& code); |
81 | 81 |
82 private: | 82 private: |
83 intptr_t Length() const { return list_.Length(); } | 83 intptr_t Length() const { return list_.Length(); } |
84 RawStackmap* MapAt(intptr_t index) const; | 84 RawStackMap* MapAt(intptr_t index) const; |
85 | 85 |
86 Stackmap& stack_map_; | 86 StackMap& stack_map_; |
87 GrowableObjectArray& list_; | 87 GrowableObjectArray& list_; |
88 DISALLOW_COPY_AND_ASSIGN(StackmapTableBuilder); | 88 DISALLOW_COPY_AND_ASSIGN(StackMapTableBuilder); |
89 }; | 89 }; |
90 | 90 |
91 | 91 |
92 class ExceptionHandlerList : public ZoneAllocated { | 92 class ExceptionHandlerList : public ZoneAllocated { |
93 public: | 93 public: |
94 struct HandlerDesc { | 94 struct HandlerDesc { |
95 intptr_t outer_try_index; // Try block in which this try block is nested. | 95 intptr_t outer_try_index; // Try block in which this try block is nested. |
96 intptr_t pc_offset; // Handler PC offset value. | 96 intptr_t pc_offset; // Handler PC offset value. |
97 const Array* handler_types; // Catch clause guards. | 97 const Array* handler_types; // Catch clause guards. |
98 bool needs_stacktrace; | 98 bool needs_stacktrace; |
(...skipping 24 matching lines...) Expand all Loading... |
123 list_[try_index].outer_try_index = outer_try_index; | 123 list_[try_index].outer_try_index = outer_try_index; |
124 ASSERT(list_[try_index].pc_offset == ExceptionHandlers::kInvalidPcOffset); | 124 ASSERT(list_[try_index].pc_offset == ExceptionHandlers::kInvalidPcOffset); |
125 list_[try_index].pc_offset = pc_offset; | 125 list_[try_index].pc_offset = pc_offset; |
126 ASSERT(handler_types.IsZoneHandle()); | 126 ASSERT(handler_types.IsZoneHandle()); |
127 list_[try_index].handler_types = &handler_types; | 127 list_[try_index].handler_types = &handler_types; |
128 list_[try_index].needs_stacktrace |= needs_stacktrace; | 128 list_[try_index].needs_stacktrace |= needs_stacktrace; |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 // Called by rethrows, to mark their enclosing handlers. | 132 // Called by rethrows, to mark their enclosing handlers. |
133 void SetNeedsStacktrace(intptr_t try_index) { | 133 void SetNeedsStackTrace(intptr_t try_index) { |
134 // Rethrows can be generated outside a try by the compiler. | 134 // Rethrows can be generated outside a try by the compiler. |
135 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 135 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
136 return; | 136 return; |
137 } | 137 } |
138 ASSERT(try_index >= 0); | 138 ASSERT(try_index >= 0); |
139 while (Length() <= try_index) { | 139 while (Length() <= try_index) { |
140 AddPlaceHolder(); | 140 AddPlaceHolder(); |
141 } | 141 } |
142 list_[try_index].needs_stacktrace = true; | 142 list_[try_index].needs_stacktrace = true; |
143 } | 143 } |
(...skipping 11 matching lines...) Expand all Loading... |
155 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) const; | 155 RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) const; |
156 | 156 |
157 private: | 157 private: |
158 GrowableArray<struct HandlerDesc> list_; | 158 GrowableArray<struct HandlerDesc> list_; |
159 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 159 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
160 }; | 160 }; |
161 | 161 |
162 } // namespace dart | 162 } // namespace dart |
163 | 163 |
164 #endif // RUNTIME_VM_CODE_DESCRIPTORS_H_ | 164 #endif // RUNTIME_VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |