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 #ifndef VM_CODE_DESCRIPTORS_H_ | 5 #ifndef VM_CODE_DESCRIPTORS_H_ |
6 #define VM_CODE_DESCRIPTORS_H_ | 6 #define VM_CODE_DESCRIPTORS_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 class DescriptorList : public ZoneAllocated { | 14 class DescriptorList : public ZoneAllocated { |
15 public: | 15 public: |
16 struct PcDesc { | 16 struct PcDesc { |
17 intptr_t pc_offset; // PC offset value of the descriptor. | 17 intptr_t pc_offset; // PC offset value of the descriptor. |
18 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). | 18 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). |
19 intptr_t node_id; // AST node id. | 19 intptr_t deopt_id; // Deoptimization id. |
20 intptr_t token_index; // Token position in source of PC. | 20 intptr_t token_index; // Token position in source of PC. |
21 intptr_t try_index; // Try block index of PC or deopt array index. | 21 intptr_t try_index; // Try block index of PC or deopt array index. |
22 }; | 22 }; |
23 | 23 |
24 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { | 24 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { |
25 } | 25 } |
26 ~DescriptorList() { } | 26 ~DescriptorList() { } |
27 | 27 |
28 intptr_t Length() const { | 28 intptr_t Length() const { |
29 return list_.length(); | 29 return list_.length(); |
30 } | 30 } |
31 | 31 |
32 intptr_t PcOffset(int index) const { | 32 intptr_t PcOffset(int index) const { |
33 return list_[index].pc_offset; | 33 return list_[index].pc_offset; |
34 } | 34 } |
35 PcDescriptors::Kind Kind(int index) const { | 35 PcDescriptors::Kind Kind(int index) const { |
36 return list_[index].kind; | 36 return list_[index].kind; |
37 } | 37 } |
38 intptr_t NodeId(int index) const { | 38 intptr_t DeoptId(int index) const { |
39 return list_[index].node_id; | 39 return list_[index].deopt_id; |
40 } | 40 } |
41 intptr_t TokenIndex(int index) const { | 41 intptr_t TokenPos(int index) const { |
42 return list_[index].token_index; | 42 return list_[index].token_index; |
43 } | 43 } |
44 intptr_t TryIndex(int index) const { | 44 intptr_t TryIndex(int index) const { |
45 return list_[index].try_index; | 45 return list_[index].try_index; |
46 } | 46 } |
47 | 47 |
48 void AddDescriptor(PcDescriptors::Kind kind, | 48 void AddDescriptor(PcDescriptors::Kind kind, |
49 intptr_t pc_offset, | 49 intptr_t pc_offset, |
50 intptr_t node_id, | 50 intptr_t deopt_id, |
51 intptr_t token_index, | 51 intptr_t token_index, |
52 intptr_t try_index); | 52 intptr_t try_index); |
53 void AddDeoptInfo(intptr_t pc_offset, | 53 void AddDeoptInfo(intptr_t pc_offset, |
54 intptr_t node_id, | 54 intptr_t deopt_id, |
55 intptr_t token_index, | 55 intptr_t token_index, |
56 intptr_t deopt_array_index); | 56 intptr_t deopt_array_index); |
57 | 57 |
58 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); | 58 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); |
59 | 59 |
60 private: | 60 private: |
61 GrowableArray<struct PcDesc> list_; | 61 GrowableArray<struct PcDesc> list_; |
62 DISALLOW_COPY_AND_ASSIGN(DescriptorList); | 62 DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
63 }; | 63 }; |
64 | 64 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 private: | 130 private: |
131 GrowableArray<struct HandlerDesc> list_; | 131 GrowableArray<struct HandlerDesc> list_; |
132 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 132 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace dart | 135 } // namespace dart |
136 | 136 |
137 #endif // VM_CODE_DESCRIPTORS_H_ | 137 #endif // VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |