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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 DCHECK_GE(space_to_start_, FIRST_PAGED_SPACE); | 473 DCHECK_GE(space_to_start_, FIRST_PAGED_SPACE); |
474 DCHECK_LE(space_to_start_, LAST_PAGED_SPACE); | 474 DCHECK_LE(space_to_start_, LAST_PAGED_SPACE); |
475 const int offset = space_to_start_ - FIRST_PAGED_SPACE; | 475 const int offset = space_to_start_ - FIRST_PAGED_SPACE; |
476 const int num_spaces = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; | 476 const int num_spaces = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; |
477 for (int i = 0; i < num_spaces; i++) { | 477 for (int i = 0; i < num_spaces; i++) { |
478 const int space_id = FIRST_PAGED_SPACE + ((i + offset) % num_spaces); | 478 const int space_id = FIRST_PAGED_SPACE + ((i + offset) % num_spaces); |
479 DCHECK_GE(space_id, FIRST_PAGED_SPACE); | 479 DCHECK_GE(space_id, FIRST_PAGED_SPACE); |
480 DCHECK_LE(space_id, LAST_PAGED_SPACE); | 480 DCHECK_LE(space_id, LAST_PAGED_SPACE); |
481 sweeper_->ParallelSweepSpace(static_cast<AllocationSpace>(space_id), 0); | 481 sweeper_->ParallelSweepSpace(static_cast<AllocationSpace>(space_id), 0); |
482 } | 482 } |
483 pending_sweeper_tasks_->Signal(); | 483 pending_sweeper_tasks_->Signal("SweeperTask::Run"); |
484 } | 484 } |
485 | 485 |
486 Sweeper* sweeper_; | 486 Sweeper* sweeper_; |
487 base::Semaphore* pending_sweeper_tasks_; | 487 base::Semaphore* pending_sweeper_tasks_; |
488 AllocationSpace space_to_start_; | 488 AllocationSpace space_to_start_; |
489 | 489 |
490 DISALLOW_COPY_AND_ASSIGN(SweeperTask); | 490 DISALLOW_COPY_AND_ASSIGN(SweeperTask); |
491 }; | 491 }; |
492 | 492 |
493 void MarkCompactCollector::Sweeper::StartSweeping() { | 493 void MarkCompactCollector::Sweeper::StartSweeping() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 VerifyEvacuation(heap_); | 578 VerifyEvacuation(heap_); |
579 } | 579 } |
580 #endif | 580 #endif |
581 } | 581 } |
582 | 582 |
583 bool MarkCompactCollector::Sweeper::IsSweepingCompleted() { | 583 bool MarkCompactCollector::Sweeper::IsSweepingCompleted() { |
584 if (!pending_sweeper_tasks_semaphore_.WaitFor( | 584 if (!pending_sweeper_tasks_semaphore_.WaitFor( |
585 base::TimeDelta::FromSeconds(0))) { | 585 base::TimeDelta::FromSeconds(0))) { |
586 return false; | 586 return false; |
587 } | 587 } |
588 pending_sweeper_tasks_semaphore_.Signal(); | 588 pending_sweeper_tasks_semaphore_.Signal("Sweeper::IsSweepingCompleted"); |
589 return true; | 589 return true; |
590 } | 590 } |
591 | 591 |
592 void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) { | 592 void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) { |
593 // This is only used when resizing an object. | 593 // This is only used when resizing an object. |
594 DCHECK(MemoryChunk::FromAddress(old_start) == | 594 DCHECK(MemoryChunk::FromAddress(old_start) == |
595 MemoryChunk::FromAddress(new_start)); | 595 MemoryChunk::FromAddress(new_start)); |
596 | 596 |
597 if (!heap->incremental_marking()->IsMarking() || | 597 if (!heap->incremental_marking()->IsMarking() || |
598 Page::FromAddress(old_start)->IsFlagSet(Page::BLACK_PAGE)) | 598 Page::FromAddress(old_start)->IsFlagSet(Page::BLACK_PAGE)) |
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3947 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3947 MarkBit mark_bit = Marking::MarkBitFrom(host); |
3948 if (Marking::IsBlack(mark_bit)) { | 3948 if (Marking::IsBlack(mark_bit)) { |
3949 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3949 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
3950 RecordRelocSlot(host, &rinfo, target); | 3950 RecordRelocSlot(host, &rinfo, target); |
3951 } | 3951 } |
3952 } | 3952 } |
3953 } | 3953 } |
3954 | 3954 |
3955 } // namespace internal | 3955 } // namespace internal |
3956 } // namespace v8 | 3956 } // namespace v8 |
OLD | NEW |