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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 143 #define DEFINE_FORWARD_DECLARATION(clazz) \ |
144 class Raw##clazz; | 144 class Raw##clazz; |
145 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 145 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
146 #undef DEFINE_FORWARD_DECLARATION | 146 #undef DEFINE_FORWARD_DECLARATION |
147 | 147 |
148 | 148 |
149 enum ClassId { | 149 enum ClassId { |
150 // Illegal class id. | 150 // Illegal class id. |
151 kIllegalCid = 0, | 151 kIllegalCid = 0, |
152 | 152 |
| 153 // The following entries describes classes for pseudo-objects in the heap |
| 154 // that should never be reachable from live objects. Free list elements |
| 155 // maintain the free list for old space, and forwarding corpses are used to |
| 156 // implement one-way become. |
| 157 kFreeListElement, |
| 158 kForwardingCorpse, |
| 159 |
153 // List of Ids for predefined classes. | 160 // List of Ids for predefined classes. |
154 #define DEFINE_OBJECT_KIND(clazz) \ | 161 #define DEFINE_OBJECT_KIND(clazz) \ |
155 k##clazz##Cid, | 162 k##clazz##Cid, |
156 CLASS_LIST(DEFINE_OBJECT_KIND) | 163 CLASS_LIST(DEFINE_OBJECT_KIND) |
157 #undef DEFINE_OBJECT_KIND | 164 #undef DEFINE_OBJECT_KIND |
158 | 165 |
159 #define DEFINE_OBJECT_KIND(clazz) \ | 166 #define DEFINE_OBJECT_KIND(clazz) \ |
160 kTypedData##clazz##Cid, | 167 kTypedData##clazz##Cid, |
161 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 168 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
162 #undef DEFINE_OBJECT_KIND | 169 #undef DEFINE_OBJECT_KIND |
(...skipping 11 matching lines...) Expand all Loading... |
174 #undef DEFINE_OBJECT_KIND | 181 #undef DEFINE_OBJECT_KIND |
175 | 182 |
176 kByteBufferCid, | 183 kByteBufferCid, |
177 | 184 |
178 // The following entries do not describe a predefined class, but instead | 185 // The following entries do not describe a predefined class, but instead |
179 // are class indexes for pre-allocated instance (Null, dynamic and Void). | 186 // are class indexes for pre-allocated instance (Null, dynamic and Void). |
180 kNullCid, | 187 kNullCid, |
181 kDynamicCid, | 188 kDynamicCid, |
182 kVoidCid, | 189 kVoidCid, |
183 | 190 |
184 // The following entries describes classes for pseudo-objects in the heap | |
185 // that should never be reachable from live objects. Free list elements | |
186 // maintain the free list for old space, and forwarding corpses are used to | |
187 // implement one-way become. | |
188 kFreeListElement, | |
189 kForwardingCorpse, | |
190 | |
191 kNumPredefinedCids, | 191 kNumPredefinedCids, |
192 }; | 192 }; |
193 | 193 |
194 enum ObjectAlignment { | 194 enum ObjectAlignment { |
195 // Alignment offsets are used to determine object age. | 195 // Alignment offsets are used to determine object age. |
196 kNewObjectAlignmentOffset = kWordSize, | 196 kNewObjectAlignmentOffset = kWordSize, |
197 kOldObjectAlignmentOffset = 0, | 197 kOldObjectAlignmentOffset = 0, |
198 // Object sizes are aligned to kObjectAlignment. | 198 // Object sizes are aligned to kObjectAlignment. |
199 kObjectAlignment = 2 * kWordSize, | 199 kObjectAlignment = 2 * kWordSize, |
200 kObjectAlignmentLog2 = kWordSizeLog2 + 1, | 200 kObjectAlignmentLog2 = kWordSizeLog2 + 1, |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2454 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2455 kTypedDataInt8ArrayViewCid + 15); | 2455 kTypedDataInt8ArrayViewCid + 15); |
2456 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2456 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2457 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2457 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2458 return (kNullCid - kTypedDataInt8ArrayCid); | 2458 return (kNullCid - kTypedDataInt8ArrayCid); |
2459 } | 2459 } |
2460 | 2460 |
2461 } // namespace dart | 2461 } // namespace dart |
2462 | 2462 |
2463 #endif // VM_RAW_OBJECT_H_ | 2463 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |