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 26 matching lines...) Expand all Loading... |
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 | 44 |
45 void CodeSourceMapBuilder::AddEntry(intptr_t pc_offset, | 45 void CodeSourceMapBuilder::AddEntry(intptr_t pc_offset, |
46 TokenPosition token_pos) { | 46 TokenPosition token_pos) { |
| 47 // Require pc offset to monotonically increase. |
| 48 ASSERT((prev_pc_offset < pc_offset) || |
| 49 ((prev_pc_offset == 0) && (pc_offset == 0))); |
47 CodeSourceMap::EncodeInteger(&encoded_data_, pc_offset - prev_pc_offset); | 50 CodeSourceMap::EncodeInteger(&encoded_data_, pc_offset - prev_pc_offset); |
48 CodeSourceMap::EncodeInteger(&encoded_data_, | 51 CodeSourceMap::EncodeInteger(&encoded_data_, |
49 token_pos.value() - prev_token_pos); | 52 token_pos.value() - prev_token_pos); |
50 | 53 |
51 prev_pc_offset = pc_offset; | 54 prev_pc_offset = pc_offset; |
52 prev_token_pos = token_pos.value(); | 55 prev_token_pos = token_pos.value(); |
53 } | 56 } |
54 | 57 |
55 | 58 |
56 RawCodeSourceMap* CodeSourceMapBuilder::Finalize() { | 59 RawCodeSourceMap* CodeSourceMapBuilder::Finalize() { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 list_[i].needs_stacktrace, | 133 list_[i].needs_stacktrace, |
131 has_catch_all); | 134 has_catch_all); |
132 handlers.SetHandledTypes(i, *list_[i].handler_types); | 135 handlers.SetHandledTypes(i, *list_[i].handler_types); |
133 } | 136 } |
134 } | 137 } |
135 return handlers.raw(); | 138 return handlers.raw(); |
136 } | 139 } |
137 | 140 |
138 | 141 |
139 } // namespace dart | 142 } // namespace dart |
OLD | NEW |