Index: runtime/vm/code_descriptors.cc |
diff --git a/runtime/vm/code_descriptors.cc b/runtime/vm/code_descriptors.cc |
index 233d1b68032eb373578737b57a739b08f3fb3201..5a9ba10eb888e0b14f513c64d19054e983a7855e 100644 |
--- a/runtime/vm/code_descriptors.cc |
+++ b/runtime/vm/code_descriptors.cc |
@@ -9,38 +9,28 @@ namespace dart { |
void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, |
intptr_t pc_offset, |
intptr_t deopt_id, |
- intptr_t token_index, |
+ intptr_t token_pos, |
intptr_t try_index) { |
ASSERT((kind == RawPcDescriptors::kRuntimeCall) || |
(kind == RawPcDescriptors::kOther) || |
(deopt_id != Isolate::kNoDeoptId)); |
- struct PcDesc data; |
- data.pc_offset = pc_offset; |
- data.kind = kind; |
- data.deopt_id = deopt_id; |
- data.SetTokenPos(token_index); |
- data.try_index = try_index; |
- list_.Add(data); |
- if (try_index >= 0) { |
- has_try_index_ = true; |
- } |
+ |
+ intptr_t merged_kind_try = |
+ RawPcDescriptors::MergedKindTry::Encode(kind, try_index); |
+ |
+ PcDescriptors::EncodeInteger(&encoded_data_, merged_kind_try); |
+ PcDescriptors::EncodeInteger(&encoded_data_, pc_offset - prev_pc_offset); |
+ PcDescriptors::EncodeInteger(&encoded_data_, deopt_id - prev_deopt_id); |
+ PcDescriptors::EncodeInteger(&encoded_data_, token_pos - prev_token_pos); |
+ |
+ prev_pc_offset = pc_offset; |
+ prev_deopt_id = deopt_id; |
+ prev_token_pos = token_pos; |
} |
RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { |
- intptr_t num_descriptors = Length(); |
- const PcDescriptors& descriptors = |
- PcDescriptors::Handle(PcDescriptors::New(num_descriptors, |
- has_try_index_)); |
- for (intptr_t i = 0; i < num_descriptors; i++) { |
- descriptors.AddDescriptor(i, |
- PcOffset(i), |
- Kind(i), |
- DeoptId(i), |
- TokenPos(i), |
- TryIndex(i)); |
- } |
- return descriptors.raw(); |
+ return PcDescriptors::New(&encoded_data_); |
} |