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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 void RememberUnmappedPage(Address page, bool compacted); | 814 void RememberUnmappedPage(Address page, bool compacted); |
815 | 815 |
816 // Global inline caching age: it is incremented on some GCs after context | 816 // Global inline caching age: it is incremented on some GCs after context |
817 // disposal. We use it to flush inline caches. | 817 // disposal. We use it to flush inline caches. |
818 int global_ic_age() { return global_ic_age_; } | 818 int global_ic_age() { return global_ic_age_; } |
819 | 819 |
820 void AgeInlineCaches() { | 820 void AgeInlineCaches() { |
821 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; | 821 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; |
822 } | 822 } |
823 | 823 |
824 int64_t amount_of_external_allocated_memory() { | 824 int64_t external_memory() { return external_memory_; } |
825 return amount_of_external_allocated_memory_; | 825 void update_external_memory(int64_t delta) { external_memory_ += delta; } |
| 826 |
| 827 void update_external_memory_concurrently_freed(intptr_t freed) { |
| 828 external_memory_concurrently_freed_.Increment(freed); |
826 } | 829 } |
827 | 830 |
828 void update_amount_of_external_allocated_memory(int64_t delta) { | 831 void account_external_memory_concurrently_freed() { |
829 amount_of_external_allocated_memory_ += delta; | 832 external_memory_ -= external_memory_concurrently_freed_.Value(); |
830 } | 833 external_memory_concurrently_freed_.SetValue(0); |
831 | |
832 void update_amount_of_external_allocated_freed_memory(intptr_t freed) { | |
833 amount_of_external_allocated_memory_freed_.Increment(freed); | |
834 } | |
835 | |
836 void account_amount_of_external_allocated_freed_memory() { | |
837 amount_of_external_allocated_memory_ -= | |
838 amount_of_external_allocated_memory_freed_.Value(); | |
839 amount_of_external_allocated_memory_freed_.SetValue(0); | |
840 } | 834 } |
841 | 835 |
842 void DeoptMarkedAllocationSites(); | 836 void DeoptMarkedAllocationSites(); |
843 | 837 |
844 bool DeoptMaybeTenuredAllocationSites() { | 838 bool DeoptMaybeTenuredAllocationSites() { |
845 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0; | 839 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0; |
846 } | 840 } |
847 | 841 |
848 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj, | 842 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj, |
849 Handle<DependentCode> dep); | 843 Handle<DependentCode> dep); |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 AllocateCode(int object_size, bool immovable); | 1984 AllocateCode(int object_size, bool immovable); |
1991 | 1985 |
1992 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); | 1986 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); |
1993 | 1987 |
1994 MUST_USE_RESULT AllocationResult InternalizeString(String* str); | 1988 MUST_USE_RESULT AllocationResult InternalizeString(String* str); |
1995 | 1989 |
1996 // =========================================================================== | 1990 // =========================================================================== |
1997 | 1991 |
1998 void set_force_oom(bool value) { force_oom_ = value; } | 1992 void set_force_oom(bool value) { force_oom_ = value; } |
1999 | 1993 |
2000 // The amount of external memory registered through the API kept alive | 1994 // The amount of external memory registered through the API. |
2001 // by global handles | 1995 int64_t external_memory_; |
2002 int64_t amount_of_external_allocated_memory_; | |
2003 | 1996 |
2004 // Caches the amount of external memory registered at the last global gc. | 1997 // The limit when to trigger memory pressure from the API. |
2005 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 1998 int64_t external_memory_limit_; |
2006 | 1999 |
2007 base::AtomicNumber<intptr_t> amount_of_external_allocated_memory_freed_; | 2000 // Caches the amount of external memory registered at the last MC. |
| 2001 int64_t external_memory_at_last_mark_compact_; |
| 2002 |
| 2003 // The amount of memory that has been freed concurrently. |
| 2004 base::AtomicNumber<intptr_t> external_memory_concurrently_freed_; |
2008 | 2005 |
2009 // This can be calculated directly from a pointer to the heap; however, it is | 2006 // This can be calculated directly from a pointer to the heap; however, it is |
2010 // more expedient to get at the isolate directly from within Heap methods. | 2007 // more expedient to get at the isolate directly from within Heap methods. |
2011 Isolate* isolate_; | 2008 Isolate* isolate_; |
2012 | 2009 |
2013 Object* roots_[kRootListLength]; | 2010 Object* roots_[kRootListLength]; |
2014 | 2011 |
2015 size_t code_range_size_; | 2012 size_t code_range_size_; |
2016 int max_semi_space_size_; | 2013 int max_semi_space_size_; |
2017 int initial_semispace_size_; | 2014 int initial_semispace_size_; |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 friend class LargeObjectSpace; | 2666 friend class LargeObjectSpace; |
2670 friend class NewSpace; | 2667 friend class NewSpace; |
2671 friend class PagedSpace; | 2668 friend class PagedSpace; |
2672 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2669 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2673 }; | 2670 }; |
2674 | 2671 |
2675 } // namespace internal | 2672 } // namespace internal |
2676 } // namespace v8 | 2673 } // namespace v8 |
2677 | 2674 |
2678 #endif // V8_HEAP_HEAP_H_ | 2675 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |