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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 | 881 |
882 // Checks whether the given object is allowed to be migrated from it's | 882 // Checks whether the given object is allowed to be migrated from it's |
883 // current space into the given destination space. Used for debugging. | 883 // current space into the given destination space. Used for debugging. |
884 inline bool AllowedToBeMigrated(HeapObject* object, AllocationSpace dest); | 884 inline bool AllowedToBeMigrated(HeapObject* object, AllocationSpace dest); |
885 | 885 |
886 void CheckHandleCount(); | 886 void CheckHandleCount(); |
887 | 887 |
888 // Number of "runtime allocations" done so far. | 888 // Number of "runtime allocations" done so far. |
889 uint32_t allocations_count() { return allocations_count_; } | 889 uint32_t allocations_count() { return allocations_count_; } |
890 | 890 |
891 // Returns deterministic "time" value in ms. Works only with | |
892 // FLAG_verify_predictable. | |
893 double synthetic_time() { return allocations_count() / 2.0; } | |
894 | |
895 // Print short heap statistics. | 891 // Print short heap statistics. |
896 void PrintShortHeapStatistics(); | 892 void PrintShortHeapStatistics(); |
897 | 893 |
898 inline HeapState gc_state() { return gc_state_; } | 894 inline HeapState gc_state() { return gc_state_; } |
899 | 895 |
900 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } | 896 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } |
901 | 897 |
902 // If an object has an AllocationMemento trailing it, return it, otherwise | 898 // If an object has an AllocationMemento trailing it, return it, otherwise |
903 // return NULL; | 899 // return NULL; |
904 inline AllocationMemento* FindAllocationMemento(HeapObject* object); | 900 inline AllocationMemento* FindAllocationMemento(HeapObject* object); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 // This event is triggered after successful allocation of a new object made | 997 // This event is triggered after successful allocation of a new object made |
1002 // by runtime. Allocations of target space for object evacuation do not | 998 // by runtime. Allocations of target space for object evacuation do not |
1003 // trigger the event. In order to track ALL allocations one must turn off | 999 // trigger the event. In order to track ALL allocations one must turn off |
1004 // FLAG_inline_new and FLAG_use_allocation_folding. | 1000 // FLAG_inline_new and FLAG_use_allocation_folding. |
1005 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 1001 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
1006 | 1002 |
1007 // This event is triggered after object is moved to a new place. | 1003 // This event is triggered after object is moved to a new place. |
1008 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 1004 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
1009 int size_in_bytes); | 1005 int size_in_bytes); |
1010 | 1006 |
| 1007 inline void OnFreeEvent(Address start, int size_in_bytes); |
| 1008 |
1011 bool deserialization_complete() const { return deserialization_complete_; } | 1009 bool deserialization_complete() const { return deserialization_complete_; } |
1012 | 1010 |
1013 bool HasLowAllocationRate(); | 1011 bool HasLowAllocationRate(); |
1014 bool HasHighFragmentation(); | 1012 bool HasHighFragmentation(); |
1015 bool HasHighFragmentation(intptr_t used, intptr_t committed); | 1013 bool HasHighFragmentation(intptr_t used, intptr_t committed); |
1016 | 1014 |
1017 void SetOptimizeForLatency() { optimize_for_memory_usage_ = false; } | 1015 void SetOptimizeForLatency() { optimize_for_memory_usage_ = false; } |
1018 void SetOptimizeForMemoryUsage() { optimize_for_memory_usage_ = true; } | 1016 void SetOptimizeForMemoryUsage() { optimize_for_memory_usage_ = true; } |
1019 bool ShouldOptimizeForMemoryUsage() { return optimize_for_memory_usage_; } | 1017 bool ShouldOptimizeForMemoryUsage() { return optimize_for_memory_usage_; } |
1020 | 1018 |
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 | 2154 |
2157 // Returns the amount of external memory registered since last global gc. | 2155 // Returns the amount of external memory registered since last global gc. |
2158 int64_t PromotedExternalMemorySize(); | 2156 int64_t PromotedExternalMemorySize(); |
2159 | 2157 |
2160 // How many "runtime allocations" happened. | 2158 // How many "runtime allocations" happened. |
2161 uint32_t allocations_count_; | 2159 uint32_t allocations_count_; |
2162 | 2160 |
2163 // Running hash over allocations performed. | 2161 // Running hash over allocations performed. |
2164 uint32_t raw_allocations_hash_; | 2162 uint32_t raw_allocations_hash_; |
2165 | 2163 |
2166 // Countdown counter, dumps allocation hash when 0. | |
2167 uint32_t dump_allocations_hash_countdown_; | |
2168 | |
2169 // How many mark-sweep collections happened. | 2164 // How many mark-sweep collections happened. |
2170 unsigned int ms_count_; | 2165 unsigned int ms_count_; |
2171 | 2166 |
2172 // How many gc happened. | 2167 // How many gc happened. |
2173 unsigned int gc_count_; | 2168 unsigned int gc_count_; |
2174 | 2169 |
2175 // For post mortem debugging. | 2170 // For post mortem debugging. |
2176 int remembered_unmapped_pages_index_; | 2171 int remembered_unmapped_pages_index_; |
2177 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; | 2172 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; |
2178 | 2173 |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2715 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2721 | 2716 |
2722 private: | 2717 private: |
2723 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2718 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2724 }; | 2719 }; |
2725 #endif // DEBUG | 2720 #endif // DEBUG |
2726 } // namespace internal | 2721 } // namespace internal |
2727 } // namespace v8 | 2722 } // namespace v8 |
2728 | 2723 |
2729 #endif // V8_HEAP_HEAP_H_ | 2724 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |