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 #include "vm/code_descriptors.h" | 5 #include "vm/code_descriptors.h" |
6 | 6 |
7 namespace dart { | 7 namespace dart { |
8 | 8 |
9 void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, | 9 void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, |
10 intptr_t pc_offset, | 10 intptr_t pc_offset, |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 | 35 |
36 RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { | 36 RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { |
37 if (encoded_data_.length() == 0) { | 37 if (encoded_data_.length() == 0) { |
38 return Object::empty_descriptors().raw(); | 38 return Object::empty_descriptors().raw(); |
39 } | 39 } |
40 return PcDescriptors::New(&encoded_data_); | 40 return PcDescriptors::New(&encoded_data_); |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 | |
45 void CodeSourceMapBuilder::AddEntry(intptr_t pc_offset, | 44 void CodeSourceMapBuilder::AddEntry(intptr_t pc_offset, |
46 TokenPosition token_pos) { | 45 TokenPosition token_pos) { |
47 // Require pc offset to monotonically increase. | 46 // Require pc offset to monotonically increase. |
48 ASSERT((prev_pc_offset < pc_offset) || | 47 ASSERT((prev_pc_offset < pc_offset) || |
49 ((prev_pc_offset == 0) && (pc_offset == 0))); | 48 ((prev_pc_offset == 0) && (pc_offset == 0))); |
50 CodeSourceMap::EncodeInteger(&encoded_data_, pc_offset - prev_pc_offset); | 49 CodeSourceMap::EncodeInteger(&encoded_data_, pc_offset - prev_pc_offset); |
51 CodeSourceMap::EncodeInteger(&encoded_data_, | 50 CodeSourceMap::EncodeInteger(&encoded_data_, |
52 token_pos.value() - prev_token_pos); | 51 token_pos.value() - prev_token_pos); |
53 | 52 |
54 prev_pc_offset = pc_offset; | 53 prev_pc_offset = pc_offset; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); | 111 ExceptionHandlers::Handle(ExceptionHandlers::New(num_handlers)); |
113 for (intptr_t i = 0; i < num_handlers; i++) { | 112 for (intptr_t i = 0; i < num_handlers; i++) { |
114 // Assert that every element in the array has been initialized. | 113 // Assert that every element in the array has been initialized. |
115 if (list_[i].handler_types == NULL) { | 114 if (list_[i].handler_types == NULL) { |
116 // Unreachable handler, entry not computed. | 115 // Unreachable handler, entry not computed. |
117 // Initialize it to some meaningful value. | 116 // Initialize it to some meaningful value. |
118 const bool has_catch_all = false; | 117 const bool has_catch_all = false; |
119 // Check it is uninitialized. | 118 // Check it is uninitialized. |
120 ASSERT((list_[i].outer_try_index == -1) && | 119 ASSERT((list_[i].outer_try_index == -1) && |
121 (list_[i].pc_offset == ExceptionHandlers::kInvalidPcOffset)); | 120 (list_[i].pc_offset == ExceptionHandlers::kInvalidPcOffset)); |
122 handlers.SetHandlerInfo(i, | 121 handlers.SetHandlerInfo(i, list_[i].outer_try_index, list_[i].pc_offset, |
123 list_[i].outer_try_index, | 122 list_[i].needs_stacktrace, has_catch_all); |
124 list_[i].pc_offset, | |
125 list_[i].needs_stacktrace, | |
126 has_catch_all); | |
127 handlers.SetHandledTypes(i, Array::empty_array()); | 123 handlers.SetHandledTypes(i, Array::empty_array()); |
128 } else { | 124 } else { |
129 const bool has_catch_all = ContainsDynamic(*list_[i].handler_types); | 125 const bool has_catch_all = ContainsDynamic(*list_[i].handler_types); |
130 handlers.SetHandlerInfo(i, | 126 handlers.SetHandlerInfo(i, list_[i].outer_try_index, list_[i].pc_offset, |
131 list_[i].outer_try_index, | 127 list_[i].needs_stacktrace, has_catch_all); |
132 list_[i].pc_offset, | |
133 list_[i].needs_stacktrace, | |
134 has_catch_all); | |
135 handlers.SetHandledTypes(i, *list_[i].handler_types); | 128 handlers.SetHandledTypes(i, *list_[i].handler_types); |
136 } | 129 } |
137 } | 130 } |
138 return handlers.raw(); | 131 return handlers.raw(); |
139 } | 132 } |
140 | 133 |
141 | 134 |
142 } // namespace dart | 135 } // namespace dart |
OLD | NEW |