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

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

Issue 7189066: Simple non-incremental compaction by evacuation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 6 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // we are rebuilding the store buffer using this function. There is, however 69 // we are rebuilding the store buffer using this function. There is, however
70 // no issue of overwriting the buffer we are iterating over, because this 70 // no issue of overwriting the buffer we are iterating over, because this
71 // stage of the scavenge can only reduce the number of addresses in the store 71 // stage of the scavenge can only reduce the number of addresses in the store
72 // buffer (some objects are promoted so pointers to them do not need to be in 72 // buffer (some objects are promoted so pointers to them do not need to be in
73 // the store buffer). The later parts of the GC scan the pages that are 73 // the store buffer). The later parts of the GC scan the pages that are
74 // exempt from the store buffer and process the promotion queue. These steps 74 // exempt from the store buffer and process the promotion queue. These steps
75 // can overflow this buffer. We check for this and on overflow we call the 75 // can overflow this buffer. We check for this and on overflow we call the
76 // callback set up with the StoreBufferRebuildScope object. 76 // callback set up with the StoreBufferRebuildScope object.
77 inline void EnterDirectlyIntoStoreBuffer(Address addr); 77 inline void EnterDirectlyIntoStoreBuffer(Address addr);
78 78
79
80 enum IterationMode {
81 SKIP_SLOTS_IN_EVACUATION_CANDIDATES,
82 VISIT_ALL_SLOTS
83 };
84
79 // Iterates over all pointers that go from old space to new space. It will 85 // Iterates over all pointers that go from old space to new space. It will
80 // delete the store buffer as it starts so the callback should reenter 86 // delete the store buffer as it starts so the callback should reenter
81 // surviving old-to-new pointers into the store buffer to rebuild it. 87 // surviving old-to-new pointers into the store buffer to rebuild it.
82 void IteratePointersToNewSpace(ObjectSlotCallback callback); 88 void IteratePointersToNewSpace(ObjectSlotCallback callback,
89 IterationMode mode);
83 90
84 static const int kStoreBufferOverflowBit = 1 << 16; 91 static const int kStoreBufferOverflowBit = 1 << 16;
85 static const int kStoreBufferSize = kStoreBufferOverflowBit; 92 static const int kStoreBufferSize = kStoreBufferOverflowBit;
86 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); 93 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
87 static const int kOldStoreBufferLength = kStoreBufferLength * 64; 94 static const int kOldStoreBufferLength = kStoreBufferLength * 64;
88 static const int kHashMapLengthLog2 = 12; 95 static const int kHashMapLengthLog2 = 12;
89 static const int kHashMapLength = 1 << kHashMapLengthLog2; 96 static const int kHashMapLength = 1 << kHashMapLengthLog2;
90 97
91 void Compact(); 98 void Compact();
92 static void GCPrologue(GCType type, GCCallbackFlags flags); 99 static void GCPrologue(GCType type, GCCallbackFlags flags);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 Address start, 184 Address start,
178 Address end, 185 Address end,
179 ObjectSlotCallback slot_callback); 186 ObjectSlotCallback slot_callback);
180 187
181 void FindPointersToNewSpaceOnPage( 188 void FindPointersToNewSpaceOnPage(
182 PagedSpace* space, 189 PagedSpace* space,
183 Page* page, 190 Page* page,
184 RegionCallback region_callback, 191 RegionCallback region_callback,
185 ObjectSlotCallback slot_callback); 192 ObjectSlotCallback slot_callback);
186 193
194 template<StoreBuffer::IterationMode mode>
195 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback);
196
197
187 #ifdef DEBUG 198 #ifdef DEBUG
188 void VerifyPointers(PagedSpace* space, RegionCallback region_callback); 199 void VerifyPointers(PagedSpace* space, RegionCallback region_callback);
189 void VerifyPointers(LargeObjectSpace* space); 200 void VerifyPointers(LargeObjectSpace* space);
190 #endif 201 #endif
191 202
192 friend class StoreBufferRebuildScope; 203 friend class StoreBufferRebuildScope;
193 friend class DontMoveStoreBufferEntriesScope; 204 friend class DontMoveStoreBufferEntriesScope;
194 }; 205 };
195 206
196 207
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 246 }
236 247
237 private: 248 private:
238 StoreBuffer* store_buffer_; 249 StoreBuffer* store_buffer_;
239 bool stored_state_; 250 bool stored_state_;
240 }; 251 };
241 252
242 } } // namespace v8::internal 253 } } // namespace v8::internal
243 254
244 #endif // V8_STORE_BUFFER_H_ 255 #endif // V8_STORE_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698