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" |
11 #include "src/cpu-profiler.h" | 11 #include "src/cpu-profiler.h" |
12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
13 #include "src/execution.h" | 13 #include "src/execution.h" |
14 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
15 #include "src/gdb-jit.h" | 15 #include "src/gdb-jit.h" |
16 #include "src/global-handles.h" | 16 #include "src/global-handles.h" |
| 17 #include "src/heap/array-buffer-tracker.h" |
17 #include "src/heap/gc-tracer.h" | 18 #include "src/heap/gc-tracer.h" |
18 #include "src/heap/incremental-marking.h" | 19 #include "src/heap/incremental-marking.h" |
19 #include "src/heap/mark-compact-inl.h" | 20 #include "src/heap/mark-compact-inl.h" |
20 #include "src/heap/object-stats.h" | 21 #include "src/heap/object-stats.h" |
21 #include "src/heap/objects-visiting.h" | 22 #include "src/heap/objects-visiting.h" |
22 #include "src/heap/objects-visiting-inl.h" | 23 #include "src/heap/objects-visiting-inl.h" |
23 #include "src/heap/spaces-inl.h" | 24 #include "src/heap/spaces-inl.h" |
24 #include "src/heap-profiler.h" | 25 #include "src/heap-profiler.h" |
25 #include "src/ic/ic.h" | 26 #include "src/ic/ic.h" |
26 #include "src/ic/stub-cache.h" | 27 #include "src/ic/stub-cache.h" |
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 // always room. | 1865 // always room. |
1865 UNREACHABLE(); | 1866 UNREACHABLE(); |
1866 } | 1867 } |
1867 allocation = new_space->AllocateRaw(size, alignment); | 1868 allocation = new_space->AllocateRaw(size, alignment); |
1868 DCHECK(!allocation.IsRetry()); | 1869 DCHECK(!allocation.IsRetry()); |
1869 } | 1870 } |
1870 Object* target = allocation.ToObjectChecked(); | 1871 Object* target = allocation.ToObjectChecked(); |
1871 | 1872 |
1872 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); | 1873 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); |
1873 if (V8_UNLIKELY(target->IsJSArrayBuffer())) { | 1874 if (V8_UNLIKELY(target->IsJSArrayBuffer())) { |
1874 heap()->RegisterLiveArrayBuffer( | 1875 heap()->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(target)); |
1875 true, JSArrayBuffer::cast(target)->backing_store()); | |
1876 } | 1876 } |
1877 heap()->IncrementSemiSpaceCopiedObjectSize(size); | 1877 heap()->IncrementSemiSpaceCopiedObjectSize(size); |
1878 } | 1878 } |
1879 *cells = 0; | 1879 *cells = 0; |
1880 } | 1880 } |
1881 return survivors_size; | 1881 return survivors_size; |
1882 } | 1882 } |
1883 | 1883 |
1884 | 1884 |
1885 void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) { | 1885 void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) { |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3091 | 3091 |
3092 OldSpace* old_space = heap()->old_space(); | 3092 OldSpace* old_space = heap()->old_space(); |
3093 | 3093 |
3094 HeapObject* target; | 3094 HeapObject* target; |
3095 AllocationAlignment alignment = object->RequiredAlignment(); | 3095 AllocationAlignment alignment = object->RequiredAlignment(); |
3096 AllocationResult allocation = old_space->AllocateRaw(object_size, alignment); | 3096 AllocationResult allocation = old_space->AllocateRaw(object_size, alignment); |
3097 if (allocation.To(&target)) { | 3097 if (allocation.To(&target)) { |
3098 MigrateObject(target, object, object_size, old_space->identity()); | 3098 MigrateObject(target, object, object_size, old_space->identity()); |
3099 // If we end up needing more special cases, we should factor this out. | 3099 // If we end up needing more special cases, we should factor this out. |
3100 if (V8_UNLIKELY(target->IsJSArrayBuffer())) { | 3100 if (V8_UNLIKELY(target->IsJSArrayBuffer())) { |
3101 heap()->PromoteArrayBuffer(target); | 3101 heap()->array_buffer_tracker()->Promote(JSArrayBuffer::cast(target)); |
3102 } | 3102 } |
3103 heap()->IncrementPromotedObjectsSize(object_size); | 3103 heap()->IncrementPromotedObjectsSize(object_size); |
3104 return true; | 3104 return true; |
3105 } | 3105 } |
3106 | 3106 |
3107 return false; | 3107 return false; |
3108 } | 3108 } |
3109 | 3109 |
3110 | 3110 |
3111 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot, | 3111 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot, |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4436 | 4436 |
4437 // Give pages that are queued to be freed back to the OS. Invalid store | 4437 // Give pages that are queued to be freed back to the OS. Invalid store |
4438 // buffer entries are already filter out. We can just release the memory. | 4438 // buffer entries are already filter out. We can just release the memory. |
4439 heap()->FreeQueuedChunks(); | 4439 heap()->FreeQueuedChunks(); |
4440 | 4440 |
4441 EvacuateNewSpaceAndCandidates(); | 4441 EvacuateNewSpaceAndCandidates(); |
4442 | 4442 |
4443 // EvacuateNewSpaceAndCandidates iterates over new space objects and for | 4443 // EvacuateNewSpaceAndCandidates iterates over new space objects and for |
4444 // ArrayBuffers either re-registers them as live or promotes them. This is | 4444 // ArrayBuffers either re-registers them as live or promotes them. This is |
4445 // needed to properly free them. | 4445 // needed to properly free them. |
4446 heap()->FreeDeadArrayBuffers(false); | 4446 heap()->array_buffer_tracker()->FreeDead(false); |
4447 | 4447 |
4448 // Clear the marking state of live large objects. | 4448 // Clear the marking state of live large objects. |
4449 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); | 4449 heap_->lo_space()->ClearMarkingStateOfLiveObjects(); |
4450 | 4450 |
4451 // Deallocate evacuated candidate pages. | 4451 // Deallocate evacuated candidate pages. |
4452 ReleaseEvacuationCandidates(); | 4452 ReleaseEvacuationCandidates(); |
4453 CodeRange* code_range = heap()->isolate()->code_range(); | 4453 CodeRange* code_range = heap()->isolate()->code_range(); |
4454 if (code_range != NULL && code_range->valid()) { | 4454 if (code_range != NULL && code_range->valid()) { |
4455 code_range->ReserveEmergencyBlock(); | 4455 code_range->ReserveEmergencyBlock(); |
4456 } | 4456 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4816 SlotsBuffer* buffer = *buffer_address; | 4816 SlotsBuffer* buffer = *buffer_address; |
4817 while (buffer != NULL) { | 4817 while (buffer != NULL) { |
4818 SlotsBuffer* next_buffer = buffer->next(); | 4818 SlotsBuffer* next_buffer = buffer->next(); |
4819 DeallocateBuffer(buffer); | 4819 DeallocateBuffer(buffer); |
4820 buffer = next_buffer; | 4820 buffer = next_buffer; |
4821 } | 4821 } |
4822 *buffer_address = NULL; | 4822 *buffer_address = NULL; |
4823 } | 4823 } |
4824 } // namespace internal | 4824 } // namespace internal |
4825 } // namespace v8 | 4825 } // namespace v8 |
OLD | NEW |