| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 V(SubtypeTestCache) \ | 43 V(SubtypeTestCache) \ |
| 44 V(Error) \ | 44 V(Error) \ |
| 45 V(ApiError) \ | 45 V(ApiError) \ |
| 46 V(LanguageError) \ | 46 V(LanguageError) \ |
| 47 V(UnhandledException) \ | 47 V(UnhandledException) \ |
| 48 V(UnwindError) \ | 48 V(UnwindError) \ |
| 49 V(Instance) \ | 49 V(Instance) \ |
| 50 V(LibraryPrefix) \ | 50 V(LibraryPrefix) \ |
| 51 V(AbstractType) \ | 51 V(AbstractType) \ |
| 52 V(Type) \ | 52 V(Type) \ |
| 53 V(FunctionType) \ |
| 53 V(TypeRef) \ | 54 V(TypeRef) \ |
| 54 V(TypeParameter) \ | 55 V(TypeParameter) \ |
| 55 V(BoundedType) \ | 56 V(BoundedType) \ |
| 56 V(MixinAppType) \ | 57 V(MixinAppType) \ |
| 58 V(Closure) \ |
| 57 V(Number) \ | 59 V(Number) \ |
| 58 V(Integer) \ | 60 V(Integer) \ |
| 59 V(Smi) \ | 61 V(Smi) \ |
| 60 V(Mint) \ | 62 V(Mint) \ |
| 61 V(Bigint) \ | 63 V(Bigint) \ |
| 62 V(Double) \ | 64 V(Double) \ |
| 63 V(Bool) \ | 65 V(Bool) \ |
| 64 V(GrowableObjectArray) \ | 66 V(GrowableObjectArray) \ |
| 65 V(Float32x4) \ | 67 V(Float32x4) \ |
| 66 V(Int32x4) \ | 68 V(Int32x4) \ |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 #undef DEFINE_OBJECT_KIND | 140 #undef DEFINE_OBJECT_KIND |
| 139 | 141 |
| 140 #define DEFINE_OBJECT_KIND(clazz) \ | 142 #define DEFINE_OBJECT_KIND(clazz) \ |
| 141 kTypedData##clazz##Cid, | 143 kTypedData##clazz##Cid, |
| 142 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 144 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
| 143 #undef DEFINE_OBJECT_KIND | 145 #undef DEFINE_OBJECT_KIND |
| 144 | 146 |
| 145 #define DEFINE_OBJECT_KIND(clazz) \ | 147 #define DEFINE_OBJECT_KIND(clazz) \ |
| 146 kTypedData##clazz##ViewCid, | 148 kTypedData##clazz##ViewCid, |
| 147 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 149 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
| 150 #undef DEFINE_OBJECT_KIND |
| 151 |
| 148 kByteDataViewCid, | 152 kByteDataViewCid, |
| 149 #undef DEFINE_OBJECT_KIND | |
| 150 | 153 |
| 151 #define DEFINE_OBJECT_KIND(clazz) \ | 154 #define DEFINE_OBJECT_KIND(clazz) \ |
| 152 kExternalTypedData##clazz##Cid, | 155 kExternalTypedData##clazz##Cid, |
| 153 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 156 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
| 154 #undef DEFINE_OBJECT_KIND | 157 #undef DEFINE_OBJECT_KIND |
| 155 | 158 |
| 156 kByteBufferCid, | 159 kByteBufferCid, |
| 157 | 160 |
| 158 // The following entries do not describe a predefined class, but instead | 161 // The following entries do not describe a predefined class, but instead |
| 159 // are class indexes for pre-allocated instance (Null, dynamic and Void). | 162 // are class indexes for pre-allocated instance (Null, dynamic and Void). |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 #if defined(DEBUG) | 586 #if defined(DEBUG) |
| 584 static void ValidateOverwrittenPointer(RawObject* raw); | 587 static void ValidateOverwrittenPointer(RawObject* raw); |
| 585 static void ValidateOverwrittenSmi(RawSmi* raw); | 588 static void ValidateOverwrittenSmi(RawSmi* raw); |
| 586 #endif // DEBUG | 589 #endif // DEBUG |
| 587 | 590 |
| 588 friend class Api; | 591 friend class Api; |
| 589 friend class ApiMessageReader; // GetClassId | 592 friend class ApiMessageReader; // GetClassId |
| 590 friend class Array; | 593 friend class Array; |
| 591 friend class Bigint; | 594 friend class Bigint; |
| 592 friend class ByteBuffer; | 595 friend class ByteBuffer; |
| 596 friend class Closure; |
| 593 friend class Code; | 597 friend class Code; |
| 594 friend class Closure; | |
| 595 friend class Double; | 598 friend class Double; |
| 596 friend class FreeListElement; | 599 friend class FreeListElement; |
| 597 friend class Function; | 600 friend class Function; |
| 598 friend class GCMarker; | 601 friend class GCMarker; |
| 599 friend class ExternalTypedData; | 602 friend class ExternalTypedData; |
| 600 friend class ForwardList; | 603 friend class ForwardList; |
| 601 friend class GrowableObjectArray; // StorePointer | 604 friend class GrowableObjectArray; // StorePointer |
| 602 friend class Heap; | 605 friend class Heap; |
| 603 friend class HeapMapAsJSONVisitor; | 606 friend class HeapMapAsJSONVisitor; |
| 604 friend class ClassStatsVisitor; | 607 friend class ClassStatsVisitor; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 RawArray* functions_hash_table_; | 655 RawArray* functions_hash_table_; |
| 653 RawArray* fields_; | 656 RawArray* fields_; |
| 654 RawArray* offset_in_words_to_field_; | 657 RawArray* offset_in_words_to_field_; |
| 655 RawArray* interfaces_; // Array of AbstractType. | 658 RawArray* interfaces_; // Array of AbstractType. |
| 656 RawGrowableObjectArray* direct_subclasses_; // Array of Class. | 659 RawGrowableObjectArray* direct_subclasses_; // Array of Class. |
| 657 RawScript* script_; | 660 RawScript* script_; |
| 658 RawLibrary* library_; | 661 RawLibrary* library_; |
| 659 RawTypeArguments* type_parameters_; // Array of TypeParameter. | 662 RawTypeArguments* type_parameters_; // Array of TypeParameter. |
| 660 RawAbstractType* super_type_; | 663 RawAbstractType* super_type_; |
| 661 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. | 664 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. |
| 662 RawFunction* signature_function_; // Associated function for signature class. | 665 RawFunction* signature_function_; // Associated function for typedef class. |
| 663 RawArray* constants_; // Canonicalized values of this class. | 666 RawArray* constants_; // Canonicalized values of this class. |
| 664 RawObject* canonical_types_; // An array of canonicalized types of this class | 667 RawObject* canonical_types_; // An array of canonicalized types of this class |
| 665 // or the canonical type. | 668 // or the canonical type. |
| 666 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. | 669 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. |
| 667 RawArray* cha_codes_; // CHA optimized codes. | 670 RawArray* cha_codes_; // CHA optimized codes. |
| 668 RawCode* allocation_stub_; // Stub code for allocation of instances. | 671 RawCode* allocation_stub_; // Stub code for allocation of instances. |
| 669 RawObject** to() { | 672 RawObject** to() { |
| 670 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); | 673 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); |
| 671 } | 674 } |
| 672 | 675 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 826 |
| 824 class RawClosureData : public RawObject { | 827 class RawClosureData : public RawObject { |
| 825 private: | 828 private: |
| 826 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); | 829 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); |
| 827 | 830 |
| 828 RawObject** from() { | 831 RawObject** from() { |
| 829 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); | 832 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); |
| 830 } | 833 } |
| 831 RawContextScope* context_scope_; | 834 RawContextScope* context_scope_; |
| 832 RawFunction* parent_function_; // Enclosing function of this local function. | 835 RawFunction* parent_function_; // Enclosing function of this local function. |
| 833 RawClass* signature_class_; | 836 RawFunctionType* signature_type_; |
| 834 RawInstance* closure_; // Closure object for static implicit closures. | 837 RawInstance* closure_; // Closure object for static implicit closures. |
| 835 RawObject** to() { | 838 RawObject** to() { |
| 836 return reinterpret_cast<RawObject**>(&ptr()->closure_); | 839 return reinterpret_cast<RawObject**>(&ptr()->closure_); |
| 837 } | 840 } |
| 838 | 841 |
| 839 friend class Function; | 842 friend class Function; |
| 840 }; | 843 }; |
| 841 | 844 |
| 842 | 845 |
| 843 class RawRedirectionData : public RawObject { | 846 class RawRedirectionData : public RawObject { |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 RawTypeArguments* arguments_; | 1559 RawTypeArguments* arguments_; |
| 1557 RawLanguageError* error_; // Error object if type is malformed or malbounded. | 1560 RawLanguageError* error_; // Error object if type is malformed or malbounded. |
| 1558 RawObject** to() { | 1561 RawObject** to() { |
| 1559 return reinterpret_cast<RawObject**>(&ptr()->error_); | 1562 return reinterpret_cast<RawObject**>(&ptr()->error_); |
| 1560 } | 1563 } |
| 1561 int32_t token_pos_; | 1564 int32_t token_pos_; |
| 1562 int8_t type_state_; | 1565 int8_t type_state_; |
| 1563 }; | 1566 }; |
| 1564 | 1567 |
| 1565 | 1568 |
| 1569 class RawFunctionType : public RawAbstractType { |
| 1570 private: |
| 1571 RAW_HEAP_OBJECT_IMPLEMENTATION(FunctionType); |
| 1572 |
| 1573 RawObject** from() { |
| 1574 return reinterpret_cast<RawObject**>(&ptr()->scope_class_); |
| 1575 } |
| 1576 RawClass* scope_class_; |
| 1577 RawTypeArguments* arguments_; |
| 1578 RawFunction* signature_; |
| 1579 RawLanguageError* error_; // Error object if type is malformed or malbounded. |
| 1580 RawObject** to() { |
| 1581 return reinterpret_cast<RawObject**>(&ptr()->error_); |
| 1582 } |
| 1583 int32_t token_pos_; |
| 1584 int8_t type_state_; |
| 1585 }; |
| 1586 |
| 1587 |
| 1566 class RawTypeRef : public RawAbstractType { | 1588 class RawTypeRef : public RawAbstractType { |
| 1567 private: | 1589 private: |
| 1568 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); | 1590 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); |
| 1569 | 1591 |
| 1570 RawObject** from() { | 1592 RawObject** from() { |
| 1571 return reinterpret_cast<RawObject**>(&ptr()->type_); | 1593 return reinterpret_cast<RawObject**>(&ptr()->type_); |
| 1572 } | 1594 } |
| 1573 RawAbstractType* type_; // The referenced type. | 1595 RawAbstractType* type_; // The referenced type. |
| 1574 RawObject** to() { | 1596 RawObject** to() { |
| 1575 return reinterpret_cast<RawObject**>(&ptr()->type_); | 1597 return reinterpret_cast<RawObject**>(&ptr()->type_); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 return reinterpret_cast<RawObject**>(&ptr()->super_type_); | 1640 return reinterpret_cast<RawObject**>(&ptr()->super_type_); |
| 1619 } | 1641 } |
| 1620 RawAbstractType* super_type_; | 1642 RawAbstractType* super_type_; |
| 1621 RawArray* mixin_types_; // Array of AbstractType. | 1643 RawArray* mixin_types_; // Array of AbstractType. |
| 1622 RawObject** to() { | 1644 RawObject** to() { |
| 1623 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); | 1645 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); |
| 1624 } | 1646 } |
| 1625 }; | 1647 }; |
| 1626 | 1648 |
| 1627 | 1649 |
| 1650 class RawClosure : public RawInstance { |
| 1651 private: |
| 1652 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
| 1653 |
| 1654 RawObject** from() { |
| 1655 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
| 1656 } |
| 1657 |
| 1658 RawTypeArguments* type_arguments_; |
| 1659 RawFunction* function_; |
| 1660 RawContext* context_; |
| 1661 |
| 1662 RawObject** to() { |
| 1663 return reinterpret_cast<RawObject**>(&ptr()->context_); |
| 1664 } |
| 1665 }; |
| 1666 |
| 1667 |
| 1628 class RawNumber : public RawInstance { | 1668 class RawNumber : public RawInstance { |
| 1629 RAW_OBJECT_IMPLEMENTATION(Number); | 1669 RAW_OBJECT_IMPLEMENTATION(Number); |
| 1630 }; | 1670 }; |
| 1631 | 1671 |
| 1632 | 1672 |
| 1633 class RawInteger : public RawNumber { | 1673 class RawInteger : public RawNumber { |
| 1634 RAW_OBJECT_IMPLEMENTATION(Integer); | 1674 RAW_OBJECT_IMPLEMENTATION(Integer); |
| 1635 }; | 1675 }; |
| 1636 | 1676 |
| 1637 | 1677 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2310 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2271 kTypedDataInt8ArrayViewCid + 15); | 2311 kTypedDataInt8ArrayViewCid + 15); |
| 2272 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2312 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2273 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2313 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2274 return (kNullCid - kTypedDataInt8ArrayCid); | 2314 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2275 } | 2315 } |
| 2276 | 2316 |
| 2277 } // namespace dart | 2317 } // namespace dart |
| 2278 | 2318 |
| 2279 #endif // VM_RAW_OBJECT_H_ | 2319 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |