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

Side by Side Diff: src/heap/heap.h

Issue 2565173004: [heap] Special handling for small heaps in eager finalization of (Closed)
Patch Set: fix test 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 | « no previous file | test/cctest/heap/test-heap.cc » ('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 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 #ifndef V8_HEAP_HEAP_H_ 5 #ifndef V8_HEAP_HEAP_H_
6 #define V8_HEAP_HEAP_H_ 6 #define V8_HEAP_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 inline size_t OldGenerationSpaceAvailable() { 1820 inline size_t OldGenerationSpaceAvailable() {
1821 if (old_generation_allocation_limit_ <= PromotedTotalSize()) return 0; 1821 if (old_generation_allocation_limit_ <= PromotedTotalSize()) return 0;
1822 return old_generation_allocation_limit_ - 1822 return old_generation_allocation_limit_ -
1823 static_cast<size_t>(PromotedTotalSize()); 1823 static_cast<size_t>(PromotedTotalSize());
1824 } 1824 }
1825 1825
1826 // We allow incremental marking to overshoot the allocation limit for 1826 // We allow incremental marking to overshoot the allocation limit for
1827 // performace reasons. If the overshoot is too large then we are more 1827 // performace reasons. If the overshoot is too large then we are more
1828 // eager to finalize incremental marking. 1828 // eager to finalize incremental marking.
1829 inline bool AllocationLimitOvershotByLargeMargin() { 1829 inline bool AllocationLimitOvershotByLargeMargin() {
1830 // This guards against too eager finalization in small heaps.
1831 // The number is chosen based on v8.browsing_mobile on Nexus 7v2.
1832 size_t kMarginForSmallHeaps = 32u * MB;
1830 if (old_generation_allocation_limit_ >= PromotedTotalSize()) return false; 1833 if (old_generation_allocation_limit_ >= PromotedTotalSize()) return false;
1831 uint64_t overshoot = PromotedTotalSize() - old_generation_allocation_limit_; 1834 uint64_t overshoot = PromotedTotalSize() - old_generation_allocation_limit_;
1832 // Overshoot margin is 50% of allocation limit or half-way to the max heap. 1835 // Overshoot margin is 50% of allocation limit or half-way to the max heap
1836 // with special handling of small heaps.
1833 uint64_t margin = 1837 uint64_t margin =
1834 Min(old_generation_allocation_limit_ / 2, 1838 Min(Max(old_generation_allocation_limit_ / 2, kMarginForSmallHeaps),
1835 (max_old_generation_size_ - old_generation_allocation_limit_) / 2); 1839 (max_old_generation_size_ - old_generation_allocation_limit_) / 2);
1836 return overshoot >= margin; 1840 return overshoot >= margin;
1837 } 1841 }
1838 1842
1839 void UpdateTotalGCTime(double duration); 1843 void UpdateTotalGCTime(double duration);
1840 1844
1841 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } 1845 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; }
1842 1846
1843 // =========================================================================== 1847 // ===========================================================================
1844 // Growing strategy. ========================================================= 1848 // Growing strategy. =========================================================
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 friend class LargeObjectSpace; 2666 friend class LargeObjectSpace;
2663 friend class NewSpace; 2667 friend class NewSpace;
2664 friend class PagedSpace; 2668 friend class PagedSpace;
2665 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2669 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2666 }; 2670 };
2667 2671
2668 } // namespace internal 2672 } // namespace internal
2669 } // namespace v8 2673 } // namespace v8
2670 2674
2671 #endif // V8_HEAP_HEAP_H_ 2675 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698