Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 | 607 |
| 608 #if V8_OS_ANDROID | 608 #if V8_OS_ANDROID |
| 609 // Don't apply pointer multiplier on Android since it has no swap space and | 609 // Don't apply pointer multiplier on Android since it has no swap space and |
| 610 // should instead adapt it's heap size based on available physical memory. | 610 // should instead adapt it's heap size based on available physical memory. |
| 611 static const int kPointerMultiplier = 1; | 611 static const int kPointerMultiplier = 1; |
| 612 #else | 612 #else |
| 613 static const int kPointerMultiplier = i::kPointerSize / 4; | 613 static const int kPointerMultiplier = i::kPointerSize / 4; |
| 614 #endif | 614 #endif |
| 615 | 615 |
| 616 // The new space size has to be a power of 2. Sizes are in MB. | 616 // The new space size has to be a power of 2. Sizes are in MB. |
| 617 static const int kMaxSemiSpaceSizeLowMemoryDevice = 1 * kPointerMultiplier; | 617 static const int kMinSemiSpaceSize = 1 * kPointerMultiplier; |
| 618 static const int kMaxSemiSpaceSizeMediumMemoryDevice = 4 * kPointerMultiplier; | 618 static const int kMaxSemiSpaceSize = 8 * kPointerMultiplier; |
| 619 static const int kMaxSemiSpaceSizeHighMemoryDevice = 8 * kPointerMultiplier; | |
| 620 static const int kMaxSemiSpaceSizeHugeMemoryDevice = 8 * kPointerMultiplier; | |
| 621 | 619 |
| 622 // The old space size has to be a multiple of Page::kPageSize. | 620 // The old space size has to be a multiple of Page::kPageSize. |
| 623 // Sizes are in MB. | 621 // Sizes are in MB. |
| 624 static const int kMaxOldSpaceSizeLowMemoryDevice = 128 * kPointerMultiplier; | 622 static const int kMinOldSpaceSize = 128 * kPointerMultiplier; |
| 625 static const int kMaxOldSpaceSizeMediumMemoryDevice = | 623 static const int kMaxOldSpaceSize = 1024 * kPointerMultiplier; |
| 626 256 * kPointerMultiplier; | |
| 627 static const int kMaxOldSpaceSizeHighMemoryDevice = 512 * kPointerMultiplier; | |
| 628 static const int kMaxOldSpaceSizeHugeMemoryDevice = 1024 * kPointerMultiplier; | |
| 629 | 624 |
| 630 static const int kTraceRingBufferSize = 512; | 625 static const int kTraceRingBufferSize = 512; |
| 631 static const int kStacktraceBufferSize = 512; | 626 static const int kStacktraceBufferSize = 512; |
| 632 | 627 |
| 633 V8_EXPORT_PRIVATE static const double kMinHeapGrowingFactor; | 628 V8_EXPORT_PRIVATE static const double kMinHeapGrowingFactor; |
| 634 V8_EXPORT_PRIVATE static const double kMaxHeapGrowingFactor; | 629 V8_EXPORT_PRIVATE static const double kMaxHeapGrowingFactor; |
| 635 static const double kMaxHeapGrowingFactorMemoryConstrained; | 630 static const double kMaxHeapGrowingFactorMemoryConstrained; |
| 636 static const double kMaxHeapGrowingFactorIdle; | 631 static const double kMaxHeapGrowingFactorIdle; |
| 637 static const double kConservativeHeapGrowingFactor; | 632 static const double kConservativeHeapGrowingFactor; |
| 638 static const double kTargetMutatorUtilization; | 633 static const double kTargetMutatorUtilization; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 944 | 939 |
| 945 bool HasLowAllocationRate(); | 940 bool HasLowAllocationRate(); |
| 946 bool HasHighFragmentation(); | 941 bool HasHighFragmentation(); |
| 947 bool HasHighFragmentation(size_t used, size_t committed); | 942 bool HasHighFragmentation(size_t used, size_t committed); |
| 948 | 943 |
| 949 void ActivateMemoryReducerIfNeeded(); | 944 void ActivateMemoryReducerIfNeeded(); |
| 950 | 945 |
| 951 bool ShouldOptimizeForMemoryUsage(); | 946 bool ShouldOptimizeForMemoryUsage(); |
| 952 | 947 |
| 953 bool IsLowMemoryDevice() { | 948 bool IsLowMemoryDevice() { |
| 949 const int kMaxOldSpaceSizeLowMemoryDevice = 128 * kPointerMultiplier; | |
|
Hannes Payer (out of office)
2017/05/19 11:39:57
I will remove these two methods in a follow-up CL.
| |
| 954 return max_old_generation_size_ <= kMaxOldSpaceSizeLowMemoryDevice; | 950 return max_old_generation_size_ <= kMaxOldSpaceSizeLowMemoryDevice; |
| 955 } | 951 } |
| 956 | 952 |
| 957 bool IsMemoryConstrainedDevice() { | 953 bool IsMemoryConstrainedDevice() { |
| 954 const int kMaxOldSpaceSizeMediumMemoryDevice = 256 * kPointerMultiplier; | |
| 958 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; | 955 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; |
| 959 } | 956 } |
| 960 | 957 |
| 961 bool HighMemoryPressure() { | 958 bool HighMemoryPressure() { |
| 962 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; | 959 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; |
| 963 } | 960 } |
| 964 | 961 |
| 965 size_t HeapLimitForDebugging() { | 962 size_t HeapLimitForDebugging() { |
| 966 const size_t kDebugHeapSizeFactor = 4; | 963 const size_t kDebugHeapSizeFactor = 4; |
| 967 size_t max_limit = std::numeric_limits<size_t>::max() / 4; | 964 size_t max_limit = std::numeric_limits<size_t>::max() / 4; |
| (...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2637 friend class PagedSpace; | 2634 friend class PagedSpace; |
| 2638 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2635 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2639 }; | 2636 }; |
| 2640 | 2637 |
| 2641 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 2638 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
| 2642 | 2639 |
| 2643 } // namespace internal | 2640 } // namespace internal |
| 2644 } // namespace v8 | 2641 } // namespace v8 |
| 2645 | 2642 |
| 2646 #endif // V8_HEAP_HEAP_H_ | 2643 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |