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

Side by Side Diff: src/store-buffer.h

Issue 18998004: Implemented lazy sweeping of new space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.cc ('k') | src/store-buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 25 matching lines...) Expand all
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 class Page; 40 class Page;
41 class PagedSpace; 41 class PagedSpace;
42 class StoreBuffer; 42 class StoreBuffer;
43 43
44 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); 44 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to);
45 45
46 typedef void (StoreBuffer::*RegionCallback)( 46 typedef void (StoreBuffer::*RegionCallback)(Address start,
47 Address start, Address end, ObjectSlotCallback slot_callback); 47 Address end,
48 ObjectSlotCallback slot_callback,
49 bool clear_maps);
48 50
49 // Used to implement the write barrier by collecting addresses of pointers 51 // Used to implement the write barrier by collecting addresses of pointers
50 // between spaces. 52 // between spaces.
51 class StoreBuffer { 53 class StoreBuffer {
52 public: 54 public:
53 explicit StoreBuffer(Heap* heap); 55 explicit StoreBuffer(Heap* heap);
54 56
55 static void StoreBufferOverflow(Isolate* isolate); 57 static void StoreBufferOverflow(Isolate* isolate);
56 58
57 inline Address TopAddress(); 59 inline Address TopAddress();
(...skipping 18 matching lines...) Expand all
76 // exempt from the store buffer and process the promotion queue. These steps 78 // exempt from the store buffer and process the promotion queue. These steps
77 // can overflow this buffer. We check for this and on overflow we call the 79 // can overflow this buffer. We check for this and on overflow we call the
78 // callback set up with the StoreBufferRebuildScope object. 80 // callback set up with the StoreBufferRebuildScope object.
79 inline void EnterDirectlyIntoStoreBuffer(Address addr); 81 inline void EnterDirectlyIntoStoreBuffer(Address addr);
80 82
81 // Iterates over all pointers that go from old space to new space. It will 83 // Iterates over all pointers that go from old space to new space. It will
82 // delete the store buffer as it starts so the callback should reenter 84 // delete the store buffer as it starts so the callback should reenter
83 // surviving old-to-new pointers into the store buffer to rebuild it. 85 // surviving old-to-new pointers into the store buffer to rebuild it.
84 void IteratePointersToNewSpace(ObjectSlotCallback callback); 86 void IteratePointersToNewSpace(ObjectSlotCallback callback);
85 87
88 // Same as IteratePointersToNewSpace but additonally clears maps in objects
89 // referenced from the store buffer that do not contain a forwarding pointer.
90 void IteratePointersToNewSpaceAndClearMaps(ObjectSlotCallback callback);
91
86 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); 92 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2);
87 static const int kStoreBufferSize = kStoreBufferOverflowBit; 93 static const int kStoreBufferSize = kStoreBufferOverflowBit;
88 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); 94 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
89 static const int kOldStoreBufferLength = kStoreBufferLength * 16; 95 static const int kOldStoreBufferLength = kStoreBufferLength * 16;
90 static const int kHashSetLengthLog2 = 12; 96 static const int kHashSetLengthLog2 = 12;
91 static const int kHashSetLength = 1 << kHashSetLengthLog2; 97 static const int kHashSetLength = 1 << kHashSetLengthLog2;
92 98
93 void Compact(); 99 void Compact();
94 100
95 void GCPrologue(); 101 void GCPrologue();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 uintptr_t* hash_set_1_; 163 uintptr_t* hash_set_1_;
158 uintptr_t* hash_set_2_; 164 uintptr_t* hash_set_2_;
159 bool hash_sets_are_empty_; 165 bool hash_sets_are_empty_;
160 166
161 void ClearFilteringHashSets(); 167 void ClearFilteringHashSets();
162 168
163 bool SpaceAvailable(intptr_t space_needed); 169 bool SpaceAvailable(intptr_t space_needed);
164 void Uniq(); 170 void Uniq();
165 void ExemptPopularPages(int prime_sample_step, int threshold); 171 void ExemptPopularPages(int prime_sample_step, int threshold);
166 172
173 // Set the map field of the object to NULL if contains a map.
174 inline void ClearDeadObject(HeapObject *object);
175
176 void IteratePointersToNewSpace(ObjectSlotCallback callback, bool clear_maps);
177
167 void FindPointersToNewSpaceInRegion(Address start, 178 void FindPointersToNewSpaceInRegion(Address start,
168 Address end, 179 Address end,
169 ObjectSlotCallback slot_callback); 180 ObjectSlotCallback slot_callback,
181 bool clear_maps);
170 182
171 // For each region of pointers on a page in use from an old space call 183 // For each region of pointers on a page in use from an old space call
172 // visit_pointer_region callback. 184 // visit_pointer_region callback.
173 // If either visit_pointer_region or callback can cause an allocation 185 // If either visit_pointer_region or callback can cause an allocation
174 // in old space and changes in allocation watermark then 186 // in old space and changes in allocation watermark then
175 // can_preallocate_during_iteration should be set to true. 187 // can_preallocate_during_iteration should be set to true.
176 void IteratePointersOnPage( 188 void IteratePointersOnPage(
177 PagedSpace* space, 189 PagedSpace* space,
178 Page* page, 190 Page* page,
179 RegionCallback region_callback, 191 RegionCallback region_callback,
180 ObjectSlotCallback slot_callback); 192 ObjectSlotCallback slot_callback);
181 193
182 void FindPointersToNewSpaceInMaps( 194 void FindPointersToNewSpaceInMaps(
183 Address start, 195 Address start,
184 Address end, 196 Address end,
185 ObjectSlotCallback slot_callback); 197 ObjectSlotCallback slot_callback,
198 bool clear_maps);
186 199
187 void FindPointersToNewSpaceInMapsRegion( 200 void FindPointersToNewSpaceInMapsRegion(
188 Address start, 201 Address start,
189 Address end, 202 Address end,
190 ObjectSlotCallback slot_callback); 203 ObjectSlotCallback slot_callback,
204 bool clear_maps);
191 205
192 void FindPointersToNewSpaceOnPage( 206 void FindPointersToNewSpaceOnPage(
193 PagedSpace* space, 207 PagedSpace* space,
194 Page* page, 208 Page* page,
195 RegionCallback region_callback, 209 RegionCallback region_callback,
196 ObjectSlotCallback slot_callback); 210 ObjectSlotCallback slot_callback,
211 bool clear_maps);
197 212
198 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback); 213 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback,
214 bool clear_maps);
199 215
200 #ifdef VERIFY_HEAP 216 #ifdef VERIFY_HEAP
201 void VerifyPointers(PagedSpace* space, RegionCallback region_callback); 217 void VerifyPointers(PagedSpace* space, RegionCallback region_callback);
202 void VerifyPointers(LargeObjectSpace* space); 218 void VerifyPointers(LargeObjectSpace* space);
203 #endif 219 #endif
204 220
205 friend class StoreBufferRebuildScope; 221 friend class StoreBufferRebuildScope;
206 friend class DontMoveStoreBufferEntriesScope; 222 friend class DontMoveStoreBufferEntriesScope;
207 }; 223 };
208 224
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 261 }
246 262
247 private: 263 private:
248 StoreBuffer* store_buffer_; 264 StoreBuffer* store_buffer_;
249 bool stored_state_; 265 bool stored_state_;
250 }; 266 };
251 267
252 } } // namespace v8::internal 268 } } // namespace v8::internal
253 269
254 #endif // V8_STORE_BUFFER_H_ 270 #endif // V8_STORE_BUFFER_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/store-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698