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

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

Issue 2364923002: [heap] New heuristics for starting of incremental marking. (Closed)
Patch Set: rebase Created 4 years, 2 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 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 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 // If sweeping is still in progress try to sweep pages on the main thread. 2839 // If sweeping is still in progress try to sweep pages on the main thread.
2840 int max_freed = collector->sweeper().ParallelSweepSpace( 2840 int max_freed = collector->sweeper().ParallelSweepSpace(
2841 identity(), size_in_bytes, kMaxPagesToSweep); 2841 identity(), size_in_bytes, kMaxPagesToSweep);
2842 RefillFreeList(); 2842 RefillFreeList();
2843 if (max_freed >= size_in_bytes) { 2843 if (max_freed >= size_in_bytes) {
2844 object = free_list_.Allocate(size_in_bytes); 2844 object = free_list_.Allocate(size_in_bytes);
2845 if (object != nullptr) return object; 2845 if (object != nullptr) return object;
2846 } 2846 }
2847 } 2847 }
2848 2848
2849 // Free list allocation failed and there is no next page. Fail if we have 2849 if (heap()->ShouldExpandOldGenerationOnAllocationFailure() && Expand()) {
2850 // hit the old generation size limit that should cause a garbage
2851 // collection.
2852 if (!heap()->always_allocate() &&
2853 heap()->OldGenerationAllocationLimitReached()) {
2854 // If sweeper threads are active, wait for them at that point and steal
2855 // elements form their free-lists.
2856 HeapObject* object = SweepAndRetryAllocation(size_in_bytes);
2857 return object;
2858 }
2859
2860 // Try to expand the space and allocate in the new next page.
2861 if (Expand()) {
2862 DCHECK((CountTotalPages() > 1) || 2850 DCHECK((CountTotalPages() > 1) ||
2863 (size_in_bytes <= free_list_.Available())); 2851 (size_in_bytes <= free_list_.Available()));
2864 return free_list_.Allocate(size_in_bytes); 2852 return free_list_.Allocate(size_in_bytes);
2865 } 2853 }
2866 2854
2867 // If sweeper threads are active, wait for them at that point and steal 2855 // If sweeper threads are active, wait for them at that point and steal
2868 // elements form their free-lists. Allocation may still fail their which 2856 // elements form their free-lists. Allocation may still fail their which
2869 // would indicate that there is not enough memory for the given allocation. 2857 // would indicate that there is not enough memory for the given allocation.
2870 return SweepAndRetryAllocation(size_in_bytes); 2858 return SweepAndRetryAllocation(size_in_bytes);
2871 } 2859 }
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 object->ShortPrint(); 3223 object->ShortPrint();
3236 PrintF("\n"); 3224 PrintF("\n");
3237 } 3225 }
3238 printf(" --------------------------------------\n"); 3226 printf(" --------------------------------------\n");
3239 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3227 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3240 } 3228 }
3241 3229
3242 #endif // DEBUG 3230 #endif // DEBUG
3243 } // namespace internal 3231 } // namespace internal
3244 } // namespace v8 3232 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698