| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 static bool IsNumberClassId(intptr_t index); | 394 static bool IsNumberClassId(intptr_t index); |
| 395 static bool IsIntegerClassId(intptr_t index); | 395 static bool IsIntegerClassId(intptr_t index); |
| 396 static bool IsStringClassId(intptr_t index); | 396 static bool IsStringClassId(intptr_t index); |
| 397 static bool IsOneByteStringClassId(intptr_t index); | 397 static bool IsOneByteStringClassId(intptr_t index); |
| 398 static bool IsTwoByteStringClassId(intptr_t index); | 398 static bool IsTwoByteStringClassId(intptr_t index); |
| 399 static bool IsExternalStringClassId(intptr_t index); | 399 static bool IsExternalStringClassId(intptr_t index); |
| 400 static bool IsBuiltinListClassId(intptr_t index); | 400 static bool IsBuiltinListClassId(intptr_t index); |
| 401 static bool IsTypedDataClassId(intptr_t index); | 401 static bool IsTypedDataClassId(intptr_t index); |
| 402 static bool IsTypedDataViewClassId(intptr_t index); | 402 static bool IsTypedDataViewClassId(intptr_t index); |
| 403 static bool IsExternalTypedDataClassId(intptr_t index); | 403 static bool IsExternalTypedDataClassId(intptr_t index); |
| 404 static bool IsImplementationClassId(intptr_t index); |
| 404 | 405 |
| 405 static intptr_t NumberOfTypedDataClasses(); | 406 static intptr_t NumberOfTypedDataClasses(); |
| 406 | 407 |
| 407 private: | 408 private: |
| 408 uword tags_; // Various object tags (bits). | 409 uword tags_; // Various object tags (bits). |
| 409 | 410 |
| 410 class WatchedBit : public BitField<bool, kWatchedBit, 1> {}; | 411 class WatchedBit : public BitField<bool, kWatchedBit, 1> {}; |
| 411 | 412 |
| 412 class MarkBit : public BitField<bool, kMarkBit, 1> {}; | 413 class MarkBit : public BitField<bool, kMarkBit, 1> {}; |
| 413 | 414 |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 kExternalTwoByteStringCid == kStringCid + 4); | 1621 kExternalTwoByteStringCid == kStringCid + 4); |
| 1621 return (index == kExternalOneByteStringCid || | 1622 return (index == kExternalOneByteStringCid || |
| 1622 index == kExternalTwoByteStringCid); | 1623 index == kExternalTwoByteStringCid); |
| 1623 } | 1624 } |
| 1624 | 1625 |
| 1625 | 1626 |
| 1626 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { | 1627 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { |
| 1627 // Make sure this function is updated when new builtin List types are added. | 1628 // Make sure this function is updated when new builtin List types are added. |
| 1628 ASSERT(kImmutableArrayCid == kArrayCid + 1 && | 1629 ASSERT(kImmutableArrayCid == kArrayCid + 1 && |
| 1629 kTypedDataCid == kGrowableObjectArrayCid + 1); | 1630 kTypedDataCid == kGrowableObjectArrayCid + 1); |
| 1630 return ((index >= kArrayCid && index < kImmutableArrayCid) || | 1631 return ((index >= kArrayCid && index <= kImmutableArrayCid) || |
| 1631 (index >= kGrowableObjectArrayCid && index < kTypedDataCid) || | 1632 (index >= kGrowableObjectArrayCid && index < kTypedDataCid) || |
| 1632 IsTypedDataClassId(index) || | 1633 IsTypedDataClassId(index) || |
| 1633 IsTypedDataViewClassId(index) || | 1634 IsTypedDataViewClassId(index) || |
| 1634 IsExternalTypedDataClassId(index)); | 1635 IsExternalTypedDataClassId(index)); |
| 1635 } | 1636 } |
| 1636 | 1637 |
| 1637 | 1638 |
| 1638 inline bool RawObject::IsTypedDataClassId(intptr_t index) { | 1639 inline bool RawObject::IsTypedDataClassId(intptr_t index) { |
| 1639 // Make sure this is updated when new TypedData types are added. | 1640 // Make sure this is updated when new TypedData types are added. |
| 1640 ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && | 1641 ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 (kExternalTypedDataFloat64ArrayCid == | 1698 (kExternalTypedDataFloat64ArrayCid == |
| 1698 kExternalTypedDataInt8ArrayCid + 10) && | 1699 kExternalTypedDataInt8ArrayCid + 10) && |
| 1699 (kExternalTypedDataFloat32x4ArrayCid == | 1700 (kExternalTypedDataFloat32x4ArrayCid == |
| 1700 kExternalTypedDataInt8ArrayCid + 11) && | 1701 kExternalTypedDataInt8ArrayCid + 11) && |
| 1701 (kNullCid == kExternalTypedDataInt8ArrayCid + 12)); | 1702 (kNullCid == kExternalTypedDataInt8ArrayCid + 12)); |
| 1702 return (index >= kExternalTypedDataInt8ArrayCid && | 1703 return (index >= kExternalTypedDataInt8ArrayCid && |
| 1703 index <= kExternalTypedDataFloat32x4ArrayCid); | 1704 index <= kExternalTypedDataFloat32x4ArrayCid); |
| 1704 } | 1705 } |
| 1705 | 1706 |
| 1706 | 1707 |
| 1708 inline bool RawObject::IsImplementationClassId(intptr_t index) { |
| 1709 return IsBuiltinListClassId(index) || |
| 1710 IsStringClassId(index) || |
| 1711 IsNumberClassId(index); |
| 1712 } |
| 1713 |
| 1714 |
| 1707 inline intptr_t RawObject::NumberOfTypedDataClasses() { | 1715 inline intptr_t RawObject::NumberOfTypedDataClasses() { |
| 1708 // Make sure this is updated when new TypedData types are added. | 1716 // Make sure this is updated when new TypedData types are added. |
| 1709 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); | 1717 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); |
| 1710 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); | 1718 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); |
| 1711 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); | 1719 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); |
| 1712 return (kNullCid - kTypedDataInt8ArrayCid); | 1720 return (kNullCid - kTypedDataInt8ArrayCid); |
| 1713 } | 1721 } |
| 1714 | 1722 |
| 1715 } // namespace dart | 1723 } // namespace dart |
| 1716 | 1724 |
| 1717 #endif // VM_RAW_OBJECT_H_ | 1725 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |