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

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

Issue 2218703004: Unify memory optimization modes and flags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: x 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 | « src/api.cc ('k') | 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 static const int kMaxExecutableSizeHugeMemoryDevice = 556 static const int kMaxExecutableSizeHugeMemoryDevice =
557 256 * kPointerMultiplier; 557 256 * kPointerMultiplier;
558 558
559 static const int kTraceRingBufferSize = 512; 559 static const int kTraceRingBufferSize = 512;
560 static const int kStacktraceBufferSize = 512; 560 static const int kStacktraceBufferSize = 512;
561 561
562 static const double kMinHeapGrowingFactor; 562 static const double kMinHeapGrowingFactor;
563 static const double kMaxHeapGrowingFactor; 563 static const double kMaxHeapGrowingFactor;
564 static const double kMaxHeapGrowingFactorMemoryConstrained; 564 static const double kMaxHeapGrowingFactorMemoryConstrained;
565 static const double kMaxHeapGrowingFactorIdle; 565 static const double kMaxHeapGrowingFactorIdle;
566 static const double kConservativeHeapGrowingFactor;
566 static const double kTargetMutatorUtilization; 567 static const double kTargetMutatorUtilization;
567 568
568 static const int kNoGCFlags = 0; 569 static const int kNoGCFlags = 0;
569 static const int kReduceMemoryFootprintMask = 1; 570 static const int kReduceMemoryFootprintMask = 1;
570 static const int kAbortIncrementalMarkingMask = 2; 571 static const int kAbortIncrementalMarkingMask = 2;
571 static const int kFinalizeIncrementalMarkingMask = 4; 572 static const int kFinalizeIncrementalMarkingMask = 4;
572 573
573 // Making the heap iterable requires us to abort incremental marking. 574 // Making the heap iterable requires us to abort incremental marking.
574 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; 575 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask;
575 576
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // This event is triggered after object is moved to a new place. 882 // This event is triggered after object is moved to a new place.
882 inline void OnMoveEvent(HeapObject* target, HeapObject* source, 883 inline void OnMoveEvent(HeapObject* target, HeapObject* source,
883 int size_in_bytes); 884 int size_in_bytes);
884 885
885 bool deserialization_complete() const { return deserialization_complete_; } 886 bool deserialization_complete() const { return deserialization_complete_; }
886 887
887 bool HasLowAllocationRate(); 888 bool HasLowAllocationRate();
888 bool HasHighFragmentation(); 889 bool HasHighFragmentation();
889 bool HasHighFragmentation(intptr_t used, intptr_t committed); 890 bool HasHighFragmentation(intptr_t used, intptr_t committed);
890 891
891 void SetOptimizeForLatency() { optimize_for_memory_usage_ = false; } 892 void ActivateMemoryReducerIfNeeded();
892 void SetOptimizeForMemoryUsage(); 893
893 bool ShouldOptimizeForMemoryUsage() { 894 bool ShouldOptimizeForMemoryUsage();
894 return optimize_for_memory_usage_ || HighMemoryPressure(); 895
896 bool IsLowMemoryDevice() {
897 return max_old_generation_size_ <= kMaxOldSpaceSizeLowMemoryDevice;
895 } 898 }
899
900 bool IsMemoryConstrainedDevice() {
901 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice;
902 }
903
896 bool HighMemoryPressure() { 904 bool HighMemoryPressure() {
897 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; 905 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone;
898 } 906 }
899 907
900 // =========================================================================== 908 // ===========================================================================
901 // Initialization. =========================================================== 909 // Initialization. ===========================================================
902 // =========================================================================== 910 // ===========================================================================
903 911
904 // Configure heap size in MB before setup. Return false if the heap has been 912 // Configure heap size in MB before setup. Return false if the heap has been
905 // set up already. 913 // set up already.
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 // Limit that triggers a global GC on the next (normally caused) GC. This 2120 // Limit that triggers a global GC on the next (normally caused) GC. This
2113 // is checked when we have already decided to do a GC to help determine 2121 // is checked when we have already decided to do a GC to help determine
2114 // which collector to invoke, before expanding a paged space in the old 2122 // which collector to invoke, before expanding a paged space in the old
2115 // generation and on every allocation in large object space. 2123 // generation and on every allocation in large object space.
2116 intptr_t old_generation_allocation_limit_; 2124 intptr_t old_generation_allocation_limit_;
2117 2125
2118 // Indicates that an allocation has failed in the old generation since the 2126 // Indicates that an allocation has failed in the old generation since the
2119 // last GC. 2127 // last GC.
2120 bool old_gen_exhausted_; 2128 bool old_gen_exhausted_;
2121 2129
2122 // Indicates that memory usage is more important than latency.
2123 // TODO(ulan): Merge it with memory reducer once chromium:490559 is fixed.
2124 bool optimize_for_memory_usage_;
2125
2126 // Indicates that inline bump-pointer allocation has been globally disabled 2130 // Indicates that inline bump-pointer allocation has been globally disabled
2127 // for all spaces. This is used to disable allocations in generated code. 2131 // for all spaces. This is used to disable allocations in generated code.
2128 bool inline_allocation_disabled_; 2132 bool inline_allocation_disabled_;
2129 2133
2130 // Weak list heads, threaded through the objects. 2134 // Weak list heads, threaded through the objects.
2131 // List heads are initialized lazily and contain the undefined_value at start. 2135 // List heads are initialized lazily and contain the undefined_value at start.
2132 Object* native_contexts_list_; 2136 Object* native_contexts_list_;
2133 Object* allocation_sites_list_; 2137 Object* allocation_sites_list_;
2134 2138
2135 // List of encountered weak collections (JSWeakMap and JSWeakSet) during 2139 // List of encountered weak collections (JSWeakMap and JSWeakSet) during
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 friend class LargeObjectSpace; 2702 friend class LargeObjectSpace;
2699 friend class NewSpace; 2703 friend class NewSpace;
2700 friend class PagedSpace; 2704 friend class PagedSpace;
2701 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2705 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2702 }; 2706 };
2703 2707
2704 } // namespace internal 2708 } // namespace internal
2705 } // namespace v8 2709 } // namespace v8
2706 2710
2707 #endif // V8_HEAP_HEAP_H_ 2711 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698