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/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 heap()->map_space()->RefillFreeList(); | 576 heap()->map_space()->RefillFreeList(); |
577 | 577 |
578 #ifdef VERIFY_HEAP | 578 #ifdef VERIFY_HEAP |
579 if (FLAG_verify_heap && !evacuation()) { | 579 if (FLAG_verify_heap && !evacuation()) { |
580 VerifyEvacuation(heap_); | 580 VerifyEvacuation(heap_); |
581 } | 581 } |
582 #endif | 582 #endif |
583 } | 583 } |
584 | 584 |
585 bool MarkCompactCollector::Sweeper::IsSweepingCompleted() { | 585 bool MarkCompactCollector::Sweeper::IsSweepingCompleted() { |
586 while ((num_sweeping_tasks_ > 0) && | 586 if (!pending_sweeper_tasks_semaphore_.WaitFor( |
587 pending_sweeper_tasks_semaphore_.WaitFor( | 587 base::TimeDelta::FromSeconds(0))) { |
588 base::TimeDelta::FromSeconds(0))) { | 588 return false; |
589 num_sweeping_tasks_--; | |
590 } | 589 } |
591 return num_sweeping_tasks_ == 0; | 590 pending_sweeper_tasks_semaphore_.Signal(); |
| 591 return true; |
592 } | 592 } |
593 | 593 |
594 void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) { | 594 void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) { |
595 // This is only used when resizing an object. | 595 // This is only used when resizing an object. |
596 DCHECK(MemoryChunk::FromAddress(old_start) == | 596 DCHECK(MemoryChunk::FromAddress(old_start) == |
597 MemoryChunk::FromAddress(new_start)); | 597 MemoryChunk::FromAddress(new_start)); |
598 | 598 |
599 if (!heap->incremental_marking()->IsMarking() || | 599 if (!heap->incremental_marking()->IsMarking() || |
600 Page::FromAddress(old_start)->IsFlagSet(Page::BLACK_PAGE)) | 600 Page::FromAddress(old_start)->IsFlagSet(Page::BLACK_PAGE)) |
601 return; | 601 return; |
(...skipping 3391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3993 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3993 MarkBit mark_bit = Marking::MarkBitFrom(host); |
3994 if (Marking::IsBlack(mark_bit)) { | 3994 if (Marking::IsBlack(mark_bit)) { |
3995 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3995 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
3996 RecordRelocSlot(host, &rinfo, target); | 3996 RecordRelocSlot(host, &rinfo, target); |
3997 } | 3997 } |
3998 } | 3998 } |
3999 } | 3999 } |
4000 | 4000 |
4001 } // namespace internal | 4001 } // namespace internal |
4002 } // namespace v8 | 4002 } // namespace v8 |
OLD | NEW |