OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 heap_->CompletelyClearInstanceofCache(); | 447 heap_->CompletelyClearInstanceofCache(); |
448 heap_->isolate()->compilation_cache()->MarkCompactPrologue(); | 448 heap_->isolate()->compilation_cache()->MarkCompactPrologue(); |
449 | 449 |
450 if (FLAG_cleanup_code_caches_at_gc) { | 450 if (FLAG_cleanup_code_caches_at_gc) { |
451 // We will mark cache black with a separate pass | 451 // We will mark cache black with a separate pass |
452 // when we finish marking. | 452 // when we finish marking. |
453 MarkObjectGreyDoNotEnqueue(heap_->polymorphic_code_cache()); | 453 MarkObjectGreyDoNotEnqueue(heap_->polymorphic_code_cache()); |
454 } | 454 } |
455 | 455 |
| 456 if (is_compacting_) { |
| 457 // It's difficult to filter out slots recorded for large objects. |
| 458 LargeObjectIterator it(heap_->lo_space()); |
| 459 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
| 460 if (obj->IsFixedArray() || obj->IsCode()) { |
| 461 Page* p = Page::FromAddress(obj->address()); |
| 462 if (p->size() > static_cast<size_t>(Page::kPageSize)) { |
| 463 p->SetFlag(Page::RESCAN_ON_EVACUATION); |
| 464 } |
| 465 } |
| 466 } |
| 467 } |
| 468 |
456 // Mark strong roots grey. | 469 // Mark strong roots grey. |
457 IncrementalMarkingRootMarkingVisitor visitor(heap_, this); | 470 IncrementalMarkingRootMarkingVisitor visitor(heap_, this); |
458 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 471 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
459 | 472 |
460 // Ready to start incremental marking. | 473 // Ready to start incremental marking. |
461 if (FLAG_trace_incremental_marking) { | 474 if (FLAG_trace_incremental_marking) { |
462 PrintF("[IncrementalMarking] Running\n"); | 475 PrintF("[IncrementalMarking] Running\n"); |
463 } | 476 } |
464 } | 477 } |
465 | 478 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 if (FLAG_trace_incremental_marking) { | 611 if (FLAG_trace_incremental_marking) { |
599 PrintF("[IncrementalMarking] Aborting.\n"); | 612 PrintF("[IncrementalMarking] Aborting.\n"); |
600 } | 613 } |
601 heap_->new_space()->LowerInlineAllocationLimit(0); | 614 heap_->new_space()->LowerInlineAllocationLimit(0); |
602 IncrementalMarking::set_should_hurry(false); | 615 IncrementalMarking::set_should_hurry(false); |
603 ResetStepCounters(); | 616 ResetStepCounters(); |
604 if (IsMarking()) { | 617 if (IsMarking()) { |
605 PatchIncrementalMarkingRecordWriteStubs(heap_, | 618 PatchIncrementalMarkingRecordWriteStubs(heap_, |
606 RecordWriteStub::STORE_BUFFER_ONLY); | 619 RecordWriteStub::STORE_BUFFER_ONLY); |
607 DeactivateIncrementalWriteBarrier(); | 620 DeactivateIncrementalWriteBarrier(); |
| 621 |
| 622 if (is_compacting_) { |
| 623 LargeObjectIterator it(heap_->lo_space()); |
| 624 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
| 625 Page* p = Page::FromAddress(obj->address()); |
| 626 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| 627 p->ClearFlag(Page::RESCAN_ON_EVACUATION); |
| 628 } |
| 629 } |
| 630 } |
608 } | 631 } |
609 heap_->isolate()->stack_guard()->Continue(GC_REQUEST); | 632 heap_->isolate()->stack_guard()->Continue(GC_REQUEST); |
610 state_ = STOPPED; | 633 state_ = STOPPED; |
611 is_compacting_ = false; | 634 is_compacting_ = false; |
612 } | 635 } |
613 | 636 |
614 | 637 |
615 void IncrementalMarking::Finalize() { | 638 void IncrementalMarking::Finalize() { |
616 Hurry(); | 639 Hurry(); |
617 state_ = STOPPED; | 640 state_ = STOPPED; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 bytes_rescanned_ = 0; | 794 bytes_rescanned_ = 0; |
772 allocation_marking_factor_ = kInitialAllocationMarkingFactor; | 795 allocation_marking_factor_ = kInitialAllocationMarkingFactor; |
773 } | 796 } |
774 | 797 |
775 | 798 |
776 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 799 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
777 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); | 800 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); |
778 } | 801 } |
779 | 802 |
780 } } // namespace v8::internal | 803 } } // namespace v8::internal |
OLD | NEW |