| 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 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 // The executable size has to be a multiple of Page::kPageSize. | 1139 // The executable size has to be a multiple of Page::kPageSize. |
| 1140 // Sizes are in MB. | 1140 // Sizes are in MB. |
| 1141 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; | 1141 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; |
| 1142 static const int kMaxExecutableSizeMediumMemoryDevice = | 1142 static const int kMaxExecutableSizeMediumMemoryDevice = |
| 1143 192 * kPointerMultiplier; | 1143 192 * kPointerMultiplier; |
| 1144 static const int kMaxExecutableSizeHighMemoryDevice = | 1144 static const int kMaxExecutableSizeHighMemoryDevice = |
| 1145 256 * kPointerMultiplier; | 1145 256 * kPointerMultiplier; |
| 1146 static const int kMaxExecutableSizeHugeMemoryDevice = | 1146 static const int kMaxExecutableSizeHugeMemoryDevice = |
| 1147 256 * kPointerMultiplier; | 1147 256 * kPointerMultiplier; |
| 1148 | 1148 |
| 1149 static const int kTraceRingBufferSize = 512; |
| 1150 |
| 1149 // Calculates the allocation limit based on a given growing factor and a | 1151 // Calculates the allocation limit based on a given growing factor and a |
| 1150 // given old generation size. | 1152 // given old generation size. |
| 1151 intptr_t CalculateOldGenerationAllocationLimit(double factor, | 1153 intptr_t CalculateOldGenerationAllocationLimit(double factor, |
| 1152 intptr_t old_gen_size); | 1154 intptr_t old_gen_size); |
| 1153 | 1155 |
| 1154 // Sets the allocation limit to trigger the next full garbage collection. | 1156 // Sets the allocation limit to trigger the next full garbage collection. |
| 1155 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, | 1157 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
| 1156 int freed_global_handles); | 1158 int freed_global_handles); |
| 1157 | 1159 |
| 1158 // Indicates whether inline bump-pointer allocation has been disabled. | 1160 // Indicates whether inline bump-pointer allocation has been disabled. |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 GCIdleTimeHandler::HeapState heap_state, | 2148 GCIdleTimeHandler::HeapState heap_state, |
| 2147 double start_ms, double deadline_in_ms, | 2149 double start_ms, double deadline_in_ms, |
| 2148 bool is_long_idle_notification); | 2150 bool is_long_idle_notification); |
| 2149 | 2151 |
| 2150 void ClearObjectStats(bool clear_last_time_stats = false); | 2152 void ClearObjectStats(bool clear_last_time_stats = false); |
| 2151 | 2153 |
| 2152 inline void UpdateAllocationsHash(HeapObject* object); | 2154 inline void UpdateAllocationsHash(HeapObject* object); |
| 2153 inline void UpdateAllocationsHash(uint32_t value); | 2155 inline void UpdateAllocationsHash(uint32_t value); |
| 2154 inline void PrintAlloctionsHash(); | 2156 inline void PrintAlloctionsHash(); |
| 2155 | 2157 |
| 2158 void AddToRingBuffer(const char* string); |
| 2159 void GetFromRingBuffer(char* buffer); |
| 2160 |
| 2156 // Object counts and used memory by InstanceType | 2161 // Object counts and used memory by InstanceType |
| 2157 size_t object_counts_[OBJECT_STATS_COUNT]; | 2162 size_t object_counts_[OBJECT_STATS_COUNT]; |
| 2158 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; | 2163 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; |
| 2159 size_t object_sizes_[OBJECT_STATS_COUNT]; | 2164 size_t object_sizes_[OBJECT_STATS_COUNT]; |
| 2160 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; | 2165 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; |
| 2161 | 2166 |
| 2162 // Maximum GC pause. | 2167 // Maximum GC pause. |
| 2163 double max_gc_pause_; | 2168 double max_gc_pause_; |
| 2164 | 2169 |
| 2165 // Total time spent in GC. | 2170 // Total time spent in GC. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 size_t new_space_allocation_counter_; | 2210 size_t new_space_allocation_counter_; |
| 2206 | 2211 |
| 2207 // If the --deopt_every_n_garbage_collections flag is set to a positive value, | 2212 // If the --deopt_every_n_garbage_collections flag is set to a positive value, |
| 2208 // this variable holds the number of garbage collections since the last | 2213 // this variable holds the number of garbage collections since the last |
| 2209 // deoptimization triggered by garbage collection. | 2214 // deoptimization triggered by garbage collection. |
| 2210 int gcs_since_last_deopt_; | 2215 int gcs_since_last_deopt_; |
| 2211 | 2216 |
| 2212 static const int kAllocationSiteScratchpadSize = 256; | 2217 static const int kAllocationSiteScratchpadSize = 256; |
| 2213 int allocation_sites_scratchpad_length_; | 2218 int allocation_sites_scratchpad_length_; |
| 2214 | 2219 |
| 2220 char trace_ring_buffer_[kTraceRingBufferSize]; |
| 2221 // If it's not full then the data is from 0 to ring_buffer_end_. If it's |
| 2222 // full then the data is from ring_buffer_end_ to the end of the buffer and |
| 2223 // from 0 to ring_buffer_end_. |
| 2224 bool ring_buffer_full_; |
| 2225 size_t ring_buffer_end_; |
| 2226 |
| 2215 static const int kMaxMarkCompactsInIdleRound = 7; | 2227 static const int kMaxMarkCompactsInIdleRound = 7; |
| 2216 static const int kIdleScavengeThreshold = 5; | 2228 static const int kIdleScavengeThreshold = 5; |
| 2217 | 2229 |
| 2218 // Shared state read by the scavenge collector and set by ScavengeObject. | 2230 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2219 PromotionQueue promotion_queue_; | 2231 PromotionQueue promotion_queue_; |
| 2220 | 2232 |
| 2221 // Flag is set when the heap has been configured. The heap can be repeatedly | 2233 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 2222 // configured through the API until it is set up. | 2234 // configured through the API until it is set up. |
| 2223 bool configured_; | 2235 bool configured_; |
| 2224 | 2236 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 int* global_handle_count; // 10 | 2288 int* global_handle_count; // 10 |
| 2277 int* weak_global_handle_count; // 11 | 2289 int* weak_global_handle_count; // 11 |
| 2278 int* pending_global_handle_count; // 12 | 2290 int* pending_global_handle_count; // 12 |
| 2279 int* near_death_global_handle_count; // 13 | 2291 int* near_death_global_handle_count; // 13 |
| 2280 int* free_global_handle_count; // 14 | 2292 int* free_global_handle_count; // 14 |
| 2281 intptr_t* memory_allocator_size; // 15 | 2293 intptr_t* memory_allocator_size; // 15 |
| 2282 intptr_t* memory_allocator_capacity; // 16 | 2294 intptr_t* memory_allocator_capacity; // 16 |
| 2283 int* objects_per_type; // 17 | 2295 int* objects_per_type; // 17 |
| 2284 int* size_per_type; // 18 | 2296 int* size_per_type; // 18 |
| 2285 int* os_error; // 19 | 2297 int* os_error; // 19 |
| 2286 int* end_marker; // 20 | 2298 char* last_few_messages; // 20 |
| 2299 int* end_marker; // 21 |
| 2287 }; | 2300 }; |
| 2288 | 2301 |
| 2289 | 2302 |
| 2290 class AlwaysAllocateScope { | 2303 class AlwaysAllocateScope { |
| 2291 public: | 2304 public: |
| 2292 explicit inline AlwaysAllocateScope(Isolate* isolate); | 2305 explicit inline AlwaysAllocateScope(Isolate* isolate); |
| 2293 inline ~AlwaysAllocateScope(); | 2306 inline ~AlwaysAllocateScope(); |
| 2294 | 2307 |
| 2295 private: | 2308 private: |
| 2296 // Implicitly disable artificial allocation failures. | 2309 // Implicitly disable artificial allocation failures. |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2709 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2697 | 2710 |
| 2698 private: | 2711 private: |
| 2699 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2712 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2700 }; | 2713 }; |
| 2701 #endif // DEBUG | 2714 #endif // DEBUG |
| 2702 } | 2715 } |
| 2703 } // namespace v8::internal | 2716 } // namespace v8::internal |
| 2704 | 2717 |
| 2705 #endif // V8_HEAP_HEAP_H_ | 2718 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |