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/v8.h" | 5 #include "src/v8.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 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 | 1854 |
1855 int size = object->Size(); | 1855 int size = object->Size(); |
1856 survivors_size += size; | 1856 survivors_size += size; |
1857 | 1857 |
1858 Heap::UpdateAllocationSiteFeedback(object, Heap::RECORD_SCRATCHPAD_SLOT); | 1858 Heap::UpdateAllocationSiteFeedback(object, Heap::RECORD_SCRATCHPAD_SLOT); |
1859 | 1859 |
1860 offset++; | 1860 offset++; |
1861 current_cell >>= 1; | 1861 current_cell >>= 1; |
1862 | 1862 |
1863 // TODO(hpayer): Refactor EvacuateObject and call this function instead. | 1863 // TODO(hpayer): Refactor EvacuateObject and call this function instead. |
1864 if (heap()->ShouldBePromoted(object->address(), size)) { | 1864 if (heap()->ShouldBePromoted(object->address(), size) && |
1865 if (!TryPromoteObject(object, size)) { | 1865 TryPromoteObject(object, size)) { |
1866 V8::FatalProcessOutOfMemory("Full GC promotion failed"); | 1866 continue; |
| 1867 } |
| 1868 |
| 1869 AllocationResult allocation = new_space->AllocateRaw(size); |
| 1870 if (allocation.IsRetry()) { |
| 1871 if (!new_space->AddFreshPage()) { |
| 1872 // Shouldn't happen. We are sweeping linearly, and to-space |
| 1873 // has the same number of pages as from-space, so there is |
| 1874 // always room. |
| 1875 UNREACHABLE(); |
1867 } | 1876 } |
1868 } else { | 1877 allocation = new_space->AllocateRaw(size); |
1869 AllocationResult allocation = new_space->AllocateRaw(size); | 1878 DCHECK(!allocation.IsRetry()); |
1870 if (allocation.IsRetry()) { | 1879 } |
1871 if (!new_space->AddFreshPage()) { | 1880 Object* target = allocation.ToObjectChecked(); |
1872 // Shouldn't happen. We are sweeping linearly, and to-space | |
1873 // has the same number of pages as from-space, so there is | |
1874 // always room. | |
1875 UNREACHABLE(); | |
1876 } | |
1877 allocation = new_space->AllocateRaw(size); | |
1878 DCHECK(!allocation.IsRetry()); | |
1879 } | |
1880 Object* target = allocation.ToObjectChecked(); | |
1881 | 1881 |
1882 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); | 1882 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); |
1883 heap()->IncrementSemiSpaceCopiedObjectSize(size); | 1883 heap()->IncrementSemiSpaceCopiedObjectSize(size); |
1884 } | |
1885 } | 1884 } |
1886 *cells = 0; | 1885 *cells = 0; |
1887 } | 1886 } |
1888 return survivors_size; | 1887 return survivors_size; |
1889 } | 1888 } |
1890 | 1889 |
1891 | 1890 |
1892 static void DiscoverGreyObjectsInSpace(Heap* heap, MarkingDeque* marking_deque, | 1891 static void DiscoverGreyObjectsInSpace(Heap* heap, MarkingDeque* marking_deque, |
1893 PagedSpace* space) { | 1892 PagedSpace* space) { |
1894 PageIterator it(space); | 1893 PageIterator it(space); |
(...skipping 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4416 SlotsBuffer* buffer = *buffer_address; | 4415 SlotsBuffer* buffer = *buffer_address; |
4417 while (buffer != NULL) { | 4416 while (buffer != NULL) { |
4418 SlotsBuffer* next_buffer = buffer->next(); | 4417 SlotsBuffer* next_buffer = buffer->next(); |
4419 DeallocateBuffer(buffer); | 4418 DeallocateBuffer(buffer); |
4420 buffer = next_buffer; | 4419 buffer = next_buffer; |
4421 } | 4420 } |
4422 *buffer_address = NULL; | 4421 *buffer_address = NULL; |
4423 } | 4422 } |
4424 } | 4423 } |
4425 } // namespace v8::internal | 4424 } // namespace v8::internal |
OLD | NEW |