| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 #endif // DEBUG | 618 #endif // DEBUG |
| 619 | 619 |
| 620 friend class Api; | 620 friend class Api; |
| 621 friend class ApiMessageReader; // GetClassId | 621 friend class ApiMessageReader; // GetClassId |
| 622 friend class Array; | 622 friend class Array; |
| 623 friend class Bigint; | 623 friend class Bigint; |
| 624 friend class ByteBuffer; | 624 friend class ByteBuffer; |
| 625 friend class Closure; | 625 friend class Closure; |
| 626 friend class Code; | 626 friend class Code; |
| 627 friend class Double; | 627 friend class Double; |
| 628 friend class ForwardPointersVisitor; // StorePointer |
| 628 friend class FreeListElement; | 629 friend class FreeListElement; |
| 629 friend class Function; | 630 friend class Function; |
| 630 friend class GCMarker; | 631 friend class GCMarker; |
| 631 friend class ExternalTypedData; | 632 friend class ExternalTypedData; |
| 632 friend class ForwardList; | 633 friend class ForwardList; |
| 633 friend class GrowableObjectArray; // StorePointer | 634 friend class GrowableObjectArray; // StorePointer |
| 634 friend class Heap; | 635 friend class Heap; |
| 635 friend class HeapMapAsJSONVisitor; | 636 friend class HeapMapAsJSONVisitor; |
| 636 friend class ClassStatsVisitor; | 637 friend class ClassStatsVisitor; |
| 637 template<bool> friend class MarkingVisitorBase; | 638 template<bool> friend class MarkingVisitorBase; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 729 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
| 729 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 730 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
| 730 int32_t next_field_offset_in_words_; // Offset of the next instance field. | 731 int32_t next_field_offset_in_words_; // Offset of the next instance field. |
| 731 classid_t id_; // Class Id, also index in the class table. | 732 classid_t id_; // Class Id, also index in the class table. |
| 732 int16_t num_type_arguments_; // Number of type arguments in flattened vector. | 733 int16_t num_type_arguments_; // Number of type arguments in flattened vector. |
| 733 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. | 734 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. |
| 734 uint16_t num_native_fields_; // Number of native fields in class. | 735 uint16_t num_native_fields_; // Number of native fields in class. |
| 735 uint16_t state_bits_; | 736 uint16_t state_bits_; |
| 736 | 737 |
| 737 friend class Instance; | 738 friend class Instance; |
| 739 friend class Isolate; |
| 738 friend class Object; | 740 friend class Object; |
| 739 friend class RawInstance; | 741 friend class RawInstance; |
| 740 friend class RawInstructions; | 742 friend class RawInstructions; |
| 741 friend class SnapshotReader; | 743 friend class SnapshotReader; |
| 742 }; | 744 }; |
| 743 | 745 |
| 744 | 746 |
| 745 class RawUnresolvedClass : public RawObject { | 747 class RawUnresolvedClass : public RawObject { |
| 746 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 748 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
| 747 | 749 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 case Snapshot::kInvalid: | 1033 case Snapshot::kInvalid: |
| 1032 break; | 1034 break; |
| 1033 } | 1035 } |
| 1034 UNREACHABLE(); | 1036 UNREACHABLE(); |
| 1035 return NULL; | 1037 return NULL; |
| 1036 } | 1038 } |
| 1037 | 1039 |
| 1038 int32_t line_offset_; | 1040 int32_t line_offset_; |
| 1039 int32_t col_offset_; | 1041 int32_t col_offset_; |
| 1040 int8_t kind_; // Of type Kind. | 1042 int8_t kind_; // Of type Kind. |
| 1043 int64_t load_timestamp_; |
| 1041 }; | 1044 }; |
| 1042 | 1045 |
| 1043 | 1046 |
| 1044 class RawLibrary : public RawObject { | 1047 class RawLibrary : public RawObject { |
| 1045 enum LibraryState { | 1048 enum LibraryState { |
| 1046 kAllocated, // Initial state. | 1049 kAllocated, // Initial state. |
| 1047 kLoadRequested, // Compiler or script requested load of library. | 1050 kLoadRequested, // Compiler or script requested load of library. |
| 1048 kLoadInProgress, // Library is in the process of being loaded. | 1051 kLoadInProgress, // Library is in the process of being loaded. |
| 1049 kLoaded, // Library is loaded. | 1052 kLoaded, // Library is loaded. |
| 1050 kLoadError, // Error occurred during load of the Library. | 1053 kLoadError, // Error occurred during load of the Library. |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 | 1679 |
| 1677 friend class ObjectStore; | 1680 friend class ObjectStore; |
| 1678 }; | 1681 }; |
| 1679 | 1682 |
| 1680 | 1683 |
| 1681 class RawType : public RawAbstractType { | 1684 class RawType : public RawAbstractType { |
| 1682 private: | 1685 private: |
| 1683 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); | 1686 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); |
| 1684 | 1687 |
| 1685 RawObject** from() { | 1688 RawObject** from() { |
| 1686 return reinterpret_cast<RawObject**>(&ptr()->type_class_); | 1689 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_); |
| 1687 } | 1690 } |
| 1688 RawObject* type_class_; // Either resolved class or unresolved class. | 1691 // Either the id of the resolved class as a Smi or an UnresolvedClass. |
| 1692 RawObject* type_class_id_; |
| 1689 RawTypeArguments* arguments_; | 1693 RawTypeArguments* arguments_; |
| 1690 // This type object represents a function type if its signature field is a | 1694 // This type object represents a function type if its signature field is a |
| 1691 // non-null function object. | 1695 // non-null function object. |
| 1692 // If this type is malformed or malbounded, the signature field gets | 1696 // 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 | 1697 // 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 | 1698 // function type, its signature is lost, but the message in the error object |
| 1695 // can describe the issue without needing the signature. | 1699 // can describe the issue without needing the signature. |
| 1696 union { | 1700 union { |
| 1697 RawFunction* signature_; // If not null, this type is a function type. | 1701 RawFunction* signature_; // If not null, this type is a function type. |
| 1698 RawLanguageError* error_; // If not null, type is malformed or malbounded. | 1702 RawLanguageError* error_; // If not null, type is malformed or malbounded. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1717 return reinterpret_cast<RawObject**>(&ptr()->type_); | 1721 return reinterpret_cast<RawObject**>(&ptr()->type_); |
| 1718 } | 1722 } |
| 1719 }; | 1723 }; |
| 1720 | 1724 |
| 1721 | 1725 |
| 1722 class RawTypeParameter : public RawAbstractType { | 1726 class RawTypeParameter : public RawAbstractType { |
| 1723 private: | 1727 private: |
| 1724 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); | 1728 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); |
| 1725 | 1729 |
| 1726 RawObject** from() { | 1730 RawObject** from() { |
| 1727 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); | 1731 return reinterpret_cast<RawObject**>(&ptr()->name_); |
| 1728 } | 1732 } |
| 1729 RawClass* parameterized_class_; | |
| 1730 RawString* name_; | 1733 RawString* name_; |
| 1731 RawAbstractType* bound_; // ObjectType if no explicit bound specified. | 1734 RawAbstractType* bound_; // ObjectType if no explicit bound specified. |
| 1732 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } | 1735 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } |
| 1736 classid_t parameterized_class_id_; |
| 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 |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2435 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2432 kTypedDataInt8ArrayViewCid + 15); | 2436 kTypedDataInt8ArrayViewCid + 15); |
| 2433 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2437 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2434 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2438 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2435 return (kNullCid - kTypedDataInt8ArrayCid); | 2439 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2436 } | 2440 } |
| 2437 | 2441 |
| 2438 } // namespace dart | 2442 } // namespace dart |
| 2439 | 2443 |
| 2440 #endif // VM_RAW_OBJECT_H_ | 2444 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |