| 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 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2570 public: | 2570 public: |
| 2571 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound }; | 2571 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound }; |
| 2572 | 2572 |
| 2573 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. | 2573 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. |
| 2574 static Handle<WeakFixedArray> Add( | 2574 static Handle<WeakFixedArray> Add( |
| 2575 Handle<Object> maybe_array, Handle<HeapObject> value, | 2575 Handle<Object> maybe_array, Handle<HeapObject> value, |
| 2576 SearchForDuplicates search_for_duplicates = kAlwaysAdd); | 2576 SearchForDuplicates search_for_duplicates = kAlwaysAdd); |
| 2577 | 2577 |
| 2578 void Remove(Handle<HeapObject> value); | 2578 void Remove(Handle<HeapObject> value); |
| 2579 | 2579 |
| 2580 inline Object* Get(int index) const; | 2580 inline Object* Get(Heap* heap, int index) const; |
| 2581 inline int Length() const; | 2581 inline int Length() const; |
| 2582 | 2582 |
| 2583 DECLARE_CAST(WeakFixedArray) | 2583 DECLARE_CAST(WeakFixedArray) |
| 2584 | 2584 |
| 2585 private: | 2585 private: |
| 2586 static const int kLastUsedIndexIndex = 0; | 2586 static const int kLastUsedIndexIndex = 0; |
| 2587 static const int kFirstIndex = 1; | 2587 static const int kFirstIndex = 1; |
| 2588 | 2588 |
| 2589 static Handle<WeakFixedArray> Allocate( | 2589 static Handle<WeakFixedArray> Allocate( |
| 2590 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); | 2590 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); |
| 2591 | 2591 |
| 2592 static void Set(Handle<WeakFixedArray> array, int index, | 2592 static void Set(Handle<WeakFixedArray> array, int index, |
| 2593 Handle<HeapObject> value); | 2593 Handle<HeapObject> value); |
| 2594 inline bool EqualAt(int index, Object* object) const; |
| 2594 inline void clear(int index); | 2595 inline void clear(int index); |
| 2595 inline bool IsEmptySlot(int index) const; | 2596 inline bool IsEmptySlot(int index) const; |
| 2596 | 2597 |
| 2597 inline int last_used_index() const; | 2598 inline int last_used_index() const; |
| 2598 inline void set_last_used_index(int index); | 2599 inline void set_last_used_index(int index); |
| 2599 | 2600 |
| 2600 // Disallow inherited setters. | 2601 // Disallow inherited setters. |
| 2601 void set(int index, Smi* value); | 2602 void set(int index, Smi* value); |
| 2602 void set(int index, Object* value); | 2603 void set(int index, Object* value); |
| 2603 void set(int index, Object* value, WriteBarrierMode mode); | 2604 void set(int index, Object* value, WriteBarrierMode mode); |
| (...skipping 7136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9740 kSize> BodyDescriptor; | 9741 kSize> BodyDescriptor; |
| 9741 | 9742 |
| 9742 private: | 9743 private: |
| 9743 DECL_ACCESSORS(type_raw, Object) | 9744 DECL_ACCESSORS(type_raw, Object) |
| 9744 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 9745 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
| 9745 }; | 9746 }; |
| 9746 | 9747 |
| 9747 | 9748 |
| 9748 class WeakCell : public HeapObject { | 9749 class WeakCell : public HeapObject { |
| 9749 public: | 9750 public: |
| 9750 inline Object* value() const; | 9751 inline Object* value(Heap* heap); |
| 9752 inline Object* ValueNoReadBarrier(); |
| 9751 | 9753 |
| 9752 // This should not be called by anyone except GC. | 9754 // This should not be called by anyone except GC. |
| 9753 inline void clear(); | 9755 inline void clear(); |
| 9754 | 9756 |
| 9755 // This should not be called by anyone except allocator. | 9757 // This should not be called by anyone except allocator. |
| 9756 inline void initialize(HeapObject* value); | 9758 inline void initialize(HeapObject* value); |
| 9757 | 9759 |
| 9758 inline bool cleared() const; | 9760 inline bool cleared() const; |
| 9759 | 9761 |
| 9760 DECL_ACCESSORS(next, Object) | 9762 DECL_ACCESSORS(next, Object) |
| 9761 | 9763 |
| 9762 DECLARE_CAST(WeakCell) | 9764 DECLARE_CAST(WeakCell) |
| 9763 | 9765 |
| 9764 DECLARE_PRINTER(WeakCell) | 9766 DECLARE_PRINTER(WeakCell) |
| 9765 DECLARE_VERIFIER(WeakCell) | 9767 DECLARE_VERIFIER(WeakCell) |
| 9766 | 9768 |
| 9767 // Layout description. | 9769 // Layout description. |
| 9768 static const int kValueOffset = HeapObject::kHeaderSize; | 9770 static const int kValueOffsetDontForgetTheReadBarrier = |
| 9769 static const int kNextOffset = kValueOffset + kPointerSize; | 9771 HeapObject::kHeaderSize; |
| 9772 static const int kNextOffset = |
| 9773 kValueOffsetDontForgetTheReadBarrier + kPointerSize; |
| 9770 static const int kSize = kNextOffset + kPointerSize; | 9774 static const int kSize = kNextOffset + kPointerSize; |
| 9771 | 9775 |
| 9772 typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor; | 9776 static inline void TriggerReadBarrier(Object* possible_weak_cell); |
| 9777 |
| 9778 typedef FixedBodyDescriptor<kValueOffsetDontForgetTheReadBarrier, kSize, |
| 9779 kSize> BodyDescriptor; |
| 9773 | 9780 |
| 9774 private: | 9781 private: |
| 9775 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); | 9782 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); |
| 9776 }; | 9783 }; |
| 9777 | 9784 |
| 9778 | 9785 |
| 9779 // The JSProxy describes EcmaScript Harmony proxies | 9786 // The JSProxy describes EcmaScript Harmony proxies |
| 9780 class JSProxy: public JSReceiver { | 9787 class JSProxy: public JSReceiver { |
| 9781 public: | 9788 public: |
| 9782 // [handler]: The handler property. | 9789 // [handler]: The handler property. |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10958 } else { | 10965 } else { |
| 10959 value &= ~(1 << bit_position); | 10966 value &= ~(1 << bit_position); |
| 10960 } | 10967 } |
| 10961 return value; | 10968 return value; |
| 10962 } | 10969 } |
| 10963 }; | 10970 }; |
| 10964 | 10971 |
| 10965 } } // namespace v8::internal | 10972 } } // namespace v8::internal |
| 10966 | 10973 |
| 10967 #endif // V8_OBJECTS_H_ | 10974 #endif // V8_OBJECTS_H_ |
| OLD | NEW |