| 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, |
| 11 intptr_t deopt_id, | 11 intptr_t deopt_id, |
| 12 intptr_t token_index, | 12 intptr_t token_pos, |
| 13 intptr_t try_index) { | 13 intptr_t try_index) { |
| 14 ASSERT((kind == RawPcDescriptors::kRuntimeCall) || | 14 ASSERT((kind == RawPcDescriptors::kRuntimeCall) || |
| 15 (kind == RawPcDescriptors::kOther) || | 15 (kind == RawPcDescriptors::kOther) || |
| 16 (deopt_id != Isolate::kNoDeoptId)); | 16 (deopt_id != Isolate::kNoDeoptId)); |
| 17 struct PcDesc data; | 17 |
| 18 data.pc_offset = pc_offset; | 18 intptr_t merged_kind_try = |
| 19 data.kind = kind; | 19 RawPcDescriptors::MergedKindTry::Encode(kind, try_index); |
| 20 data.deopt_id = deopt_id; | 20 |
| 21 data.SetTokenPos(token_index); | 21 PcDescriptors::EncodeInteger(&encoded_data_, merged_kind_try); |
| 22 data.try_index = try_index; | 22 PcDescriptors::EncodeInteger(&encoded_data_, pc_offset - prev_pc_offset); |
| 23 list_.Add(data); | 23 PcDescriptors::EncodeInteger(&encoded_data_, deopt_id - prev_deopt_id); |
| 24 if (try_index >= 0) { | 24 PcDescriptors::EncodeInteger(&encoded_data_, token_pos - prev_token_pos); |
| 25 has_try_index_ = true; | 25 |
| 26 } | 26 prev_pc_offset = pc_offset; |
| 27 prev_deopt_id = deopt_id; |
| 28 prev_token_pos = token_pos; |
| 27 } | 29 } |
| 28 | 30 |
| 29 | 31 |
| 30 RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { | 32 RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { |
| 31 intptr_t num_descriptors = Length(); | 33 return PcDescriptors::New(&encoded_data_); |
| 32 const PcDescriptors& descriptors = | |
| 33 PcDescriptors::Handle(PcDescriptors::New(num_descriptors, | |
| 34 has_try_index_)); | |
| 35 for (intptr_t i = 0; i < num_descriptors; i++) { | |
| 36 descriptors.AddDescriptor(i, | |
| 37 PcOffset(i), | |
| 38 Kind(i), | |
| 39 DeoptId(i), | |
| 40 TokenPos(i), | |
| 41 TryIndex(i)); | |
| 42 } | |
| 43 return descriptors.raw(); | |
| 44 } | 34 } |
| 45 | 35 |
| 46 | 36 |
| 47 void StackmapTableBuilder::AddEntry(intptr_t pc_offset, | 37 void StackmapTableBuilder::AddEntry(intptr_t pc_offset, |
| 48 BitmapBuilder* bitmap, | 38 BitmapBuilder* bitmap, |
| 49 intptr_t register_bit_count) { | 39 intptr_t register_bit_count) { |
| 50 stack_map_ = Stackmap::New(pc_offset, bitmap, register_bit_count); | 40 stack_map_ = Stackmap::New(pc_offset, bitmap, register_bit_count); |
| 51 list_.Add(stack_map_, Heap::kOld); | 41 list_.Add(stack_map_, Heap::kOld); |
| 52 } | 42 } |
| 53 | 43 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 list_[i].needs_stacktrace, | 106 list_[i].needs_stacktrace, |
| 117 has_catch_all); | 107 has_catch_all); |
| 118 handlers.SetHandledTypes(i, *list_[i].handler_types); | 108 handlers.SetHandledTypes(i, *list_[i].handler_types); |
| 119 } | 109 } |
| 120 } | 110 } |
| 121 return handlers.raw(); | 111 return handlers.raw(); |
| 122 } | 112 } |
| 123 | 113 |
| 124 | 114 |
| 125 } // namespace dart | 115 } // namespace dart |
| OLD | NEW |