OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 | 1682 |
1683 Address cell_base = p->area_start(); | 1683 Address cell_base = p->area_start(); |
1684 int cell_index = Bitmap::IndexToCell( | 1684 int cell_index = Bitmap::IndexToCell( |
1685 Bitmap::CellAlignIndex( | 1685 Bitmap::CellAlignIndex( |
1686 p->AddressToMarkbitIndex(cell_base))); | 1686 p->AddressToMarkbitIndex(cell_base))); |
1687 | 1687 |
1688 | 1688 |
1689 for (; | 1689 for (; |
1690 cell_index < last_cell_index; | 1690 cell_index < last_cell_index; |
1691 cell_index++, cell_base += 32 * kPointerSize) { | 1691 cell_index++, cell_base += 32 * kPointerSize) { |
1692 ASSERT((unsigned)cell_index == | 1692 ASSERT(static_cast<unsigned>(cell_index) == |
1693 Bitmap::IndexToCell( | 1693 Bitmap::IndexToCell( |
1694 Bitmap::CellAlignIndex( | 1694 Bitmap::CellAlignIndex( |
1695 p->AddressToMarkbitIndex(cell_base)))); | 1695 p->AddressToMarkbitIndex(cell_base)))); |
1696 | 1696 |
1697 const MarkBit::CellType current_cell = cells[cell_index]; | 1697 const MarkBit::CellType current_cell = cells[cell_index]; |
1698 if (current_cell == 0) continue; | 1698 if (current_cell == 0) continue; |
1699 | 1699 |
1700 const MarkBit::CellType next_cell = cells[cell_index + 1]; | 1700 const MarkBit::CellType next_cell = cells[cell_index + 1]; |
1701 MarkBit::CellType grey_objects = current_cell & | 1701 MarkBit::CellType grey_objects = current_cell & |
1702 ((current_cell >> 1) | (next_cell << (Bitmap::kBitsPerCell - 1))); | 1702 ((current_cell >> 1) | (next_cell << (Bitmap::kBitsPerCell - 1))); |
1703 | 1703 |
1704 int offset = 0; | 1704 int offset = 0; |
1705 while (grey_objects != 0) { | 1705 while (grey_objects != 0) { |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 Address cell_base = p->area_start(); | 2582 Address cell_base = p->area_start(); |
2583 int cell_index = Bitmap::IndexToCell( | 2583 int cell_index = Bitmap::IndexToCell( |
2584 Bitmap::CellAlignIndex( | 2584 Bitmap::CellAlignIndex( |
2585 p->AddressToMarkbitIndex(cell_base))); | 2585 p->AddressToMarkbitIndex(cell_base))); |
2586 | 2586 |
2587 int offsets[16]; | 2587 int offsets[16]; |
2588 | 2588 |
2589 for (; | 2589 for (; |
2590 cell_index < last_cell_index; | 2590 cell_index < last_cell_index; |
2591 cell_index++, cell_base += 32 * kPointerSize) { | 2591 cell_index++, cell_base += 32 * kPointerSize) { |
2592 ASSERT((unsigned)cell_index == | 2592 ASSERT(static_cast<unsigned>(cell_index) == |
2593 Bitmap::IndexToCell( | 2593 Bitmap::IndexToCell( |
2594 Bitmap::CellAlignIndex( | 2594 Bitmap::CellAlignIndex( |
2595 p->AddressToMarkbitIndex(cell_base)))); | 2595 p->AddressToMarkbitIndex(cell_base)))); |
2596 if (cells[cell_index] == 0) continue; | 2596 if (cells[cell_index] == 0) continue; |
2597 | 2597 |
2598 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); | 2598 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); |
2599 for (int i = 0; i < live_objects; i++) { | 2599 for (int i = 0; i < live_objects; i++) { |
2600 Address object_addr = cell_base + offsets[i] * kPointerSize; | 2600 Address object_addr = cell_base + offsets[i] * kPointerSize; |
2601 HeapObject* object = HeapObject::FromAddress(object_addr); | 2601 HeapObject* object = HeapObject::FromAddress(object_addr); |
2602 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); | 2602 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); |
2603 | 2603 |
2604 int size = object->Size(); | 2604 int size = object->Size(); |
2605 | 2605 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2755 | 2755 |
2756 SkipList* skip_list = p->skip_list(); | 2756 SkipList* skip_list = p->skip_list(); |
2757 int curr_region = -1; | 2757 int curr_region = -1; |
2758 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { | 2758 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { |
2759 skip_list->Clear(); | 2759 skip_list->Clear(); |
2760 } | 2760 } |
2761 | 2761 |
2762 for (; | 2762 for (; |
2763 cell_index < last_cell_index; | 2763 cell_index < last_cell_index; |
2764 cell_index++, object_address += 32 * kPointerSize) { | 2764 cell_index++, object_address += 32 * kPointerSize) { |
2765 ASSERT((unsigned)cell_index == | 2765 ASSERT(static_cast<unsigned>(cell_index) == |
2766 Bitmap::IndexToCell( | 2766 Bitmap::IndexToCell( |
2767 Bitmap::CellAlignIndex( | 2767 Bitmap::CellAlignIndex( |
2768 p->AddressToMarkbitIndex(object_address)))); | 2768 p->AddressToMarkbitIndex(object_address)))); |
2769 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); | 2769 int live_objects = MarkWordToObjectStarts(cells[cell_index], offsets); |
2770 int live_index = 0; | 2770 int live_index = 0; |
2771 for ( ; live_objects != 0; live_objects--) { | 2771 for ( ; live_objects != 0; live_objects--) { |
2772 Address free_end = object_address + offsets[live_index++] * kPointerSize; | 2772 Address free_end = object_address + offsets[live_index++] * kPointerSize; |
2773 if (free_end != free_start) { | 2773 if (free_end != free_start) { |
2774 space->Free(free_start, static_cast<int>(free_end - free_start)); | 2774 space->Free(free_start, static_cast<int>(free_end - free_start)); |
2775 } | 2775 } |
2776 HeapObject* live_object = HeapObject::FromAddress(free_end); | 2776 HeapObject* live_object = HeapObject::FromAddress(free_end); |
2777 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(live_object))); | 2777 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(live_object))); |
2778 Map* map = live_object->map(); | 2778 Map* map = live_object->map(); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 // the marking bitmap for that cell, which describes where the live object | 3435 // the marking bitmap for that cell, which describes where the live object |
3436 // started. Unless we find a large free space in the bitmap we will not | 3436 // started. Unless we find a large free space in the bitmap we will not |
3437 // digest this pair into a real address. We start the iteration here at the | 3437 // digest this pair into a real address. We start the iteration here at the |
3438 // first word in the marking bit map that indicates a live object. | 3438 // first word in the marking bit map that indicates a live object. |
3439 Address free_start = block_address; | 3439 Address free_start = block_address; |
3440 uint32_t free_start_cell = cells[cell_index]; | 3440 uint32_t free_start_cell = cells[cell_index]; |
3441 | 3441 |
3442 for ( ; | 3442 for ( ; |
3443 cell_index < last_cell_index; | 3443 cell_index < last_cell_index; |
3444 cell_index++, block_address += 32 * kPointerSize) { | 3444 cell_index++, block_address += 32 * kPointerSize) { |
3445 ASSERT((unsigned)cell_index == | 3445 ASSERT(static_cast<unsigned>(cell_index) == |
3446 Bitmap::IndexToCell( | 3446 Bitmap::IndexToCell( |
3447 Bitmap::CellAlignIndex( | 3447 Bitmap::CellAlignIndex( |
3448 p->AddressToMarkbitIndex(block_address)))); | 3448 p->AddressToMarkbitIndex(block_address)))); |
3449 uint32_t cell = cells[cell_index]; | 3449 uint32_t cell = cells[cell_index]; |
3450 if (cell != 0) { | 3450 if (cell != 0) { |
3451 // We have a live object. Check approximately whether it is more than 32 | 3451 // We have a live object. Check approximately whether it is more than 32 |
3452 // words since the last live object. | 3452 // words since the last live object. |
3453 if (block_address - free_start > 32 * kPointerSize) { | 3453 if (block_address - free_start > 32 * kPointerSize) { |
3454 free_start = DigestFreeStart(free_start, free_start_cell); | 3454 free_start = DigestFreeStart(free_start, free_start_cell); |
3455 if (block_address - free_start > 32 * kPointerSize) { | 3455 if (block_address - free_start > 32 * kPointerSize) { |
3456 // Now that we know the exact start of the free space it still looks | 3456 // Now that we know the exact start of the free space it still looks |
3457 // like we have a large enough free space to be worth bothering with. | 3457 // like we have a large enough free space to be worth bothering with. |
3458 // so now we need to find the start of the first live object at the | 3458 // so now we need to find the start of the first live object at the |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3812 while (buffer != NULL) { | 3812 while (buffer != NULL) { |
3813 SlotsBuffer* next_buffer = buffer->next(); | 3813 SlotsBuffer* next_buffer = buffer->next(); |
3814 DeallocateBuffer(buffer); | 3814 DeallocateBuffer(buffer); |
3815 buffer = next_buffer; | 3815 buffer = next_buffer; |
3816 } | 3816 } |
3817 *buffer_address = NULL; | 3817 *buffer_address = NULL; |
3818 } | 3818 } |
3819 | 3819 |
3820 | 3820 |
3821 } } // namespace v8::internal | 3821 } } // namespace v8::internal |
OLD | NEW |