| 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 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 public: | 2595 public: |
| 2596 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound }; | 2596 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound }; |
| 2597 | 2597 |
| 2598 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. | 2598 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. |
| 2599 static Handle<WeakFixedArray> Add( | 2599 static Handle<WeakFixedArray> Add( |
| 2600 Handle<Object> maybe_array, Handle<HeapObject> value, | 2600 Handle<Object> maybe_array, Handle<HeapObject> value, |
| 2601 SearchForDuplicates search_for_duplicates = kAlwaysAdd); | 2601 SearchForDuplicates search_for_duplicates = kAlwaysAdd); |
| 2602 | 2602 |
| 2603 void Remove(Handle<HeapObject> value); | 2603 void Remove(Handle<HeapObject> value); |
| 2604 | 2604 |
| 2605 inline Object* Get(int index) const; | 2605 inline Object* Get(Heap* heap, int index) const; |
| 2606 inline int Length() const; | 2606 inline int Length() const; |
| 2607 | 2607 |
| 2608 DECLARE_CAST(WeakFixedArray) | 2608 DECLARE_CAST(WeakFixedArray) |
| 2609 | 2609 |
| 2610 private: | 2610 private: |
| 2611 static const int kLastUsedIndexIndex = 0; | 2611 static const int kLastUsedIndexIndex = 0; |
| 2612 static const int kFirstIndex = 1; | 2612 static const int kFirstIndex = 1; |
| 2613 | 2613 |
| 2614 static Handle<WeakFixedArray> Allocate( | 2614 static Handle<WeakFixedArray> Allocate( |
| 2615 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); | 2615 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); |
| 2616 | 2616 |
| 2617 static void Set(Handle<WeakFixedArray> array, int index, | 2617 static void Set(Handle<WeakFixedArray> array, int index, |
| 2618 Handle<HeapObject> value); | 2618 Handle<HeapObject> value); |
| 2619 inline bool EqualAt(int index, Object* object) const; |
| 2619 inline void clear(int index); | 2620 inline void clear(int index); |
| 2620 inline bool IsEmptySlot(int index) const; | 2621 inline bool IsEmptySlot(int index) const; |
| 2621 | 2622 |
| 2622 inline int last_used_index() const; | 2623 inline int last_used_index() const; |
| 2623 inline void set_last_used_index(int index); | 2624 inline void set_last_used_index(int index); |
| 2624 | 2625 |
| 2625 // Disallow inherited setters. | 2626 // Disallow inherited setters. |
| 2626 void set(int index, Smi* value); | 2627 void set(int index, Smi* value); |
| 2627 void set(int index, Object* value); | 2628 void set(int index, Object* value); |
| 2628 void set(int index, Object* value, WriteBarrierMode mode); | 2629 void set(int index, Object* value, WriteBarrierMode mode); |
| (...skipping 7126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9755 kSize> BodyDescriptor; | 9756 kSize> BodyDescriptor; |
| 9756 | 9757 |
| 9757 private: | 9758 private: |
| 9758 DECL_ACCESSORS(type_raw, Object) | 9759 DECL_ACCESSORS(type_raw, Object) |
| 9759 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 9760 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
| 9760 }; | 9761 }; |
| 9761 | 9762 |
| 9762 | 9763 |
| 9763 class WeakCell : public HeapObject { | 9764 class WeakCell : public HeapObject { |
| 9764 public: | 9765 public: |
| 9765 inline Object* value() const; | 9766 inline Object* value(Heap* heap); |
| 9767 inline Object* ValueNoReadBarrier(); |
| 9766 | 9768 |
| 9767 // This should not be called by anyone except GC. | 9769 // This should not be called by anyone except GC. |
| 9768 inline void clear(); | 9770 inline void clear(); |
| 9769 | 9771 |
| 9770 // This should not be called by anyone except allocator. | 9772 // This should not be called by anyone except allocator. |
| 9771 inline void initialize(HeapObject* value); | 9773 inline void initialize(HeapObject* value); |
| 9772 | 9774 |
| 9773 inline bool cleared() const; | 9775 inline bool cleared() const; |
| 9774 | 9776 |
| 9775 DECL_ACCESSORS(next, Object) | 9777 DECL_ACCESSORS(next, Object) |
| 9776 | 9778 |
| 9777 DECLARE_CAST(WeakCell) | 9779 DECLARE_CAST(WeakCell) |
| 9778 | 9780 |
| 9779 DECLARE_PRINTER(WeakCell) | 9781 DECLARE_PRINTER(WeakCell) |
| 9780 DECLARE_VERIFIER(WeakCell) | 9782 DECLARE_VERIFIER(WeakCell) |
| 9781 | 9783 |
| 9782 // Layout description. | 9784 // Layout description. |
| 9783 static const int kValueOffset = HeapObject::kHeaderSize; | 9785 static const int kValueOffsetDontForgetTheReadBarrier = |
| 9784 static const int kNextOffset = kValueOffset + kPointerSize; | 9786 HeapObject::kHeaderSize; |
| 9787 static const int kNextOffset = |
| 9788 kValueOffsetDontForgetTheReadBarrier + kPointerSize; |
| 9785 static const int kSize = kNextOffset + kPointerSize; | 9789 static const int kSize = kNextOffset + kPointerSize; |
| 9786 | 9790 |
| 9787 typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor; | 9791 static inline void TriggerReadBarrier(Object* possible_weak_cell); |
| 9792 |
| 9793 typedef FixedBodyDescriptor<kValueOffsetDontForgetTheReadBarrier, kSize, |
| 9794 kSize> BodyDescriptor; |
| 9788 | 9795 |
| 9789 private: | 9796 private: |
| 9790 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); | 9797 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); |
| 9791 }; | 9798 }; |
| 9792 | 9799 |
| 9793 | 9800 |
| 9794 // The JSProxy describes EcmaScript Harmony proxies | 9801 // The JSProxy describes EcmaScript Harmony proxies |
| 9795 class JSProxy: public JSReceiver { | 9802 class JSProxy: public JSReceiver { |
| 9796 public: | 9803 public: |
| 9797 // [handler]: The handler property. | 9804 // [handler]: The handler property. |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10976 } else { | 10983 } else { |
| 10977 value &= ~(1 << bit_position); | 10984 value &= ~(1 << bit_position); |
| 10978 } | 10985 } |
| 10979 return value; | 10986 return value; |
| 10980 } | 10987 } |
| 10981 }; | 10988 }; |
| 10982 | 10989 |
| 10983 } } // namespace v8::internal | 10990 } } // namespace v8::internal |
| 10984 | 10991 |
| 10985 #endif // V8_OBJECTS_H_ | 10992 #endif // V8_OBJECTS_H_ |
| OLD | NEW |