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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 bool MarkCompactCollector::AreSweeperThreadsActivated() { | 653 bool MarkCompactCollector::AreSweeperThreadsActivated() { |
654 return isolate()->sweeper_threads() != NULL || FLAG_job_based_sweeping; | 654 return isolate()->sweeper_threads() != NULL || FLAG_job_based_sweeping; |
655 } | 655 } |
656 | 656 |
657 | 657 |
658 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { | 658 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { |
659 return sweeping_pending_; | 659 return sweeping_pending_; |
660 } | 660 } |
661 | 661 |
662 | 662 |
663 bool Marking::TransferMark(Address old_start, Address new_start) { | 663 void Marking::TransferMark(Address old_start, Address new_start) { |
664 // This is only used when resizing an object. | 664 // This is only used when resizing an object. |
665 ASSERT(MemoryChunk::FromAddress(old_start) == | 665 ASSERT(MemoryChunk::FromAddress(old_start) == |
666 MemoryChunk::FromAddress(new_start)); | 666 MemoryChunk::FromAddress(new_start)); |
667 | 667 |
| 668 if (!heap_->incremental_marking()->IsMarking()) return; |
| 669 |
668 // If the mark doesn't move, we don't check the color of the object. | 670 // If the mark doesn't move, we don't check the color of the object. |
669 // It doesn't matter whether the object is black, since it hasn't changed | 671 // It doesn't matter whether the object is black, since it hasn't changed |
670 // size, so the adjustment to the live data count will be zero anyway. | 672 // size, so the adjustment to the live data count will be zero anyway. |
671 if (old_start == new_start) return false; | 673 if (old_start == new_start) return; |
672 | 674 |
673 MarkBit new_mark_bit = MarkBitFrom(new_start); | 675 MarkBit new_mark_bit = MarkBitFrom(new_start); |
674 MarkBit old_mark_bit = MarkBitFrom(old_start); | 676 MarkBit old_mark_bit = MarkBitFrom(old_start); |
675 | 677 |
676 #ifdef DEBUG | 678 #ifdef DEBUG |
677 ObjectColor old_color = Color(old_mark_bit); | 679 ObjectColor old_color = Color(old_mark_bit); |
678 #endif | 680 #endif |
679 | 681 |
680 if (Marking::IsBlack(old_mark_bit)) { | 682 if (Marking::IsBlack(old_mark_bit)) { |
681 old_mark_bit.Clear(); | 683 old_mark_bit.Clear(); |
682 ASSERT(IsWhite(old_mark_bit)); | 684 ASSERT(IsWhite(old_mark_bit)); |
683 Marking::MarkBlack(new_mark_bit); | 685 Marking::MarkBlack(new_mark_bit); |
684 return true; | 686 return; |
685 } else if (Marking::IsGrey(old_mark_bit)) { | 687 } else if (Marking::IsGrey(old_mark_bit)) { |
686 ASSERT(heap_->incremental_marking()->IsMarking()); | |
687 old_mark_bit.Clear(); | 688 old_mark_bit.Clear(); |
688 old_mark_bit.Next().Clear(); | 689 old_mark_bit.Next().Clear(); |
689 ASSERT(IsWhite(old_mark_bit)); | 690 ASSERT(IsWhite(old_mark_bit)); |
690 heap_->incremental_marking()->WhiteToGreyAndPush( | 691 heap_->incremental_marking()->WhiteToGreyAndPush( |
691 HeapObject::FromAddress(new_start), new_mark_bit); | 692 HeapObject::FromAddress(new_start), new_mark_bit); |
692 heap_->incremental_marking()->RestartIfNotMarking(); | 693 heap_->incremental_marking()->RestartIfNotMarking(); |
693 } | 694 } |
694 | 695 |
695 #ifdef DEBUG | 696 #ifdef DEBUG |
696 ObjectColor new_color = Color(new_mark_bit); | 697 ObjectColor new_color = Color(new_mark_bit); |
697 ASSERT(new_color == old_color); | 698 ASSERT(new_color == old_color); |
698 #endif | 699 #endif |
699 | |
700 return false; | |
701 } | 700 } |
702 | 701 |
703 | 702 |
704 const char* AllocationSpaceName(AllocationSpace space) { | 703 const char* AllocationSpaceName(AllocationSpace space) { |
705 switch (space) { | 704 switch (space) { |
706 case NEW_SPACE: return "NEW_SPACE"; | 705 case NEW_SPACE: return "NEW_SPACE"; |
707 case OLD_POINTER_SPACE: return "OLD_POINTER_SPACE"; | 706 case OLD_POINTER_SPACE: return "OLD_POINTER_SPACE"; |
708 case OLD_DATA_SPACE: return "OLD_DATA_SPACE"; | 707 case OLD_DATA_SPACE: return "OLD_DATA_SPACE"; |
709 case CODE_SPACE: return "CODE_SPACE"; | 708 case CODE_SPACE: return "CODE_SPACE"; |
710 case MAP_SPACE: return "MAP_SPACE"; | 709 case MAP_SPACE: return "MAP_SPACE"; |
(...skipping 3802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4513 while (buffer != NULL) { | 4512 while (buffer != NULL) { |
4514 SlotsBuffer* next_buffer = buffer->next(); | 4513 SlotsBuffer* next_buffer = buffer->next(); |
4515 DeallocateBuffer(buffer); | 4514 DeallocateBuffer(buffer); |
4516 buffer = next_buffer; | 4515 buffer = next_buffer; |
4517 } | 4516 } |
4518 *buffer_address = NULL; | 4517 *buffer_address = NULL; |
4519 } | 4518 } |
4520 | 4519 |
4521 | 4520 |
4522 } } // namespace v8::internal | 4521 } } // namespace v8::internal |
OLD | NEW |