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

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
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 16 matching lines...) Expand all
74 // buffer (some objects are promoted so pointers to them do not need to be in 76 // buffer (some objects are promoted so pointers to them do not need to be in
75 // the store buffer). The later parts of the GC scan the pages that are 77 // the store buffer). The later parts of the GC scan the pages that are
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, bool clear_maps);
titzer 2013/07/10 17:06:35 Boolean flags of doom be gone! Recommend to have t
Hannes Payer (out of office) 2013/07/11 07:30:40 Done.
85 87
86 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); 88 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2);
87 static const int kStoreBufferSize = kStoreBufferOverflowBit; 89 static const int kStoreBufferSize = kStoreBufferOverflowBit;
88 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); 90 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
89 static const int kOldStoreBufferLength = kStoreBufferLength * 16; 91 static const int kOldStoreBufferLength = kStoreBufferLength * 16;
90 static const int kHashSetLengthLog2 = 12; 92 static const int kHashSetLengthLog2 = 12;
91 static const int kHashSetLength = 1 << kHashSetLengthLog2; 93 static const int kHashSetLength = 1 << kHashSetLengthLog2;
92 94
93 void Compact(); 95 void Compact();
94 96
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bool hash_sets_are_empty_; 161 bool hash_sets_are_empty_;
160 162
161 void ClearFilteringHashSets(); 163 void ClearFilteringHashSets();
162 164
163 bool SpaceAvailable(intptr_t space_needed); 165 bool SpaceAvailable(intptr_t space_needed);
164 void Uniq(); 166 void Uniq();
165 void ExemptPopularPages(int prime_sample_step, int threshold); 167 void ExemptPopularPages(int prime_sample_step, int threshold);
166 168
167 void FindPointersToNewSpaceInRegion(Address start, 169 void FindPointersToNewSpaceInRegion(Address start,
168 Address end, 170 Address end,
169 ObjectSlotCallback slot_callback); 171 ObjectSlotCallback slot_callback,
172 bool clear_maps);
170 173
171 // For each region of pointers on a page in use from an old space call 174 // For each region of pointers on a page in use from an old space call
172 // visit_pointer_region callback. 175 // visit_pointer_region callback.
173 // If either visit_pointer_region or callback can cause an allocation 176 // If either visit_pointer_region or callback can cause an allocation
174 // in old space and changes in allocation watermark then 177 // in old space and changes in allocation watermark then
175 // can_preallocate_during_iteration should be set to true. 178 // can_preallocate_during_iteration should be set to true.
176 void IteratePointersOnPage( 179 void IteratePointersOnPage(
177 PagedSpace* space, 180 PagedSpace* space,
178 Page* page, 181 Page* page,
179 RegionCallback region_callback, 182 RegionCallback region_callback,
180 ObjectSlotCallback slot_callback); 183 ObjectSlotCallback slot_callback);
181 184
182 void FindPointersToNewSpaceInMaps( 185 void FindPointersToNewSpaceInMaps(
183 Address start, 186 Address start,
184 Address end, 187 Address end,
185 ObjectSlotCallback slot_callback); 188 ObjectSlotCallback slot_callback,
189 bool clear_maps);
186 190
187 void FindPointersToNewSpaceInMapsRegion( 191 void FindPointersToNewSpaceInMapsRegion(
188 Address start, 192 Address start,
189 Address end, 193 Address end,
190 ObjectSlotCallback slot_callback); 194 ObjectSlotCallback slot_callback,
195 bool clear_maps);
191 196
192 void FindPointersToNewSpaceOnPage( 197 void FindPointersToNewSpaceOnPage(
193 PagedSpace* space, 198 PagedSpace* space,
194 Page* page, 199 Page* page,
195 RegionCallback region_callback, 200 RegionCallback region_callback,
196 ObjectSlotCallback slot_callback); 201 ObjectSlotCallback slot_callback,
202 bool clear_maps);
197 203
198 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback); 204 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback,
205 bool clear_maps);
199 206
200 #ifdef VERIFY_HEAP 207 #ifdef VERIFY_HEAP
201 void VerifyPointers(PagedSpace* space, RegionCallback region_callback); 208 void VerifyPointers(PagedSpace* space, RegionCallback region_callback);
202 void VerifyPointers(LargeObjectSpace* space); 209 void VerifyPointers(LargeObjectSpace* space);
203 #endif 210 #endif
204 211
205 friend class StoreBufferRebuildScope; 212 friend class StoreBufferRebuildScope;
206 friend class DontMoveStoreBufferEntriesScope; 213 friend class DontMoveStoreBufferEntriesScope;
207 }; 214 };
208 215
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 252 }
246 253
247 private: 254 private:
248 StoreBuffer* store_buffer_; 255 StoreBuffer* store_buffer_;
249 bool stored_state_; 256 bool stored_state_;
250 }; 257 };
251 258
252 } } // namespace v8::internal 259 } } // namespace v8::internal
253 260
254 #endif // V8_STORE_BUFFER_H_ 261 #endif // V8_STORE_BUFFER_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/store-buffer.cc » ('j') | src/store-buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698