| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 9708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9719 kValueOffset + kPointerSize, | 9719 kValueOffset + kPointerSize, |
| 9720 kSize> BodyDescriptor; | 9720 kSize> BodyDescriptor; |
| 9721 | 9721 |
| 9722 private: | 9722 private: |
| 9723 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); | 9723 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); |
| 9724 }; | 9724 }; |
| 9725 | 9725 |
| 9726 | 9726 |
| 9727 class PropertyCell: public Cell { | 9727 class PropertyCell: public Cell { |
| 9728 public: | 9728 public: |
| 9729 // [type]: type of the global property. | |
| 9730 HeapType* type(); | |
| 9731 void set_type(HeapType* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | |
| 9732 | |
| 9733 // [dependent_code]: dependent code that depends on the type of the global | 9729 // [dependent_code]: dependent code that depends on the type of the global |
| 9734 // property. | 9730 // property. |
| 9735 DECL_ACCESSORS(dependent_code, DependentCode) | 9731 DECL_ACCESSORS(dependent_code, DependentCode) |
| 9736 | 9732 |
| 9737 // Sets the value of the cell and updates the type field to be the union | 9733 // Computes the new type of the cell's contents for the given value, but |
| 9738 // of the cell's current type and the value's type. If the change causes | 9734 // without actually modifying the details. |
| 9739 // a change of the type of the cell's contents, code dependent on the cell | 9735 static PropertyCellType UpdatedType(Handle<PropertyCell> cell, |
| 9740 // will be deoptimized. | 9736 Handle<Object> value, |
| 9741 // Usually returns the value that was passed in, but may perform | 9737 PropertyDetails details); |
| 9742 // non-observable modifications on it, such as internalize strings. | 9738 static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry, |
| 9743 static Handle<Object> SetValueInferType(Handle<PropertyCell> cell, | 9739 Handle<Object> value, |
| 9744 Handle<Object> value); | 9740 PropertyDetails details); |
| 9745 | 9741 |
| 9746 // Computes the new type of the cell's contents for the given value, but | 9742 static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary, |
| 9747 // without actually modifying the 'type' field. | 9743 int entry); |
| 9748 static Handle<HeapType> UpdatedType(Handle<PropertyCell> cell, | |
| 9749 Handle<Object> value); | |
| 9750 | 9744 |
| 9751 static void AddDependentCompilationInfo(Handle<PropertyCell> cell, | 9745 static void AddDependentCompilationInfo(Handle<PropertyCell> cell, |
| 9752 CompilationInfo* info); | 9746 CompilationInfo* info); |
| 9753 | 9747 |
| 9754 DECLARE_CAST(PropertyCell) | 9748 DECLARE_CAST(PropertyCell) |
| 9755 | 9749 |
| 9756 inline Address TypeAddress() { | |
| 9757 return address() + kTypeOffset; | |
| 9758 } | |
| 9759 | |
| 9760 // Dispatched behavior. | 9750 // Dispatched behavior. |
| 9761 DECLARE_PRINTER(PropertyCell) | 9751 DECLARE_PRINTER(PropertyCell) |
| 9762 DECLARE_VERIFIER(PropertyCell) | 9752 DECLARE_VERIFIER(PropertyCell) |
| 9763 | 9753 |
| 9764 // Layout description. | 9754 // Layout description. |
| 9765 static const int kTypeOffset = kValueOffset + kPointerSize; | 9755 static const int kDependentCodeOffset = kValueOffset + kPointerSize; |
| 9766 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; | |
| 9767 static const int kSize = kDependentCodeOffset + kPointerSize; | 9756 static const int kSize = kDependentCodeOffset + kPointerSize; |
| 9768 | 9757 |
| 9769 static const int kPointerFieldsBeginOffset = kValueOffset; | 9758 static const int kPointerFieldsBeginOffset = kValueOffset; |
| 9770 static const int kPointerFieldsEndOffset = kSize; | 9759 static const int kPointerFieldsEndOffset = kSize; |
| 9771 | 9760 |
| 9772 typedef FixedBodyDescriptor<kValueOffset, | 9761 typedef FixedBodyDescriptor<kValueOffset, |
| 9773 kSize, | 9762 kSize, |
| 9774 kSize> BodyDescriptor; | 9763 kSize> BodyDescriptor; |
| 9775 | 9764 |
| 9776 private: | 9765 private: |
| 9777 DECL_ACCESSORS(type_raw, Object) | |
| 9778 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 9766 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
| 9779 }; | 9767 }; |
| 9780 | 9768 |
| 9781 | 9769 |
| 9782 class WeakCell : public HeapObject { | 9770 class WeakCell : public HeapObject { |
| 9783 public: | 9771 public: |
| 9784 inline Object* value() const; | 9772 inline Object* value() const; |
| 9785 | 9773 |
| 9786 // This should not be called by anyone except GC. | 9774 // This should not be called by anyone except GC. |
| 9787 inline void clear(); | 9775 inline void clear(); |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10999 } else { | 10987 } else { |
| 11000 value &= ~(1 << bit_position); | 10988 value &= ~(1 << bit_position); |
| 11001 } | 10989 } |
| 11002 return value; | 10990 return value; |
| 11003 } | 10991 } |
| 11004 }; | 10992 }; |
| 11005 | 10993 |
| 11006 } } // namespace v8::internal | 10994 } } // namespace v8::internal |
| 11007 | 10995 |
| 11008 #endif // V8_OBJECTS_H_ | 10996 #endif // V8_OBJECTS_H_ |
| OLD | NEW |