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 2796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2807 class Field : public Object { | 2807 class Field : public Object { |
2808 public: | 2808 public: |
2809 RawString* name() const { return raw_ptr()->name_; } | 2809 RawString* name() const { return raw_ptr()->name_; } |
2810 RawString* PrettyName() const; | 2810 RawString* PrettyName() const; |
2811 RawString* UserVisibleName() const; | 2811 RawString* UserVisibleName() const; |
2812 virtual RawString* DictionaryName() const { return name(); } | 2812 virtual RawString* DictionaryName() const { return name(); } |
2813 | 2813 |
2814 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } | 2814 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } |
2815 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } | 2815 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } |
2816 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } | 2816 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } |
2817 bool is_synthetic() const { | 2817 bool is_reflectable() const { |
2818 return SyntheticBit::decode(raw_ptr()->kind_bits_); | 2818 return ReflectableBit::decode(raw_ptr()->kind_bits_); |
2819 } | 2819 } |
2820 | 2820 |
2821 inline intptr_t Offset() const; | 2821 inline intptr_t Offset() const; |
2822 inline void SetOffset(intptr_t value_in_bytes) const; | 2822 inline void SetOffset(intptr_t value_in_bytes) const; |
2823 | 2823 |
2824 RawInstance* value() const; | 2824 RawInstance* value() const; |
2825 void set_value(const Instance& value) const; | 2825 void set_value(const Instance& value) const; |
2826 | 2826 |
2827 RawClass* owner() const; | 2827 RawClass* owner() const; |
2828 RawClass* origin() const; // Either mixin class, or same as owner(). | 2828 RawClass* origin() const; // Either mixin class, or same as owner(). |
2829 | 2829 |
2830 RawAbstractType* type() const { return raw_ptr()->type_; } | 2830 RawAbstractType* type() const { return raw_ptr()->type_; } |
2831 void set_type(const AbstractType& value) const; | 2831 void set_type(const AbstractType& value) const; |
2832 | 2832 |
2833 static intptr_t InstanceSize() { | 2833 static intptr_t InstanceSize() { |
2834 return RoundedAllocationSize(sizeof(RawField)); | 2834 return RoundedAllocationSize(sizeof(RawField)); |
2835 } | 2835 } |
2836 | 2836 |
2837 static RawField* New(const String& name, | 2837 static RawField* New(const String& name, |
2838 bool is_static, | 2838 bool is_static, |
2839 bool is_final, | 2839 bool is_final, |
2840 bool is_const, | 2840 bool is_const, |
2841 bool is_synthetic, | 2841 bool is_reflectable, |
2842 const Class& owner, | 2842 const Class& owner, |
2843 intptr_t token_pos); | 2843 intptr_t token_pos); |
2844 | 2844 |
2845 // Allocate new field object, clone values from this field. The | 2845 // Allocate new field object, clone values from this field. The |
2846 // owner of the clone is new_owner. | 2846 // owner of the clone is new_owner. |
2847 RawField* Clone(const Class& new_owner) const; | 2847 RawField* Clone(const Class& new_owner) const; |
2848 | 2848 |
2849 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } | 2849 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } |
2850 | 2850 |
2851 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } | 2851 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 | 2980 |
2981 private: | 2981 private: |
2982 friend class StoreInstanceFieldInstr; // Generated code access to bit field. | 2982 friend class StoreInstanceFieldInstr; // Generated code access to bit field. |
2983 | 2983 |
2984 enum { | 2984 enum { |
2985 kConstBit = 0, | 2985 kConstBit = 0, |
2986 kStaticBit, | 2986 kStaticBit, |
2987 kFinalBit, | 2987 kFinalBit, |
2988 kHasInitializerBit, | 2988 kHasInitializerBit, |
2989 kUnboxingCandidateBit, | 2989 kUnboxingCandidateBit, |
2990 kSyntheticBit | 2990 kReflectableBit |
2991 }; | 2991 }; |
2992 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 2992 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
2993 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | 2993 class StaticBit : public BitField<bool, kStaticBit, 1> {}; |
2994 class FinalBit : public BitField<bool, kFinalBit, 1> {}; | 2994 class FinalBit : public BitField<bool, kFinalBit, 1> {}; |
2995 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; | 2995 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; |
2996 class UnboxingCandidateBit : public BitField<bool, | 2996 class UnboxingCandidateBit : public BitField<bool, |
2997 kUnboxingCandidateBit, 1> { | 2997 kUnboxingCandidateBit, 1> { |
2998 }; | 2998 }; |
2999 class SyntheticBit : public BitField<bool, kSyntheticBit, 1> {}; | 2999 class ReflectableBit : public BitField<bool, kReflectableBit, 1> {}; |
3000 | 3000 |
3001 // Update guarded cid and guarded length for this field. Returns true, if | 3001 // Update guarded cid and guarded length for this field. Returns true, if |
3002 // deoptimization of dependent code is required. | 3002 // deoptimization of dependent code is required. |
3003 bool UpdateGuardedCidAndLength(const Object& value) const; | 3003 bool UpdateGuardedCidAndLength(const Object& value) const; |
3004 | 3004 |
3005 void set_name(const String& value) const; | 3005 void set_name(const String& value) const; |
3006 void set_is_static(bool is_static) const { | 3006 void set_is_static(bool is_static) const { |
3007 set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_)); | 3007 set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_)); |
3008 } | 3008 } |
3009 void set_is_final(bool is_final) const { | 3009 void set_is_final(bool is_final) const { |
3010 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_)); | 3010 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_)); |
3011 } | 3011 } |
3012 void set_is_const(bool value) const { | 3012 void set_is_const(bool value) const { |
3013 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); | 3013 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); |
3014 } | 3014 } |
3015 void set_is_synthetic(bool value) const { | 3015 void set_is_reflectable(bool value) const { |
3016 set_kind_bits(SyntheticBit::update(value, raw_ptr()->kind_bits_)); | 3016 set_kind_bits(ReflectableBit::update(value, raw_ptr()->kind_bits_)); |
3017 } | 3017 } |
3018 void set_owner(const Object& value) const { | 3018 void set_owner(const Object& value) const { |
3019 StorePointer(&raw_ptr()->owner_, value.raw()); | 3019 StorePointer(&raw_ptr()->owner_, value.raw()); |
3020 } | 3020 } |
3021 void set_token_pos(intptr_t token_pos) const { | 3021 void set_token_pos(intptr_t token_pos) const { |
3022 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); | 3022 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); |
3023 } | 3023 } |
3024 void set_kind_bits(intptr_t value) const { | 3024 void set_kind_bits(intptr_t value) const { |
3025 StoreNonPointer(&raw_ptr()->kind_bits_, static_cast<uint8_t>(value)); | 3025 StoreNonPointer(&raw_ptr()->kind_bits_, static_cast<uint8_t>(value)); |
3026 } | 3026 } |
(...skipping 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8031 | 8031 |
8032 | 8032 |
8033 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8033 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8034 intptr_t index) { | 8034 intptr_t index) { |
8035 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8035 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8036 } | 8036 } |
8037 | 8037 |
8038 } // namespace dart | 8038 } // namespace dart |
8039 | 8039 |
8040 #endif // VM_OBJECT_H_ | 8040 #endif // VM_OBJECT_H_ |
OLD | NEW |