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