| 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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 // TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class, | 1110 // TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class, |
| 1111 // leaf method, ...). | 1111 // leaf method, ...). |
| 1112 void RegisterCHACode(const Code& code); | 1112 void RegisterCHACode(const Code& code); |
| 1113 | 1113 |
| 1114 void DisableCHAOptimizedCode(); | 1114 void DisableCHAOptimizedCode(); |
| 1115 | 1115 |
| 1116 RawArray* cha_codes() const { return raw_ptr()->cha_codes_; } | 1116 RawArray* cha_codes() const { return raw_ptr()->cha_codes_; } |
| 1117 void set_cha_codes(const Array& value) const; | 1117 void set_cha_codes(const Array& value) const; |
| 1118 | 1118 |
| 1119 private: | 1119 private: |
| 1120 enum { | 1120 enum MemberKind { |
| 1121 kAny = 0, | 1121 kAny = 0, |
| 1122 kStatic, | 1122 kStatic, |
| 1123 kInstance, | 1123 kInstance, |
| 1124 kConstructor, | 1124 kConstructor, |
| 1125 kFactory, | 1125 kFactory, |
| 1126 }; | 1126 }; |
| 1127 enum { | 1127 enum StateBits { |
| 1128 kConstBit = 0, | 1128 kConstBit = 0, |
| 1129 kImplementedBit = 1, | 1129 kImplementedBit = 1, |
| 1130 kTypeFinalizedBit = 2, | 1130 kTypeFinalizedBit = 2, |
| 1131 kClassFinalizedBits = 3, | 1131 kClassFinalizedPos = 3, |
| 1132 kClassFinalizedSize = 2, | 1132 kClassFinalizedSize = 2, |
| 1133 kAbstractBit = 5, | 1133 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5 |
| 1134 kPatchBit = 6, | 1134 kPatchBit = 6, |
| 1135 kSynthesizedClassBit = 7, | 1135 kSynthesizedClassBit = 7, |
| 1136 kMarkedForParsingBit = 8, | 1136 kMarkedForParsingBit = 8, |
| 1137 kMixinAppAliasBit = 9, | 1137 kMixinAppAliasBit = 9, |
| 1138 kMixinTypeAppliedBit = 10, | 1138 kMixinTypeAppliedBit = 10, |
| 1139 kFieldsMarkedNullableBit = 11, | 1139 kFieldsMarkedNullableBit = 11, |
| 1140 kCycleFreeBit = 12, | 1140 kCycleFreeBit = 12, |
| 1141 }; | 1141 }; |
| 1142 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 1142 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
| 1143 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; | 1143 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; |
| 1144 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; | 1144 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; |
| 1145 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, | 1145 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, |
| 1146 kClassFinalizedBits, kClassFinalizedSize> {}; // NOLINT | 1146 kClassFinalizedPos, kClassFinalizedSize> {}; // NOLINT |
| 1147 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 1147 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
| 1148 class PatchBit : public BitField<bool, kPatchBit, 1> {}; | 1148 class PatchBit : public BitField<bool, kPatchBit, 1> {}; |
| 1149 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; | 1149 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; |
| 1150 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; | 1150 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; |
| 1151 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {}; | 1151 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {}; |
| 1152 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; | 1152 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; |
| 1153 class FieldsMarkedNullableBit : public BitField<bool, | 1153 class FieldsMarkedNullableBit : public BitField<bool, |
| 1154 kFieldsMarkedNullableBit, 1> {}; // NOLINT | 1154 kFieldsMarkedNullableBit, 1> {}; // NOLINT |
| 1155 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {}; | 1155 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {}; |
| 1156 | 1156 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1183 void set_num_type_arguments(intptr_t value) const; | 1183 void set_num_type_arguments(intptr_t value) const; |
| 1184 | 1184 |
| 1185 int16_t num_own_type_arguments() const { | 1185 int16_t num_own_type_arguments() const { |
| 1186 return raw_ptr()->num_own_type_arguments_; | 1186 return raw_ptr()->num_own_type_arguments_; |
| 1187 } | 1187 } |
| 1188 void set_num_own_type_arguments(intptr_t value) const; | 1188 void set_num_own_type_arguments(intptr_t value) const; |
| 1189 | 1189 |
| 1190 // Assigns empty array to all raw class array fields. | 1190 // Assigns empty array to all raw class array fields. |
| 1191 void InitEmptyFields(); | 1191 void InitEmptyFields(); |
| 1192 | 1192 |
| 1193 static RawFunction* CheckFunctionType(const Function& func, intptr_t type); | 1193 static RawFunction* CheckFunctionType(const Function& func, MemberKind kind); |
| 1194 RawFunction* LookupFunction(const String& name, intptr_t type) const; | 1194 RawFunction* LookupFunction(const String& name, MemberKind kind) const; |
| 1195 RawFunction* LookupFunctionAllowPrivate(const String& name, | 1195 RawFunction* LookupFunctionAllowPrivate(const String& name, |
| 1196 intptr_t type) const; | 1196 MemberKind kind) const; |
| 1197 RawField* LookupField(const String& name, intptr_t type) const; | 1197 RawField* LookupField(const String& name, MemberKind kind) const; |
| 1198 | 1198 |
| 1199 RawFunction* LookupAccessorFunction(const char* prefix, | 1199 RawFunction* LookupAccessorFunction(const char* prefix, |
| 1200 intptr_t prefix_length, | 1200 intptr_t prefix_length, |
| 1201 const String& name) const; | 1201 const String& name) const; |
| 1202 | 1202 |
| 1203 // Allocate an instance class which has a VM implementation. | 1203 // Allocate an instance class which has a VM implementation. |
| 1204 template <class FakeInstance> static RawClass* New(intptr_t id); | 1204 template <class FakeInstance> static RawClass* New(intptr_t id); |
| 1205 | 1205 |
| 1206 // Check the subtype or 'more specific' relationship. | 1206 // Check the subtype or 'more specific' relationship. |
| 1207 bool TypeTest(TypeTestKind test_kind, | 1207 bool TypeTest(TypeTestKind test_kind, |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 | 1939 |
| 1940 // Return false and report an error if the fingerprint does not match. | 1940 // Return false and report an error if the fingerprint does not match. |
| 1941 bool CheckSourceFingerprint(int32_t fp) const; | 1941 bool CheckSourceFingerprint(int32_t fp) const; |
| 1942 | 1942 |
| 1943 static const int kCtorPhaseInit = 1 << 0; | 1943 static const int kCtorPhaseInit = 1 << 0; |
| 1944 static const int kCtorPhaseBody = 1 << 1; | 1944 static const int kCtorPhaseBody = 1 << 1; |
| 1945 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); | 1945 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); |
| 1946 | 1946 |
| 1947 private: | 1947 private: |
| 1948 enum KindTagBits { | 1948 enum KindTagBits { |
| 1949 kKindTagBit = 0, | 1949 kKindTagPos = 0, |
| 1950 kKindTagSize = 4, | 1950 kKindTagSize = 4, |
| 1951 kStaticBit = 4, | 1951 kStaticBit = kKindTagPos + kKindTagSize, // = 4 |
| 1952 kConstBit = 5, | 1952 kConstBit = 5, |
| 1953 kAbstractBit = 6, | 1953 kAbstractBit = 6, |
| 1954 kVisibleBit = 7, | 1954 kVisibleBit = 7, |
| 1955 kOptimizableBit = 8, | 1955 kOptimizableBit = 8, |
| 1956 kInlinableBit = 9, | 1956 kInlinableBit = 9, |
| 1957 kIntrinsicBit = 10, | 1957 kIntrinsicBit = 10, |
| 1958 kRecognizedBit = 11, | 1958 kRecognizedBit = 11, |
| 1959 kNativeBit = 12, | 1959 kNativeBit = 12, |
| 1960 kRedirectingBit = 13, | 1960 kRedirectingBit = 13, |
| 1961 kExternalBit = 14, | 1961 kExternalBit = 14, |
| 1962 kAllowsHoistingCheckClassBit = 15, | 1962 kAllowsHoistingCheckClassBit = 15, |
| 1963 }; | 1963 }; |
| 1964 class KindBits : | 1964 class KindBits : |
| 1965 public BitField<RawFunction::Kind, kKindTagBit, kKindTagSize> {}; // NOLINT | 1965 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT |
| 1966 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | 1966 class StaticBit : public BitField<bool, kStaticBit, 1> {}; |
| 1967 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 1967 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
| 1968 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 1968 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
| 1969 class VisibleBit : public BitField<bool, kVisibleBit, 1> {}; | 1969 class VisibleBit : public BitField<bool, kVisibleBit, 1> {}; |
| 1970 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; | 1970 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; |
| 1971 class InlinableBit : public BitField<bool, kInlinableBit, 1> {}; | 1971 class InlinableBit : public BitField<bool, kInlinableBit, 1> {}; |
| 1972 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {}; | 1972 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {}; |
| 1973 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {}; | 1973 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {}; |
| 1974 class NativeBit : public BitField<bool, kNativeBit, 1> {}; | 1974 class NativeBit : public BitField<bool, kNativeBit, 1> {}; |
| 1975 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; | 1975 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; |
| (...skipping 5000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6976 | 6976 |
| 6977 | 6977 |
| 6978 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6978 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6979 intptr_t index) { | 6979 intptr_t index) { |
| 6980 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6980 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6981 } | 6981 } |
| 6982 | 6982 |
| 6983 } // namespace dart | 6983 } // namespace dart |
| 6984 | 6984 |
| 6985 #endif // VM_OBJECT_H_ | 6985 #endif // VM_OBJECT_H_ |
| OLD | NEW |