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 <map> | 9 #include <map> |
10 | 10 |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 return old_generation_allocation_limit_; | 1845 return old_generation_allocation_limit_; |
1846 } | 1846 } |
1847 | 1847 |
1848 bool always_allocate() { return always_allocate_scope_count_.Value() != 0; } | 1848 bool always_allocate() { return always_allocate_scope_count_.Value() != 0; } |
1849 | 1849 |
1850 bool CanExpandOldGeneration(int size) { | 1850 bool CanExpandOldGeneration(int size) { |
1851 if (force_oom_) return false; | 1851 if (force_oom_) return false; |
1852 return (OldGenerationCapacity() + size) < MaxOldGenerationSize(); | 1852 return (OldGenerationCapacity() + size) < MaxOldGenerationSize(); |
1853 } | 1853 } |
1854 | 1854 |
| 1855 bool IsCloseToOutOfMemory(size_t slack) { |
| 1856 return OldGenerationCapacity() + slack >= MaxOldGenerationSize(); |
| 1857 } |
| 1858 |
1855 bool ShouldExpandOldGenerationOnAllocationFailure(); | 1859 bool ShouldExpandOldGenerationOnAllocationFailure(); |
1856 | 1860 |
1857 enum class IncrementalMarkingLimit { kNoLimit, kSoftLimit, kHardLimit }; | 1861 enum class IncrementalMarkingLimit { kNoLimit, kSoftLimit, kHardLimit }; |
1858 IncrementalMarkingLimit IncrementalMarkingLimitReached(); | 1862 IncrementalMarkingLimit IncrementalMarkingLimitReached(); |
1859 | 1863 |
1860 // =========================================================================== | 1864 // =========================================================================== |
1861 // Idle notification. ======================================================== | 1865 // Idle notification. ======================================================== |
1862 // =========================================================================== | 1866 // =========================================================================== |
1863 | 1867 |
1864 bool RecentIdleNotificationHappened(); | 1868 bool RecentIdleNotificationHappened(); |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 friend class LargeObjectSpace; | 2643 friend class LargeObjectSpace; |
2640 friend class NewSpace; | 2644 friend class NewSpace; |
2641 friend class PagedSpace; | 2645 friend class PagedSpace; |
2642 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2646 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2643 }; | 2647 }; |
2644 | 2648 |
2645 } // namespace internal | 2649 } // namespace internal |
2646 } // namespace v8 | 2650 } // namespace v8 |
2647 | 2651 |
2648 #endif // V8_HEAP_HEAP_H_ | 2652 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |