| 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(PcDescriptors::Kind kind, | 9 void DescriptorList::AddDescriptor(PcDescriptors::Kind kind, |
| 10 intptr_t pc_offset, | 10 intptr_t pc_offset, |
| 11 intptr_t node_id, | 11 intptr_t deopt_id, |
| 12 intptr_t token_index, | 12 intptr_t token_index, |
| 13 intptr_t try_index) { | 13 intptr_t try_index) { |
| 14 struct PcDesc data; | 14 struct PcDesc data; |
| 15 data.pc_offset = pc_offset; | 15 data.pc_offset = pc_offset; |
| 16 data.kind = kind; | 16 data.kind = kind; |
| 17 data.node_id = node_id; | 17 data.deopt_id = deopt_id; |
| 18 data.token_index = token_index; | 18 data.token_index = token_index; |
| 19 data.try_index = try_index; | 19 data.try_index = try_index; |
| 20 list_.Add(data); | 20 list_.Add(data); |
| 21 } | 21 } |
| 22 | 22 |
| 23 | 23 |
| 24 void DescriptorList::AddDeoptInfo(intptr_t pc_offset, | 24 void DescriptorList::AddDeoptInfo(intptr_t pc_offset, |
| 25 intptr_t node_id, | 25 intptr_t deopt_id, |
| 26 intptr_t token_index, | 26 intptr_t token_index, |
| 27 intptr_t deopt_array_index) { | 27 intptr_t deopt_array_index) { |
| 28 struct PcDesc data; | 28 struct PcDesc data; |
| 29 data.pc_offset = pc_offset; | 29 data.pc_offset = pc_offset; |
| 30 data.kind = PcDescriptors::kDeoptIndex; | 30 data.kind = PcDescriptors::kDeoptIndex; |
| 31 data.node_id = node_id; | 31 data.deopt_id = deopt_id; |
| 32 data.token_index = token_index; | 32 data.token_index = token_index; |
| 33 // Try_index is reused for deopt_array_index. | 33 // Try_index is reused for deopt_array_index. |
| 34 data.try_index = deopt_array_index; | 34 data.try_index = deopt_array_index; |
| 35 list_.Add(data); | 35 list_.Add(data); |
| 36 } | 36 } |
| 37 | 37 |
| 38 | 38 |
| 39 RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { | 39 RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { |
| 40 intptr_t num_descriptors = Length(); | 40 intptr_t num_descriptors = Length(); |
| 41 const PcDescriptors& descriptors = | 41 const PcDescriptors& descriptors = |
| 42 PcDescriptors::Handle(PcDescriptors::New(num_descriptors)); | 42 PcDescriptors::Handle(PcDescriptors::New(num_descriptors)); |
| 43 for (intptr_t i = 0; i < num_descriptors; i++) { | 43 for (intptr_t i = 0; i < num_descriptors; i++) { |
| 44 descriptors.AddDescriptor(i, | 44 descriptors.AddDescriptor(i, |
| 45 (entry_point + PcOffset(i)), | 45 (entry_point + PcOffset(i)), |
| 46 Kind(i), | 46 Kind(i), |
| 47 NodeId(i), | 47 DeoptId(i), |
| 48 TokenIndex(i), | 48 TokenPos(i), |
| 49 TryIndex(i)); | 49 TryIndex(i)); |
| 50 } | 50 } |
| 51 return descriptors.raw(); | 51 return descriptors.raw(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 void StackmapTableBuilder::AddEntry(intptr_t pc_offset, | 55 void StackmapTableBuilder::AddEntry(intptr_t pc_offset, |
| 56 BitmapBuilder* bitmap) { | 56 BitmapBuilder* bitmap) { |
| 57 stack_map_ = Stackmap::New(pc_offset, bitmap); | 57 stack_map_ = Stackmap::New(pc_offset, bitmap); |
| 58 list_.Add(stack_map_); | 58 list_.Add(stack_map_); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 RawStackmap* StackmapTableBuilder::Map(int index) const { | 94 RawStackmap* StackmapTableBuilder::Map(int index) const { |
| 95 Stackmap& map = Stackmap::Handle(); | 95 Stackmap& map = Stackmap::Handle(); |
| 96 map ^= list_.At(index); | 96 map ^= list_.At(index); |
| 97 return map.raw(); | 97 return map.raw(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace dart | 100 } // namespace dart |
| OLD | NEW |