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 #include "src/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 #ifdef VERIFY_HEAP | 296 #ifdef VERIFY_HEAP |
297 static void VerifyValidSlotsBufferEntries(Heap* heap, PagedSpace* space) { | 297 static void VerifyValidSlotsBufferEntries(Heap* heap, PagedSpace* space) { |
298 PageIterator it(space); | 298 PageIterator it(space); |
299 while (it.has_next()) { | 299 while (it.has_next()) { |
300 Page* p = it.next(); | 300 Page* p = it.next(); |
301 SlotsBuffer::VerifySlots(heap, p->slots_buffer()); | 301 SlotsBuffer::VerifySlots(heap, p->slots_buffer()); |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 | 305 |
306 static void VerifyValidStoreAndSlotsBufferEntries(Heap* heap) { | 306 void MarkCompactCollector::VerifyValidStoreAndSlotsBufferEntries() { |
307 heap->store_buffer()->VerifyValidStoreBufferEntries(); | 307 heap()->store_buffer()->VerifyValidStoreBufferEntries(); |
308 | 308 |
309 VerifyValidSlotsBufferEntries(heap, heap->old_space()); | 309 VerifyValidSlotsBufferEntries(heap(), heap()->old_space()); |
310 VerifyValidSlotsBufferEntries(heap, heap->code_space()); | 310 VerifyValidSlotsBufferEntries(heap(), heap()->code_space()); |
311 VerifyValidSlotsBufferEntries(heap, heap->map_space()); | 311 VerifyValidSlotsBufferEntries(heap(), heap()->map_space()); |
312 | 312 |
313 LargeObjectIterator it(heap->lo_space()); | 313 LargeObjectIterator it(heap()->lo_space()); |
314 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { | 314 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { |
315 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); | 315 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); |
316 SlotsBuffer::VerifySlots(heap, chunk->slots_buffer()); | 316 SlotsBuffer::VerifySlots(heap(), chunk->slots_buffer()); |
317 } | 317 } |
318 } | 318 } |
319 #endif | 319 #endif |
320 | 320 |
321 | 321 |
322 void MarkCompactCollector::CollectGarbage() { | 322 void MarkCompactCollector::CollectGarbage() { |
323 // Make sure that Prepare() has been called. The individual steps below will | 323 // Make sure that Prepare() has been called. The individual steps below will |
324 // update the state as they proceed. | 324 // update the state as they proceed. |
325 DCHECK(state_ == PREPARE_GC); | 325 DCHECK(state_ == PREPARE_GC); |
326 | 326 |
(...skipping 15 matching lines...) Expand all Loading... |
342 #ifdef VERIFY_HEAP | 342 #ifdef VERIFY_HEAP |
343 if (FLAG_verify_heap) { | 343 if (FLAG_verify_heap) { |
344 VerifyMarking(heap_); | 344 VerifyMarking(heap_); |
345 } | 345 } |
346 #endif | 346 #endif |
347 | 347 |
348 ClearInvalidStoreAndSlotsBufferEntries(); | 348 ClearInvalidStoreAndSlotsBufferEntries(); |
349 | 349 |
350 #ifdef VERIFY_HEAP | 350 #ifdef VERIFY_HEAP |
351 if (FLAG_verify_heap) { | 351 if (FLAG_verify_heap) { |
352 VerifyValidStoreAndSlotsBufferEntries(heap_); | 352 VerifyValidStoreAndSlotsBufferEntries(); |
353 } | 353 } |
354 #endif | 354 #endif |
355 | 355 |
356 SweepSpaces(); | 356 SweepSpaces(); |
357 | 357 |
358 Finish(); | 358 Finish(); |
359 | 359 |
360 if (marking_parity_ == EVEN_MARKING_PARITY) { | 360 if (marking_parity_ == EVEN_MARKING_PARITY) { |
361 marking_parity_ = ODD_MARKING_PARITY; | 361 marking_parity_ = ODD_MARKING_PARITY; |
362 } else { | 362 } else { |
(...skipping 4333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4696 SlotsBuffer* buffer = *buffer_address; | 4696 SlotsBuffer* buffer = *buffer_address; |
4697 while (buffer != NULL) { | 4697 while (buffer != NULL) { |
4698 SlotsBuffer* next_buffer = buffer->next(); | 4698 SlotsBuffer* next_buffer = buffer->next(); |
4699 DeallocateBuffer(buffer); | 4699 DeallocateBuffer(buffer); |
4700 buffer = next_buffer; | 4700 buffer = next_buffer; |
4701 } | 4701 } |
4702 *buffer_address = NULL; | 4702 *buffer_address = NULL; |
4703 } | 4703 } |
4704 } // namespace internal | 4704 } // namespace internal |
4705 } // namespace v8 | 4705 } // namespace v8 |
OLD | NEW |