Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1326613002: heap: make array buffer maps disjoint (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adjust on unregister Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 we end up needing more special cases, we should factor this out.
Michael Lippautz 2015/09/02 07:23:00 Remove this comment.
fedor.indutny 2015/09/02 08:56:08 Acknowledged.
1871 if (V8_UNLIKELY(target->IsJSArrayBuffer())) {
1872 heap()->RegisterLiveArrayBuffer(
1873 true, JSArrayBuffer::cast(target)->backing_store());
1874 }
1870 heap()->IncrementSemiSpaceCopiedObjectSize(size); 1875 heap()->IncrementSemiSpaceCopiedObjectSize(size);
1871 } 1876 }
1872 *cells = 0; 1877 *cells = 0;
1873 } 1878 }
1874 return survivors_size; 1879 return survivors_size;
1875 } 1880 }
1876 1881
1877 1882
1878 void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) { 1883 void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) {
1879 PageIterator it(space); 1884 PageIterator it(space);
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after
4424 } 4429 }
4425 } 4430 }
4426 4431
4427 // Deallocate unmarked large objects. 4432 // Deallocate unmarked large objects.
4428 heap_->lo_space()->FreeUnmarkedObjects(); 4433 heap_->lo_space()->FreeUnmarkedObjects();
4429 4434
4430 // Give pages that are queued to be freed back to the OS. Invalid store 4435 // 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. 4436 // buffer entries are already filter out. We can just release the memory.
4432 heap()->FreeQueuedChunks(); 4437 heap()->FreeQueuedChunks();
4433 4438
4439 EvacuateNewSpaceAndCandidates();
4440
4441 // NOTE: ArrayBuffers must be evacuated first, before freeing them. Otherwise
4442 // not yet discovered buffers for scavenge will have all of them, and they
4443 // will be erroneously freed.
Michael Lippautz 2015/09/02 07:23:00 Replace to: EvacuateNewSpaceAndCandidates iterate
fedor.indutny 2015/09/02 08:56:08 Acknowledged.
4434 heap()->FreeDeadArrayBuffers(false); 4444 heap()->FreeDeadArrayBuffers(false);
4435 4445
4436 EvacuateNewSpaceAndCandidates();
4437
4438 // Clear the marking state of live large objects. 4446 // Clear the marking state of live large objects.
4439 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); 4447 heap_->lo_space()->ClearMarkingStateOfLiveObjects();
4440 4448
4441 // Deallocate evacuated candidate pages. 4449 // Deallocate evacuated candidate pages.
4442 ReleaseEvacuationCandidates(); 4450 ReleaseEvacuationCandidates();
4443 CodeRange* code_range = heap()->isolate()->code_range(); 4451 CodeRange* code_range = heap()->isolate()->code_range();
4444 if (code_range != NULL && code_range->valid()) { 4452 if (code_range != NULL && code_range->valid()) {
4445 code_range->ReserveEmergencyBlock(); 4453 code_range->ReserveEmergencyBlock();
4446 } 4454 }
4447 4455
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 SlotsBuffer* buffer = *buffer_address; 4814 SlotsBuffer* buffer = *buffer_address;
4807 while (buffer != NULL) { 4815 while (buffer != NULL) {
4808 SlotsBuffer* next_buffer = buffer->next(); 4816 SlotsBuffer* next_buffer = buffer->next();
4809 DeallocateBuffer(buffer); 4817 DeallocateBuffer(buffer);
4810 buffer = next_buffer; 4818 buffer = next_buffer;
4811 } 4819 }
4812 *buffer_address = NULL; 4820 *buffer_address = NULL;
4813 } 4821 }
4814 } // namespace internal 4822 } // namespace internal
4815 } // namespace v8 4823 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698