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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 | 177 |
178 // The following entries do not describe a predefined class, but instead | 178 // The following entries do not describe a predefined class, but instead |
179 // are class indexes for pre-allocated instance (Null, dynamic and Void). | 179 // are class indexes for pre-allocated instance (Null, dynamic and Void). |
180 kNullCid, | 180 kNullCid, |
181 kDynamicCid, | 181 kDynamicCid, |
182 kVoidCid, | 182 kVoidCid, |
183 | 183 |
184 // The following entry does not describe a real class, but instead it is an | 184 // The following entry does not describe a real class, but instead it is an |
185 // id which is used to identify free list elements in the heap. | 185 // id which is used to identify free list elements in the heap. |
186 kFreeListElement, | 186 kFreeListElement, |
187 kForwardingCorpse, | |
Cutch
2016/06/02 14:09:53
Add a comment about kForwardingCorpse
rmacnak
2016/06/02 17:57:06
Done.
| |
187 | 188 |
188 kNumPredefinedCids, | 189 kNumPredefinedCids, |
189 }; | 190 }; |
190 | 191 |
191 enum ObjectAlignment { | 192 enum ObjectAlignment { |
192 // Alignment offsets are used to determine object age. | 193 // Alignment offsets are used to determine object age. |
193 kNewObjectAlignmentOffset = kWordSize, | 194 kNewObjectAlignmentOffset = kWordSize, |
194 kOldObjectAlignmentOffset = 0, | 195 kOldObjectAlignmentOffset = 0, |
195 // Object sizes are aligned to kObjectAlignment. | 196 // Object sizes are aligned to kObjectAlignment. |
196 kObjectAlignment = 2 * kWordSize, | 197 kObjectAlignment = 2 * kWordSize, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 | 436 |
436 bool IsStringInstance() const { | 437 bool IsStringInstance() const { |
437 return IsStringClassId(GetClassId()); | 438 return IsStringClassId(GetClassId()); |
438 } | 439 } |
439 bool IsDartInstance() const { | 440 bool IsDartInstance() const { |
440 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); | 441 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); |
441 } | 442 } |
442 bool IsFreeListElement() const { | 443 bool IsFreeListElement() const { |
443 return ((GetClassId() == kFreeListElement)); | 444 return ((GetClassId() == kFreeListElement)); |
444 } | 445 } |
446 bool IsForwardingCorpse() const { | |
447 return ((GetClassId() == kForwardingCorpse)); | |
448 } | |
445 | 449 |
446 intptr_t Size() const { | 450 intptr_t Size() const { |
447 uword tags = ptr()->tags_; | 451 uword tags = ptr()->tags_; |
448 intptr_t result = SizeTag::decode(tags); | 452 intptr_t result = SizeTag::decode(tags); |
449 if (result != 0) { | 453 if (result != 0) { |
450 ASSERT(result == SizeFromClass()); | 454 ASSERT(result == SizeFromClass()); |
451 return result; | 455 return result; |
452 } | 456 } |
453 result = SizeFromClass(); | 457 result = SizeFromClass(); |
454 ASSERT(result > SizeTag::kMaxSizeTag); | 458 ASSERT(result > SizeTag::kMaxSizeTag); |
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2420 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2424 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2421 kTypedDataInt8ArrayViewCid + 15); | 2425 kTypedDataInt8ArrayViewCid + 15); |
2422 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2426 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2423 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2427 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2424 return (kNullCid - kTypedDataInt8ArrayCid); | 2428 return (kNullCid - kTypedDataInt8ArrayCid); |
2425 } | 2429 } |
2426 | 2430 |
2427 } // namespace dart | 2431 } // namespace dart |
2428 | 2432 |
2429 #endif // VM_RAW_OBJECT_H_ | 2433 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |