Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/heap/heap.h

Issue 1632913003: [heap] Move to page lookups for SemiSpace, NewSpace, and Heap containment methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: DCHECK in serializer Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // =========================================================================== 1075 // ===========================================================================
1080 // Incremental marking API. ================================================== 1076 // Incremental marking API. ==================================================
1081 // =========================================================================== 1077 // ===========================================================================
1082 1078
1083 // Start incremental marking and ensure that idle time handler can perform 1079 // Start incremental marking and ensure that idle time handler can perform
(...skipping 23 matching lines...) Expand all
1107 // Finalizes an external string by deleting the associated external 1103 // Finalizes an external string by deleting the associated external
1108 // data and clearing the resource pointer. 1104 // data and clearing the resource pointer.
1109 inline void FinalizeExternalString(String* string); 1105 inline void FinalizeExternalString(String* string);
1110 1106
1111 // =========================================================================== 1107 // ===========================================================================
1112 // Methods checking/returning the space of a given object/address. =========== 1108 // Methods checking/returning the space of a given object/address. ===========
1113 // =========================================================================== 1109 // ===========================================================================
1114 1110
1115 // Returns whether the object resides in new space. 1111 // Returns whether the object resides in new space.
1116 inline bool InNewSpace(Object* object); 1112 inline bool InNewSpace(Object* object);
1117 inline bool InNewSpace(Address address);
1118 inline bool InNewSpacePage(Address address);
1119 inline bool InFromSpace(Object* object); 1113 inline bool InFromSpace(Object* object);
1120 inline bool InToSpace(Object* object); 1114 inline bool InToSpace(Object* object);
1121 1115
1122 // Returns whether the object resides in old space. 1116 // Returns whether the object resides in old space.
1123 inline bool InOldSpace(Address address);
1124 inline bool InOldSpace(Object* object); 1117 inline bool InOldSpace(Object* object);
1125 1118
1126 // Checks whether an address/object in the heap (including auxiliary 1119 // Checks whether an address/object in the heap (including auxiliary
1127 // area and unused area). 1120 // area and unused area).
1128 bool Contains(Address addr);
1129 bool Contains(HeapObject* value); 1121 bool Contains(HeapObject* value);
1130 1122
1131 // Checks whether an address/object in a space. 1123 // Checks whether an address/object in a space.
1132 // Currently used by tests, serialization and heap verification only. 1124 // Currently used by tests, serialization and heap verification only.
1133 bool InSpace(Address addr, AllocationSpace space);
1134 bool InSpace(HeapObject* value, AllocationSpace space); 1125 bool InSpace(HeapObject* value, AllocationSpace space);
1135 1126
1127 // Slow methods that can be used for verification as they can also be used
1128 // with off-heap Addresses.
1129 bool ContainsSlow(Address addr);
1130 bool InSpaceSlow(Address addr, AllocationSpace space);
1131 inline bool InNewSpaceSlow(Address address);
1132 inline bool InOldSpaceSlow(Address address);
1133
1136 // =========================================================================== 1134 // ===========================================================================
1137 // Object statistics tracking. =============================================== 1135 // Object statistics tracking. ===============================================
1138 // =========================================================================== 1136 // ===========================================================================
1139 1137
1140 // Returns the number of buckets used by object statistics tracking during a 1138 // Returns the number of buckets used by object statistics tracking during a
1141 // major GC. Note that the following methods fail gracefully when the bounds 1139 // major GC. Note that the following methods fail gracefully when the bounds
1142 // are exceeded though. 1140 // are exceeded though.
1143 size_t NumberOfTrackedHeapObjectTypes(); 1141 size_t NumberOfTrackedHeapObjectTypes();
1144 1142
1145 // Returns object statistics about count and size at the last major GC. 1143 // Returns object statistics about count and size at the last major GC.
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 2628
2631 private: 2629 private:
2632 friend class NewSpace; 2630 friend class NewSpace;
2633 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); 2631 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver);
2634 }; 2632 };
2635 2633
2636 } // namespace internal 2634 } // namespace internal
2637 } // namespace v8 2635 } // namespace v8
2638 2636
2639 #endif // V8_HEAP_HEAP_H_ 2637 #endif // V8_HEAP_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698