Chromium Code Reviews| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 bool MarkCompactCollector::AreSweeperThreadsActivated() { | 657 bool MarkCompactCollector::AreSweeperThreadsActivated() { |
| 658 return isolate()->sweeper_threads() != NULL || FLAG_job_based_sweeping; | 658 return isolate()->sweeper_threads() != NULL || FLAG_job_based_sweeping; |
| 659 } | 659 } |
| 660 | 660 |
| 661 | 661 |
| 662 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { | 662 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { |
| 663 return sweeping_pending_; | 663 return sweeping_pending_; |
| 664 } | 664 } |
| 665 | 665 |
| 666 | 666 |
| 667 bool MarkCompactCollector::CanMoveObjectStart(HeapObject* object) { | |
| 668 Address address = object->address(); | |
| 669 bool is_in_old_pointer_space = heap_->InOldPointerSpace(address); | |
| 670 bool is_in_old_data_space = heap_->InOldDataSpace(address); | |
| 671 | |
| 672 if (heap_->lo_space()->Contains(object)) return false; | |
| 673 | |
| 674 // We cannot move the object start if the given old space page is | |
| 675 // concurrently swept. | |
| 676 return (!is_in_old_pointer_space && !is_in_old_data_space) || | |
| 677 Page::FromAddress(address)->parallel_sweeping() <= | |
| 678 MemoryChunk::PARALLEL_SWEEPING_FINALIZE; | |
| 679 } | |
|
Michael Starzinger
2014/03/24 12:21:35
nit: Indentation is off.
Hannes Payer (out of office)
2014/03/25 11:41:08
Done.
| |
| 680 | |
| 681 | |
| 667 void Marking::TransferMark(Address old_start, Address new_start) { | 682 void Marking::TransferMark(Address old_start, Address new_start) { |
| 668 // This is only used when resizing an object. | 683 // This is only used when resizing an object. |
| 669 ASSERT(MemoryChunk::FromAddress(old_start) == | 684 ASSERT(MemoryChunk::FromAddress(old_start) == |
| 670 MemoryChunk::FromAddress(new_start)); | 685 MemoryChunk::FromAddress(new_start)); |
| 671 | 686 |
| 672 if (!heap_->incremental_marking()->IsMarking()) return; | 687 if (!heap_->incremental_marking()->IsMarking()) return; |
| 673 | 688 |
| 674 // If the mark doesn't move, we don't check the color of the object. | 689 // If the mark doesn't move, we don't check the color of the object. |
| 675 // It doesn't matter whether the object is black, since it hasn't changed | 690 // It doesn't matter whether the object is black, since it hasn't changed |
| 676 // size, so the adjustment to the live data count will be zero anyway. | 691 // size, so the adjustment to the live data count will be zero anyway. |
| (...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4079 FreeList* free_list = space == heap()->old_pointer_space() | 4094 FreeList* free_list = space == heap()->old_pointer_space() |
| 4080 ? free_list_old_pointer_space_.get() | 4095 ? free_list_old_pointer_space_.get() |
| 4081 : free_list_old_data_space_.get(); | 4096 : free_list_old_data_space_.get(); |
| 4082 FreeList private_free_list(space); | 4097 FreeList private_free_list(space); |
| 4083 while (it.has_next()) { | 4098 while (it.has_next()) { |
| 4084 Page* p = it.next(); | 4099 Page* p = it.next(); |
| 4085 | 4100 |
| 4086 if (p->TryParallelSweeping()) { | 4101 if (p->TryParallelSweeping()) { |
| 4087 SweepConservatively<SWEEP_IN_PARALLEL>(space, &private_free_list, p); | 4102 SweepConservatively<SWEEP_IN_PARALLEL>(space, &private_free_list, p); |
| 4088 free_list->Concatenate(&private_free_list); | 4103 free_list->Concatenate(&private_free_list); |
| 4104 p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_FINALIZE); | |
| 4089 } | 4105 } |
| 4090 } | 4106 } |
| 4091 } | 4107 } |
| 4092 | 4108 |
| 4093 | 4109 |
| 4094 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { | 4110 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
| 4095 space->set_was_swept_conservatively(sweeper == CONSERVATIVE || | 4111 space->set_was_swept_conservatively(sweeper == CONSERVATIVE || |
| 4096 sweeper == LAZY_CONSERVATIVE || | 4112 sweeper == LAZY_CONSERVATIVE || |
| 4097 sweeper == PARALLEL_CONSERVATIVE || | 4113 sweeper == PARALLEL_CONSERVATIVE || |
| 4098 sweeper == CONCURRENT_CONSERVATIVE); | 4114 sweeper == CONCURRENT_CONSERVATIVE); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4277 | 4293 |
| 4278 // Deallocate evacuated candidate pages. | 4294 // Deallocate evacuated candidate pages. |
| 4279 ReleaseEvacuationCandidates(); | 4295 ReleaseEvacuationCandidates(); |
| 4280 } | 4296 } |
| 4281 | 4297 |
| 4282 | 4298 |
| 4283 void MarkCompactCollector::ParallelSweepSpaceComplete(PagedSpace* space) { | 4299 void MarkCompactCollector::ParallelSweepSpaceComplete(PagedSpace* space) { |
| 4284 PageIterator it(space); | 4300 PageIterator it(space); |
| 4285 while (it.has_next()) { | 4301 while (it.has_next()) { |
| 4286 Page* p = it.next(); | 4302 Page* p = it.next(); |
| 4287 if (p->parallel_sweeping() == MemoryChunk::PARALLEL_SWEEPING_IN_PROGRESS) { | 4303 if (p->parallel_sweeping() == MemoryChunk::PARALLEL_SWEEPING_FINALIZE) { |
| 4288 p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_DONE); | 4304 p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_DONE); |
| 4289 p->MarkSweptConservatively(); | 4305 p->MarkSweptConservatively(); |
| 4290 } | 4306 } |
| 4307 ASSERT(p->parallel_sweeping() == MemoryChunk::PARALLEL_SWEEPING_DONE); | |
| 4291 } | 4308 } |
| 4292 } | 4309 } |
| 4293 | 4310 |
| 4294 | 4311 |
| 4295 void MarkCompactCollector::ParallelSweepSpacesComplete() { | 4312 void MarkCompactCollector::ParallelSweepSpacesComplete() { |
| 4296 ParallelSweepSpaceComplete(heap()->old_pointer_space()); | 4313 ParallelSweepSpaceComplete(heap()->old_pointer_space()); |
| 4297 ParallelSweepSpaceComplete(heap()->old_data_space()); | 4314 ParallelSweepSpaceComplete(heap()->old_data_space()); |
| 4298 } | 4315 } |
| 4299 | 4316 |
| 4300 | 4317 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4518 while (buffer != NULL) { | 4535 while (buffer != NULL) { |
| 4519 SlotsBuffer* next_buffer = buffer->next(); | 4536 SlotsBuffer* next_buffer = buffer->next(); |
| 4520 DeallocateBuffer(buffer); | 4537 DeallocateBuffer(buffer); |
| 4521 buffer = next_buffer; | 4538 buffer = next_buffer; |
| 4522 } | 4539 } |
| 4523 *buffer_address = NULL; | 4540 *buffer_address = NULL; |
| 4524 } | 4541 } |
| 4525 | 4542 |
| 4526 | 4543 |
| 4527 } } // namespace v8::internal | 4544 } } // namespace v8::internal |
| OLD | NEW |