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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 bool HasBeenSetUp(); | 880 bool HasBeenSetUp(); |
881 | 881 |
882 // =========================================================================== | 882 // =========================================================================== |
883 // Getters for spaces. ======================================================= | 883 // Getters for spaces. ======================================================= |
884 // =========================================================================== | 884 // =========================================================================== |
885 | 885 |
886 // Return the starting address and a mask for the new space. And-masking an | 886 // Return the starting address and a mask for the new space. And-masking an |
887 // address with the mask will result in the start address of the new space | 887 // address with the mask will result in the start address of the new space |
888 // for all addresses in either semispace. | 888 // for all addresses in either semispace. |
889 Address NewSpaceStart() { return new_space_.start(); } | 889 Address NewSpaceStart() { return new_space_.start(); } |
890 uintptr_t NewSpaceMask() { return new_space_.mask(); } | |
891 Address NewSpaceTop() { return new_space_.top(); } | 890 Address NewSpaceTop() { return new_space_.top(); } |
892 | 891 |
893 NewSpace* new_space() { return &new_space_; } | 892 NewSpace* new_space() { return &new_space_; } |
894 OldSpace* old_space() { return old_space_; } | 893 OldSpace* old_space() { return old_space_; } |
895 OldSpace* code_space() { return code_space_; } | 894 OldSpace* code_space() { return code_space_; } |
896 MapSpace* map_space() { return map_space_; } | 895 MapSpace* map_space() { return map_space_; } |
897 LargeObjectSpace* lo_space() { return lo_space_; } | 896 LargeObjectSpace* lo_space() { return lo_space_; } |
898 | 897 |
899 PagedSpace* paged_space(int idx) { | 898 PagedSpace* paged_space(int idx) { |
900 switch (idx) { | 899 switch (idx) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 ObjectSlotCallback callback); | 1075 ObjectSlotCallback callback); |
1077 | 1076 |
1078 void IterateAndMarkPointersToFromSpace(HeapObject* object, Address start, | 1077 void IterateAndMarkPointersToFromSpace(HeapObject* object, Address start, |
1079 Address end, bool record_slots, | 1078 Address end, bool record_slots, |
1080 ObjectSlotCallback callback); | 1079 ObjectSlotCallback callback); |
1081 | 1080 |
1082 // =========================================================================== | 1081 // =========================================================================== |
1083 // Store buffer API. ========================================================= | 1082 // Store buffer API. ========================================================= |
1084 // =========================================================================== | 1083 // =========================================================================== |
1085 | 1084 |
1086 // Write barrier support for address[offset] = o. | 1085 // Write barrier support for object[offset] = o; |
1087 INLINE(void RecordWrite(Address address, int offset)); | 1086 inline void RecordWrite(Object* object, int offset, Object* o); |
1088 | |
1089 // Write barrier support for address[start : start + len[ = o. | |
1090 INLINE(void RecordWrites(Address address, int start, int len)); | |
1091 | 1087 |
1092 Address* store_buffer_top_address() { | 1088 Address* store_buffer_top_address() { |
1093 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1089 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
1094 } | 1090 } |
1095 | 1091 |
1096 // =========================================================================== | 1092 // =========================================================================== |
1097 // Incremental marking API. ================================================== | 1093 // Incremental marking API. ================================================== |
1098 // =========================================================================== | 1094 // =========================================================================== |
1099 | 1095 |
1100 // Start incremental marking and ensure that idle time handler can perform | 1096 // Start incremental marking and ensure that idle time handler can perform |
(...skipping 23 matching lines...) Expand all Loading... |
1124 // Finalizes an external string by deleting the associated external | 1120 // Finalizes an external string by deleting the associated external |
1125 // data and clearing the resource pointer. | 1121 // data and clearing the resource pointer. |
1126 inline void FinalizeExternalString(String* string); | 1122 inline void FinalizeExternalString(String* string); |
1127 | 1123 |
1128 // =========================================================================== | 1124 // =========================================================================== |
1129 // Methods checking/returning the space of a given object/address. =========== | 1125 // Methods checking/returning the space of a given object/address. =========== |
1130 // =========================================================================== | 1126 // =========================================================================== |
1131 | 1127 |
1132 // Returns whether the object resides in new space. | 1128 // Returns whether the object resides in new space. |
1133 inline bool InNewSpace(Object* object); | 1129 inline bool InNewSpace(Object* object); |
1134 inline bool InNewSpace(Address address); | |
1135 inline bool InNewSpacePage(Address address); | |
1136 inline bool InFromSpace(Object* object); | 1130 inline bool InFromSpace(Object* object); |
1137 inline bool InToSpace(Object* object); | 1131 inline bool InToSpace(Object* object); |
1138 | 1132 |
1139 // Returns whether the object resides in old space. | 1133 // Returns whether the object resides in old space. |
1140 inline bool InOldSpace(Address address); | |
1141 inline bool InOldSpace(Object* object); | 1134 inline bool InOldSpace(Object* object); |
1142 | 1135 |
1143 // Checks whether an address/object in the heap (including auxiliary | 1136 // Checks whether an address/object in the heap (including auxiliary |
1144 // area and unused area). | 1137 // area and unused area). |
1145 bool Contains(Address addr); | |
1146 bool Contains(HeapObject* value); | 1138 bool Contains(HeapObject* value); |
1147 | 1139 |
1148 // Checks whether an address/object in a space. | 1140 // Checks whether an address/object in a space. |
1149 // Currently used by tests, serialization and heap verification only. | 1141 // Currently used by tests, serialization and heap verification only. |
1150 bool InSpace(Address addr, AllocationSpace space); | |
1151 bool InSpace(HeapObject* value, AllocationSpace space); | 1142 bool InSpace(HeapObject* value, AllocationSpace space); |
1152 | 1143 |
| 1144 // Slow methods that can be used for verification as they can also be used |
| 1145 // with off-heap Addresses. |
| 1146 bool ContainsSlow(Address addr); |
| 1147 bool InSpaceSlow(Address addr, AllocationSpace space); |
| 1148 inline bool InNewSpaceSlow(Address address); |
| 1149 inline bool InOldSpaceSlow(Address address); |
| 1150 |
1153 // =========================================================================== | 1151 // =========================================================================== |
1154 // Object statistics tracking. =============================================== | 1152 // Object statistics tracking. =============================================== |
1155 // =========================================================================== | 1153 // =========================================================================== |
1156 | 1154 |
1157 // Returns the number of buckets used by object statistics tracking during a | 1155 // Returns the number of buckets used by object statistics tracking during a |
1158 // major GC. Note that the following methods fail gracefully when the bounds | 1156 // major GC. Note that the following methods fail gracefully when the bounds |
1159 // are exceeded though. | 1157 // are exceeded though. |
1160 size_t NumberOfTrackedHeapObjectTypes(); | 1158 size_t NumberOfTrackedHeapObjectTypes(); |
1161 | 1159 |
1162 // Returns object statistics about count and size at the last major GC. | 1160 // Returns object statistics about count and size at the last major GC. |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 | 2652 |
2655 private: | 2653 private: |
2656 friend class NewSpace; | 2654 friend class NewSpace; |
2657 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); | 2655 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); |
2658 }; | 2656 }; |
2659 | 2657 |
2660 } // namespace internal | 2658 } // namespace internal |
2661 } // namespace v8 | 2659 } // namespace v8 |
2662 | 2660 |
2663 #endif // V8_HEAP_HEAP_H_ | 2661 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |