| 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1365 |
| 1366 inline void UpdateNewSpaceAllocationCounter(); | 1366 inline void UpdateNewSpaceAllocationCounter(); |
| 1367 inline size_t NewSpaceAllocationCounter(); | 1367 inline size_t NewSpaceAllocationCounter(); |
| 1368 | 1368 |
| 1369 // This should be used only for testing. | 1369 // This should be used only for testing. |
| 1370 void set_new_space_allocation_counter(size_t new_value) { | 1370 void set_new_space_allocation_counter(size_t new_value) { |
| 1371 new_space_allocation_counter_ = new_value; | 1371 new_space_allocation_counter_ = new_value; |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 void UpdateOldGenerationAllocationCounter() { | 1374 void UpdateOldGenerationAllocationCounter() { |
| 1375 old_generation_allocation_counter_ = OldGenerationAllocationCounter(); | 1375 old_generation_allocation_counter_at_last_gc_ = |
| 1376 OldGenerationAllocationCounter(); |
| 1376 } | 1377 } |
| 1377 | 1378 |
| 1378 size_t OldGenerationAllocationCounter() { | 1379 size_t OldGenerationAllocationCounter() { |
| 1379 return old_generation_allocation_counter_ + PromotedSinceLastGC(); | 1380 return old_generation_allocation_counter_at_last_gc_ + |
| 1381 PromotedSinceLastGC(); |
| 1380 } | 1382 } |
| 1381 | 1383 |
| 1382 // This should be used only for testing. | 1384 // This should be used only for testing. |
| 1383 void set_old_generation_allocation_counter(size_t new_value) { | 1385 void set_old_generation_allocation_counter_at_last_gc(size_t new_value) { |
| 1384 old_generation_allocation_counter_ = new_value; | 1386 old_generation_allocation_counter_at_last_gc_ = new_value; |
| 1385 } | 1387 } |
| 1386 | 1388 |
| 1387 size_t PromotedSinceLastGC() { | 1389 size_t PromotedSinceLastGC() { |
| 1388 return PromotedSpaceSizeOfObjects() - old_generation_size_at_last_gc_; | 1390 return PromotedSpaceSizeOfObjects() - old_generation_size_at_last_gc_; |
| 1389 } | 1391 } |
| 1390 | 1392 |
| 1391 int gc_count() const { return gc_count_; } | 1393 int gc_count() const { return gc_count_; } |
| 1392 | 1394 |
| 1393 // Returns the size of objects residing in non new spaces. | 1395 // Returns the size of objects residing in non new spaces. |
| 1394 intptr_t PromotedSpaceSizeOfObjects(); | 1396 intptr_t PromotedSpaceSizeOfObjects(); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 | 1703 |
| 1702 // Record statistics before and after garbage collection. | 1704 // Record statistics before and after garbage collection. |
| 1703 void ReportStatisticsBeforeGC(); | 1705 void ReportStatisticsBeforeGC(); |
| 1704 void ReportStatisticsAfterGC(); | 1706 void ReportStatisticsAfterGC(); |
| 1705 | 1707 |
| 1706 // Creates and installs the full-sized number string cache. | 1708 // Creates and installs the full-sized number string cache. |
| 1707 int FullSizeNumberStringCacheLength(); | 1709 int FullSizeNumberStringCacheLength(); |
| 1708 // Flush the number to string cache. | 1710 // Flush the number to string cache. |
| 1709 void FlushNumberStringCache(); | 1711 void FlushNumberStringCache(); |
| 1710 | 1712 |
| 1711 // TODO(hpayer): Allocation site pretenuring may make this method obsolete. | |
| 1712 // Re-visit incremental marking heuristics. | |
| 1713 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } | |
| 1714 | |
| 1715 void ConfigureInitialOldGenerationSize(); | 1713 void ConfigureInitialOldGenerationSize(); |
| 1716 | 1714 |
| 1717 bool HasLowYoungGenerationAllocationRate(); | 1715 bool HasLowYoungGenerationAllocationRate(); |
| 1718 bool HasLowOldGenerationAllocationRate(); | 1716 bool HasLowOldGenerationAllocationRate(); |
| 1719 double YoungGenerationMutatorUtilization(); | 1717 double YoungGenerationMutatorUtilization(); |
| 1720 double OldGenerationMutatorUtilization(); | 1718 double OldGenerationMutatorUtilization(); |
| 1721 | 1719 |
| 1722 void ReduceNewSpaceSize(); | 1720 void ReduceNewSpaceSize(); |
| 1723 | 1721 |
| 1724 GCIdleTimeHeapState ComputeHeapState(); | 1722 GCIdleTimeHeapState ComputeHeapState(); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 List<GCCallbackPair> gc_epilogue_callbacks_; | 2177 List<GCCallbackPair> gc_epilogue_callbacks_; |
| 2180 List<GCCallbackPair> gc_prologue_callbacks_; | 2178 List<GCCallbackPair> gc_prologue_callbacks_; |
| 2181 | 2179 |
| 2182 // Total RegExp code ever generated | 2180 // Total RegExp code ever generated |
| 2183 double total_regexp_code_generated_; | 2181 double total_regexp_code_generated_; |
| 2184 | 2182 |
| 2185 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; | 2183 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; |
| 2186 | 2184 |
| 2187 GCTracer* tracer_; | 2185 GCTracer* tracer_; |
| 2188 | 2186 |
| 2189 int high_survival_rate_period_length_; | |
| 2190 intptr_t promoted_objects_size_; | 2187 intptr_t promoted_objects_size_; |
| 2191 double promotion_ratio_; | 2188 double promotion_ratio_; |
| 2192 double promotion_rate_; | 2189 double promotion_rate_; |
| 2193 intptr_t semi_space_copied_object_size_; | 2190 intptr_t semi_space_copied_object_size_; |
| 2194 intptr_t previous_semi_space_copied_object_size_; | 2191 intptr_t previous_semi_space_copied_object_size_; |
| 2195 double semi_space_copied_rate_; | 2192 double semi_space_copied_rate_; |
| 2196 int nodes_died_in_new_space_; | 2193 int nodes_died_in_new_space_; |
| 2197 int nodes_copied_in_new_space_; | 2194 int nodes_copied_in_new_space_; |
| 2198 int nodes_promoted_; | 2195 int nodes_promoted_; |
| 2199 | 2196 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 size_t crankshaft_codegen_bytes_generated_; | 2235 size_t crankshaft_codegen_bytes_generated_; |
| 2239 | 2236 |
| 2240 // This counter is increased before each GC and never reset. | 2237 // This counter is increased before each GC and never reset. |
| 2241 // To account for the bytes allocated since the last GC, use the | 2238 // To account for the bytes allocated since the last GC, use the |
| 2242 // NewSpaceAllocationCounter() function. | 2239 // NewSpaceAllocationCounter() function. |
| 2243 size_t new_space_allocation_counter_; | 2240 size_t new_space_allocation_counter_; |
| 2244 | 2241 |
| 2245 // This counter is increased before each GC and never reset. To | 2242 // This counter is increased before each GC and never reset. To |
| 2246 // account for the bytes allocated since the last GC, use the | 2243 // account for the bytes allocated since the last GC, use the |
| 2247 // OldGenerationAllocationCounter() function. | 2244 // OldGenerationAllocationCounter() function. |
| 2248 size_t old_generation_allocation_counter_; | 2245 size_t old_generation_allocation_counter_at_last_gc_; |
| 2249 | 2246 |
| 2250 // The size of objects in old generation after the last MarkCompact GC. | 2247 // The size of objects in old generation after the last MarkCompact GC. |
| 2251 size_t old_generation_size_at_last_gc_; | 2248 size_t old_generation_size_at_last_gc_; |
| 2252 | 2249 |
| 2253 // If the --deopt_every_n_garbage_collections flag is set to a positive value, | 2250 // If the --deopt_every_n_garbage_collections flag is set to a positive value, |
| 2254 // this variable holds the number of garbage collections since the last | 2251 // this variable holds the number of garbage collections since the last |
| 2255 // deoptimization triggered by garbage collection. | 2252 // deoptimization triggered by garbage collection. |
| 2256 int gcs_since_last_deopt_; | 2253 int gcs_since_last_deopt_; |
| 2257 | 2254 |
| 2258 // The feedback storage is used to store allocation sites (keys) and how often | 2255 // The feedback storage is used to store allocation sites (keys) and how often |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2610 friend class LargeObjectSpace; | 2607 friend class LargeObjectSpace; |
| 2611 friend class NewSpace; | 2608 friend class NewSpace; |
| 2612 friend class PagedSpace; | 2609 friend class PagedSpace; |
| 2613 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2610 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2614 }; | 2611 }; |
| 2615 | 2612 |
| 2616 } // namespace internal | 2613 } // namespace internal |
| 2617 } // namespace v8 | 2614 } // namespace v8 |
| 2618 | 2615 |
| 2619 #endif // V8_HEAP_HEAP_H_ | 2616 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |