OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1420 void QueueMemoryChunkForFree(MemoryChunk* chunk); | 1420 void QueueMemoryChunkForFree(MemoryChunk* chunk); |
1421 void FreeQueuedChunks(); | 1421 void FreeQueuedChunks(); |
1422 | 1422 |
1423 // Completely clear the Instanceof cache (to stop it keeping objects alive | 1423 // Completely clear the Instanceof cache (to stop it keeping objects alive |
1424 // around a GC). | 1424 // around a GC). |
1425 inline void CompletelyClearInstanceofCache(); | 1425 inline void CompletelyClearInstanceofCache(); |
1426 | 1426 |
1427 // The roots that have an index less than this are always in old space. | 1427 // The roots that have an index less than this are always in old space. |
1428 static const int kOldSpaceRoots = 0x20; | 1428 static const int kOldSpaceRoots = 0x20; |
1429 | 1429 |
1430 bool idle_notification_will_schedule_next_gc() { | |
1431 return idle_notification_will_schedule_next_gc_; | |
1432 } | |
1433 | |
1430 private: | 1434 private: |
1431 Heap(); | 1435 Heap(); |
1432 | 1436 |
1433 // This can be calculated directly from a pointer to the heap; however, it is | 1437 // This can be calculated directly from a pointer to the heap; however, it is |
1434 // more expedient to get at the isolate directly from within Heap methods. | 1438 // more expedient to get at the isolate directly from within Heap methods. |
1435 Isolate* isolate_; | 1439 Isolate* isolate_; |
1436 | 1440 |
1437 intptr_t code_range_size_; | 1441 intptr_t code_range_size_; |
1438 int reserved_semispace_size_; | 1442 int reserved_semispace_size_; |
1439 int max_semispace_size_; | 1443 int max_semispace_size_; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1745 bool IsIncreasingSurvivalTrend() { | 1749 bool IsIncreasingSurvivalTrend() { |
1746 return survival_rate_trend() == INCREASING; | 1750 return survival_rate_trend() == INCREASING; |
1747 } | 1751 } |
1748 | 1752 |
1749 bool IsHighSurvivalRate() { | 1753 bool IsHighSurvivalRate() { |
1750 return high_survival_rate_period_length_ > 0; | 1754 return high_survival_rate_period_length_ > 0; |
1751 } | 1755 } |
1752 | 1756 |
1753 void SelectScavengingVisitorsTable(); | 1757 void SelectScavengingVisitorsTable(); |
1754 | 1758 |
1759 bool WorthStartingGCWhenIdle() { | |
1760 if (contexts_disposed_ > 0) { | |
1761 return true; | |
1762 } | |
1763 if (number_idle_notifications_ < kMaxIdleCount) { | |
1764 return incremental_marking()->WorthActivating(); | |
1765 } | |
1766 if (gc_count_ - last_idle_notification_gc_count_ > kGCsBetweenCleanup) { | |
1767 return incremental_marking()->WorthActivating() && | |
1768 NextGCIsLikelyToBeFull(); | |
1769 } | |
1770 return false; | |
1771 } | |
1772 | |
1773 // Returns true if no more GC work is left. | |
1774 bool IdleGlobalGC(); | |
1775 | |
1755 static const int kInitialSymbolTableSize = 2048; | 1776 static const int kInitialSymbolTableSize = 2048; |
1756 static const int kInitialEvalCacheSize = 64; | 1777 static const int kInitialEvalCacheSize = 64; |
1757 | 1778 |
1758 // Maximum GC pause. | 1779 // Maximum GC pause. |
1759 int max_gc_pause_; | 1780 int max_gc_pause_; |
1760 | 1781 |
1761 // Maximum size of objects alive after GC. | 1782 // Maximum size of objects alive after GC. |
1762 intptr_t max_alive_after_gc_; | 1783 intptr_t max_alive_after_gc_; |
1763 | 1784 |
1764 // Minimal interval between two subsequent collections. | 1785 // Minimal interval between two subsequent collections. |
1765 int min_in_mutator_; | 1786 int min_in_mutator_; |
1766 | 1787 |
1767 // Size of objects alive after last GC. | 1788 // Size of objects alive after last GC. |
1768 intptr_t alive_after_last_gc_; | 1789 intptr_t alive_after_last_gc_; |
1769 | 1790 |
1770 double last_gc_end_timestamp_; | 1791 double last_gc_end_timestamp_; |
1771 | 1792 |
1772 MarkCompactCollector mark_compact_collector_; | 1793 MarkCompactCollector mark_compact_collector_; |
1773 | 1794 |
1774 StoreBuffer store_buffer_; | 1795 StoreBuffer store_buffer_; |
1775 | 1796 |
1776 Marking marking_; | 1797 Marking marking_; |
1777 | 1798 |
1778 IncrementalMarking incremental_marking_; | 1799 IncrementalMarking incremental_marking_; |
1779 | 1800 |
1801 static const int kIdlesBeforeScavenge = 4; | |
1802 static const int kIdlesBeforeMarkSweep = 7; | |
1803 static const int kIdlesBeforeMarkCompact = 8; | |
1804 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; | |
Erik Corry
2011/11/10 15:06:55
The name kMaxIdleCount no longer makes much sense.
ulan
2011/11/11 13:27:26
Now I don't use this constant in the new IdleNotif
| |
1805 static const unsigned int kGCsBetweenCleanup = 4; | |
Erik Corry
2011/11/10 15:06:55
I suggest kScavengesBeforeFullGC for this one.
ulan
2011/11/11 13:27:26
Ditto.
| |
1806 | |
1780 int number_idle_notifications_; | 1807 int number_idle_notifications_; |
1781 unsigned int last_idle_notification_gc_count_; | 1808 unsigned int last_idle_notification_gc_count_; |
1782 bool last_idle_notification_gc_count_init_; | 1809 bool last_idle_notification_gc_count_init_; |
1810 bool idle_notification_will_schedule_next_gc_; | |
1811 double last_idle_notification_timestamp_; | |
1812 | |
1783 | 1813 |
1784 // Shared state read by the scavenge collector and set by ScavengeObject. | 1814 // Shared state read by the scavenge collector and set by ScavengeObject. |
1785 PromotionQueue promotion_queue_; | 1815 PromotionQueue promotion_queue_; |
1786 | 1816 |
1787 // Flag is set when the heap has been configured. The heap can be repeatedly | 1817 // Flag is set when the heap has been configured. The heap can be repeatedly |
1788 // configured through the API until it is setup. | 1818 // configured through the API until it is setup. |
1789 bool configured_; | 1819 bool configured_; |
1790 | 1820 |
1791 ExternalStringTable external_string_table_; | 1821 ExternalStringTable external_string_table_; |
1792 | 1822 |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2478 | 2508 |
2479 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2509 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2480 }; | 2510 }; |
2481 #endif // DEBUG || LIVE_OBJECT_LIST | 2511 #endif // DEBUG || LIVE_OBJECT_LIST |
2482 | 2512 |
2483 } } // namespace v8::internal | 2513 } } // namespace v8::internal |
2484 | 2514 |
2485 #undef HEAP | 2515 #undef HEAP |
2486 | 2516 |
2487 #endif // V8_HEAP_H_ | 2517 #endif // V8_HEAP_H_ |
OLD | NEW |