| 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 RUNTIME_VM_RAW_OBJECT_H_ | 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_ |
| 6 #define RUNTIME_VM_RAW_OBJECT_H_ | 6 #define RUNTIME_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/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 kMarkBit = 0, | 264 kMarkBit = 0, |
| 265 kCanonicalBit = 1, | 265 kCanonicalBit = 1, |
| 266 kVMHeapObjectBit = 2, | 266 kVMHeapObjectBit = 2, |
| 267 kRememberedBit = 3, | 267 kRememberedBit = 3, |
| 268 kReservedTagPos = 4, // kReservedBit{100K,1M,10M} | 268 kReservedTagPos = 4, // kReservedBit{100K,1M,10M} |
| 269 kReservedTagSize = 4, | 269 kReservedTagSize = 4, |
| 270 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 8 | 270 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 8 |
| 271 kSizeTagSize = 8, | 271 kSizeTagSize = 8, |
| 272 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16 | 272 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16 |
| 273 kClassIdTagSize = 16, | 273 kClassIdTagSize = 16, |
| 274 #if defined(HASH_IN_OBJECT_HEADER) |
| 275 kHashTagPos = kClassIdTagPos + kClassIdTagSize, // = 32 |
| 276 kHashTagSize = 16, |
| 277 #endif |
| 274 }; | 278 }; |
| 275 | 279 |
| 276 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte)); | 280 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte)); |
| 277 | 281 |
| 278 // Encodes the object size in the tag in units of object alignment. | 282 // Encodes the object size in the tag in units of object alignment. |
| 279 class SizeTag { | 283 class SizeTag { |
| 280 public: | 284 public: |
| 281 static const intptr_t kMaxSizeTag = ((1 << RawObject::kSizeTagSize) - 1) | 285 static const intptr_t kMaxSizeTag = ((1 << RawObject::kSizeTagSize) - 1) |
| 282 << kObjectAlignmentLog2; | 286 << kObjectAlignmentLog2; |
| 283 | 287 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 bool IsTypedDataView##clazz() const { \ | 406 bool IsTypedDataView##clazz() const { \ |
| 403 return ((GetClassId() == kTypedData##clazz##ViewCid)); \ | 407 return ((GetClassId() == kTypedData##clazz##ViewCid)); \ |
| 404 } \ | 408 } \ |
| 405 bool IsExternalTypedData##clazz() const { \ | 409 bool IsExternalTypedData##clazz() const { \ |
| 406 return ((GetClassId() == kExternalTypedData##clazz##Cid)); \ | 410 return ((GetClassId() == kExternalTypedData##clazz##Cid)); \ |
| 407 } | 411 } |
| 408 CLASS_LIST_TYPED_DATA(DEFINE_IS_CID) | 412 CLASS_LIST_TYPED_DATA(DEFINE_IS_CID) |
| 409 #undef DEFINE_IS_CID | 413 #undef DEFINE_IS_CID |
| 410 | 414 |
| 411 bool IsStringInstance() const { return IsStringClassId(GetClassId()); } | 415 bool IsStringInstance() const { return IsStringClassId(GetClassId()); } |
| 416 bool IsRawNull() const { return GetClassId() == kNullCid; } |
| 412 bool IsDartInstance() const { | 417 bool IsDartInstance() const { |
| 413 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); | 418 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); |
| 414 } | 419 } |
| 415 bool IsFreeListElement() const { | 420 bool IsFreeListElement() const { |
| 416 return ((GetClassId() == kFreeListElement)); | 421 return ((GetClassId() == kFreeListElement)); |
| 417 } | 422 } |
| 418 bool IsForwardingCorpse() const { | 423 bool IsForwardingCorpse() const { |
| 419 return ((GetClassId() == kForwardingCorpse)); | 424 return ((GetClassId() == kForwardingCorpse)); |
| 420 } | 425 } |
| 421 bool IsPseudoObject() const { | 426 bool IsPseudoObject() const { |
| (...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 kTypedDataInt8ArrayViewCid + 15); | 2456 kTypedDataInt8ArrayViewCid + 15); |
| 2452 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2457 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2453 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2458 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2454 return (kNullCid - kTypedDataInt8ArrayCid); | 2459 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2455 } | 2460 } |
| 2456 | 2461 |
| 2457 | 2462 |
| 2458 } // namespace dart | 2463 } // namespace dart |
| 2459 | 2464 |
| 2460 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2465 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
| OLD | NEW |