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

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

Issue 2223493002: [heap] Use smaller minimum allocation limit growing step when optimizing for memory usage. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 4 years, 4 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
« no previous file with comments | « no previous file | src/heap/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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 512
513 // Support for partial snapshots. After calling this we have a linear 513 // Support for partial snapshots. After calling this we have a linear
514 // space to write objects in each space. 514 // space to write objects in each space.
515 struct Chunk { 515 struct Chunk {
516 uint32_t size; 516 uint32_t size;
517 Address start; 517 Address start;
518 Address end; 518 Address end;
519 }; 519 };
520 typedef List<Chunk> Reservation; 520 typedef List<Chunk> Reservation;
521 521
522 static const intptr_t kMinimumOldGenerationAllocationLimit =
523 8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
524
525 static const int kInitalOldGenerationLimitFactor = 2; 522 static const int kInitalOldGenerationLimitFactor = 2;
526 523
527 #if V8_OS_ANDROID 524 #if V8_OS_ANDROID
528 // Don't apply pointer multiplier on Android since it has no swap space and 525 // Don't apply pointer multiplier on Android since it has no swap space and
529 // should instead adapt it's heap size based on available physical memory. 526 // should instead adapt it's heap size based on available physical memory.
530 static const int kPointerMultiplier = 1; 527 static const int kPointerMultiplier = 1;
531 #else 528 #else
532 static const int kPointerMultiplier = i::kPointerSize / 4; 529 static const int kPointerMultiplier = i::kPointerSize / 4;
533 #endif 530 #endif
534 531
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 1793
1797 // Calculates the allocation limit based on a given growing factor and a 1794 // Calculates the allocation limit based on a given growing factor and a
1798 // given old generation size. 1795 // given old generation size.
1799 intptr_t CalculateOldGenerationAllocationLimit(double factor, 1796 intptr_t CalculateOldGenerationAllocationLimit(double factor,
1800 intptr_t old_gen_size); 1797 intptr_t old_gen_size);
1801 1798
1802 // Sets the allocation limit to trigger the next full garbage collection. 1799 // Sets the allocation limit to trigger the next full garbage collection.
1803 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed, 1800 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed,
1804 double mutator_speed); 1801 double mutator_speed);
1805 1802
1803 intptr_t MinimumAllocationLimitGrowingStep() {
1804 const double kRegularAllocationLimitGrowingStep = 8;
1805 const double kLowMemoryAllocationLimitGrowingStep = 2;
1806 intptr_t limit = (Page::kPageSize > MB ? Page::kPageSize : MB);
1807 return limit * (ShouldOptimizeForMemoryUsage()
1808 ? kLowMemoryAllocationLimitGrowingStep
1809 : kRegularAllocationLimitGrowingStep);
1810 }
1811
1806 // =========================================================================== 1812 // ===========================================================================
1807 // Idle notification. ======================================================== 1813 // Idle notification. ========================================================
1808 // =========================================================================== 1814 // ===========================================================================
1809 1815
1810 bool RecentIdleNotificationHappened(); 1816 bool RecentIdleNotificationHappened();
1811 void ScheduleIdleScavengeIfNeeded(int bytes_allocated); 1817 void ScheduleIdleScavengeIfNeeded(int bytes_allocated);
1812 1818
1813 // =========================================================================== 1819 // ===========================================================================
1814 // HeapIterator helpers. ===================================================== 1820 // HeapIterator helpers. =====================================================
1815 // =========================================================================== 1821 // ===========================================================================
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 friend class LargeObjectSpace; 2708 friend class LargeObjectSpace;
2703 friend class NewSpace; 2709 friend class NewSpace;
2704 friend class PagedSpace; 2710 friend class PagedSpace;
2705 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2711 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2706 }; 2712 };
2707 2713
2708 } // namespace internal 2714 } // namespace internal
2709 } // namespace v8 2715 } // namespace v8
2710 2716
2711 #endif // V8_HEAP_HEAP_H_ 2717 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698