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 9828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9839 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate); | 9839 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate); |
9840 static void Set(Handle<JSWeakCollection> collection, Handle<Object> key, | 9840 static void Set(Handle<JSWeakCollection> collection, Handle<Object> key, |
9841 Handle<Object> value, int32_t hash); | 9841 Handle<Object> value, int32_t hash); |
9842 static bool Delete(Handle<JSWeakCollection> collection, Handle<Object> key, | 9842 static bool Delete(Handle<JSWeakCollection> collection, Handle<Object> key, |
9843 int32_t hash); | 9843 int32_t hash); |
9844 | 9844 |
9845 static const int kTableOffset = JSObject::kHeaderSize; | 9845 static const int kTableOffset = JSObject::kHeaderSize; |
9846 static const int kNextOffset = kTableOffset + kPointerSize; | 9846 static const int kNextOffset = kTableOffset + kPointerSize; |
9847 static const int kSize = kNextOffset + kPointerSize; | 9847 static const int kSize = kNextOffset + kPointerSize; |
9848 | 9848 |
9849 class BodyDescriptor; | 9849 // Visiting policy defines whether the table and next collection fields |
| 9850 // should be visited or not. |
| 9851 enum BodyVisitingPolicy { kVisitStrong, kVisitWeak }; |
| 9852 |
| 9853 // Iterates the function object according to the visiting policy. |
| 9854 template <BodyVisitingPolicy> |
| 9855 class BodyDescriptorImpl; |
| 9856 |
| 9857 // Visit the whole object. |
| 9858 typedef BodyDescriptorImpl<kVisitStrong> BodyDescriptor; |
| 9859 |
| 9860 // Don't visit table and next collection fields. |
| 9861 typedef BodyDescriptorImpl<kVisitWeak> BodyDescriptorWeak; |
9850 | 9862 |
9851 private: | 9863 private: |
9852 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection); | 9864 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection); |
9853 }; | 9865 }; |
9854 | 9866 |
9855 | 9867 |
9856 // The JSWeakMap describes EcmaScript Harmony weak maps | 9868 // The JSWeakMap describes EcmaScript Harmony weak maps |
9857 class JSWeakMap: public JSWeakCollection { | 9869 class JSWeakMap: public JSWeakCollection { |
9858 public: | 9870 public: |
9859 DECLARE_CAST(JSWeakMap) | 9871 DECLARE_CAST(JSWeakMap) |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10738 } | 10750 } |
10739 return value; | 10751 return value; |
10740 } | 10752 } |
10741 }; | 10753 }; |
10742 | 10754 |
10743 | 10755 |
10744 } // NOLINT, false-positive due to second-order macros. | 10756 } // NOLINT, false-positive due to second-order macros. |
10745 } // NOLINT, false-positive due to second-order macros. | 10757 } // NOLINT, false-positive due to second-order macros. |
10746 | 10758 |
10747 #endif // V8_OBJECTS_H_ | 10759 #endif // V8_OBJECTS_H_ |
OLD | NEW |