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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 | 536 |
| 537 | 537 |
| 538 void MarkCompactCollector::WaitUntilSweepingCompleted() { | 538 void MarkCompactCollector::WaitUntilSweepingCompleted() { |
| 539 if (sweeping_pending_) { | 539 if (sweeping_pending_) { |
| 540 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 540 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 541 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); | 541 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
| 542 } | 542 } |
| 543 sweeping_pending_ = false; | 543 sweeping_pending_ = false; |
| 544 ReleaseEvacuationCandidates(); | |
| 544 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); | 545 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); |
| 545 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); | 546 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); |
| 546 heap()->FreeQueuedChunks(); | 547 heap()->FreeQueuedChunks(); |
| 547 } | 548 } |
| 548 } | 549 } |
| 549 | 550 |
| 550 | 551 |
| 551 intptr_t MarkCompactCollector:: | 552 intptr_t MarkCompactCollector:: |
| 552 StealMemoryFromSweeperThreads(PagedSpace* space) { | 553 StealMemoryFromSweeperThreads(PagedSpace* space) { |
| 553 intptr_t freed_bytes = 0; | 554 intptr_t freed_bytes = 0; |
| (...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3273 heap_->isolate()->inner_pointer_to_code_cache()->Flush(); | 3274 heap_->isolate()->inner_pointer_to_code_cache()->Flush(); |
| 3274 | 3275 |
| 3275 #ifdef VERIFY_HEAP | 3276 #ifdef VERIFY_HEAP |
| 3276 if (FLAG_verify_heap) { | 3277 if (FLAG_verify_heap) { |
| 3277 VerifyEvacuation(heap_); | 3278 VerifyEvacuation(heap_); |
| 3278 } | 3279 } |
| 3279 #endif | 3280 #endif |
| 3280 | 3281 |
| 3281 slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); | 3282 slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); |
| 3282 ASSERT(migration_slots_buffer_ == NULL); | 3283 ASSERT(migration_slots_buffer_ == NULL); |
| 3284 } | |
| 3285 | |
| 3286 | |
| 3287 void MarkCompactCollector::ReleaseEvacuationCandidates() { | |
| 3288 int npages = evacuation_candidates_.length(); | |
| 3283 for (int i = 0; i < npages; i++) { | 3289 for (int i = 0; i < npages; i++) { |
| 3284 Page* p = evacuation_candidates_[i]; | 3290 Page* p = evacuation_candidates_[i]; |
| 3285 if (!p->IsEvacuationCandidate()) continue; | 3291 if (!p->IsEvacuationCandidate()) continue; |
| 3286 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 3292 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
| 3287 space->Free(p->area_start(), p->area_size()); | 3293 space->Free(p->area_start(), p->area_size()); |
| 3288 p->set_scan_on_scavenge(false); | 3294 p->set_scan_on_scavenge(false); |
| 3289 slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); | 3295 slots_buffer_allocator_.DeallocateChain(p->slots_buffer_address()); |
| 3290 p->ResetLiveBytes(); | 3296 p->ResetLiveBytes(); |
| 3291 space->ReleasePage(p); | 3297 space->ReleasePage(p); |
| 3292 } | 3298 } |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3852 // the other spaces rely on possibly non-live maps to get the sizes for | 3858 // the other spaces rely on possibly non-live maps to get the sizes for |
| 3853 // non-live objects. | 3859 // non-live objects. |
| 3854 | 3860 |
| 3855 SweepSpace(heap()->old_pointer_space(), how_to_sweep); | 3861 SweepSpace(heap()->old_pointer_space(), how_to_sweep); |
| 3856 SweepSpace(heap()->old_data_space(), how_to_sweep); | 3862 SweepSpace(heap()->old_data_space(), how_to_sweep); |
| 3857 | 3863 |
| 3858 if (how_to_sweep == PARALLEL_CONSERVATIVE) { | 3864 if (how_to_sweep == PARALLEL_CONSERVATIVE) { |
| 3859 // TODO(hpayer): fix race with concurrent sweeper | 3865 // TODO(hpayer): fix race with concurrent sweeper |
| 3860 StartSweeperThreads(); | 3866 StartSweeperThreads(); |
| 3861 if (FLAG_parallel_sweeping && !FLAG_concurrent_sweeping) { | 3867 if (FLAG_parallel_sweeping && !FLAG_concurrent_sweeping) { |
| 3862 WaitUntilSweepingCompleted(); | 3868 WaitUntilSweepingCompleted(); |
|
Michael Starzinger
2013/02/20 18:20:07
The ordering of the calls is off, in the "parallel
Hannes Payer (out of office)
2013/02/21 12:05:17
Done.
| |
| 3863 } | 3869 } |
| 3864 } | 3870 } |
| 3865 | 3871 |
| 3866 RemoveDeadInvalidatedCode(); | 3872 RemoveDeadInvalidatedCode(); |
| 3867 SweepSpace(heap()->code_space(), PRECISE); | 3873 SweepSpace(heap()->code_space(), PRECISE); |
| 3868 | 3874 |
| 3869 SweepSpace(heap()->cell_space(), PRECISE); | 3875 SweepSpace(heap()->cell_space(), PRECISE); |
| 3870 | 3876 |
| 3871 EvacuateNewSpaceAndCandidates(); | 3877 EvacuateNewSpaceAndCandidates(); |
| 3872 | 3878 |
| 3873 // ClearNonLiveTransitions depends on precise sweeping of map space to | 3879 // ClearNonLiveTransitions depends on precise sweeping of map space to |
| 3874 // detect whether unmarked map became dead in this collection or in one | 3880 // detect whether unmarked map became dead in this collection or in one |
| 3875 // of the previous ones. | 3881 // of the previous ones. |
| 3876 SweepSpace(heap()->map_space(), PRECISE); | 3882 SweepSpace(heap()->map_space(), PRECISE); |
| 3877 | 3883 |
| 3878 // Deallocate unmarked objects and clear marked bits for marked objects. | 3884 // Deallocate unmarked objects and clear marked bits for marked objects. |
| 3879 heap_->lo_space()->FreeUnmarkedObjects(); | 3885 heap_->lo_space()->FreeUnmarkedObjects(); |
| 3886 | |
| 3887 if (!AreSweeperThreadsActivated()) { | |
|
Michael Starzinger
2013/02/20 18:20:07
... but called down here at this call-site. Also I
Hannes Payer (out of office)
2013/02/21 12:05:17
The right condition is "if (!FLAG_concurrent_sweep
| |
| 3888 ReleaseEvacuationCandidates(); | |
| 3889 } | |
| 3880 } | 3890 } |
| 3881 | 3891 |
| 3882 | 3892 |
| 3883 void MarkCompactCollector::EnableCodeFlushing(bool enable) { | 3893 void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
| 3884 #ifdef ENABLE_DEBUGGER_SUPPORT | 3894 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 3885 if (heap()->isolate()->debug()->IsLoaded() || | 3895 if (heap()->isolate()->debug()->IsLoaded() || |
| 3886 heap()->isolate()->debug()->has_break_points()) { | 3896 heap()->isolate()->debug()->has_break_points()) { |
| 3887 enable = false; | 3897 enable = false; |
| 3888 } | 3898 } |
| 3889 #endif | 3899 #endif |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4070 while (buffer != NULL) { | 4080 while (buffer != NULL) { |
| 4071 SlotsBuffer* next_buffer = buffer->next(); | 4081 SlotsBuffer* next_buffer = buffer->next(); |
| 4072 DeallocateBuffer(buffer); | 4082 DeallocateBuffer(buffer); |
| 4073 buffer = next_buffer; | 4083 buffer = next_buffer; |
| 4074 } | 4084 } |
| 4075 *buffer_address = NULL; | 4085 *buffer_address = NULL; |
| 4076 } | 4086 } |
| 4077 | 4087 |
| 4078 | 4088 |
| 4079 } } // namespace v8::internal | 4089 } } // namespace v8::internal |
| OLD | NEW |