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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 // has the same number of pages as from-space, so there is | 1860 // has the same number of pages as from-space, so there is |
1861 // always room. | 1861 // always room. |
1862 UNREACHABLE(); | 1862 UNREACHABLE(); |
1863 } | 1863 } |
1864 allocation = new_space->AllocateRaw(size, alignment); | 1864 allocation = new_space->AllocateRaw(size, alignment); |
1865 DCHECK(!allocation.IsRetry()); | 1865 DCHECK(!allocation.IsRetry()); |
1866 } | 1866 } |
1867 Object* target = allocation.ToObjectChecked(); | 1867 Object* target = allocation.ToObjectChecked(); |
1868 | 1868 |
1869 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); | 1869 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); |
| 1870 if (V8_UNLIKELY(target->IsJSArrayBuffer())) { |
| 1871 heap()->RegisterLiveArrayBuffer( |
| 1872 true, JSArrayBuffer::cast(target)->backing_store()); |
| 1873 } |
1870 heap()->IncrementSemiSpaceCopiedObjectSize(size); | 1874 heap()->IncrementSemiSpaceCopiedObjectSize(size); |
1871 } | 1875 } |
1872 *cells = 0; | 1876 *cells = 0; |
1873 } | 1877 } |
1874 return survivors_size; | 1878 return survivors_size; |
1875 } | 1879 } |
1876 | 1880 |
1877 | 1881 |
1878 void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) { | 1882 void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) { |
1879 PageIterator it(space); | 1883 PageIterator it(space); |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4424 } | 4428 } |
4425 } | 4429 } |
4426 | 4430 |
4427 // Deallocate unmarked large objects. | 4431 // Deallocate unmarked large objects. |
4428 heap_->lo_space()->FreeUnmarkedObjects(); | 4432 heap_->lo_space()->FreeUnmarkedObjects(); |
4429 | 4433 |
4430 // Give pages that are queued to be freed back to the OS. Invalid store | 4434 // Give pages that are queued to be freed back to the OS. Invalid store |
4431 // buffer entries are already filter out. We can just release the memory. | 4435 // buffer entries are already filter out. We can just release the memory. |
4432 heap()->FreeQueuedChunks(); | 4436 heap()->FreeQueuedChunks(); |
4433 | 4437 |
| 4438 EvacuateNewSpaceAndCandidates(); |
| 4439 |
| 4440 // EvacuateNewSpaceAndCandidates iterates over new space objects and for |
| 4441 // ArrayBuffers either re-registers them as live or promotes them. This is |
| 4442 // needed to properly free them. |
4434 heap()->FreeDeadArrayBuffers(false); | 4443 heap()->FreeDeadArrayBuffers(false); |
4435 | 4444 |
4436 EvacuateNewSpaceAndCandidates(); | |
4437 | |
4438 // Clear the marking state of live large objects. | 4445 // Clear the marking state of live large objects. |
4439 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); | 4446 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); |
4440 | 4447 |
4441 // Deallocate evacuated candidate pages. | 4448 // Deallocate evacuated candidate pages. |
4442 ReleaseEvacuationCandidates(); | 4449 ReleaseEvacuationCandidates(); |
4443 CodeRange* code_range = heap()->isolate()->code_range(); | 4450 CodeRange* code_range = heap()->isolate()->code_range(); |
4444 if (code_range != NULL && code_range->valid()) { | 4451 if (code_range != NULL && code_range->valid()) { |
4445 code_range->ReserveEmergencyBlock(); | 4452 code_range->ReserveEmergencyBlock(); |
4446 } | 4453 } |
4447 | 4454 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4806 SlotsBuffer* buffer = *buffer_address; | 4813 SlotsBuffer* buffer = *buffer_address; |
4807 while (buffer != NULL) { | 4814 while (buffer != NULL) { |
4808 SlotsBuffer* next_buffer = buffer->next(); | 4815 SlotsBuffer* next_buffer = buffer->next(); |
4809 DeallocateBuffer(buffer); | 4816 DeallocateBuffer(buffer); |
4810 buffer = next_buffer; | 4817 buffer = next_buffer; |
4811 } | 4818 } |
4812 *buffer_address = NULL; | 4819 *buffer_address = NULL; |
4813 } | 4820 } |
4814 } // namespace internal | 4821 } // namespace internal |
4815 } // namespace v8 | 4822 } // namespace v8 |
OLD | NEW |