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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } | 1345 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } |
1346 | 1346 |
1347 inline void IncrementNodesPromoted() { nodes_promoted_++; } | 1347 inline void IncrementNodesPromoted() { nodes_promoted_++; } |
1348 | 1348 |
1349 inline void IncrementYoungSurvivorsCounter(intptr_t survived) { | 1349 inline void IncrementYoungSurvivorsCounter(intptr_t survived) { |
1350 DCHECK_GE(survived, 0); | 1350 DCHECK_GE(survived, 0); |
1351 survived_last_scavenge_ = survived; | 1351 survived_last_scavenge_ = survived; |
1352 survived_since_last_expansion_ += survived; | 1352 survived_since_last_expansion_ += survived; |
1353 } | 1353 } |
1354 | 1354 |
| 1355 inline intptr_t PromotedTotalSize() { |
| 1356 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
| 1357 if (total > std::numeric_limits<intptr_t>::max()) { |
| 1358 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. |
| 1359 return std::numeric_limits<intptr_t>::max(); |
| 1360 } |
| 1361 if (total < 0) return 0; |
| 1362 return static_cast<intptr_t>(total); |
| 1363 } |
| 1364 |
1355 inline void UpdateNewSpaceAllocationCounter(); | 1365 inline void UpdateNewSpaceAllocationCounter(); |
1356 | 1366 |
1357 inline size_t NewSpaceAllocationCounter(); | 1367 inline size_t NewSpaceAllocationCounter(); |
1358 | 1368 |
1359 // This should be used only for testing. | 1369 // This should be used only for testing. |
1360 void set_new_space_allocation_counter(size_t new_value) { | 1370 void set_new_space_allocation_counter(size_t new_value) { |
1361 new_space_allocation_counter_ = new_value; | 1371 new_space_allocation_counter_ = new_value; |
1362 } | 1372 } |
1363 | 1373 |
1364 void UpdateOldGenerationAllocationCounter() { | 1374 void UpdateOldGenerationAllocationCounter() { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 1797 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); |
1788 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1798 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
1789 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 1799 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
1790 void ProcessWeakListRoots(WeakObjectRetainer* retainer); | 1800 void ProcessWeakListRoots(WeakObjectRetainer* retainer); |
1791 | 1801 |
1792 // =========================================================================== | 1802 // =========================================================================== |
1793 // GC statistics. ============================================================ | 1803 // GC statistics. ============================================================ |
1794 // =========================================================================== | 1804 // =========================================================================== |
1795 | 1805 |
1796 inline intptr_t OldGenerationSpaceAvailable() { | 1806 inline intptr_t OldGenerationSpaceAvailable() { |
1797 return old_generation_allocation_limit_ - PromotedSpaceSizeOfObjects(); | 1807 return old_generation_allocation_limit_ - PromotedTotalSize(); |
1798 } | 1808 } |
1799 | 1809 |
1800 // Returns maximum GC pause. | 1810 // Returns maximum GC pause. |
1801 double get_max_gc_pause() { return max_gc_pause_; } | 1811 double get_max_gc_pause() { return max_gc_pause_; } |
1802 | 1812 |
1803 // Returns maximum size of objects alive after GC. | 1813 // Returns maximum size of objects alive after GC. |
1804 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } | 1814 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } |
1805 | 1815 |
1806 // Returns minimal interval between two subsequent collections. | 1816 // Returns minimal interval between two subsequent collections. |
1807 double get_min_in_mutator() { return min_in_mutator_; } | 1817 double get_min_in_mutator() { return min_in_mutator_; } |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2631 friend class LargeObjectSpace; | 2641 friend class LargeObjectSpace; |
2632 friend class NewSpace; | 2642 friend class NewSpace; |
2633 friend class PagedSpace; | 2643 friend class PagedSpace; |
2634 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2644 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2635 }; | 2645 }; |
2636 | 2646 |
2637 } // namespace internal | 2647 } // namespace internal |
2638 } // namespace v8 | 2648 } // namespace v8 |
2639 | 2649 |
2640 #endif // V8_HEAP_HEAP_H_ | 2650 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |