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" |
11 #include "vm/growable_array.h" | 11 #include "vm/growable_array.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 class DescriptorList : public ZoneAllocated { | 16 class DescriptorList : public ZoneAllocated { |
17 public: | 17 public: |
18 struct PcDesc { | 18 struct PcDesc { |
19 intptr_t pc_offset; // PC offset value of the descriptor. | 19 intptr_t pc_offset; // PC offset value of the descriptor. |
20 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). | 20 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). |
21 intptr_t deopt_id; // Deoptimization id. | 21 intptr_t deopt_id; // Deoptimization id. |
22 intptr_t data; // Token position or deopt rason. | 22 intptr_t data; // Token position or deopt reason. |
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(DeoptReasonId value) { data = value; } | 26 void SetDeoptReason(DeoptReasonId value) { data = value; } |
27 DeoptReasonId DeoptReason() const { | 27 DeoptReasonId DeoptReason() const { |
28 ASSERT(static_cast<uword>(data) < kDeoptNumReasons); | |
Ivan Posva
2014/04/25 20:59:22
Can we change this into a compile time assert?
regis
2014/04/25 23:38:28
The value of 'data' is not known at compile time.
| |
28 return static_cast<DeoptReasonId>(data); | 29 return static_cast<DeoptReasonId>(data); |
29 } | 30 } |
30 }; | 31 }; |
31 | 32 |
32 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { | 33 explicit DescriptorList(intptr_t initial_capacity) : list_(initial_capacity) { |
33 } | 34 } |
34 ~DescriptorList() { } | 35 ~DescriptorList() { } |
35 | 36 |
36 intptr_t Length() const { | 37 intptr_t Length() const { |
37 return list_.length(); | 38 return list_.length(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 } | 178 } |
178 | 179 |
179 private: | 180 private: |
180 GrowableArray<struct HandlerDesc> list_; | 181 GrowableArray<struct HandlerDesc> list_; |
181 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); | 182 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); |
182 }; | 183 }; |
183 | 184 |
184 } // namespace dart | 185 } // namespace dart |
185 | 186 |
186 #endif // VM_CODE_DESCRIPTORS_H_ | 187 #endif // VM_CODE_DESCRIPTORS_H_ |
OLD | NEW |