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

Side by Side Diff: src/heap/spaces.cc

Issue 2552613004: [heap] Ensure finalization of incremental marking even if all allocations (Closed)
Patch Set: revert marking change Created 4 years 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
« no previous file with comments | « src/heap/incremental-marking.h ('k') | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/spaces.h" 5 #include "src/heap/spaces.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 // If sweeping is still in progress try to sweep pages on the main thread. 2832 // If sweeping is still in progress try to sweep pages on the main thread.
2833 int max_freed = collector->sweeper().ParallelSweepSpace( 2833 int max_freed = collector->sweeper().ParallelSweepSpace(
2834 identity(), size_in_bytes, kMaxPagesToSweep); 2834 identity(), size_in_bytes, kMaxPagesToSweep);
2835 RefillFreeList(); 2835 RefillFreeList();
2836 if (max_freed >= size_in_bytes) { 2836 if (max_freed >= size_in_bytes) {
2837 object = free_list_.Allocate(static_cast<size_t>(size_in_bytes)); 2837 object = free_list_.Allocate(static_cast<size_t>(size_in_bytes));
2838 if (object != nullptr) return object; 2838 if (object != nullptr) return object;
2839 } 2839 }
2840 } 2840 }
2841 2841
2842 if (heap()->ShouldExpandOldGenerationOnAllocationFailure() && Expand()) { 2842 if (heap()->ShouldExpandOldGenerationOnSlowAllocation() && Expand()) {
2843 DCHECK((CountTotalPages() > 1) || 2843 DCHECK((CountTotalPages() > 1) ||
2844 (static_cast<size_t>(size_in_bytes) <= free_list_.Available())); 2844 (static_cast<size_t>(size_in_bytes) <= free_list_.Available()));
2845 return free_list_.Allocate(static_cast<size_t>(size_in_bytes)); 2845 return free_list_.Allocate(static_cast<size_t>(size_in_bytes));
2846 } 2846 }
2847 2847
2848 // If sweeper threads are active, wait for them at that point and steal 2848 // If sweeper threads are active, wait for them at that point and steal
2849 // elements form their free-lists. Allocation may still fail their which 2849 // elements form their free-lists. Allocation may still fail their which
2850 // would indicate that there is not enough memory for the given allocation. 2850 // would indicate that there is not enough memory for the given allocation.
2851 return SweepAndRetryAllocation(size_in_bytes); 2851 return SweepAndRetryAllocation(size_in_bytes);
2852 } 2852 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 heap()->memory_allocator()->Free<MemoryAllocator::kFull>(page); 2948 heap()->memory_allocator()->Free<MemoryAllocator::kFull>(page);
2949 } 2949 }
2950 SetUp(); 2950 SetUp();
2951 } 2951 }
2952 2952
2953 2953
2954 AllocationResult LargeObjectSpace::AllocateRaw(int object_size, 2954 AllocationResult LargeObjectSpace::AllocateRaw(int object_size,
2955 Executability executable) { 2955 Executability executable) {
2956 // Check if we want to force a GC before growing the old space further. 2956 // Check if we want to force a GC before growing the old space further.
2957 // If so, fail the allocation. 2957 // If so, fail the allocation.
2958 if (!heap()->CanExpandOldGeneration(object_size)) { 2958 if (!heap()->CanExpandOldGeneration(object_size) ||
2959 !heap()->ShouldExpandOldGenerationOnSlowAllocation()) {
2959 return AllocationResult::Retry(identity()); 2960 return AllocationResult::Retry(identity());
2960 } 2961 }
2961 2962
2962 LargePage* page = heap()->memory_allocator()->AllocateLargePage( 2963 LargePage* page = heap()->memory_allocator()->AllocateLargePage(
2963 object_size, this, executable); 2964 object_size, this, executable);
2964 if (page == NULL) return AllocationResult::Retry(identity()); 2965 if (page == NULL) return AllocationResult::Retry(identity());
2965 DCHECK_GE(page->area_size(), static_cast<size_t>(object_size)); 2966 DCHECK_GE(page->area_size(), static_cast<size_t>(object_size));
2966 2967
2967 size_ += static_cast<int>(page->size()); 2968 size_ += static_cast<int>(page->size());
2968 AccountCommitted(page->size()); 2969 AccountCommitted(page->size());
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 object->ShortPrint(); 3229 object->ShortPrint();
3229 PrintF("\n"); 3230 PrintF("\n");
3230 } 3231 }
3231 printf(" --------------------------------------\n"); 3232 printf(" --------------------------------------\n");
3232 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3233 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3233 } 3234 }
3234 3235
3235 #endif // DEBUG 3236 #endif // DEBUG
3236 } // namespace internal 3237 } // namespace internal
3237 } // namespace v8 3238 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698