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