| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 static intptr_t super_type_offset() { | 760 static intptr_t super_type_offset() { |
| 761 return OFFSET_OF(RawClass, super_type_); | 761 return OFFSET_OF(RawClass, super_type_); |
| 762 } | 762 } |
| 763 | 763 |
| 764 // Asserts that the class of the super type has been resolved. | 764 // Asserts that the class of the super type has been resolved. |
| 765 RawClass* SuperClass() const; | 765 RawClass* SuperClass() const; |
| 766 | 766 |
| 767 RawType* mixin() const { return raw_ptr()->mixin_; } | 767 RawType* mixin() const { return raw_ptr()->mixin_; } |
| 768 void set_mixin(const Type& value) const; | 768 void set_mixin(const Type& value) const; |
| 769 | 769 |
| 770 bool IsMixinApplication() const; |
| 771 |
| 770 RawClass* patch_class() const { | 772 RawClass* patch_class() const { |
| 771 return raw_ptr()->patch_class_; | 773 return raw_ptr()->patch_class_; |
| 772 } | 774 } |
| 773 void set_patch_class(const Class& patch_class) const; | 775 void set_patch_class(const Class& patch_class) const; |
| 774 | 776 |
| 775 // Interfaces is an array of Types. | 777 // Interfaces is an array of Types. |
| 776 RawArray* interfaces() const { return raw_ptr()->interfaces_; } | 778 RawArray* interfaces() const { return raw_ptr()->interfaces_; } |
| 777 void set_interfaces(const Array& value) const; | 779 void set_interfaces(const Array& value) const; |
| 778 static intptr_t interfaces_offset() { | 780 static intptr_t interfaces_offset() { |
| 779 return OFFSET_OF(RawClass, interfaces_); | 781 return OFFSET_OF(RawClass, interfaces_); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 return PatchBit::decode(raw_ptr()->state_bits_); | 898 return PatchBit::decode(raw_ptr()->state_bits_); |
| 897 } | 899 } |
| 898 void set_is_patch() const; | 900 void set_is_patch() const; |
| 899 | 901 |
| 900 bool is_synthesized_class() const { | 902 bool is_synthesized_class() const { |
| 901 return SynthesizedClassBit::decode(raw_ptr()->state_bits_); | 903 return SynthesizedClassBit::decode(raw_ptr()->state_bits_); |
| 902 } | 904 } |
| 903 void set_is_synthesized_class() const; | 905 void set_is_synthesized_class() const; |
| 904 | 906 |
| 905 bool is_finalized() const { | 907 bool is_finalized() const { |
| 906 return StateBits::decode(raw_ptr()->state_bits_) == RawClass::kFinalized; | 908 return ClassFinalizedBits::decode(raw_ptr()->state_bits_) |
| 909 == RawClass::kFinalized; |
| 907 } | 910 } |
| 908 void set_is_finalized() const; | 911 void set_is_finalized() const; |
| 909 | 912 |
| 910 bool is_prefinalized() const { | 913 bool is_prefinalized() const { |
| 911 return StateBits::decode(raw_ptr()->state_bits_) == RawClass::kPreFinalized; | 914 return ClassFinalizedBits::decode(raw_ptr()->state_bits_) |
| 915 == RawClass::kPreFinalized; |
| 912 } | 916 } |
| 913 | 917 |
| 914 void set_is_prefinalized() const; | 918 void set_is_prefinalized() const; |
| 915 | 919 |
| 916 bool is_marked_for_parsing() const { | 920 bool is_marked_for_parsing() const { |
| 917 return MarkedForParsingBit::decode(raw_ptr()->state_bits_); | 921 return MarkedForParsingBit::decode(raw_ptr()->state_bits_); |
| 918 } | 922 } |
| 919 void set_is_marked_for_parsing() const; | 923 void set_is_marked_for_parsing() const; |
| 920 void reset_is_marked_for_parsing() const; | 924 void reset_is_marked_for_parsing() const; |
| 921 | 925 |
| 922 bool is_const() const { return ConstBit::decode(raw_ptr()->state_bits_); } | 926 bool is_const() const { return ConstBit::decode(raw_ptr()->state_bits_); } |
| 923 void set_is_const() const; | 927 void set_is_const() const; |
| 924 | 928 |
| 925 bool is_mixin_typedef() const { | 929 bool is_mixin_typedef() const { |
| 926 return MixinTypedefBit::decode(raw_ptr()->state_bits_); | 930 return MixinTypedefBit::decode(raw_ptr()->state_bits_); |
| 927 } | 931 } |
| 928 void set_is_mixin_typedef() const; | 932 void set_is_mixin_typedef() const; |
| 929 | 933 |
| 934 bool is_mixin_type_applied() const { |
| 935 return MixinTypeAppliedBit::decode(raw_ptr()->state_bits_); |
| 936 } |
| 937 void set_is_mixin_type_applied() const; |
| 938 |
| 930 int num_native_fields() const { | 939 int num_native_fields() const { |
| 931 return raw_ptr()->num_native_fields_; | 940 return raw_ptr()->num_native_fields_; |
| 932 } | 941 } |
| 933 void set_num_native_fields(int value) const { | 942 void set_num_native_fields(int value) const { |
| 934 raw_ptr()->num_native_fields_ = value; | 943 raw_ptr()->num_native_fields_ = value; |
| 935 } | 944 } |
| 936 static intptr_t num_native_fields_offset() { | 945 static intptr_t num_native_fields_offset() { |
| 937 return OFFSET_OF(RawClass, num_native_fields_); | 946 return OFFSET_OF(RawClass, num_native_fields_); |
| 938 } | 947 } |
| 939 | 948 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 kConstructor, | 1021 kConstructor, |
| 1013 kFactory, | 1022 kFactory, |
| 1014 }; | 1023 }; |
| 1015 enum { | 1024 enum { |
| 1016 kConstBit = 0, | 1025 kConstBit = 0, |
| 1017 kImplementedBit = 1, | 1026 kImplementedBit = 1, |
| 1018 kAbstractBit = 2, | 1027 kAbstractBit = 2, |
| 1019 kPatchBit = 3, | 1028 kPatchBit = 3, |
| 1020 kSynthesizedClassBit = 4, | 1029 kSynthesizedClassBit = 4, |
| 1021 kTypeFinalizedBit = 5, | 1030 kTypeFinalizedBit = 5, |
| 1022 kStateTagBit = 6, | 1031 kClassFinalizedBits = 6, |
| 1023 kStateTagSize = 2, | 1032 kClassFinalizedSize = 2, |
| 1024 kMarkedForParsingBit = 8, | 1033 kMarkedForParsingBit = 8, |
| 1025 kMixinTypedefBit = 9, | 1034 kMixinTypedefBit = 9, |
| 1035 kMixinTypeAppliedBit = 10, |
| 1026 }; | 1036 }; |
| 1027 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 1037 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
| 1028 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; | 1038 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; |
| 1029 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 1039 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
| 1030 class PatchBit : public BitField<bool, kPatchBit, 1> {}; | 1040 class PatchBit : public BitField<bool, kPatchBit, 1> {}; |
| 1031 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; | 1041 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; |
| 1032 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; | 1042 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; |
| 1033 class StateBits : public BitField<RawClass::ClassState, | 1043 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, |
| 1034 kStateTagBit, kStateTagSize> {}; // NOLINT | 1044 kClassFinalizedBits, kClassFinalizedSize> {}; // NOLINT |
| 1035 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; | 1045 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; |
| 1036 class MixinTypedefBit : public BitField<bool, kMixinTypedefBit, 1> {}; | 1046 class MixinTypedefBit : public BitField<bool, kMixinTypedefBit, 1> {}; |
| 1047 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; |
| 1037 | 1048 |
| 1038 void set_name(const String& value) const; | 1049 void set_name(const String& value) const; |
| 1039 void set_signature_function(const Function& value) const; | 1050 void set_signature_function(const Function& value) const; |
| 1040 void set_signature_type(const AbstractType& value) const; | 1051 void set_signature_type(const AbstractType& value) const; |
| 1041 void set_class_state(RawClass::ClassState state) const; | |
| 1042 void set_state_bits(intptr_t bits) const; | 1052 void set_state_bits(intptr_t bits) const; |
| 1043 | 1053 |
| 1044 void set_constants(const Array& value) const; | 1054 void set_constants(const Array& value) const; |
| 1045 | 1055 |
| 1046 void set_canonical_types(const Array& value) const; | 1056 void set_canonical_types(const Array& value) const; |
| 1047 RawArray* canonical_types() const; | 1057 RawArray* canonical_types() const; |
| 1048 | 1058 |
| 1049 RawArray* invocation_dispatcher_cache() const; | 1059 RawArray* invocation_dispatcher_cache() const; |
| 1050 void set_invocation_dispatcher_cache(const Array& cache) const; | 1060 void set_invocation_dispatcher_cache(const Array& cache) const; |
| 1051 RawFunction* CreateInvocationDispatcher(const String& target_name, | 1061 RawFunction* CreateInvocationDispatcher(const String& target_name, |
| (...skipping 5100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6152 | 6162 |
| 6153 | 6163 |
| 6154 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6164 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6155 intptr_t index) { | 6165 intptr_t index) { |
| 6156 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6166 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6157 } | 6167 } |
| 6158 | 6168 |
| 6159 } // namespace dart | 6169 } // namespace dart |
| 6160 | 6170 |
| 6161 #endif // VM_OBJECT_H_ | 6171 #endif // VM_OBJECT_H_ |
| OLD | NEW |