OLD | NEW |
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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 LargeObjectIterator it(heap_->lo_space()); | 324 LargeObjectIterator it(heap_->lo_space()); |
325 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 325 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
326 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 326 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
327 ASSERT(Marking::IsWhite(mark_bit)); | 327 ASSERT(Marking::IsWhite(mark_bit)); |
328 } | 328 } |
329 } | 329 } |
330 #endif | 330 #endif |
331 | 331 |
332 | 332 |
333 static void ClearMarkbits(PagedSpace* space) { | 333 static void ClearMarkbitsInPagedSpace(PagedSpace* space) { |
334 PageIterator it(space); | 334 PageIterator it(space); |
335 | 335 |
336 while (it.has_next()) { | 336 while (it.has_next()) { |
337 Bitmap::Clear(it.next()); | 337 Bitmap::Clear(it.next()); |
338 } | 338 } |
339 } | 339 } |
340 | 340 |
341 | 341 |
342 static void ClearMarkbits(NewSpace* space) { | 342 static void ClearMarkbitsInNewSpace(NewSpace* space) { |
343 NewSpacePageIterator it(space->ToSpaceStart(), space->ToSpaceEnd()); | 343 NewSpacePageIterator it(space->ToSpaceStart(), space->ToSpaceEnd()); |
344 | 344 |
345 while (it.has_next()) { | 345 while (it.has_next()) { |
346 Bitmap::Clear(it.next()); | 346 Bitmap::Clear(it.next()); |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 static void ClearMarkbits(Heap* heap) { | 351 void MarkCompactCollector::ClearMarkbits() { |
352 ClearMarkbits(heap->code_space()); | 352 ClearMarkbitsInPagedSpace(heap_->code_space()); |
353 ClearMarkbits(heap->map_space()); | 353 ClearMarkbitsInPagedSpace(heap_->map_space()); |
354 ClearMarkbits(heap->old_pointer_space()); | 354 ClearMarkbitsInPagedSpace(heap_->old_pointer_space()); |
355 ClearMarkbits(heap->old_data_space()); | 355 ClearMarkbitsInPagedSpace(heap_->old_data_space()); |
356 ClearMarkbits(heap->cell_space()); | 356 ClearMarkbitsInPagedSpace(heap_->cell_space()); |
357 ClearMarkbits(heap->new_space()); | 357 ClearMarkbitsInNewSpace(heap_->new_space()); |
358 | 358 |
359 LargeObjectIterator it(heap->lo_space()); | 359 LargeObjectIterator it(heap_->lo_space()); |
360 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 360 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
361 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 361 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
362 mark_bit.Clear(); | 362 mark_bit.Clear(); |
363 mark_bit.Next().Clear(); | 363 mark_bit.Next().Clear(); |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 | 367 |
368 bool Marking::TransferMark(Address old_start, Address new_start) { | 368 bool Marking::TransferMark(Address old_start, Address new_start) { |
369 // This is only used when resizing an object. | 369 // This is only used when resizing an object. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 #ifdef ENABLE_GDB_JIT_INTERFACE | 497 #ifdef ENABLE_GDB_JIT_INTERFACE |
498 if (FLAG_gdbjit) { | 498 if (FLAG_gdbjit) { |
499 // If GDBJIT interface is active disable compaction. | 499 // If GDBJIT interface is active disable compaction. |
500 compacting_collection_ = false; | 500 compacting_collection_ = false; |
501 } | 501 } |
502 #endif | 502 #endif |
503 | 503 |
504 // Clear marking bits for precise sweeping to collect all garbage. | 504 // Clear marking bits for precise sweeping to collect all garbage. |
505 if (was_marked_incrementally_ && PreciseSweepingRequired()) { | 505 if (was_marked_incrementally_ && PreciseSweepingRequired()) { |
506 heap()->incremental_marking()->Abort(); | 506 heap()->incremental_marking()->Abort(); |
507 ClearMarkbits(heap_); | 507 ClearMarkbits(); |
508 AbortCompaction(); | 508 AbortCompaction(); |
509 was_marked_incrementally_ = false; | 509 was_marked_incrementally_ = false; |
510 } | 510 } |
511 | 511 |
512 // Don't start compaction if we are in the middle of incremental | 512 // Don't start compaction if we are in the middle of incremental |
513 // marking cycle. We did not collect any slots. | 513 // marking cycle. We did not collect any slots. |
514 if (!FLAG_never_compact && !was_marked_incrementally_) { | 514 if (!FLAG_never_compact && !was_marked_incrementally_) { |
515 StartCompaction(); | 515 StartCompaction(); |
516 } | 516 } |
517 | 517 |
(...skipping 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 while (buffer != NULL) { | 3823 while (buffer != NULL) { |
3824 SlotsBuffer* next_buffer = buffer->next(); | 3824 SlotsBuffer* next_buffer = buffer->next(); |
3825 DeallocateBuffer(buffer); | 3825 DeallocateBuffer(buffer); |
3826 buffer = next_buffer; | 3826 buffer = next_buffer; |
3827 } | 3827 } |
3828 *buffer_address = NULL; | 3828 *buffer_address = NULL; |
3829 } | 3829 } |
3830 | 3830 |
3831 | 3831 |
3832 } } // namespace v8::internal | 3832 } } // namespace v8::internal |
OLD | NEW |