| 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/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/token.h" | 10 #include "vm/token.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 | 213 |
| 214 // RawObject is the base class of all raw objects, even though it carries the | 214 // RawObject is the base class of all raw objects, even though it carries the |
| 215 // class_ field not all raw objects are allocated in the heap and thus cannot | 215 // class_ field not all raw objects are allocated in the heap and thus cannot |
| 216 // be dereferenced (e.g. RawSmi). | 216 // be dereferenced (e.g. RawSmi). |
| 217 class RawObject { | 217 class RawObject { |
| 218 public: | 218 public: |
| 219 // The tags field which is a part of the object header uses the following | 219 // The tags field which is a part of the object header uses the following |
| 220 // bit fields for storing tags. | 220 // bit fields for storing tags. |
| 221 enum TagBits { | 221 enum TagBits { |
| 222 kFreeBit = 0, | 222 kWatchedBit = 0, |
| 223 kMarkBit = 1, | 223 kMarkBit = 1, |
| 224 kCanonicalBit = 2, | 224 kCanonicalBit = 2, |
| 225 kFromSnapshotBit = 3, | 225 kFromSnapshotBit = 3, |
| 226 kWatchedBit = 4, | 226 kReservedTagBit = 4, // kReservedBit{1K, 10K,100K,1M,10M} |
| 227 kReservedTagBit = 5, // kReservedBit{10K,100K,1M,10M} | 227 kReservedTagSize = 4, |
| 228 kReservedTagSize = 3, | |
| 229 kSizeTagBit = 8, | 228 kSizeTagBit = 8, |
| 230 kSizeTagSize = 8, | 229 kSizeTagSize = 8, |
| 231 kClassIdTagBit = kSizeTagBit + kSizeTagSize, | 230 kClassIdTagBit = kSizeTagBit + kSizeTagSize, |
| 232 kClassIdTagSize = 16 | 231 kClassIdTagSize = 16 |
| 233 }; | 232 }; |
| 234 | 233 |
| 235 // Encodes the object size in the tag in units of object alignment. | 234 // Encodes the object size in the tag in units of object alignment. |
| 236 class SizeTag { | 235 class SizeTag { |
| 237 public: | 236 public: |
| 238 static const intptr_t kMaxSizeTag = | 237 static const intptr_t kMaxSizeTag = |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 static bool IsBuiltinListClassId(intptr_t index); | 378 static bool IsBuiltinListClassId(intptr_t index); |
| 380 static bool IsTypedDataClassId(intptr_t index); | 379 static bool IsTypedDataClassId(intptr_t index); |
| 381 static bool IsTypedDataViewClassId(intptr_t index); | 380 static bool IsTypedDataViewClassId(intptr_t index); |
| 382 static bool IsExternalTypedDataClassId(intptr_t index); | 381 static bool IsExternalTypedDataClassId(intptr_t index); |
| 383 | 382 |
| 384 static intptr_t NumberOfTypedDataClasses(); | 383 static intptr_t NumberOfTypedDataClasses(); |
| 385 | 384 |
| 386 private: | 385 private: |
| 387 uword tags_; // Various object tags (bits). | 386 uword tags_; // Various object tags (bits). |
| 388 | 387 |
| 389 class FreeBit : public BitField<bool, kFreeBit, 1> {}; | 388 class WatchedBit : public BitField<bool, kWatchedBit, 1> {}; |
| 390 | 389 |
| 391 class MarkBit : public BitField<bool, kMarkBit, 1> {}; | 390 class MarkBit : public BitField<bool, kMarkBit, 1> {}; |
| 392 | 391 |
| 393 class WatchedBit : public BitField<bool, kWatchedBit, 1> {}; | |
| 394 | |
| 395 class CanonicalObjectTag : public BitField<bool, kCanonicalBit, 1> {}; | 392 class CanonicalObjectTag : public BitField<bool, kCanonicalBit, 1> {}; |
| 396 | 393 |
| 397 class CreatedFromSnapshotTag : public BitField<bool, kFromSnapshotBit, 1> {}; | 394 class CreatedFromSnapshotTag : public BitField<bool, kFromSnapshotBit, 1> {}; |
| 398 | 395 |
| 399 class ReservedBits : public BitField<intptr_t, | 396 class ReservedBits : public BitField<intptr_t, |
| 400 kReservedTagBit, | 397 kReservedTagBit, |
| 401 kReservedTagSize> {}; // NOLINT | 398 kReservedTagSize> {}; // NOLINT |
| 402 | 399 |
| 403 RawObject* ptr() const { | 400 RawObject* ptr() const { |
| 404 ASSERT(IsHeapObject()); | 401 ASSERT(IsHeapObject()); |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 // Make sure this is updated when new TypedData types are added. | 1661 // Make sure this is updated when new TypedData types are added. |
| 1665 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); | 1662 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); |
| 1666 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); | 1663 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); |
| 1667 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); | 1664 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); |
| 1668 return (kNullCid - kTypedDataInt8ArrayCid); | 1665 return (kNullCid - kTypedDataInt8ArrayCid); |
| 1669 } | 1666 } |
| 1670 | 1667 |
| 1671 } // namespace dart | 1668 } // namespace dart |
| 1672 | 1669 |
| 1673 #endif // VM_RAW_OBJECT_H_ | 1670 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |