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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ClearNonLiveReferences(); | 314 ClearNonLiveReferences(); |
315 | 315 |
316 RecordObjectStats(); | 316 RecordObjectStats(); |
317 | 317 |
318 #ifdef VERIFY_HEAP | 318 #ifdef VERIFY_HEAP |
319 if (FLAG_verify_heap) { | 319 if (FLAG_verify_heap) { |
320 VerifyMarking(heap_); | 320 VerifyMarking(heap_); |
321 } | 321 } |
322 #endif | 322 #endif |
323 | 323 |
324 SweepSpaces(); | 324 StartSweepSpaces(); |
325 | 325 |
326 EvacuateNewSpaceAndCandidates(); | 326 EvacuateNewSpaceAndCandidates(); |
327 | 327 |
328 Finish(); | 328 Finish(); |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 #ifdef VERIFY_HEAP | 332 #ifdef VERIFY_HEAP |
333 void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { | 333 void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { |
334 for (Page* p : *space) { | 334 for (Page* p : *space) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 DISALLOW_COPY_AND_ASSIGN(SweeperTask); | 445 DISALLOW_COPY_AND_ASSIGN(SweeperTask); |
446 }; | 446 }; |
447 | 447 |
448 void MarkCompactCollector::Sweeper::StartSweeping() { | 448 void MarkCompactCollector::Sweeper::StartSweeping() { |
449 sweeping_in_progress_ = true; | 449 sweeping_in_progress_ = true; |
450 ForAllSweepingSpaces([this](AllocationSpace space) { | 450 ForAllSweepingSpaces([this](AllocationSpace space) { |
451 std::sort(sweeping_list_[space].begin(), sweeping_list_[space].end(), | 451 std::sort(sweeping_list_[space].begin(), sweeping_list_[space].end(), |
452 [](Page* a, Page* b) { return a->LiveBytes() < b->LiveBytes(); }); | 452 [](Page* a, Page* b) { return a->LiveBytes() < b->LiveBytes(); }); |
453 }); | 453 }); |
454 if (FLAG_concurrent_sweeping) { | 454 } |
| 455 |
| 456 void MarkCompactCollector::Sweeper::StartSweeperTasks() { |
| 457 if (FLAG_concurrent_sweeping && sweeping_in_progress_) { |
455 ForAllSweepingSpaces([this](AllocationSpace space) { | 458 ForAllSweepingSpaces([this](AllocationSpace space) { |
456 if (space == NEW_SPACE) return; | 459 if (space == NEW_SPACE) return; |
457 StartSweepingHelper(space); | 460 num_sweeping_tasks_.Increment(1); |
| 461 V8::GetCurrentPlatform()->CallOnBackgroundThread( |
| 462 new SweeperTask(this, &pending_sweeper_tasks_semaphore_, space), |
| 463 v8::Platform::kShortRunningTask); |
458 }); | 464 }); |
459 } | 465 } |
460 } | 466 } |
461 | 467 |
462 void MarkCompactCollector::Sweeper::StartSweepingHelper( | |
463 AllocationSpace space_to_start) { | |
464 num_sweeping_tasks_.Increment(1); | |
465 V8::GetCurrentPlatform()->CallOnBackgroundThread( | |
466 new SweeperTask(this, &pending_sweeper_tasks_semaphore_, space_to_start), | |
467 v8::Platform::kShortRunningTask); | |
468 } | |
469 | |
470 void MarkCompactCollector::Sweeper::SweepOrWaitUntilSweepingCompleted( | 468 void MarkCompactCollector::Sweeper::SweepOrWaitUntilSweepingCompleted( |
471 Page* page) { | 469 Page* page) { |
472 if (!page->SweepingDone()) { | 470 if (!page->SweepingDone()) { |
473 ParallelSweepPage(page, page->owner()->identity()); | 471 ParallelSweepPage(page, page->owner()->identity()); |
474 if (!page->SweepingDone()) { | 472 if (!page->SweepingDone()) { |
475 // We were not able to sweep that page, i.e., a concurrent | 473 // We were not able to sweep that page, i.e., a concurrent |
476 // sweeper thread currently owns this page. Wait for the sweeper | 474 // sweeper thread currently owns this page. Wait for the sweeper |
477 // thread to be done with this page. | 475 // thread to be done with this page. |
478 page->WaitUntilSweepingCompleted(); | 476 page->WaitUntilSweepingCompleted(); |
479 } | 477 } |
480 } | 478 } |
481 } | 479 } |
482 | 480 |
483 void MarkCompactCollector::SweepAndRefill(CompactionSpace* space) { | 481 void MarkCompactCollector::SweepAndRefill(CompactionSpace* space) { |
484 if (FLAG_concurrent_sweeping && !sweeper().IsSweepingCompleted()) { | 482 if (FLAG_concurrent_sweeping && |
| 483 !sweeper().IsSweepingCompleted(space->identity())) { |
485 sweeper().ParallelSweepSpace(space->identity(), 0); | 484 sweeper().ParallelSweepSpace(space->identity(), 0); |
486 space->RefillFreeList(); | 485 space->RefillFreeList(); |
487 } | 486 } |
488 } | 487 } |
489 | 488 |
490 Page* MarkCompactCollector::Sweeper::GetSweptPageSafe(PagedSpace* space) { | 489 Page* MarkCompactCollector::Sweeper::GetSweptPageSafe(PagedSpace* space) { |
491 base::LockGuard<base::Mutex> guard(&mutex_); | 490 base::LockGuard<base::Mutex> guard(&mutex_); |
492 SweptList& list = swept_list_[space->identity()]; | 491 SweptList& list = swept_list_[space->identity()]; |
493 if (list.length() > 0) { | 492 if (list.length() > 0) { |
494 return list.RemoveLast(); | 493 return list.RemoveLast(); |
495 } | 494 } |
496 return nullptr; | 495 return nullptr; |
497 } | 496 } |
498 | 497 |
499 void MarkCompactCollector::Sweeper::EnsureCompleted() { | 498 void MarkCompactCollector::Sweeper::EnsureCompleted() { |
500 if (!sweeping_in_progress_) return; | 499 if (!sweeping_in_progress_) return; |
501 | 500 |
502 // If sweeping is not completed or not running at all, we try to complete it | 501 // If sweeping is not completed or not running at all, we try to complete it |
503 // here. | 502 // here. |
504 if (!FLAG_concurrent_sweeping || !IsSweepingCompleted()) { | 503 ForAllSweepingSpaces([this](AllocationSpace space) { |
505 ForAllSweepingSpaces( | 504 if (!FLAG_concurrent_sweeping || !this->IsSweepingCompleted(space)) { |
506 [this](AllocationSpace space) { ParallelSweepSpace(space, 0); }); | 505 ParallelSweepSpace(space, 0); |
507 } | 506 } |
| 507 }); |
508 | 508 |
509 if (FLAG_concurrent_sweeping) { | 509 if (FLAG_concurrent_sweeping) { |
510 while (num_sweeping_tasks_.Value() > 0) { | 510 while (num_sweeping_tasks_.Value() > 0) { |
511 pending_sweeper_tasks_semaphore_.Wait(); | 511 pending_sweeper_tasks_semaphore_.Wait(); |
512 num_sweeping_tasks_.Increment(-1); | 512 num_sweeping_tasks_.Increment(-1); |
513 } | 513 } |
514 } | 514 } |
515 | 515 |
516 ForAllSweepingSpaces([this](AllocationSpace space) { | 516 ForAllSweepingSpaces([this](AllocationSpace space) { |
517 if (space == NEW_SPACE) { | 517 if (space == NEW_SPACE) { |
518 swept_list_[NEW_SPACE].Clear(); | 518 swept_list_[NEW_SPACE].Clear(); |
519 } | 519 } |
520 DCHECK(sweeping_list_[space].empty()); | 520 DCHECK(sweeping_list_[space].empty()); |
521 }); | 521 }); |
522 late_pages_ = false; | |
523 sweeping_in_progress_ = false; | 522 sweeping_in_progress_ = false; |
524 } | 523 } |
525 | 524 |
526 void MarkCompactCollector::Sweeper::EnsureNewSpaceCompleted() { | 525 void MarkCompactCollector::Sweeper::EnsureNewSpaceCompleted() { |
527 if (!sweeping_in_progress_) return; | 526 if (!sweeping_in_progress_) return; |
528 if (!FLAG_concurrent_sweeping || !IsSweepingCompleted()) { | 527 if (!FLAG_concurrent_sweeping || !IsSweepingCompleted(NEW_SPACE)) { |
529 for (Page* p : *heap_->new_space()) { | 528 for (Page* p : *heap_->new_space()) { |
530 SweepOrWaitUntilSweepingCompleted(p); | 529 SweepOrWaitUntilSweepingCompleted(p); |
531 } | 530 } |
532 } | 531 } |
533 } | 532 } |
534 | 533 |
535 void MarkCompactCollector::EnsureSweepingCompleted() { | 534 void MarkCompactCollector::EnsureSweepingCompleted() { |
536 if (!sweeper().sweeping_in_progress()) return; | 535 if (!sweeper().sweeping_in_progress()) return; |
537 | 536 |
538 sweeper().EnsureCompleted(); | 537 sweeper().EnsureCompleted(); |
539 heap()->old_space()->RefillFreeList(); | 538 heap()->old_space()->RefillFreeList(); |
540 heap()->code_space()->RefillFreeList(); | 539 heap()->code_space()->RefillFreeList(); |
541 heap()->map_space()->RefillFreeList(); | 540 heap()->map_space()->RefillFreeList(); |
542 | 541 |
543 #ifdef VERIFY_HEAP | 542 #ifdef VERIFY_HEAP |
544 if (FLAG_verify_heap && !evacuation()) { | 543 if (FLAG_verify_heap && !evacuation()) { |
545 VerifyEvacuation(heap_); | 544 VerifyEvacuation(heap_); |
546 } | 545 } |
547 #endif | 546 #endif |
548 } | 547 } |
549 | 548 |
550 bool MarkCompactCollector::Sweeper::IsSweepingCompleted() { | 549 bool MarkCompactCollector::Sweeper::AreSweeperTasksRunning() { |
551 DCHECK(FLAG_concurrent_sweeping); | 550 DCHECK(FLAG_concurrent_sweeping); |
552 while (pending_sweeper_tasks_semaphore_.WaitFor( | 551 while (pending_sweeper_tasks_semaphore_.WaitFor( |
553 base::TimeDelta::FromSeconds(0))) { | 552 base::TimeDelta::FromSeconds(0))) { |
554 num_sweeping_tasks_.Increment(-1); | 553 num_sweeping_tasks_.Increment(-1); |
555 } | 554 } |
556 return num_sweeping_tasks_.Value() == 0; | 555 return num_sweeping_tasks_.Value() != 0; |
| 556 } |
| 557 |
| 558 bool MarkCompactCollector::Sweeper::IsSweepingCompleted(AllocationSpace space) { |
| 559 DCHECK(FLAG_concurrent_sweeping); |
| 560 if (AreSweeperTasksRunning()) return false; |
| 561 base::LockGuard<base::Mutex> guard(&mutex_); |
| 562 return sweeping_list_[space].empty(); |
557 } | 563 } |
558 | 564 |
559 const char* AllocationSpaceName(AllocationSpace space) { | 565 const char* AllocationSpaceName(AllocationSpace space) { |
560 switch (space) { | 566 switch (space) { |
561 case NEW_SPACE: | 567 case NEW_SPACE: |
562 return "NEW_SPACE"; | 568 return "NEW_SPACE"; |
563 case OLD_SPACE: | 569 case OLD_SPACE: |
564 return "OLD_SPACE"; | 570 return "OLD_SPACE"; |
565 case CODE_SPACE: | 571 case CODE_SPACE: |
566 return "CODE_SPACE"; | 572 return "CODE_SPACE"; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 if (!was_marked_incrementally_ && FLAG_verify_heap) { | 831 if (!was_marked_incrementally_ && FLAG_verify_heap) { |
826 VerifyMarkbitsAreClean(); | 832 VerifyMarkbitsAreClean(); |
827 } | 833 } |
828 #endif | 834 #endif |
829 } | 835 } |
830 | 836 |
831 | 837 |
832 void MarkCompactCollector::Finish() { | 838 void MarkCompactCollector::Finish() { |
833 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_FINISH); | 839 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_FINISH); |
834 | 840 |
835 if (sweeper().contains_late_pages() && FLAG_concurrent_sweeping) { | 841 sweeper().StartSweeperTasks(); |
836 // If we added some more pages during MC, we need to start at least one | |
837 // more task as all other tasks might already be finished. | |
838 sweeper().StartSweepingHelper(OLD_SPACE); | |
839 } | |
840 | 842 |
841 // The hashing of weak_object_to_code_table is no longer valid. | 843 // The hashing of weak_object_to_code_table is no longer valid. |
842 heap()->weak_object_to_code_table()->Rehash( | 844 heap()->weak_object_to_code_table()->Rehash( |
843 heap()->isolate()->factory()->undefined_value()); | 845 heap()->isolate()->factory()->undefined_value()); |
844 | 846 |
845 // Clear the marking state of live large objects. | 847 // Clear the marking state of live large objects. |
846 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); | 848 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); |
847 | 849 |
848 #ifdef DEBUG | 850 #ifdef DEBUG |
849 DCHECK(state_ == SWEEP_SPACES || state_ == RELOCATE_OBJECTS); | 851 DCHECK(state_ == SWEEP_SPACES || state_ == RELOCATE_OBJECTS); |
(...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3166 } | 3168 } |
3167 | 3169 |
3168 int MarkCompactCollector::NumberOfParallelCompactionTasks(int pages, | 3170 int MarkCompactCollector::NumberOfParallelCompactionTasks(int pages, |
3169 intptr_t live_bytes) { | 3171 intptr_t live_bytes) { |
3170 if (!FLAG_parallel_compaction) return 1; | 3172 if (!FLAG_parallel_compaction) return 1; |
3171 // Compute the number of needed tasks based on a target compaction time, the | 3173 // Compute the number of needed tasks based on a target compaction time, the |
3172 // profiled compaction speed and marked live memory. | 3174 // profiled compaction speed and marked live memory. |
3173 // | 3175 // |
3174 // The number of parallel compaction tasks is limited by: | 3176 // The number of parallel compaction tasks is limited by: |
3175 // - #evacuation pages | 3177 // - #evacuation pages |
3176 // - (#cores - 1) | 3178 // - #cores |
3177 const double kTargetCompactionTimeInMs = .5; | 3179 const double kTargetCompactionTimeInMs = .5; |
3178 const int kNumSweepingTasks = 3; | |
3179 | 3180 |
3180 double compaction_speed = | 3181 double compaction_speed = |
3181 heap()->tracer()->CompactionSpeedInBytesPerMillisecond(); | 3182 heap()->tracer()->CompactionSpeedInBytesPerMillisecond(); |
3182 | 3183 |
3183 const int available_cores = Max( | 3184 const int available_cores = Max( |
3184 1, static_cast<int>( | 3185 1, static_cast<int>( |
3185 V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()) - | 3186 V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads())); |
3186 kNumSweepingTasks - 1); | |
3187 int tasks; | 3187 int tasks; |
3188 if (compaction_speed > 0) { | 3188 if (compaction_speed > 0) { |
3189 tasks = 1 + static_cast<int>(live_bytes / compaction_speed / | 3189 tasks = 1 + static_cast<int>(live_bytes / compaction_speed / |
3190 kTargetCompactionTimeInMs); | 3190 kTargetCompactionTimeInMs); |
3191 } else { | 3191 } else { |
3192 tasks = pages; | 3192 tasks = pages; |
3193 } | 3193 } |
3194 const int tasks_capped_pages = Min(pages, tasks); | 3194 const int tasks_capped_pages = Min(pages, tasks); |
3195 return Min(available_cores, tasks_capped_pages); | 3195 return Min(available_cores, tasks_capped_pages); |
3196 } | 3196 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3536 // still contain stale pointers. We only free the chunks after pointer updates | 3536 // still contain stale pointers. We only free the chunks after pointer updates |
3537 // to still have access to page headers. | 3537 // to still have access to page headers. |
3538 heap()->memory_allocator()->unmapper()->FreeQueuedChunks(); | 3538 heap()->memory_allocator()->unmapper()->FreeQueuedChunks(); |
3539 | 3539 |
3540 { | 3540 { |
3541 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_CLEAN_UP); | 3541 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_CLEAN_UP); |
3542 | 3542 |
3543 for (Page* p : newspace_evacuation_candidates_) { | 3543 for (Page* p : newspace_evacuation_candidates_) { |
3544 if (p->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION)) { | 3544 if (p->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION)) { |
3545 p->ClearFlag(Page::PAGE_NEW_NEW_PROMOTION); | 3545 p->ClearFlag(Page::PAGE_NEW_NEW_PROMOTION); |
3546 sweeper().AddLatePage(p->owner()->identity(), p); | 3546 sweeper().AddPage(p->owner()->identity(), p); |
3547 } else if (p->IsFlagSet(Page::PAGE_NEW_OLD_PROMOTION)) { | 3547 } else if (p->IsFlagSet(Page::PAGE_NEW_OLD_PROMOTION)) { |
3548 p->ClearFlag(Page::PAGE_NEW_OLD_PROMOTION); | 3548 p->ClearFlag(Page::PAGE_NEW_OLD_PROMOTION); |
3549 p->ForAllFreeListCategories( | 3549 p->ForAllFreeListCategories( |
3550 [](FreeListCategory* category) { DCHECK(!category->is_linked()); }); | 3550 [](FreeListCategory* category) { DCHECK(!category->is_linked()); }); |
3551 sweeper().AddLatePage(p->owner()->identity(), p); | 3551 sweeper().AddPage(p->owner()->identity(), p); |
3552 } | 3552 } |
3553 } | 3553 } |
3554 newspace_evacuation_candidates_.Rewind(0); | 3554 newspace_evacuation_candidates_.Rewind(0); |
3555 | 3555 |
3556 for (Page* p : evacuation_candidates_) { | 3556 for (Page* p : evacuation_candidates_) { |
3557 // Important: skip list should be cleared only after roots were updated | 3557 // Important: skip list should be cleared only after roots were updated |
3558 // because root iteration traverses the stack and might have to find | 3558 // because root iteration traverses the stack and might have to find |
3559 // code objects from non-updated pc pointing into evacuation candidate. | 3559 // code objects from non-updated pc pointing into evacuation candidate. |
3560 SkipList* list = p->skip_list(); | 3560 SkipList* list = p->skip_list(); |
3561 if (list != NULL) list->Clear(); | 3561 if (list != NULL) list->Clear(); |
3562 if (p->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) { | 3562 if (p->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) { |
3563 sweeper().AddLatePage(p->owner()->identity(), p); | 3563 sweeper().AddPage(p->owner()->identity(), p); |
3564 p->ClearFlag(Page::COMPACTION_WAS_ABORTED); | 3564 p->ClearFlag(Page::COMPACTION_WAS_ABORTED); |
3565 } | 3565 } |
3566 } | 3566 } |
3567 | 3567 |
3568 // Deallocate evacuated candidate pages. | 3568 // Deallocate evacuated candidate pages. |
3569 ReleaseEvacuationCandidates(); | 3569 ReleaseEvacuationCandidates(); |
3570 } | 3570 } |
3571 | 3571 |
3572 #ifdef VERIFY_HEAP | 3572 #ifdef VERIFY_HEAP |
3573 if (FLAG_verify_heap && !sweeper().sweeping_in_progress()) { | 3573 if (FLAG_verify_heap && !sweeper().sweeping_in_progress()) { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 base::LockGuard<base::Mutex> guard(&mutex_); | 3855 base::LockGuard<base::Mutex> guard(&mutex_); |
3856 swept_list_[identity].Add(page); | 3856 swept_list_[identity].Add(page); |
3857 } | 3857 } |
3858 page->concurrent_sweeping_state().SetValue(Page::kSweepingDone); | 3858 page->concurrent_sweeping_state().SetValue(Page::kSweepingDone); |
3859 page->mutex()->Unlock(); | 3859 page->mutex()->Unlock(); |
3860 } | 3860 } |
3861 return max_freed; | 3861 return max_freed; |
3862 } | 3862 } |
3863 | 3863 |
3864 void MarkCompactCollector::Sweeper::AddPage(AllocationSpace space, Page* page) { | 3864 void MarkCompactCollector::Sweeper::AddPage(AllocationSpace space, Page* page) { |
3865 DCHECK(!sweeping_in_progress_); | 3865 DCHECK(!FLAG_concurrent_sweeping || !AreSweeperTasksRunning()); |
3866 PrepareToBeSweptPage(space, page); | 3866 PrepareToBeSweptPage(space, page); |
3867 sweeping_list_[space].push_back(page); | 3867 sweeping_list_[space].push_back(page); |
3868 } | 3868 } |
3869 | 3869 |
3870 void MarkCompactCollector::Sweeper::AddLatePage(AllocationSpace space, | |
3871 Page* page) { | |
3872 DCHECK(sweeping_in_progress_); | |
3873 PrepareToBeSweptPage(space, page); | |
3874 late_pages_ = true; | |
3875 AddSweepingPageSafe(space, page); | |
3876 } | |
3877 | |
3878 void MarkCompactCollector::Sweeper::PrepareToBeSweptPage(AllocationSpace space, | 3870 void MarkCompactCollector::Sweeper::PrepareToBeSweptPage(AllocationSpace space, |
3879 Page* page) { | 3871 Page* page) { |
3880 page->concurrent_sweeping_state().SetValue(Page::kSweepingPending); | 3872 page->concurrent_sweeping_state().SetValue(Page::kSweepingPending); |
3881 DCHECK_GE(page->area_size(), static_cast<size_t>(page->LiveBytes())); | 3873 DCHECK_GE(page->area_size(), static_cast<size_t>(page->LiveBytes())); |
3882 size_t to_sweep = page->area_size() - page->LiveBytes(); | 3874 size_t to_sweep = page->area_size() - page->LiveBytes(); |
3883 if (space != NEW_SPACE) | 3875 if (space != NEW_SPACE) |
3884 heap_->paged_space(space)->accounting_stats_.ShrinkSpace(to_sweep); | 3876 heap_->paged_space(space)->accounting_stats_.ShrinkSpace(to_sweep); |
3885 } | 3877 } |
3886 | 3878 |
3887 Page* MarkCompactCollector::Sweeper::GetSweepingPageSafe( | 3879 Page* MarkCompactCollector::Sweeper::GetSweepingPageSafe( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3948 sweeper().AddPage(space->identity(), p); | 3940 sweeper().AddPage(space->identity(), p); |
3949 will_be_swept++; | 3941 will_be_swept++; |
3950 } | 3942 } |
3951 | 3943 |
3952 if (FLAG_gc_verbose) { | 3944 if (FLAG_gc_verbose) { |
3953 PrintIsolate(isolate(), "sweeping: space=%s initialized_for_sweeping=%d", | 3945 PrintIsolate(isolate(), "sweeping: space=%s initialized_for_sweeping=%d", |
3954 AllocationSpaceName(space->identity()), will_be_swept); | 3946 AllocationSpaceName(space->identity()), will_be_swept); |
3955 } | 3947 } |
3956 } | 3948 } |
3957 | 3949 |
3958 | 3950 void MarkCompactCollector::StartSweepSpaces() { |
3959 void MarkCompactCollector::SweepSpaces() { | |
3960 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_SWEEP); | 3951 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_SWEEP); |
3961 #ifdef DEBUG | 3952 #ifdef DEBUG |
3962 state_ = SWEEP_SPACES; | 3953 state_ = SWEEP_SPACES; |
3963 #endif | 3954 #endif |
3964 | 3955 |
3965 { | 3956 { |
3966 { | 3957 { |
3967 GCTracer::Scope sweep_scope(heap()->tracer(), | 3958 GCTracer::Scope sweep_scope(heap()->tracer(), |
3968 GCTracer::Scope::MC_SWEEP_OLD); | 3959 GCTracer::Scope::MC_SWEEP_OLD); |
3969 StartSweepSpace(heap()->old_space()); | 3960 StartSweepSpace(heap()->old_space()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4019 // The target is always in old space, we don't have to record the slot in | 4010 // The target is always in old space, we don't have to record the slot in |
4020 // the old-to-new remembered set. | 4011 // the old-to-new remembered set. |
4021 DCHECK(!heap()->InNewSpace(target)); | 4012 DCHECK(!heap()->InNewSpace(target)); |
4022 RecordRelocSlot(host, &rinfo, target); | 4013 RecordRelocSlot(host, &rinfo, target); |
4023 } | 4014 } |
4024 } | 4015 } |
4025 } | 4016 } |
4026 | 4017 |
4027 } // namespace internal | 4018 } // namespace internal |
4028 } // namespace v8 | 4019 } // namespace v8 |
OLD | NEW |