Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: runtime/vm/object.h

Issue 12529008: Collect type feedback for fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ensure that not-null constraints are recomputed correctly Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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) {
srdjan 2013/03/18 18:54:35 Add ()
Vyacheslav Egorov (Google) 2013/03/18 19:41:18 Killed this accessor. It has confusing name (confl
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
srdjan 2013/03/18 18:54:35 Remove one line.
Vyacheslav Egorov (Google) 2013/03/18 19:41:18 Done.
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 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4643 4676
4644 4677
4645 class Array : public Instance { 4678 class Array : public Instance {
4646 public: 4679 public:
4647 intptr_t Length() const { 4680 intptr_t Length() const {
4648 ASSERT(!IsNull()); 4681 ASSERT(!IsNull());
4649 return Smi::Value(raw_ptr()->length_); 4682 return Smi::Value(raw_ptr()->length_);
4650 } 4683 }
4651 static intptr_t length_offset() { return OFFSET_OF(RawArray, length_); } 4684 static intptr_t length_offset() { return OFFSET_OF(RawArray, length_); }
4652 static intptr_t data_offset() { return length_offset() + kWordSize; } 4685 static intptr_t data_offset() { return length_offset() + kWordSize; }
4686 static intptr_t element_offset(intptr_t index) {
4687 return data_offset() + kWordSize * index;
4688 }
4653 4689
4654 RawObject* At(intptr_t index) const { 4690 RawObject* At(intptr_t index) const {
4655 return *ObjectAddr(index); 4691 return *ObjectAddr(index);
4656 } 4692 }
4657 void SetAt(intptr_t index, const Object& value) const { 4693 void SetAt(intptr_t index, const Object& value) const {
4658 // TODO(iposva): Add storing NoGCScope. 4694 // TODO(iposva): Add storing NoGCScope.
4659 StorePointer(ObjectAddr(index), value.raw()); 4695 StorePointer(ObjectAddr(index), value.raw());
4660 } 4696 }
4661 4697
4662 virtual RawAbstractTypeArguments* GetTypeArguments() const { 4698 virtual RawAbstractTypeArguments* GetTypeArguments() const {
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after
6824 6860
6825 6861
6826 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6862 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6827 intptr_t index) { 6863 intptr_t index) {
6828 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6864 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6829 } 6865 }
6830 6866
6831 } // namespace dart 6867 } // namespace dart
6832 6868
6833 #endif // VM_OBJECT_H_ 6869 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698