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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 RawObject** from() { | 764 RawObject** from() { |
765 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); | 765 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); |
766 } | 766 } |
767 // The instantiations_ array remains empty for instantiated type arguments. | 767 // The instantiations_ array remains empty for instantiated type arguments. |
768 RawArray* instantiations_; // Array of paired canonical vectors: | 768 RawArray* instantiations_; // Array of paired canonical vectors: |
769 // Even index: instantiator. | 769 // Even index: instantiator. |
770 // Odd index: instantiated (without bound error). | 770 // Odd index: instantiated (without bound error). |
771 // Instantiations leading to bound errors do not get cached. | 771 // Instantiations leading to bound errors do not get cached. |
772 RawSmi* length_; | 772 RawSmi* length_; |
773 | 773 |
| 774 RawSmi* hash_; |
| 775 |
774 // Variable length data follows here. | 776 // Variable length data follows here. |
775 RawAbstractType* const* types() const { | 777 RawAbstractType* const* types() const { |
776 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); | 778 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); |
777 } | 779 } |
778 RawAbstractType** types() { | 780 RawAbstractType** types() { |
779 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); | 781 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); |
780 } | 782 } |
781 RawObject** to(intptr_t length) { | 783 RawObject** to(intptr_t length) { |
782 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); | 784 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); |
783 } | 785 } |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 | 1682 |
1681 class RawType : public RawAbstractType { | 1683 class RawType : public RawAbstractType { |
1682 private: | 1684 private: |
1683 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); | 1685 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); |
1684 | 1686 |
1685 RawObject** from() { | 1687 RawObject** from() { |
1686 return reinterpret_cast<RawObject**>(&ptr()->type_class_); | 1688 return reinterpret_cast<RawObject**>(&ptr()->type_class_); |
1687 } | 1689 } |
1688 RawObject* type_class_; // Either resolved class or unresolved class. | 1690 RawObject* type_class_; // Either resolved class or unresolved class. |
1689 RawTypeArguments* arguments_; | 1691 RawTypeArguments* arguments_; |
| 1692 RawSmi* hash_; |
1690 // This type object represents a function type if its signature field is a | 1693 // This type object represents a function type if its signature field is a |
1691 // non-null function object. | 1694 // non-null function object. |
1692 // If this type is malformed or malbounded, the signature field gets | 1695 // If this type is malformed or malbounded, the signature field gets |
1693 // overwritten by the error object in order to save space. If the type is a | 1696 // overwritten by the error object in order to save space. If the type is a |
1694 // function type, its signature is lost, but the message in the error object | 1697 // function type, its signature is lost, but the message in the error object |
1695 // can describe the issue without needing the signature. | 1698 // can describe the issue without needing the signature. |
1696 union { | 1699 union { |
1697 RawFunction* signature_; // If not null, this type is a function type. | 1700 RawFunction* signature_; // If not null, this type is a function type. |
1698 RawLanguageError* error_; // If not null, type is malformed or malbounded. | 1701 RawLanguageError* error_; // If not null, type is malformed or malbounded. |
1699 } sig_or_err_; | 1702 } sig_or_err_; |
(...skipping 21 matching lines...) Expand all Loading... |
1721 | 1724 |
1722 class RawTypeParameter : public RawAbstractType { | 1725 class RawTypeParameter : public RawAbstractType { |
1723 private: | 1726 private: |
1724 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); | 1727 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); |
1725 | 1728 |
1726 RawObject** from() { | 1729 RawObject** from() { |
1727 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); | 1730 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); |
1728 } | 1731 } |
1729 RawClass* parameterized_class_; | 1732 RawClass* parameterized_class_; |
1730 RawString* name_; | 1733 RawString* name_; |
| 1734 RawSmi* hash_; |
1731 RawAbstractType* bound_; // ObjectType if no explicit bound specified. | 1735 RawAbstractType* bound_; // ObjectType if no explicit bound specified. |
1732 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } | 1736 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } |
1733 TokenPosition token_pos_; | 1737 TokenPosition token_pos_; |
1734 int16_t index_; | 1738 int16_t index_; |
1735 int8_t type_state_; | 1739 int8_t type_state_; |
1736 }; | 1740 }; |
1737 | 1741 |
1738 | 1742 |
1739 class RawBoundedType : public RawAbstractType { | 1743 class RawBoundedType : public RawAbstractType { |
1740 private: | 1744 private: |
1741 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); | 1745 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); |
1742 | 1746 |
1743 RawObject** from() { | 1747 RawObject** from() { |
1744 return reinterpret_cast<RawObject**>(&ptr()->type_); | 1748 return reinterpret_cast<RawObject**>(&ptr()->type_); |
1745 } | 1749 } |
1746 RawAbstractType* type_; | 1750 RawAbstractType* type_; |
1747 RawAbstractType* bound_; | 1751 RawAbstractType* bound_; |
| 1752 RawSmi* hash_; |
1748 RawTypeParameter* type_parameter_; // For more detailed error reporting. | 1753 RawTypeParameter* type_parameter_; // For more detailed error reporting. |
1749 RawObject** to() { | 1754 RawObject** to() { |
1750 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); | 1755 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); |
1751 } | 1756 } |
1752 }; | 1757 }; |
1753 | 1758 |
1754 | 1759 |
1755 class RawMixinAppType : public RawAbstractType { | 1760 class RawMixinAppType : public RawAbstractType { |
1756 private: | 1761 private: |
1757 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); | 1762 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); |
1758 | 1763 |
1759 RawObject** from() { | 1764 RawObject** from() { |
1760 return reinterpret_cast<RawObject**>(&ptr()->super_type_); | 1765 return reinterpret_cast<RawObject**>(&ptr()->super_type_); |
1761 } | 1766 } |
1762 RawAbstractType* super_type_; | 1767 RawAbstractType* super_type_; |
| 1768 RawSmi* hash_; |
1763 RawArray* mixin_types_; // Array of AbstractType. | 1769 RawArray* mixin_types_; // Array of AbstractType. |
1764 RawObject** to() { | 1770 RawObject** to() { |
1765 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); | 1771 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); |
1766 } | 1772 } |
1767 }; | 1773 }; |
1768 | 1774 |
1769 | 1775 |
1770 class RawClosure : public RawInstance { | 1776 class RawClosure : public RawInstance { |
1771 private: | 1777 private: |
1772 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); | 1778 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2437 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2432 kTypedDataInt8ArrayViewCid + 15); | 2438 kTypedDataInt8ArrayViewCid + 15); |
2433 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2439 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2434 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2440 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2435 return (kNullCid - kTypedDataInt8ArrayCid); | 2441 return (kNullCid - kTypedDataInt8ArrayCid); |
2436 } | 2442 } |
2437 | 2443 |
2438 } // namespace dart | 2444 } // namespace dart |
2439 | 2445 |
2440 #endif // VM_RAW_OBJECT_H_ | 2446 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |