| 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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 921 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
| 922 | 922 |
| 923 // This event is triggered after object is moved to a new place. | 923 // This event is triggered after object is moved to a new place. |
| 924 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 924 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
| 925 int size_in_bytes); | 925 int size_in_bytes); |
| 926 | 926 |
| 927 bool deserialization_complete() const { return deserialization_complete_; } | 927 bool deserialization_complete() const { return deserialization_complete_; } |
| 928 | 928 |
| 929 bool HasLowAllocationRate(); | 929 bool HasLowAllocationRate(); |
| 930 bool HasHighFragmentation(); | 930 bool HasHighFragmentation(); |
| 931 bool HasHighFragmentation(intptr_t used, intptr_t committed); | 931 bool HasHighFragmentation(size_t used, size_t committed); |
| 932 | 932 |
| 933 void ActivateMemoryReducerIfNeeded(); | 933 void ActivateMemoryReducerIfNeeded(); |
| 934 | 934 |
| 935 bool ShouldOptimizeForMemoryUsage(); | 935 bool ShouldOptimizeForMemoryUsage(); |
| 936 | 936 |
| 937 bool IsLowMemoryDevice() { | 937 bool IsLowMemoryDevice() { |
| 938 return max_old_generation_size_ <= kMaxOldSpaceSizeLowMemoryDevice; | 938 return max_old_generation_size_ <= kMaxOldSpaceSizeLowMemoryDevice; |
| 939 } | 939 } |
| 940 | 940 |
| 941 bool IsMemoryConstrainedDevice() { | 941 bool IsMemoryConstrainedDevice() { |
| 942 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; | 942 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; |
| 943 } | 943 } |
| 944 | 944 |
| 945 bool HighMemoryPressure() { | 945 bool HighMemoryPressure() { |
| 946 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; | 946 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; |
| 947 } | 947 } |
| 948 | 948 |
| 949 // =========================================================================== | 949 // =========================================================================== |
| 950 // Initialization. =========================================================== | 950 // Initialization. =========================================================== |
| 951 // =========================================================================== | 951 // =========================================================================== |
| 952 | 952 |
| 953 // Configure heap size in MB before setup. Return false if the heap has been | 953 // Configure heap size in MB before setup. Return false if the heap has been |
| 954 // set up already. | 954 // set up already. |
| 955 bool ConfigureHeap(int max_semi_space_size, int max_old_space_size, | 955 bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, |
| 956 int max_executable_size, size_t code_range_size); | 956 size_t max_executable_size, size_t code_range_size); |
| 957 bool ConfigureHeapDefault(); | 957 bool ConfigureHeapDefault(); |
| 958 | 958 |
| 959 // Prepares the heap, setting up memory areas that are needed in the isolate | 959 // Prepares the heap, setting up memory areas that are needed in the isolate |
| 960 // without actually creating any objects. | 960 // without actually creating any objects. |
| 961 bool SetUp(); | 961 bool SetUp(); |
| 962 | 962 |
| 963 // Bootstraps the object heap with the core set of objects required to run. | 963 // Bootstraps the object heap with the core set of objects required to run. |
| 964 // Returns whether it succeeded. | 964 // Returns whether it succeeded. |
| 965 bool CreateHeapObjects(); | 965 bool CreateHeapObjects(); |
| 966 | 966 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 // =========================================================================== | 1286 // =========================================================================== |
| 1287 | 1287 |
| 1288 // Collect code (Code and BytecodeArray objects) statistics. | 1288 // Collect code (Code and BytecodeArray objects) statistics. |
| 1289 void CollectCodeStatistics(); | 1289 void CollectCodeStatistics(); |
| 1290 | 1290 |
| 1291 // =========================================================================== | 1291 // =========================================================================== |
| 1292 // GC statistics. ============================================================ | 1292 // GC statistics. ============================================================ |
| 1293 // =========================================================================== | 1293 // =========================================================================== |
| 1294 | 1294 |
| 1295 // Returns the maximum amount of memory reserved for the heap. | 1295 // Returns the maximum amount of memory reserved for the heap. |
| 1296 intptr_t MaxReserved() { | 1296 size_t MaxReserved() { |
| 1297 return 2 * max_semi_space_size_ + max_old_generation_size_; | 1297 return 2 * max_semi_space_size_ + max_old_generation_size_; |
| 1298 } | 1298 } |
| 1299 int MaxSemiSpaceSize() { return max_semi_space_size_; } | 1299 size_t MaxSemiSpaceSize() { return max_semi_space_size_; } |
| 1300 int InitialSemiSpaceSize() { return initial_semispace_size_; } | 1300 size_t InitialSemiSpaceSize() { return initial_semispace_size_; } |
| 1301 intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } | 1301 size_t MaxOldGenerationSize() { return max_old_generation_size_; } |
| 1302 intptr_t MaxExecutableSize() { return max_executable_size_; } | 1302 size_t MaxExecutableSize() { return max_executable_size_; } |
| 1303 | 1303 |
| 1304 // Returns the capacity of the heap in bytes w/o growing. Heap grows when | 1304 // Returns the capacity of the heap in bytes w/o growing. Heap grows when |
| 1305 // more spaces are needed until it reaches the limit. | 1305 // more spaces are needed until it reaches the limit. |
| 1306 intptr_t Capacity(); | 1306 size_t Capacity(); |
| 1307 | 1307 |
| 1308 // Returns the capacity of the old generation. | 1308 // Returns the capacity of the old generation. |
| 1309 intptr_t OldGenerationCapacity(); | 1309 size_t OldGenerationCapacity(); |
| 1310 | 1310 |
| 1311 // Returns the amount of memory currently committed for the heap. | 1311 // Returns the amount of memory currently committed for the heap. |
| 1312 size_t CommittedMemory(); | 1312 size_t CommittedMemory(); |
| 1313 | 1313 |
| 1314 // Returns the amount of memory currently committed for the old space. | 1314 // Returns the amount of memory currently committed for the old space. |
| 1315 size_t CommittedOldGenerationMemory(); | 1315 size_t CommittedOldGenerationMemory(); |
| 1316 | 1316 |
| 1317 // Returns the amount of executable memory currently committed for the heap. | 1317 // Returns the amount of executable memory currently committed for the heap. |
| 1318 size_t CommittedMemoryExecutable(); | 1318 size_t CommittedMemoryExecutable(); |
| 1319 | 1319 |
| 1320 // Returns the amount of phyical memory currently committed for the heap. | 1320 // Returns the amount of phyical memory currently committed for the heap. |
| 1321 size_t CommittedPhysicalMemory(); | 1321 size_t CommittedPhysicalMemory(); |
| 1322 | 1322 |
| 1323 // Returns the maximum amount of memory ever committed for the heap. | 1323 // Returns the maximum amount of memory ever committed for the heap. |
| 1324 size_t MaximumCommittedMemory() { return maximum_committed_; } | 1324 size_t MaximumCommittedMemory() { return maximum_committed_; } |
| 1325 | 1325 |
| 1326 // Updates the maximum committed memory for the heap. Should be called | 1326 // Updates the maximum committed memory for the heap. Should be called |
| 1327 // whenever a space grows. | 1327 // whenever a space grows. |
| 1328 void UpdateMaximumCommitted(); | 1328 void UpdateMaximumCommitted(); |
| 1329 | 1329 |
| 1330 // Returns the available bytes in space w/o growing. | 1330 // Returns the available bytes in space w/o growing. |
| 1331 // Heap doesn't guarantee that it can allocate an object that requires | 1331 // Heap doesn't guarantee that it can allocate an object that requires |
| 1332 // all available bytes. Check MaxHeapObjectSize() instead. | 1332 // all available bytes. Check MaxHeapObjectSize() instead. |
| 1333 intptr_t Available(); | 1333 size_t Available(); |
| 1334 | 1334 |
| 1335 // Returns of size of all objects residing in the heap. | 1335 // Returns of size of all objects residing in the heap. |
| 1336 intptr_t SizeOfObjects(); | 1336 size_t SizeOfObjects(); |
| 1337 | 1337 |
| 1338 void UpdateSurvivalStatistics(int start_new_space_size); | 1338 void UpdateSurvivalStatistics(int start_new_space_size); |
| 1339 | 1339 |
| 1340 inline void IncrementPromotedObjectsSize(intptr_t object_size) { | 1340 inline void IncrementPromotedObjectsSize(size_t object_size) { |
| 1341 DCHECK_GE(object_size, 0); | |
| 1342 promoted_objects_size_ += object_size; | 1341 promoted_objects_size_ += object_size; |
| 1343 } | 1342 } |
| 1344 inline intptr_t promoted_objects_size() { return promoted_objects_size_; } | 1343 inline size_t promoted_objects_size() { return promoted_objects_size_; } |
| 1345 | 1344 |
| 1346 inline void IncrementSemiSpaceCopiedObjectSize(intptr_t object_size) { | 1345 inline void IncrementSemiSpaceCopiedObjectSize(size_t object_size) { |
| 1347 DCHECK_GE(object_size, 0); | |
| 1348 semi_space_copied_object_size_ += object_size; | 1346 semi_space_copied_object_size_ += object_size; |
| 1349 } | 1347 } |
| 1350 inline intptr_t semi_space_copied_object_size() { | 1348 inline size_t semi_space_copied_object_size() { |
| 1351 return semi_space_copied_object_size_; | 1349 return semi_space_copied_object_size_; |
| 1352 } | 1350 } |
| 1353 | 1351 |
| 1354 inline intptr_t SurvivedNewSpaceObjectSize() { | 1352 inline size_t SurvivedNewSpaceObjectSize() { |
| 1355 return promoted_objects_size_ + semi_space_copied_object_size_; | 1353 return promoted_objects_size_ + semi_space_copied_object_size_; |
| 1356 } | 1354 } |
| 1357 | 1355 |
| 1358 inline void IncrementNodesDiedInNewSpace() { nodes_died_in_new_space_++; } | 1356 inline void IncrementNodesDiedInNewSpace() { nodes_died_in_new_space_++; } |
| 1359 | 1357 |
| 1360 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } | 1358 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } |
| 1361 | 1359 |
| 1362 inline void IncrementNodesPromoted() { nodes_promoted_++; } | 1360 inline void IncrementNodesPromoted() { nodes_promoted_++; } |
| 1363 | 1361 |
| 1364 inline void IncrementYoungSurvivorsCounter(intptr_t survived) { | 1362 inline void IncrementYoungSurvivorsCounter(size_t survived) { |
| 1365 DCHECK_GE(survived, 0); | |
| 1366 survived_last_scavenge_ = survived; | 1363 survived_last_scavenge_ = survived; |
| 1367 survived_since_last_expansion_ += survived; | 1364 survived_since_last_expansion_ += survived; |
| 1368 } | 1365 } |
| 1369 | 1366 |
| 1370 inline intptr_t PromotedTotalSize() { | 1367 inline uint64_t PromotedTotalSize() { |
| 1371 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); | 1368 return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
| 1372 if (total > std::numeric_limits<intptr_t>::max()) { | |
| 1373 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. | |
| 1374 return std::numeric_limits<intptr_t>::max(); | |
| 1375 } | |
| 1376 if (total < 0) return 0; | |
| 1377 return static_cast<intptr_t>(total); | |
| 1378 } | 1369 } |
| 1379 | 1370 |
| 1380 inline void UpdateNewSpaceAllocationCounter(); | 1371 inline void UpdateNewSpaceAllocationCounter(); |
| 1381 | 1372 |
| 1382 inline size_t NewSpaceAllocationCounter(); | 1373 inline size_t NewSpaceAllocationCounter(); |
| 1383 | 1374 |
| 1384 // This should be used only for testing. | 1375 // This should be used only for testing. |
| 1385 void set_new_space_allocation_counter(size_t new_value) { | 1376 void set_new_space_allocation_counter(size_t new_value) { |
| 1386 new_space_allocation_counter_ = new_value; | 1377 new_space_allocation_counter_ = new_value; |
| 1387 } | 1378 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1401 old_generation_allocation_counter_at_last_gc_ = new_value; | 1392 old_generation_allocation_counter_at_last_gc_ = new_value; |
| 1402 } | 1393 } |
| 1403 | 1394 |
| 1404 size_t PromotedSinceLastGC() { | 1395 size_t PromotedSinceLastGC() { |
| 1405 return PromotedSpaceSizeOfObjects() - old_generation_size_at_last_gc_; | 1396 return PromotedSpaceSizeOfObjects() - old_generation_size_at_last_gc_; |
| 1406 } | 1397 } |
| 1407 | 1398 |
| 1408 int gc_count() const { return gc_count_; } | 1399 int gc_count() const { return gc_count_; } |
| 1409 | 1400 |
| 1410 // Returns the size of objects residing in non new spaces. | 1401 // Returns the size of objects residing in non new spaces. |
| 1411 intptr_t PromotedSpaceSizeOfObjects(); | 1402 size_t PromotedSpaceSizeOfObjects(); |
| 1412 | 1403 |
| 1413 double total_regexp_code_generated() { return total_regexp_code_generated_; } | 1404 double total_regexp_code_generated() { return total_regexp_code_generated_; } |
| 1414 void IncreaseTotalRegexpCodeGenerated(int size) { | 1405 void IncreaseTotalRegexpCodeGenerated(int size) { |
| 1415 total_regexp_code_generated_ += size; | 1406 total_regexp_code_generated_ += size; |
| 1416 } | 1407 } |
| 1417 | 1408 |
| 1418 void IncrementCodeGeneratedBytes(bool is_crankshafted, int size) { | 1409 void IncrementCodeGeneratedBytes(bool is_crankshafted, int size) { |
| 1419 if (is_crankshafted) { | 1410 if (is_crankshafted) { |
| 1420 crankshaft_codegen_bytes_generated_ += size; | 1411 crankshaft_codegen_bytes_generated_ += size; |
| 1421 } else { | 1412 } else { |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); | 1805 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); |
| 1815 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 1806 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); |
| 1816 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1807 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
| 1817 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 1808 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
| 1818 void ProcessWeakListRoots(WeakObjectRetainer* retainer); | 1809 void ProcessWeakListRoots(WeakObjectRetainer* retainer); |
| 1819 | 1810 |
| 1820 // =========================================================================== | 1811 // =========================================================================== |
| 1821 // GC statistics. ============================================================ | 1812 // GC statistics. ============================================================ |
| 1822 // =========================================================================== | 1813 // =========================================================================== |
| 1823 | 1814 |
| 1824 inline intptr_t OldGenerationSpaceAvailable() { | 1815 inline size_t OldGenerationSpaceAvailable() { |
| 1825 return old_generation_allocation_limit_ - PromotedTotalSize(); | 1816 if (old_generation_allocation_limit_ <= PromotedTotalSize()) return 0; |
| 1817 return old_generation_allocation_limit_ - |
| 1818 static_cast<size_t>(PromotedTotalSize()); |
| 1826 } | 1819 } |
| 1827 | 1820 |
| 1828 void UpdateTotalGCTime(double duration); | 1821 void UpdateTotalGCTime(double duration); |
| 1829 | 1822 |
| 1830 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } | 1823 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } |
| 1831 | 1824 |
| 1832 // =========================================================================== | 1825 // =========================================================================== |
| 1833 // Growing strategy. ========================================================= | 1826 // Growing strategy. ========================================================= |
| 1834 // =========================================================================== | 1827 // =========================================================================== |
| 1835 | 1828 |
| 1836 // Decrease the allocation limit if the new limit based on the given | 1829 // Decrease the allocation limit if the new limit based on the given |
| 1837 // parameters is lower than the current limit. | 1830 // parameters is lower than the current limit. |
| 1838 void DampenOldGenerationAllocationLimit(intptr_t old_gen_size, | 1831 void DampenOldGenerationAllocationLimit(size_t old_gen_size, double gc_speed, |
| 1839 double gc_speed, | |
| 1840 double mutator_speed); | 1832 double mutator_speed); |
| 1841 | 1833 |
| 1842 | |
| 1843 // Calculates the allocation limit based on a given growing factor and a | 1834 // Calculates the allocation limit based on a given growing factor and a |
| 1844 // given old generation size. | 1835 // given old generation size. |
| 1845 intptr_t CalculateOldGenerationAllocationLimit(double factor, | 1836 size_t CalculateOldGenerationAllocationLimit(double factor, |
| 1846 intptr_t old_gen_size); | 1837 size_t old_gen_size); |
| 1847 | 1838 |
| 1848 // Sets the allocation limit to trigger the next full garbage collection. | 1839 // Sets the allocation limit to trigger the next full garbage collection. |
| 1849 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed, | 1840 void SetOldGenerationAllocationLimit(size_t old_gen_size, double gc_speed, |
| 1850 double mutator_speed); | 1841 double mutator_speed); |
| 1851 | 1842 |
| 1852 intptr_t MinimumAllocationLimitGrowingStep(); | 1843 size_t MinimumAllocationLimitGrowingStep(); |
| 1853 | 1844 |
| 1854 intptr_t old_generation_allocation_limit() const { | 1845 size_t old_generation_allocation_limit() const { |
| 1855 return old_generation_allocation_limit_; | 1846 return old_generation_allocation_limit_; |
| 1856 } | 1847 } |
| 1857 | 1848 |
| 1858 bool always_allocate() { return always_allocate_scope_count_.Value() != 0; } | 1849 bool always_allocate() { return always_allocate_scope_count_.Value() != 0; } |
| 1859 | 1850 |
| 1860 bool CanExpandOldGeneration(int size) { | 1851 bool CanExpandOldGeneration(int size) { |
| 1861 if (force_oom_) return false; | 1852 if (force_oom_) return false; |
| 1862 return (OldGenerationCapacity() + size) < MaxOldGenerationSize(); | 1853 return (OldGenerationCapacity() + size) < MaxOldGenerationSize(); |
| 1863 } | 1854 } |
| 1864 | 1855 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 // The amount of memory that has been freed concurrently. | 2100 // The amount of memory that has been freed concurrently. |
| 2110 base::AtomicNumber<intptr_t> external_memory_concurrently_freed_; | 2101 base::AtomicNumber<intptr_t> external_memory_concurrently_freed_; |
| 2111 | 2102 |
| 2112 // This can be calculated directly from a pointer to the heap; however, it is | 2103 // This can be calculated directly from a pointer to the heap; however, it is |
| 2113 // more expedient to get at the isolate directly from within Heap methods. | 2104 // more expedient to get at the isolate directly from within Heap methods. |
| 2114 Isolate* isolate_; | 2105 Isolate* isolate_; |
| 2115 | 2106 |
| 2116 Object* roots_[kRootListLength]; | 2107 Object* roots_[kRootListLength]; |
| 2117 | 2108 |
| 2118 size_t code_range_size_; | 2109 size_t code_range_size_; |
| 2119 int max_semi_space_size_; | 2110 size_t max_semi_space_size_; |
| 2120 int initial_semispace_size_; | 2111 size_t initial_semispace_size_; |
| 2121 intptr_t max_old_generation_size_; | 2112 size_t max_old_generation_size_; |
| 2122 intptr_t initial_old_generation_size_; | 2113 size_t initial_old_generation_size_; |
| 2123 bool old_generation_size_configured_; | 2114 bool old_generation_size_configured_; |
| 2124 intptr_t max_executable_size_; | 2115 size_t max_executable_size_; |
| 2125 size_t maximum_committed_; | 2116 size_t maximum_committed_; |
| 2126 | 2117 |
| 2127 // For keeping track of how much data has survived | 2118 // For keeping track of how much data has survived |
| 2128 // scavenge since last new space expansion. | 2119 // scavenge since last new space expansion. |
| 2129 intptr_t survived_since_last_expansion_; | 2120 size_t survived_since_last_expansion_; |
| 2130 | 2121 |
| 2131 // ... and since the last scavenge. | 2122 // ... and since the last scavenge. |
| 2132 intptr_t survived_last_scavenge_; | 2123 size_t survived_last_scavenge_; |
| 2133 | 2124 |
| 2134 // This is not the depth of nested AlwaysAllocateScope's but rather a single | 2125 // This is not the depth of nested AlwaysAllocateScope's but rather a single |
| 2135 // count, as scopes can be acquired from multiple tasks (read: threads). | 2126 // count, as scopes can be acquired from multiple tasks (read: threads). |
| 2136 base::AtomicNumber<size_t> always_allocate_scope_count_; | 2127 base::AtomicNumber<size_t> always_allocate_scope_count_; |
| 2137 | 2128 |
| 2138 // Stores the memory pressure level that set by MemoryPressureNotification | 2129 // Stores the memory pressure level that set by MemoryPressureNotification |
| 2139 // and reset by a mark-compact garbage collection. | 2130 // and reset by a mark-compact garbage collection. |
| 2140 base::AtomicValue<MemoryPressureLevel> memory_pressure_level_; | 2131 base::AtomicValue<MemoryPressureLevel> memory_pressure_level_; |
| 2141 | 2132 |
| 2142 // For keeping track of context disposals. | 2133 // For keeping track of context disposals. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2154 OldSpace* code_space_; | 2145 OldSpace* code_space_; |
| 2155 MapSpace* map_space_; | 2146 MapSpace* map_space_; |
| 2156 LargeObjectSpace* lo_space_; | 2147 LargeObjectSpace* lo_space_; |
| 2157 // Map from the space id to the space. | 2148 // Map from the space id to the space. |
| 2158 Space* space_[LAST_SPACE + 1]; | 2149 Space* space_[LAST_SPACE + 1]; |
| 2159 HeapState gc_state_; | 2150 HeapState gc_state_; |
| 2160 int gc_post_processing_depth_; | 2151 int gc_post_processing_depth_; |
| 2161 Address new_space_top_after_last_gc_; | 2152 Address new_space_top_after_last_gc_; |
| 2162 | 2153 |
| 2163 // Returns the amount of external memory registered since last global gc. | 2154 // Returns the amount of external memory registered since last global gc. |
| 2164 int64_t PromotedExternalMemorySize(); | 2155 uint64_t PromotedExternalMemorySize(); |
| 2165 | 2156 |
| 2166 // How many "runtime allocations" happened. | 2157 // How many "runtime allocations" happened. |
| 2167 uint32_t allocations_count_; | 2158 uint32_t allocations_count_; |
| 2168 | 2159 |
| 2169 // Running hash over allocations performed. | 2160 // Running hash over allocations performed. |
| 2170 uint32_t raw_allocations_hash_; | 2161 uint32_t raw_allocations_hash_; |
| 2171 | 2162 |
| 2172 // How many mark-sweep collections happened. | 2163 // How many mark-sweep collections happened. |
| 2173 unsigned int ms_count_; | 2164 unsigned int ms_count_; |
| 2174 | 2165 |
| 2175 // How many gc happened. | 2166 // How many gc happened. |
| 2176 unsigned int gc_count_; | 2167 unsigned int gc_count_; |
| 2177 | 2168 |
| 2178 // For post mortem debugging. | 2169 // For post mortem debugging. |
| 2179 int remembered_unmapped_pages_index_; | 2170 int remembered_unmapped_pages_index_; |
| 2180 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; | 2171 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; |
| 2181 | 2172 |
| 2182 #ifdef DEBUG | 2173 #ifdef DEBUG |
| 2183 // If the --gc-interval flag is set to a positive value, this | 2174 // If the --gc-interval flag is set to a positive value, this |
| 2184 // variable holds the value indicating the number of allocations | 2175 // variable holds the value indicating the number of allocations |
| 2185 // remain until the next failure and garbage collection. | 2176 // remain until the next failure and garbage collection. |
| 2186 int allocation_timeout_; | 2177 int allocation_timeout_; |
| 2187 #endif // DEBUG | 2178 #endif // DEBUG |
| 2188 | 2179 |
| 2189 // Limit that triggers a global GC on the next (normally caused) GC. This | 2180 // Limit that triggers a global GC on the next (normally caused) GC. This |
| 2190 // is checked when we have already decided to do a GC to help determine | 2181 // is checked when we have already decided to do a GC to help determine |
| 2191 // which collector to invoke, before expanding a paged space in the old | 2182 // which collector to invoke, before expanding a paged space in the old |
| 2192 // generation and on every allocation in large object space. | 2183 // generation and on every allocation in large object space. |
| 2193 intptr_t old_generation_allocation_limit_; | 2184 size_t old_generation_allocation_limit_; |
| 2194 | 2185 |
| 2195 // Indicates that inline bump-pointer allocation has been globally disabled | 2186 // Indicates that inline bump-pointer allocation has been globally disabled |
| 2196 // for all spaces. This is used to disable allocations in generated code. | 2187 // for all spaces. This is used to disable allocations in generated code. |
| 2197 bool inline_allocation_disabled_; | 2188 bool inline_allocation_disabled_; |
| 2198 | 2189 |
| 2199 // Weak list heads, threaded through the objects. | 2190 // Weak list heads, threaded through the objects. |
| 2200 // List heads are initialized lazily and contain the undefined_value at start. | 2191 // List heads are initialized lazily and contain the undefined_value at start. |
| 2201 Object* native_contexts_list_; | 2192 Object* native_contexts_list_; |
| 2202 Object* allocation_sites_list_; | 2193 Object* allocation_sites_list_; |
| 2203 | 2194 |
| 2204 // List of encountered weak collections (JSWeakMap and JSWeakSet) during | 2195 // List of encountered weak collections (JSWeakMap and JSWeakSet) during |
| 2205 // marking. It is initialized during marking, destroyed after marking and | 2196 // marking. It is initialized during marking, destroyed after marking and |
| 2206 // contains Smi(0) while marking is not active. | 2197 // contains Smi(0) while marking is not active. |
| 2207 Object* encountered_weak_collections_; | 2198 Object* encountered_weak_collections_; |
| 2208 | 2199 |
| 2209 Object* encountered_weak_cells_; | 2200 Object* encountered_weak_cells_; |
| 2210 | 2201 |
| 2211 Object* encountered_transition_arrays_; | 2202 Object* encountered_transition_arrays_; |
| 2212 | 2203 |
| 2213 List<GCCallbackPair> gc_epilogue_callbacks_; | 2204 List<GCCallbackPair> gc_epilogue_callbacks_; |
| 2214 List<GCCallbackPair> gc_prologue_callbacks_; | 2205 List<GCCallbackPair> gc_prologue_callbacks_; |
| 2215 | 2206 |
| 2216 // Total RegExp code ever generated | 2207 // Total RegExp code ever generated |
| 2217 double total_regexp_code_generated_; | 2208 double total_regexp_code_generated_; |
| 2218 | 2209 |
| 2219 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; | 2210 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; |
| 2220 | 2211 |
| 2221 GCTracer* tracer_; | 2212 GCTracer* tracer_; |
| 2222 | 2213 |
| 2223 intptr_t promoted_objects_size_; | 2214 size_t promoted_objects_size_; |
| 2224 double promotion_ratio_; | 2215 double promotion_ratio_; |
| 2225 double promotion_rate_; | 2216 double promotion_rate_; |
| 2226 intptr_t semi_space_copied_object_size_; | 2217 size_t semi_space_copied_object_size_; |
| 2227 intptr_t previous_semi_space_copied_object_size_; | 2218 size_t previous_semi_space_copied_object_size_; |
| 2228 double semi_space_copied_rate_; | 2219 double semi_space_copied_rate_; |
| 2229 int nodes_died_in_new_space_; | 2220 int nodes_died_in_new_space_; |
| 2230 int nodes_copied_in_new_space_; | 2221 int nodes_copied_in_new_space_; |
| 2231 int nodes_promoted_; | 2222 int nodes_promoted_; |
| 2232 | 2223 |
| 2233 // This is the pretenuring trigger for allocation sites that are in maybe | 2224 // This is the pretenuring trigger for allocation sites that are in maybe |
| 2234 // tenure state. When we switched to the maximum new space size we deoptimize | 2225 // tenure state. When we switched to the maximum new space size we deoptimize |
| 2235 // the code that belongs to the allocation site and derive the lifetime | 2226 // the code that belongs to the allocation site and derive the lifetime |
| 2236 // of the allocation site. | 2227 // of the allocation site. |
| 2237 unsigned int maximum_size_scavenges_; | 2228 unsigned int maximum_size_scavenges_; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 friend class LargeObjectSpace; | 2641 friend class LargeObjectSpace; |
| 2651 friend class NewSpace; | 2642 friend class NewSpace; |
| 2652 friend class PagedSpace; | 2643 friend class PagedSpace; |
| 2653 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2644 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2654 }; | 2645 }; |
| 2655 | 2646 |
| 2656 } // namespace internal | 2647 } // namespace internal |
| 2657 } // namespace v8 | 2648 } // namespace v8 |
| 2658 | 2649 |
| 2659 #endif // V8_HEAP_HEAP_H_ | 2650 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |