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/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 intptr_t try_index; // Try block index of PC or deopt array index. | 23 intptr_t try_index; // Try block index of PC or deopt array index. |
24 void SetTokenPos(intptr_t value) { data = value; } | 24 void SetTokenPos(intptr_t value) { data = value; } |
25 intptr_t TokenPos() const { return data; } | 25 intptr_t TokenPos() const { return data; } |
26 void SetDeoptReason(ICData::DeoptReasonId value) { data = value; } | 26 void SetDeoptReason(ICData::DeoptReasonId value) { data = value; } |
27 ICData::DeoptReasonId DeoptReason() const { | 27 ICData::DeoptReasonId DeoptReason() const { |
28 ASSERT((0 <= data) && (data < ICData::kDeoptNumReasons)); | 28 ASSERT((0 <= data) && (data < ICData::kDeoptNumReasons)); |
29 return static_cast<ICData::DeoptReasonId>(data); | 29 return static_cast<ICData::DeoptReasonId>(data); |
30 } | 30 } |
31 }; | 31 }; |
32 | 32 |
33 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { | 33 explicit DescriptorList(intptr_t initial_capacity) |
34 } | 34 : list_(initial_capacity), has_try_index_(false) {} |
35 ~DescriptorList() { } | 35 ~DescriptorList() { } |
36 | 36 |
37 intptr_t Length() const { | 37 intptr_t Length() const { |
38 return list_.length(); | 38 return list_.length(); |
39 } | 39 } |
40 | 40 |
41 intptr_t PcOffset(intptr_t index) const { | 41 intptr_t PcOffset(intptr_t index) const { |
42 return list_[index].pc_offset; | 42 return list_[index].pc_offset; |
43 } | 43 } |
44 RawPcDescriptors::Kind Kind(intptr_t index) const { | 44 RawPcDescriptors::Kind Kind(intptr_t index) const { |
45 return list_[index].kind; | 45 return list_[index].kind; |
46 } | 46 } |
47 intptr_t DeoptId(intptr_t index) const { | 47 intptr_t DeoptId(intptr_t index) const { |
48 return list_[index].deopt_id; | 48 return list_[index].deopt_id; |
49 } | 49 } |
50 intptr_t TokenPos(intptr_t index) const { | 50 intptr_t TokenPos(intptr_t index) const { |
51 return list_[index].TokenPos(); | 51 return list_[index].TokenPos(); |
52 } | 52 } |
53 ICData::DeoptReasonId DeoptReason(intptr_t index) const { | 53 ICData::DeoptReasonId DeoptReason(intptr_t index) const { |
54 return list_[index].DeoptReason(); | 54 return list_[index].DeoptReason(); |
55 } | 55 } |
56 intptr_t TryIndex(intptr_t index) const { | 56 intptr_t TryIndex(intptr_t index) const { |
57 return list_[index].try_index; | 57 return list_[index].try_index; |
siva
2014/07/14 19:42:01
Should this be:
return (!has_try_index_) ? -1 : l
srdjan
2014/07/14 23:55:25
Done as:
return (has_try_index_) ? list_[index].tr
| |
58 } | 58 } |
59 | 59 |
60 void AddDescriptor(RawPcDescriptors::Kind kind, | 60 void AddDescriptor(RawPcDescriptors::Kind kind, |
61 intptr_t pc_offset, | 61 intptr_t pc_offset, |
62 intptr_t deopt_id, | 62 intptr_t deopt_id, |
63 intptr_t token_index, | 63 intptr_t token_index, |
64 intptr_t try_index); | 64 intptr_t try_index); |
65 | 65 |
66 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); | 66 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); |
67 | 67 |
68 private: | 68 private: |
69 GrowableArray<struct PcDesc> list_; | 69 GrowableArray<struct PcDesc> list_; |
70 bool has_try_index_; | |
70 DISALLOW_COPY_AND_ASSIGN(DescriptorList); | 71 DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
71 }; | 72 }; |
72 | 73 |
73 | 74 |
74 class StackmapTableBuilder : public ZoneAllocated { | 75 class StackmapTableBuilder : public ZoneAllocated { |
75 public: | 76 public: |
76 explicit StackmapTableBuilder() | 77 explicit StackmapTableBuilder() |
77 : stack_map_(Stackmap::ZoneHandle()), | 78 : stack_map_(Stackmap::ZoneHandle()), |
78 list_(GrowableObjectArray::ZoneHandle( | 79 list_(GrowableObjectArray::ZoneHandle( |
79 GrowableObjectArray::New(Heap::kOld))) { } | 80 GrowableObjectArray::New(Heap::kOld))) { } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 } | 179 } |
179 | 180 |
180 private: | 181 private: |
181 GrowableArray<struct HandlerDesc> list_; | 182 GrowableArray<struct HandlerDesc> list_; |
182 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 183 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
183 }; | 184 }; |
184 | 185 |
185 } // namespace dart | 186 } // namespace dart |
186 | 187 |
187 #endif // VM_CODE_DESCRIPTORS_H_ | 188 #endif // VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |