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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 // Check whether the heap is currently iterable. | 830 // Check whether the heap is currently iterable. |
831 bool IsHeapIterable(); | 831 bool IsHeapIterable(); |
832 | 832 |
833 // Notify the heap that a context has been disposed. | 833 // Notify the heap that a context has been disposed. |
834 int NotifyContextDisposed(bool dependant_context); | 834 int NotifyContextDisposed(bool dependant_context); |
835 | 835 |
836 // Start incremental marking and ensure that idle time handler can perform | 836 // Start incremental marking and ensure that idle time handler can perform |
837 // incremental steps. | 837 // incremental steps. |
838 void StartIdleIncrementalMarking(); | 838 void StartIdleIncrementalMarking(); |
839 | 839 |
| 840 // Starts incremental marking assuming incremental marking is currently |
| 841 // stopped. |
| 842 void StartIncrementalMarking(int gc_flags, |
| 843 const GCCallbackFlags gc_callback_flags, |
| 844 const char* reason = nullptr); |
| 845 |
| 846 // Performs incremental marking steps of step_size_in_bytes as long as |
| 847 // deadline_ins_ms is not reached. step_size_in_bytes can be 0 to compute |
| 848 // an estimate increment. Returns the remaining time that cannot be used |
| 849 // for incremental marking anymore because a single step would exceed the |
| 850 // deadline. |
| 851 double AdvanceIncrementalMarking( |
| 852 intptr_t step_size_in_bytes, double deadline_in_ms, |
| 853 IncrementalMarking::StepActions step_actions); |
| 854 |
| 855 void FinalizeIncrementalMarkingIfComplete(const char* comment); |
| 856 |
840 inline void increment_scan_on_scavenge_pages() { | 857 inline void increment_scan_on_scavenge_pages() { |
841 scan_on_scavenge_pages_++; | 858 scan_on_scavenge_pages_++; |
842 if (FLAG_gc_verbose) { | 859 if (FLAG_gc_verbose) { |
843 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | 860 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); |
844 } | 861 } |
845 } | 862 } |
846 | 863 |
847 inline void decrement_scan_on_scavenge_pages() { | 864 inline void decrement_scan_on_scavenge_pages() { |
848 scan_on_scavenge_pages_--; | 865 scan_on_scavenge_pages_--; |
849 if (FLAG_gc_verbose) { | 866 if (FLAG_gc_verbose) { |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 // prepared by finishing the previous one. | 1637 // prepared by finishing the previous one. |
1621 void PrepareArrayBufferDiscoveryInNewSpace(); | 1638 void PrepareArrayBufferDiscoveryInNewSpace(); |
1622 | 1639 |
1623 // An ArrayBuffer moved from new space to old space. | 1640 // An ArrayBuffer moved from new space to old space. |
1624 void PromoteArrayBuffer(Object* buffer); | 1641 void PromoteArrayBuffer(Object* buffer); |
1625 | 1642 |
1626 bool HasLowAllocationRate(); | 1643 bool HasLowAllocationRate(); |
1627 bool HasHighFragmentation(); | 1644 bool HasHighFragmentation(); |
1628 bool HasHighFragmentation(intptr_t used, intptr_t committed); | 1645 bool HasHighFragmentation(intptr_t used, intptr_t committed); |
1629 | 1646 |
| 1647 bool ShouldOptimizeForMemoryUsage() { return optimize_for_memory_usage_; } |
| 1648 |
1630 protected: | 1649 protected: |
1631 // Methods made available to tests. | 1650 // Methods made available to tests. |
1632 | 1651 |
1633 // Allocates a JS Map in the heap. | 1652 // Allocates a JS Map in the heap. |
1634 MUST_USE_RESULT AllocationResult | 1653 MUST_USE_RESULT AllocationResult |
1635 AllocateMap(InstanceType instance_type, int instance_size, | 1654 AllocateMap(InstanceType instance_type, int instance_size, |
1636 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1655 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
1637 | 1656 |
1638 // Allocates and initializes a new JavaScript object based on a | 1657 // Allocates and initializes a new JavaScript object based on a |
1639 // constructor. | 1658 // constructor. |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } | 2279 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } |
2261 | 2280 |
2262 void ConfigureInitialOldGenerationSize(); | 2281 void ConfigureInitialOldGenerationSize(); |
2263 | 2282 |
2264 void ConfigureNewGenerationSize(); | 2283 void ConfigureNewGenerationSize(); |
2265 | 2284 |
2266 void SelectScavengingVisitorsTable(); | 2285 void SelectScavengingVisitorsTable(); |
2267 | 2286 |
2268 bool HasLowYoungGenerationAllocationRate(); | 2287 bool HasLowYoungGenerationAllocationRate(); |
2269 bool HasLowOldGenerationAllocationRate(); | 2288 bool HasLowOldGenerationAllocationRate(); |
| 2289 double YoungGenerationMutatorUtilization(); |
| 2290 double OldGenerationMutatorUtilization(); |
2270 | 2291 |
2271 void ReduceNewSpaceSize(); | 2292 void ReduceNewSpaceSize(); |
2272 | 2293 |
2273 bool TryFinalizeIdleIncrementalMarking( | 2294 bool TryFinalizeIdleIncrementalMarking( |
2274 double idle_time_in_ms, size_t size_of_objects, | 2295 double idle_time_in_ms, size_t size_of_objects, |
2275 size_t mark_compact_speed_in_bytes_per_ms); | 2296 size_t mark_compact_speed_in_bytes_per_ms); |
2276 | 2297 |
2277 GCIdleTimeHandler::HeapState ComputeHeapState(); | 2298 GCIdleTimeHandler::HeapState ComputeHeapState(); |
2278 | 2299 |
2279 bool PerformIdleTimeAction(GCIdleTimeAction action, | 2300 bool PerformIdleTimeAction(GCIdleTimeAction action, |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2892 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2872 | 2893 |
2873 private: | 2894 private: |
2874 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2895 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2875 }; | 2896 }; |
2876 #endif // DEBUG | 2897 #endif // DEBUG |
2877 } | 2898 } |
2878 } // namespace v8::internal | 2899 } // namespace v8::internal |
2879 | 2900 |
2880 #endif // V8_HEAP_HEAP_H_ | 2901 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |