| 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_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 bool HasBeenSetUp(); | 863 bool HasBeenSetUp(); |
| 864 | 864 |
| 865 // =========================================================================== | 865 // =========================================================================== |
| 866 // Getters for spaces. ======================================================= | 866 // Getters for spaces. ======================================================= |
| 867 // =========================================================================== | 867 // =========================================================================== |
| 868 | 868 |
| 869 // Return the starting address and a mask for the new space. And-masking an | 869 // Return the starting address and a mask for the new space. And-masking an |
| 870 // address with the mask will result in the start address of the new space | 870 // address with the mask will result in the start address of the new space |
| 871 // for all addresses in either semispace. | 871 // for all addresses in either semispace. |
| 872 Address NewSpaceStart() { return new_space_.start(); } | 872 Address NewSpaceStart() { return new_space_.start(); } |
| 873 uintptr_t NewSpaceMask() { return new_space_.mask(); } | |
| 874 Address NewSpaceTop() { return new_space_.top(); } | 873 Address NewSpaceTop() { return new_space_.top(); } |
| 875 | 874 |
| 876 NewSpace* new_space() { return &new_space_; } | 875 NewSpace* new_space() { return &new_space_; } |
| 877 OldSpace* old_space() { return old_space_; } | 876 OldSpace* old_space() { return old_space_; } |
| 878 OldSpace* code_space() { return code_space_; } | 877 OldSpace* code_space() { return code_space_; } |
| 879 MapSpace* map_space() { return map_space_; } | 878 MapSpace* map_space() { return map_space_; } |
| 880 LargeObjectSpace* lo_space() { return lo_space_; } | 879 LargeObjectSpace* lo_space() { return lo_space_; } |
| 881 | 880 |
| 882 PagedSpace* paged_space(int idx) { | 881 PagedSpace* paged_space(int idx) { |
| 883 switch (idx) { | 882 switch (idx) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 ObjectSlotCallback callback); | 1058 ObjectSlotCallback callback); |
| 1060 | 1059 |
| 1061 void IterateAndMarkPointersToFromSpace(HeapObject* object, Address start, | 1060 void IterateAndMarkPointersToFromSpace(HeapObject* object, Address start, |
| 1062 Address end, bool record_slots, | 1061 Address end, bool record_slots, |
| 1063 ObjectSlotCallback callback); | 1062 ObjectSlotCallback callback); |
| 1064 | 1063 |
| 1065 // =========================================================================== | 1064 // =========================================================================== |
| 1066 // Store buffer API. ========================================================= | 1065 // Store buffer API. ========================================================= |
| 1067 // =========================================================================== | 1066 // =========================================================================== |
| 1068 | 1067 |
| 1069 // Write barrier support for address[offset] = o. | 1068 // Write barrier support for object[offset] = o; |
| 1070 INLINE(void RecordWrite(Address address, int offset)); | 1069 inline void RecordWrite(Object* object, int offset, Object* o); |
| 1071 | |
| 1072 // Write barrier support for address[start : start + len[ = o. | |
| 1073 INLINE(void RecordWrites(Address address, int start, int len)); | |
| 1074 | 1070 |
| 1075 Address* store_buffer_top_address() { | 1071 Address* store_buffer_top_address() { |
| 1076 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1072 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
| 1077 } | 1073 } |
| 1078 | 1074 |
| 1079 void ClearRecordedSlot(HeapObject* object, Object** slot); | 1075 void ClearRecordedSlot(HeapObject* object, Object** slot); |
| 1080 | 1076 |
| 1081 // =========================================================================== | 1077 // =========================================================================== |
| 1082 // Incremental marking API. ================================================== | 1078 // Incremental marking API. ================================================== |
| 1083 // =========================================================================== | 1079 // =========================================================================== |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1109 // Finalizes an external string by deleting the associated external | 1105 // Finalizes an external string by deleting the associated external |
| 1110 // data and clearing the resource pointer. | 1106 // data and clearing the resource pointer. |
| 1111 inline void FinalizeExternalString(String* string); | 1107 inline void FinalizeExternalString(String* string); |
| 1112 | 1108 |
| 1113 // =========================================================================== | 1109 // =========================================================================== |
| 1114 // Methods checking/returning the space of a given object/address. =========== | 1110 // Methods checking/returning the space of a given object/address. =========== |
| 1115 // =========================================================================== | 1111 // =========================================================================== |
| 1116 | 1112 |
| 1117 // Returns whether the object resides in new space. | 1113 // Returns whether the object resides in new space. |
| 1118 inline bool InNewSpace(Object* object); | 1114 inline bool InNewSpace(Object* object); |
| 1119 inline bool InNewSpace(Address address); | |
| 1120 inline bool InNewSpacePage(Address address); | |
| 1121 inline bool InFromSpace(Object* object); | 1115 inline bool InFromSpace(Object* object); |
| 1122 inline bool InToSpace(Object* object); | 1116 inline bool InToSpace(Object* object); |
| 1123 | 1117 |
| 1124 // Returns whether the object resides in old space. | 1118 // Returns whether the object resides in old space. |
| 1125 inline bool InOldSpace(Address address); | |
| 1126 inline bool InOldSpace(Object* object); | 1119 inline bool InOldSpace(Object* object); |
| 1127 | 1120 |
| 1128 // Checks whether an address/object in the heap (including auxiliary | 1121 // Checks whether an address/object in the heap (including auxiliary |
| 1129 // area and unused area). | 1122 // area and unused area). |
| 1130 bool Contains(Address addr); | |
| 1131 bool Contains(HeapObject* value); | 1123 bool Contains(HeapObject* value); |
| 1132 | 1124 |
| 1133 // Checks whether an address/object in a space. | 1125 // Checks whether an address/object in a space. |
| 1134 // Currently used by tests, serialization and heap verification only. | 1126 // Currently used by tests, serialization and heap verification only. |
| 1135 bool InSpace(Address addr, AllocationSpace space); | |
| 1136 bool InSpace(HeapObject* value, AllocationSpace space); | 1127 bool InSpace(HeapObject* value, AllocationSpace space); |
| 1137 | 1128 |
| 1129 // Slow methods that can be used for verification as they can also be used |
| 1130 // with off-heap Addresses. |
| 1131 bool ContainsSlow(Address addr); |
| 1132 bool InSpaceSlow(Address addr, AllocationSpace space); |
| 1133 inline bool InNewSpaceSlow(Address address); |
| 1134 inline bool InOldSpaceSlow(Address address); |
| 1135 |
| 1138 // =========================================================================== | 1136 // =========================================================================== |
| 1139 // Object statistics tracking. =============================================== | 1137 // Object statistics tracking. =============================================== |
| 1140 // =========================================================================== | 1138 // =========================================================================== |
| 1141 | 1139 |
| 1142 // Returns the number of buckets used by object statistics tracking during a | 1140 // Returns the number of buckets used by object statistics tracking during a |
| 1143 // major GC. Note that the following methods fail gracefully when the bounds | 1141 // major GC. Note that the following methods fail gracefully when the bounds |
| 1144 // are exceeded though. | 1142 // are exceeded though. |
| 1145 size_t NumberOfTrackedHeapObjectTypes(); | 1143 size_t NumberOfTrackedHeapObjectTypes(); |
| 1146 | 1144 |
| 1147 // Returns object statistics about count and size at the last major GC. | 1145 // Returns object statistics about count and size at the last major GC. |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 | 2630 |
| 2633 private: | 2631 private: |
| 2634 friend class NewSpace; | 2632 friend class NewSpace; |
| 2635 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); | 2633 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); |
| 2636 }; | 2634 }; |
| 2637 | 2635 |
| 2638 } // namespace internal | 2636 } // namespace internal |
| 2639 } // namespace v8 | 2637 } // namespace v8 |
| 2640 | 2638 |
| 2641 #endif // V8_HEAP_HEAP_H_ | 2639 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |