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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 | 51 |
52 bool StackmapTableBuilder::Verify() { | 52 bool StackmapTableBuilder::Verify() { |
53 intptr_t num_entries = Length(); | 53 intptr_t num_entries = Length(); |
54 Stackmap& map1 = Stackmap::Handle(); | 54 Stackmap& map1 = Stackmap::Handle(); |
55 Stackmap& map2 = Stackmap::Handle(); | 55 Stackmap& map2 = Stackmap::Handle(); |
56 for (intptr_t i = 1; i < num_entries; i++) { | 56 for (intptr_t i = 1; i < num_entries; i++) { |
57 map1 = MapAt(i - 1); | 57 map1 = MapAt(i - 1); |
58 map2 = MapAt(i); | 58 map2 = MapAt(i); |
59 // Ensure there are no duplicates and the entries are sorted. | 59 // Ensure there are no duplicates and the entries are sorted. |
60 if (map1.PC() >= map2.PC()) { | 60 if (map1.PcOffset() >= map2.PcOffset()) { |
61 return false; | 61 return false; |
62 } | 62 } |
63 } | 63 } |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 RawArray* StackmapTableBuilder::FinalizeStackmaps(const Code& code) { | 68 RawArray* StackmapTableBuilder::FinalizeStackmaps(const Code& code) { |
69 ASSERT(Verify()); | 69 ASSERT(Verify()); |
70 intptr_t num_entries = Length(); | 70 intptr_t num_entries = Length(); |
71 if (num_entries == 0) { | 71 if (num_entries == 0) { |
72 return Object::empty_array().raw(); | 72 return Object::empty_array().raw(); |
73 } | 73 } |
74 uword entry_point = code.EntryPoint(); | |
75 for (intptr_t i = 0; i < num_entries; i++) { | |
76 stack_map_ = MapAt(i); | |
77 stack_map_.SetPC(entry_point + stack_map_.PC()); | |
78 } | |
79 return Array::MakeArray(list_); | 74 return Array::MakeArray(list_); |
80 } | 75 } |
81 | 76 |
82 | 77 |
83 RawStackmap* StackmapTableBuilder::MapAt(intptr_t index) const { | 78 RawStackmap* StackmapTableBuilder::MapAt(intptr_t index) const { |
84 Stackmap& map = Stackmap::Handle(); | 79 Stackmap& map = Stackmap::Handle(); |
85 map ^= list_.At(index); | 80 map ^= list_.At(index); |
86 return map.raw(); | 81 return map.raw(); |
87 } | 82 } |
88 | 83 |
89 } // namespace dart | 84 } // namespace dart |
OLD | NEW |