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

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

Issue 2624973003: [heap] Add API function for checking if the heap limit was increased (Closed)
Patch Set: fix comment Created 3 years, 11 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') | test/cctest/test-api.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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 } 949 }
950 950
951 bool IsMemoryConstrainedDevice() { 951 bool IsMemoryConstrainedDevice() {
952 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; 952 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice;
953 } 953 }
954 954
955 bool HighMemoryPressure() { 955 bool HighMemoryPressure() {
956 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; 956 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone;
957 } 957 }
958 958
959 void IncreaseHeapLimitForDebugging() { 959 size_t HeapLimitForDebugging() {
960 const size_t kDebugHeapSizeFactor = 4; 960 const size_t kDebugHeapSizeFactor = 4;
961 size_t max_limit = std::numeric_limits<size_t>::max() / 4; 961 size_t max_limit = std::numeric_limits<size_t>::max() / 4;
962 return Min(max_limit,
963 initial_max_old_generation_size_ * kDebugHeapSizeFactor);
964 }
965
966 void IncreaseHeapLimitForDebugging() {
962 max_old_generation_size_ = 967 max_old_generation_size_ =
963 Max(max_old_generation_size_, 968 Max(max_old_generation_size_, HeapLimitForDebugging());
964 Min(max_limit,
965 initial_max_old_generation_size_ * kDebugHeapSizeFactor));
966 } 969 }
967 970
968 void RestoreOriginalHeapLimit() { 971 void RestoreOriginalHeapLimit() {
969 // Do not set the limit lower than the live size + some slack. 972 // Do not set the limit lower than the live size + some slack.
970 size_t min_limit = SizeOfObjects() + SizeOfObjects() / 4; 973 size_t min_limit = SizeOfObjects() + SizeOfObjects() / 4;
971 max_old_generation_size_ = 974 max_old_generation_size_ =
972 Min(max_old_generation_size_, 975 Min(max_old_generation_size_,
973 Max(initial_max_old_generation_size_, min_limit)); 976 Max(initial_max_old_generation_size_, min_limit));
974 } 977 }
975 978
979 bool IsHeapLimitIncreasedForDebugging() {
980 return max_old_generation_size_ == HeapLimitForDebugging();
981 }
982
976 // =========================================================================== 983 // ===========================================================================
977 // Initialization. =========================================================== 984 // Initialization. ===========================================================
978 // =========================================================================== 985 // ===========================================================================
979 986
980 // Configure heap size in MB before setup. Return false if the heap has been 987 // Configure heap size in MB before setup. Return false if the heap has been
981 // set up already. 988 // set up already.
982 bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, 989 bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size,
983 size_t max_executable_size, size_t code_range_size); 990 size_t max_executable_size, size_t code_range_size);
984 bool ConfigureHeapDefault(); 991 bool ConfigureHeapDefault();
985 992
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 friend class LargeObjectSpace; 2683 friend class LargeObjectSpace;
2677 friend class NewSpace; 2684 friend class NewSpace;
2678 friend class PagedSpace; 2685 friend class PagedSpace;
2679 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2686 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2680 }; 2687 };
2681 2688
2682 } // namespace internal 2689 } // namespace internal
2683 } // namespace v8 2690 } // namespace v8
2684 2691
2685 #endif // V8_HEAP_HEAP_H_ 2692 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698