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

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

Issue 2919023003: [heap] Scale max heap growing factor. (Closed)
Patch Set: rename Created 3 years, 6 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') | src/heap/heap.cc » ('J')
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 <vector> 9 #include <vector>
10 10
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 #else 620 #else
621 static const int kPointerMultiplier = i::kPointerSize / 4; 621 static const int kPointerMultiplier = i::kPointerSize / 4;
622 #endif 622 #endif
623 623
624 // The new space size has to be a power of 2. Sizes are in MB. 624 // The new space size has to be a power of 2. Sizes are in MB.
625 static const int kMinSemiSpaceSize = 1 * kPointerMultiplier; 625 static const int kMinSemiSpaceSize = 1 * kPointerMultiplier;
626 static const int kMaxSemiSpaceSize = 8 * kPointerMultiplier; 626 static const int kMaxSemiSpaceSize = 8 * kPointerMultiplier;
627 627
628 // The old space size has to be a multiple of Page::kPageSize. 628 // The old space size has to be a multiple of Page::kPageSize.
629 // Sizes are in MB. 629 // Sizes are in MB.
630 static const int kMinOldSpaceSize = 128 * kPointerMultiplier; 630 static const int kMinOldGenerationSize = 128 * kPointerMultiplier;
631 static const int kMaxOldSpaceSize = 1024 * kPointerMultiplier; 631 static const int kMaxOldGenerationSize = 1024 * kPointerMultiplier;
632 632
633 static const int kTraceRingBufferSize = 512; 633 static const int kTraceRingBufferSize = 512;
634 static const int kStacktraceBufferSize = 512; 634 static const int kStacktraceBufferSize = 512;
635 635
636 V8_EXPORT_PRIVATE static const double kMinHeapGrowingFactor; 636 V8_EXPORT_PRIVATE static const double kMinHeapGrowingFactor;
637 V8_EXPORT_PRIVATE static const double kMaxHeapGrowingFactor; 637 V8_EXPORT_PRIVATE static const double kMaxHeapGrowingFactor;
638 static const double kMaxHeapGrowingFactorMemoryConstrained; 638 static const double kMaxHeapGrowingFactorMemoryConstrained;
639 static const double kMaxHeapGrowingFactorIdle; 639 static const double kMaxHeapGrowingFactorIdle;
640 static const double kConservativeHeapGrowingFactor; 640 static const double kConservativeHeapGrowingFactor;
641 static const double kTargetMutatorUtilization; 641 static const double kTargetMutatorUtilization;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 case SCAVENGER: 712 case SCAVENGER:
713 return "Scavenger"; 713 return "Scavenger";
714 case MARK_COMPACTOR: 714 case MARK_COMPACTOR:
715 return "Mark-Compact"; 715 return "Mark-Compact";
716 case MINOR_MARK_COMPACTOR: 716 case MINOR_MARK_COMPACTOR:
717 return "Minor Mark-Compact"; 717 return "Minor Mark-Compact";
718 } 718 }
719 return "Unknown collector"; 719 return "Unknown collector";
720 } 720 }
721 721
722 V8_EXPORT_PRIVATE static double MaxHeapGrowingFactor(
723 size_t max_old_generation_size);
722 V8_EXPORT_PRIVATE static double HeapGrowingFactor(double gc_speed, 724 V8_EXPORT_PRIVATE static double HeapGrowingFactor(double gc_speed,
723 double mutator_speed); 725 double mutator_speed,
726 double max_factor);
724 727
725 // Copy block of memory from src to dst. Size of block should be aligned 728 // Copy block of memory from src to dst. Size of block should be aligned
726 // by pointer size. 729 // by pointer size.
727 static inline void CopyBlock(Address dst, Address src, int byte_size); 730 static inline void CopyBlock(Address dst, Address src, int byte_size);
728 731
729 // Determines a static visitor id based on the given {map} that can then be 732 // Determines a static visitor id based on the given {map} that can then be
730 // stored on the map to facilitate fast dispatch for {StaticVisitorBase}. 733 // stored on the map to facilitate fast dispatch for {StaticVisitorBase}.
731 static int GetStaticVisitorIdForMap(Map* map); 734 static int GetStaticVisitorIdForMap(Map* map);
732 735
733 // Notifies the heap that is ok to start marking or other activities that 736 // Notifies the heap that is ok to start marking or other activities that
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 bool deserialization_complete() const { return deserialization_complete_; } 945 bool deserialization_complete() const { return deserialization_complete_; }
943 946
944 bool HasLowAllocationRate(); 947 bool HasLowAllocationRate();
945 bool HasHighFragmentation(); 948 bool HasHighFragmentation();
946 bool HasHighFragmentation(size_t used, size_t committed); 949 bool HasHighFragmentation(size_t used, size_t committed);
947 950
948 void ActivateMemoryReducerIfNeeded(); 951 void ActivateMemoryReducerIfNeeded();
949 952
950 bool ShouldOptimizeForMemoryUsage(); 953 bool ShouldOptimizeForMemoryUsage();
951 954
952 bool IsLowMemoryDevice() {
953 const int kMaxOldSpaceSizeLowMemoryDevice = 128 * kPointerMultiplier;
954 return max_old_generation_size_ <= kMaxOldSpaceSizeLowMemoryDevice;
955 }
956
957 bool IsMemoryConstrainedDevice() {
958 const int kMaxOldSpaceSizeMediumMemoryDevice = 256 * kPointerMultiplier;
959 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice;
960 }
961
962 bool HighMemoryPressure() { 955 bool HighMemoryPressure() {
963 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; 956 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone;
964 } 957 }
965 958
966 size_t HeapLimitForDebugging() { 959 size_t HeapLimitForDebugging() {
967 const size_t kDebugHeapSizeFactor = 4; 960 const size_t kDebugHeapSizeFactor = 4;
968 size_t max_limit = std::numeric_limits<size_t>::max() / 4; 961 size_t max_limit = std::numeric_limits<size_t>::max() / 4;
969 return Min(max_limit, 962 return Min(max_limit,
970 initial_max_old_generation_size_ * kDebugHeapSizeFactor); 963 initial_max_old_generation_size_ * kDebugHeapSizeFactor);
971 } 964 }
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 } 1345 }
1353 size_t MaxSemiSpaceSize() { return max_semi_space_size_; } 1346 size_t MaxSemiSpaceSize() { return max_semi_space_size_; }
1354 size_t InitialSemiSpaceSize() { return initial_semispace_size_; } 1347 size_t InitialSemiSpaceSize() { return initial_semispace_size_; }
1355 size_t MaxOldGenerationSize() { return max_old_generation_size_; } 1348 size_t MaxOldGenerationSize() { return max_old_generation_size_; }
1356 1349
1357 static size_t ComputeMaxOldGenerationSize(uint64_t physical_memory) { 1350 static size_t ComputeMaxOldGenerationSize(uint64_t physical_memory) {
1358 const int old_space_physical_memory_factor = 4; 1351 const int old_space_physical_memory_factor = 4;
1359 int computed_size = 1352 int computed_size =
1360 static_cast<int>(physical_memory / i::MB / 1353 static_cast<int>(physical_memory / i::MB /
1361 old_space_physical_memory_factor * kPointerMultiplier); 1354 old_space_physical_memory_factor * kPointerMultiplier);
1362 return Max(Min(computed_size, kMaxOldSpaceSize), kMinOldSpaceSize); 1355 return Max(Min(computed_size, kMaxOldGenerationSize),
1356 kMinOldGenerationSize);
1363 } 1357 }
1364 1358
1365 static size_t ComputeMaxSemiSpaceSize(uint64_t physical_memory) { 1359 static size_t ComputeMaxSemiSpaceSize(uint64_t physical_memory) {
1366 const uint64_t min_physical_memory = 512 * MB; 1360 const uint64_t min_physical_memory = 512 * MB;
1367 const uint64_t max_physical_memory = 2 * static_cast<uint64_t>(GB); 1361 const uint64_t max_physical_memory = 2 * static_cast<uint64_t>(GB);
1368 1362
1369 uint64_t capped_physical_memory = 1363 uint64_t capped_physical_memory =
1370 Max(Min(physical_memory, max_physical_memory), min_physical_memory); 1364 Max(Min(physical_memory, max_physical_memory), min_physical_memory);
1371 // linearly scale max semi-space size: (X-A)/(B-A)*(D-C)+C 1365 // linearly scale max semi-space size: (X-A)/(B-A)*(D-C)+C
1372 return static_cast<int>(((capped_physical_memory - min_physical_memory) * 1366 return static_cast<int>(((capped_physical_memory - min_physical_memory) *
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 friend class PagedSpace; 2668 friend class PagedSpace;
2675 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2669 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2676 }; 2670 };
2677 2671
2678 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); 2672 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space);
2679 2673
2680 } // namespace internal 2674 } // namespace internal
2681 } // namespace v8 2675 } // namespace v8
2682 2676
2683 #endif // V8_HEAP_HEAP_H_ 2677 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698