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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 RawAbstractType* const* types() const { | 757 RawAbstractType* const* types() const { |
758 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); | 758 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); |
759 } | 759 } |
760 RawAbstractType** types() { | 760 RawAbstractType** types() { |
761 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); | 761 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); |
762 } | 762 } |
763 RawObject** to(intptr_t length) { | 763 RawObject** to(intptr_t length) { |
764 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); | 764 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); |
765 } | 765 } |
766 | 766 |
| 767 friend class Object; |
767 friend class SnapshotReader; | 768 friend class SnapshotReader; |
768 }; | 769 }; |
769 | 770 |
770 | 771 |
771 class RawPatchClass : public RawObject { | 772 class RawPatchClass : public RawObject { |
772 private: | 773 private: |
773 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); | 774 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); |
774 | 775 |
775 RawObject** from() { | 776 RawObject** from() { |
776 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); | 777 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 RawString* name_; | 1732 RawString* name_; |
1732 RawSmi* hash_; | 1733 RawSmi* hash_; |
1733 RawAbstractType* bound_; // ObjectType if no explicit bound specified. | 1734 RawAbstractType* bound_; // ObjectType if no explicit bound specified. |
1734 RawFunction* parameterized_function_; | 1735 RawFunction* parameterized_function_; |
1735 RawObject** to() { | 1736 RawObject** to() { |
1736 return reinterpret_cast<RawObject**>(&ptr()->parameterized_function_); | 1737 return reinterpret_cast<RawObject**>(&ptr()->parameterized_function_); |
1737 } | 1738 } |
1738 classid_t parameterized_class_id_; | 1739 classid_t parameterized_class_id_; |
1739 TokenPosition token_pos_; | 1740 TokenPosition token_pos_; |
1740 int16_t index_; | 1741 int16_t index_; |
1741 uint8_t parent_level_; // Max 255 levels of nested generic functions is OK. | |
1742 int8_t type_state_; | 1742 int8_t type_state_; |
1743 | 1743 |
1744 friend class CidRewriteVisitor; | 1744 friend class CidRewriteVisitor; |
1745 }; | 1745 }; |
1746 | 1746 |
1747 | 1747 |
1748 class RawBoundedType : public RawAbstractType { | 1748 class RawBoundedType : public RawAbstractType { |
1749 private: | 1749 private: |
1750 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); | 1750 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); |
1751 | 1751 |
(...skipping 21 matching lines...) Expand all Loading... |
1773 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); | 1773 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); |
1774 } | 1774 } |
1775 }; | 1775 }; |
1776 | 1776 |
1777 | 1777 |
1778 class RawClosure : public RawInstance { | 1778 class RawClosure : public RawInstance { |
1779 private: | 1779 private: |
1780 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); | 1780 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
1781 | 1781 |
1782 RawObject** from() { | 1782 RawObject** from() { |
1783 return reinterpret_cast<RawObject**>(&ptr()->instantiator_); | 1783 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); |
1784 } | 1784 } |
1785 | 1785 |
1786 // No instance fields should be declared before the following 3 fields whose | 1786 // No instance fields should be declared before the following 3 fields whose |
1787 // offsets must be identical in Dart and C++. | 1787 // offsets must be identical in Dart and C++. |
1788 | 1788 |
1789 // These 3 fields are also declared in the Dart source of class _Closure. | 1789 // These 4 fields are also declared in the Dart source of class _Closure. |
1790 RawTypeArguments* instantiator_; | 1790 RawTypeArguments* instantiator_type_arguments_; |
| 1791 RawTypeArguments* function_type_arguments_; |
1791 RawFunction* function_; | 1792 RawFunction* function_; |
1792 RawContext* context_; | 1793 RawContext* context_; |
1793 | 1794 |
1794 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->context_); } | 1795 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->context_); } |
1795 }; | 1796 }; |
1796 | 1797 |
1797 | 1798 |
1798 class RawNumber : public RawInstance { | 1799 class RawNumber : public RawInstance { |
1799 RAW_OBJECT_IMPLEMENTATION(Number); | 1800 RAW_OBJECT_IMPLEMENTATION(Number); |
1800 }; | 1801 }; |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2436 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2436 kTypedDataInt8ArrayViewCid + 15); | 2437 kTypedDataInt8ArrayViewCid + 15); |
2437 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2438 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2438 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2439 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2439 return (kNullCid - kTypedDataInt8ArrayCid); | 2440 return (kNullCid - kTypedDataInt8ArrayCid); |
2440 } | 2441 } |
2441 | 2442 |
2442 } // namespace dart | 2443 } // namespace dart |
2443 | 2444 |
2444 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2445 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
OLD | NEW |