| 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/code_generator.h" |
| 8 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 9 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| 10 #include "vm/object.h" | 11 #include "vm/object.h" |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 | 14 |
| 14 class DescriptorList : public ZoneAllocated { | 15 class DescriptorList : public ZoneAllocated { |
| 15 public: | 16 public: |
| 16 struct PcDesc { | 17 struct PcDesc { |
| 17 intptr_t pc_offset; // PC offset value of the descriptor. | 18 intptr_t pc_offset; // PC offset value of the descriptor. |
| 18 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). | 19 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). |
| 19 intptr_t deopt_id; // Deoptimization id. | 20 intptr_t deopt_id; // Deoptimization id. |
| 20 intptr_t token_index; // Token position in source of PC. | 21 intptr_t data; // Token position or deopt rason. |
| 21 intptr_t try_index; // Try block index of PC or deopt array index. | 22 intptr_t try_index; // Try block index of PC or deopt array index. |
| 23 void SetTokenPos(intptr_t value) { data = value; } |
| 24 intptr_t TokenPos() const { return data; } |
| 25 void SetDeoptReason(DeoptReasonId value) { data = value; } |
| 26 DeoptReasonId DeoptReason() const { |
| 27 return static_cast<DeoptReasonId>(data); |
| 28 } |
| 22 }; | 29 }; |
| 23 | 30 |
| 24 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { | 31 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { |
| 25 } | 32 } |
| 26 ~DescriptorList() { } | 33 ~DescriptorList() { } |
| 27 | 34 |
| 28 intptr_t Length() const { | 35 intptr_t Length() const { |
| 29 return list_.length(); | 36 return list_.length(); |
| 30 } | 37 } |
| 31 | 38 |
| 32 intptr_t PcOffset(int index) const { | 39 intptr_t PcOffset(int index) const { |
| 33 return list_[index].pc_offset; | 40 return list_[index].pc_offset; |
| 34 } | 41 } |
| 35 PcDescriptors::Kind Kind(int index) const { | 42 PcDescriptors::Kind Kind(int index) const { |
| 36 return list_[index].kind; | 43 return list_[index].kind; |
| 37 } | 44 } |
| 38 intptr_t DeoptId(int index) const { | 45 intptr_t DeoptId(int index) const { |
| 39 return list_[index].deopt_id; | 46 return list_[index].deopt_id; |
| 40 } | 47 } |
| 41 intptr_t TokenPos(int index) const { | 48 intptr_t TokenPos(int index) const { |
| 42 return list_[index].token_index; | 49 return list_[index].TokenPos(); |
| 50 } |
| 51 DeoptReasonId DeoptReason(int index) const { |
| 52 return list_[index].DeoptReason(); |
| 43 } | 53 } |
| 44 intptr_t TryIndex(int index) const { | 54 intptr_t TryIndex(int index) const { |
| 45 return list_[index].try_index; | 55 return list_[index].try_index; |
| 46 } | 56 } |
| 47 | 57 |
| 48 void AddDescriptor(PcDescriptors::Kind kind, | 58 void AddDescriptor(PcDescriptors::Kind kind, |
| 49 intptr_t pc_offset, | 59 intptr_t pc_offset, |
| 50 intptr_t deopt_id, | 60 intptr_t deopt_id, |
| 51 intptr_t token_index, | 61 intptr_t token_index, |
| 52 intptr_t try_index); | 62 intptr_t try_index); |
| 53 void AddDeoptInfo(intptr_t pc_offset, | 63 void AddDeoptIndex(intptr_t pc_offset, |
| 54 intptr_t deopt_id, | 64 intptr_t deopt_id, |
| 55 intptr_t token_index, | 65 DeoptReasonId deopt_reason, |
| 56 intptr_t deopt_array_index); | 66 intptr_t deopt_array_index); |
| 57 | 67 |
| 58 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); | 68 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); |
| 59 | 69 |
| 60 private: | 70 private: |
| 61 GrowableArray<struct PcDesc> list_; | 71 GrowableArray<struct PcDesc> list_; |
| 62 DISALLOW_COPY_AND_ASSIGN(DescriptorList); | 72 DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
| 63 }; | 73 }; |
| 64 | 74 |
| 65 | 75 |
| 66 class StackmapTableBuilder : public ZoneAllocated { | 76 class StackmapTableBuilder : public ZoneAllocated { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 140 } |
| 131 | 141 |
| 132 private: | 142 private: |
| 133 GrowableArray<struct HandlerDesc> list_; | 143 GrowableArray<struct HandlerDesc> list_; |
| 134 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 144 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
| 135 }; | 145 }; |
| 136 | 146 |
| 137 } // namespace dart | 147 } // namespace dart |
| 138 | 148 |
| 139 #endif // VM_CODE_DESCRIPTORS_H_ | 149 #endif // VM_CODE_DESCRIPTORS_H_ |
| OLD | NEW |