Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Side by Side Diff: src/heap/heap.h

Issue 1218863002: Replace reduce-memory mode in idle notification with delayed clean-up GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "src/allocation.h" 11 #include "src/allocation.h"
12 #include "src/assert-scope.h" 12 #include "src/assert-scope.h"
13 #include "src/counters.h" 13 #include "src/counters.h"
14 #include "src/globals.h" 14 #include "src/globals.h"
15 #include "src/heap/gc-idle-time-handler.h" 15 #include "src/heap/gc-idle-time-handler.h"
16 #include "src/heap/gc-tracer.h" 16 #include "src/heap/gc-tracer.h"
17 #include "src/heap/incremental-marking.h" 17 #include "src/heap/incremental-marking.h"
18 #include "src/heap/mark-compact.h" 18 #include "src/heap/mark-compact.h"
19 #include "src/heap/memory-reducer.h"
19 #include "src/heap/objects-visiting.h" 20 #include "src/heap/objects-visiting.h"
20 #include "src/heap/spaces.h" 21 #include "src/heap/spaces.h"
21 #include "src/heap/store-buffer.h" 22 #include "src/heap/store-buffer.h"
22 #include "src/list.h" 23 #include "src/list.h"
23 #include "src/splay-tree-inl.h" 24 #include "src/splay-tree-inl.h"
24 25
25 namespace v8 { 26 namespace v8 {
26 namespace internal { 27 namespace internal {
27 28
28 // Defines all the roots in Heap. 29 // Defines all the roots in Heap.
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 825
825 // Last hope GC, should try to squeeze as much as possible. 826 // Last hope GC, should try to squeeze as much as possible.
826 void CollectAllAvailableGarbage(const char* gc_reason = NULL); 827 void CollectAllAvailableGarbage(const char* gc_reason = NULL);
827 828
828 // Check whether the heap is currently iterable. 829 // Check whether the heap is currently iterable.
829 bool IsHeapIterable(); 830 bool IsHeapIterable();
830 831
831 // Notify the heap that a context has been disposed. 832 // Notify the heap that a context has been disposed.
832 int NotifyContextDisposed(bool dependant_context); 833 int NotifyContextDisposed(bool dependant_context);
833 834
835 // Start incremental marking and ensure that idle time handler can perform
836 // incremental steps.
837 void StartIdleIncrementalMarking();
838
834 inline void increment_scan_on_scavenge_pages() { 839 inline void increment_scan_on_scavenge_pages() {
835 scan_on_scavenge_pages_++; 840 scan_on_scavenge_pages_++;
836 if (FLAG_gc_verbose) { 841 if (FLAG_gc_verbose) {
837 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); 842 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_);
838 } 843 }
839 } 844 }
840 845
841 inline void decrement_scan_on_scavenge_pages() { 846 inline void decrement_scan_on_scavenge_pages() {
842 scan_on_scavenge_pages_--; 847 scan_on_scavenge_pages_--;
843 if (FLAG_gc_verbose) { 848 if (FLAG_gc_verbose) {
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 // marking or scavenge phase. 1611 // marking or scavenge phase.
1607 void FreeDeadArrayBuffers(bool from_scavenge); 1612 void FreeDeadArrayBuffers(bool from_scavenge);
1608 1613
1609 // Prepare for a new scavenge phase. A new marking phase is implicitly 1614 // Prepare for a new scavenge phase. A new marking phase is implicitly
1610 // prepared by finishing the previous one. 1615 // prepared by finishing the previous one.
1611 void PrepareArrayBufferDiscoveryInNewSpace(); 1616 void PrepareArrayBufferDiscoveryInNewSpace();
1612 1617
1613 // An ArrayBuffer moved from new space to old space. 1618 // An ArrayBuffer moved from new space to old space.
1614 void PromoteArrayBuffer(Object* buffer); 1619 void PromoteArrayBuffer(Object* buffer);
1615 1620
1621 bool HasLowAllocationRate();
1622 bool HasHighFragmentation();
1623 bool HasHighFragmentation(intptr_t used, intptr_t committed);
1624
1616 protected: 1625 protected:
1617 // Methods made available to tests. 1626 // Methods made available to tests.
1618 1627
1619 // Allocates a JS Map in the heap. 1628 // Allocates a JS Map in the heap.
1620 MUST_USE_RESULT AllocationResult 1629 MUST_USE_RESULT AllocationResult
1621 AllocateMap(InstanceType instance_type, int instance_size, 1630 AllocateMap(InstanceType instance_type, int instance_size,
1622 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1631 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1623 1632
1624 // Allocates and initializes a new JavaScript object based on a 1633 // Allocates and initializes a new JavaScript object based on a
1625 // constructor. 1634 // constructor.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 // remain until the next failure and garbage collection. 1775 // remain until the next failure and garbage collection.
1767 int allocation_timeout_; 1776 int allocation_timeout_;
1768 #endif // DEBUG 1777 #endif // DEBUG
1769 1778
1770 // Limit that triggers a global GC on the next (normally caused) GC. This 1779 // Limit that triggers a global GC on the next (normally caused) GC. This
1771 // is checked when we have already decided to do a GC to help determine 1780 // is checked when we have already decided to do a GC to help determine
1772 // which collector to invoke, before expanding a paged space in the old 1781 // which collector to invoke, before expanding a paged space in the old
1773 // generation and on every allocation in large object space. 1782 // generation and on every allocation in large object space.
1774 intptr_t old_generation_allocation_limit_; 1783 intptr_t old_generation_allocation_limit_;
1775 1784
1776 // The allocation limit when there is >16.66ms idle time in the idle time
1777 // handler.
1778 intptr_t idle_old_generation_allocation_limit_;
1779
1780 // Indicates that an allocation has failed in the old generation since the 1785 // Indicates that an allocation has failed in the old generation since the
1781 // last GC. 1786 // last GC.
1782 bool old_gen_exhausted_; 1787 bool old_gen_exhausted_;
1783 1788
1784 // Indicates that inline bump-pointer allocation has been globally disabled 1789 // Indicates that inline bump-pointer allocation has been globally disabled
1785 // for all spaces. This is used to disable allocations in generated code. 1790 // for all spaces. This is used to disable allocations in generated code.
1786 bool inline_allocation_disabled_; 1791 bool inline_allocation_disabled_;
1787 1792
1788 // Weak list heads, threaded through the objects. 1793 // Weak list heads, threaded through the objects.
1789 // List heads are initialized lazily and contain the undefined_value at start. 1794 // List heads are initialized lazily and contain the undefined_value at start.
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } 2249 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; }
2245 2250
2246 void ConfigureInitialOldGenerationSize(); 2251 void ConfigureInitialOldGenerationSize();
2247 2252
2248 void ConfigureNewGenerationSize(); 2253 void ConfigureNewGenerationSize();
2249 2254
2250 void SelectScavengingVisitorsTable(); 2255 void SelectScavengingVisitorsTable();
2251 2256
2252 bool HasLowYoungGenerationAllocationRate(); 2257 bool HasLowYoungGenerationAllocationRate();
2253 bool HasLowOldGenerationAllocationRate(); 2258 bool HasLowOldGenerationAllocationRate();
2254 bool HasLowAllocationRate();
2255 2259
2256 void ReduceNewSpaceSize(); 2260 void ReduceNewSpaceSize();
2257 2261
2258 bool TryFinalizeIdleIncrementalMarking( 2262 bool TryFinalizeIdleIncrementalMarking(
2259 double idle_time_in_ms, size_t size_of_objects, 2263 double idle_time_in_ms, size_t size_of_objects,
2260 size_t mark_compact_speed_in_bytes_per_ms); 2264 size_t mark_compact_speed_in_bytes_per_ms);
2261 2265
2262 GCIdleTimeHandler::HeapState ComputeHeapState(); 2266 GCIdleTimeHandler::HeapState ComputeHeapState();
2263 2267
2264 bool PerformIdleTimeAction(GCIdleTimeAction action, 2268 bool PerformIdleTimeAction(GCIdleTimeAction action,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 MarkCompactCollector mark_compact_collector_; 2315 MarkCompactCollector mark_compact_collector_;
2312 2316
2313 StoreBuffer store_buffer_; 2317 StoreBuffer store_buffer_;
2314 2318
2315 Marking marking_; 2319 Marking marking_;
2316 2320
2317 IncrementalMarking incremental_marking_; 2321 IncrementalMarking incremental_marking_;
2318 2322
2319 GCIdleTimeHandler gc_idle_time_handler_; 2323 GCIdleTimeHandler gc_idle_time_handler_;
2320 2324
2325 MemoryReducer memory_reducer_;
2326
2321 // These two counters are monotomically increasing and never reset. 2327 // These two counters are monotomically increasing and never reset.
2322 size_t full_codegen_bytes_generated_; 2328 size_t full_codegen_bytes_generated_;
2323 size_t crankshaft_codegen_bytes_generated_; 2329 size_t crankshaft_codegen_bytes_generated_;
2324 2330
2325 // This counter is increased before each GC and never reset. 2331 // This counter is increased before each GC and never reset.
2326 // To account for the bytes allocated since the last GC, use the 2332 // To account for the bytes allocated since the last GC, use the
2327 // NewSpaceAllocationCounter() function. 2333 // NewSpaceAllocationCounter() function.
2328 size_t new_space_allocation_counter_; 2334 size_t new_space_allocation_counter_;
2329 2335
2330 // This counter is increased before each GC and never reset. To 2336 // This counter is increased before each GC and never reset. To
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2858 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2853 2859
2854 private: 2860 private:
2855 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2861 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2856 }; 2862 };
2857 #endif // DEBUG 2863 #endif // DEBUG
2858 } 2864 }
2859 } // namespace v8::internal 2865 } // namespace v8::internal
2860 2866
2861 #endif // V8_HEAP_HEAP_H_ 2867 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698