| 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 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 1768 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 1769 | 1769 |
| 1770 bool has_initializer() const { | 1770 bool has_initializer() const { |
| 1771 return HasInitializerBit::decode(raw_ptr()->kind_bits_); | 1771 return HasInitializerBit::decode(raw_ptr()->kind_bits_); |
| 1772 } | 1772 } |
| 1773 void set_has_initializer(bool has_initializer) const { | 1773 void set_has_initializer(bool has_initializer) const { |
| 1774 set_kind_bits(HasInitializerBit::update(has_initializer, | 1774 set_kind_bits(HasInitializerBit::update(has_initializer, |
| 1775 raw_ptr()->kind_bits_)); | 1775 raw_ptr()->kind_bits_)); |
| 1776 } | 1776 } |
| 1777 | 1777 |
| 1778 intptr_t GuardedCid() const { |
| 1779 if (is_nullable() && guarded_cid() != kNullCid) { |
| 1780 return kDynamicCid; |
| 1781 } |
| 1782 return raw_ptr()->guarded_cid_; |
| 1783 } |
| 1784 |
| 1785 intptr_t guarded_cid() const { return raw_ptr()->guarded_cid_; } |
| 1786 void set_guarded_cid(intptr_t cid) const { |
| 1787 raw_ptr()->guarded_cid_ = cid; |
| 1788 } |
| 1789 static intptr_t guarded_cid_offset() { |
| 1790 return OFFSET_OF(RawField, guarded_cid_); |
| 1791 } |
| 1792 |
| 1793 bool is_nullable() const { |
| 1794 return raw_ptr()->is_nullable_ == kNullCid; |
| 1795 } |
| 1796 void set_is_nullable(bool val) const { |
| 1797 raw_ptr()->is_nullable_ = val ? kNullCid : kIllegalCid; |
| 1798 } |
| 1799 static intptr_t is_nullable_offset() { |
| 1800 return OFFSET_OF(RawField, is_nullable_); |
| 1801 } |
| 1802 |
| 1803 RawArray* dependent_code() const; |
| 1804 void set_dependent_code(const Array& array) const; |
| 1805 void RegisterDependentCode(const Code& code) const; |
| 1806 void UnregisterDependentCode(const Code& code) const; |
| 1807 void DeoptimizeDependentCode() const; |
| 1808 void UpdateCid(intptr_t cid) const; |
| 1809 |
| 1810 |
| 1778 // Constructs getter and setter names for fields and vice versa. | 1811 // Constructs getter and setter names for fields and vice versa. |
| 1779 static RawString* GetterName(const String& field_name); | 1812 static RawString* GetterName(const String& field_name); |
| 1780 static RawString* GetterSymbol(const String& field_name); | 1813 static RawString* GetterSymbol(const String& field_name); |
| 1781 static RawString* SetterName(const String& field_name); | 1814 static RawString* SetterName(const String& field_name); |
| 1782 static RawString* SetterSymbol(const String& field_name); | 1815 static RawString* SetterSymbol(const String& field_name); |
| 1783 static RawString* NameFromGetter(const String& getter_name); | 1816 static RawString* NameFromGetter(const String& getter_name); |
| 1784 static RawString* NameFromSetter(const String& setter_name); | 1817 static RawString* NameFromSetter(const String& setter_name); |
| 1785 static bool IsGetterName(const String& function_name); | 1818 static bool IsGetterName(const String& function_name); |
| 1786 static bool IsSetterName(const String& function_name); | 1819 static bool IsSetterName(const String& function_name); |
| 1787 | 1820 |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2779 const GrowableObjectArray& ic_data_objs) const; | 2812 const GrowableObjectArray& ic_data_objs) const; |
| 2780 | 2813 |
| 2781 // Returns an array indexed by deopt id, containing the extracted ICData. | 2814 // Returns an array indexed by deopt id, containing the extracted ICData. |
| 2782 RawArray* ExtractTypeFeedbackArray() const; | 2815 RawArray* ExtractTypeFeedbackArray() const; |
| 2783 | 2816 |
| 2784 // Returns deopt-ids of all static calls that were never resolved, i.e., | 2817 // Returns deopt-ids of all static calls that were never resolved, i.e., |
| 2785 // never executed. | 2818 // never executed. |
| 2786 void ExtractUncalledStaticCallDeoptIds( | 2819 void ExtractUncalledStaticCallDeoptIds( |
| 2787 GrowableArray<intptr_t>* deopt_ids) const; | 2820 GrowableArray<intptr_t>* deopt_ids) const; |
| 2788 | 2821 |
| 2822 RawArray* guarded_fields() const; |
| 2823 void set_guarded_fields(const Array& guarded_fields) const; |
| 2824 |
| 2789 private: | 2825 private: |
| 2790 // An object finder visitor interface. | 2826 // An object finder visitor interface. |
| 2791 class FindRawCodeVisitor : public FindObjectVisitor { | 2827 class FindRawCodeVisitor : public FindObjectVisitor { |
| 2792 public: | 2828 public: |
| 2793 explicit FindRawCodeVisitor(uword pc) | 2829 explicit FindRawCodeVisitor(uword pc) |
| 2794 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } | 2830 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } |
| 2795 virtual ~FindRawCodeVisitor() { } | 2831 virtual ~FindRawCodeVisitor() { } |
| 2796 | 2832 |
| 2797 // Check if object matches find condition. | 2833 // Check if object matches find condition. |
| 2798 virtual bool FindObject(RawObject* obj); | 2834 virtual bool FindObject(RawObject* obj); |
| (...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4643 | 4679 |
| 4644 | 4680 |
| 4645 class Array : public Instance { | 4681 class Array : public Instance { |
| 4646 public: | 4682 public: |
| 4647 intptr_t Length() const { | 4683 intptr_t Length() const { |
| 4648 ASSERT(!IsNull()); | 4684 ASSERT(!IsNull()); |
| 4649 return Smi::Value(raw_ptr()->length_); | 4685 return Smi::Value(raw_ptr()->length_); |
| 4650 } | 4686 } |
| 4651 static intptr_t length_offset() { return OFFSET_OF(RawArray, length_); } | 4687 static intptr_t length_offset() { return OFFSET_OF(RawArray, length_); } |
| 4652 static intptr_t data_offset() { return length_offset() + kWordSize; } | 4688 static intptr_t data_offset() { return length_offset() + kWordSize; } |
| 4689 static intptr_t element_offset(intptr_t index) { |
| 4690 return data_offset() + kWordSize * index; |
| 4691 } |
| 4653 | 4692 |
| 4654 RawObject* At(intptr_t index) const { | 4693 RawObject* At(intptr_t index) const { |
| 4655 return *ObjectAddr(index); | 4694 return *ObjectAddr(index); |
| 4656 } | 4695 } |
| 4657 void SetAt(intptr_t index, const Object& value) const { | 4696 void SetAt(intptr_t index, const Object& value) const { |
| 4658 // TODO(iposva): Add storing NoGCScope. | 4697 // TODO(iposva): Add storing NoGCScope. |
| 4659 StorePointer(ObjectAddr(index), value.raw()); | 4698 StorePointer(ObjectAddr(index), value.raw()); |
| 4660 } | 4699 } |
| 4661 | 4700 |
| 4662 virtual RawAbstractTypeArguments* GetTypeArguments() const { | 4701 virtual RawAbstractTypeArguments* GetTypeArguments() const { |
| (...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6824 | 6863 |
| 6825 | 6864 |
| 6826 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6865 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6827 intptr_t index) { | 6866 intptr_t index) { |
| 6828 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6867 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6829 } | 6868 } |
| 6830 | 6869 |
| 6831 } // namespace dart | 6870 } // namespace dart |
| 6832 | 6871 |
| 6833 #endif // VM_OBJECT_H_ | 6872 #endif // VM_OBJECT_H_ |
| OLD | NEW |