| 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 |
| 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/cleanup-gc.h" |
| 15 #include "src/heap/gc-idle-time-handler.h" | 16 #include "src/heap/gc-idle-time-handler.h" |
| 16 #include "src/heap/gc-tracer.h" | 17 #include "src/heap/gc-tracer.h" |
| 17 #include "src/heap/incremental-marking.h" | 18 #include "src/heap/incremental-marking.h" |
| 18 #include "src/heap/mark-compact.h" | 19 #include "src/heap/mark-compact.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 |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 // marking or scavenge phase. | 1607 // marking or scavenge phase. |
| 1607 void FreeDeadArrayBuffers(bool from_scavenge); | 1608 void FreeDeadArrayBuffers(bool from_scavenge); |
| 1608 | 1609 |
| 1609 // Prepare for a new scavenge phase. A new marking phase is implicitly | 1610 // Prepare for a new scavenge phase. A new marking phase is implicitly |
| 1610 // prepared by finishing the previous one. | 1611 // prepared by finishing the previous one. |
| 1611 void PrepareArrayBufferDiscoveryInNewSpace(); | 1612 void PrepareArrayBufferDiscoveryInNewSpace(); |
| 1612 | 1613 |
| 1613 // An ArrayBuffer moved from new space to old space. | 1614 // An ArrayBuffer moved from new space to old space. |
| 1614 void PromoteArrayBuffer(Object* buffer); | 1615 void PromoteArrayBuffer(Object* buffer); |
| 1615 | 1616 |
| 1617 bool HasLowAllocationRate(); |
| 1618 bool HasHighFragmentation(); |
| 1619 bool HasHighFragmentation(intptr_t used, intptr_t committed); |
| 1620 |
| 1616 protected: | 1621 protected: |
| 1617 // Methods made available to tests. | 1622 // Methods made available to tests. |
| 1618 | 1623 |
| 1619 // Allocates a JS Map in the heap. | 1624 // Allocates a JS Map in the heap. |
| 1620 MUST_USE_RESULT AllocationResult | 1625 MUST_USE_RESULT AllocationResult |
| 1621 AllocateMap(InstanceType instance_type, int instance_size, | 1626 AllocateMap(InstanceType instance_type, int instance_size, |
| 1622 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1627 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 1623 | 1628 |
| 1624 // Allocates and initializes a new JavaScript object based on a | 1629 // Allocates and initializes a new JavaScript object based on a |
| 1625 // constructor. | 1630 // constructor. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 // remain until the next failure and garbage collection. | 1771 // remain until the next failure and garbage collection. |
| 1767 int allocation_timeout_; | 1772 int allocation_timeout_; |
| 1768 #endif // DEBUG | 1773 #endif // DEBUG |
| 1769 | 1774 |
| 1770 // Limit that triggers a global GC on the next (normally caused) GC. This | 1775 // 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 | 1776 // 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 | 1777 // which collector to invoke, before expanding a paged space in the old |
| 1773 // generation and on every allocation in large object space. | 1778 // generation and on every allocation in large object space. |
| 1774 intptr_t old_generation_allocation_limit_; | 1779 intptr_t old_generation_allocation_limit_; |
| 1775 | 1780 |
| 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 | 1781 // Indicates that an allocation has failed in the old generation since the |
| 1781 // last GC. | 1782 // last GC. |
| 1782 bool old_gen_exhausted_; | 1783 bool old_gen_exhausted_; |
| 1783 | 1784 |
| 1784 // Indicates that inline bump-pointer allocation has been globally disabled | 1785 // Indicates that inline bump-pointer allocation has been globally disabled |
| 1785 // for all spaces. This is used to disable allocations in generated code. | 1786 // for all spaces. This is used to disable allocations in generated code. |
| 1786 bool inline_allocation_disabled_; | 1787 bool inline_allocation_disabled_; |
| 1787 | 1788 |
| 1788 // Weak list heads, threaded through the objects. | 1789 // Weak list heads, threaded through the objects. |
| 1789 // List heads are initialized lazily and contain the undefined_value at start. | 1790 // List heads are initialized lazily and contain the undefined_value at start. |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } | 2245 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } |
| 2245 | 2246 |
| 2246 void ConfigureInitialOldGenerationSize(); | 2247 void ConfigureInitialOldGenerationSize(); |
| 2247 | 2248 |
| 2248 void ConfigureNewGenerationSize(); | 2249 void ConfigureNewGenerationSize(); |
| 2249 | 2250 |
| 2250 void SelectScavengingVisitorsTable(); | 2251 void SelectScavengingVisitorsTable(); |
| 2251 | 2252 |
| 2252 bool HasLowYoungGenerationAllocationRate(); | 2253 bool HasLowYoungGenerationAllocationRate(); |
| 2253 bool HasLowOldGenerationAllocationRate(); | 2254 bool HasLowOldGenerationAllocationRate(); |
| 2254 bool HasLowAllocationRate(); | |
| 2255 | 2255 |
| 2256 void ReduceNewSpaceSize(); | 2256 void ReduceNewSpaceSize(); |
| 2257 | 2257 |
| 2258 bool TryFinalizeIdleIncrementalMarking( | 2258 bool TryFinalizeIdleIncrementalMarking( |
| 2259 double idle_time_in_ms, size_t size_of_objects, | 2259 double idle_time_in_ms, size_t size_of_objects, |
| 2260 size_t mark_compact_speed_in_bytes_per_ms); | 2260 size_t mark_compact_speed_in_bytes_per_ms); |
| 2261 | 2261 |
| 2262 GCIdleTimeHandler::HeapState ComputeHeapState(); | 2262 GCIdleTimeHandler::HeapState ComputeHeapState(); |
| 2263 | 2263 |
| 2264 bool PerformIdleTimeAction(GCIdleTimeAction action, | 2264 bool PerformIdleTimeAction(GCIdleTimeAction action, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 MarkCompactCollector mark_compact_collector_; | 2311 MarkCompactCollector mark_compact_collector_; |
| 2312 | 2312 |
| 2313 StoreBuffer store_buffer_; | 2313 StoreBuffer store_buffer_; |
| 2314 | 2314 |
| 2315 Marking marking_; | 2315 Marking marking_; |
| 2316 | 2316 |
| 2317 IncrementalMarking incremental_marking_; | 2317 IncrementalMarking incremental_marking_; |
| 2318 | 2318 |
| 2319 GCIdleTimeHandler gc_idle_time_handler_; | 2319 GCIdleTimeHandler gc_idle_time_handler_; |
| 2320 | 2320 |
| 2321 CleanupGC cleanup_gc_; |
| 2322 |
| 2321 // These two counters are monotomically increasing and never reset. | 2323 // These two counters are monotomically increasing and never reset. |
| 2322 size_t full_codegen_bytes_generated_; | 2324 size_t full_codegen_bytes_generated_; |
| 2323 size_t crankshaft_codegen_bytes_generated_; | 2325 size_t crankshaft_codegen_bytes_generated_; |
| 2324 | 2326 |
| 2325 // This counter is increased before each GC and never reset. | 2327 // This counter is increased before each GC and never reset. |
| 2326 // To account for the bytes allocated since the last GC, use the | 2328 // To account for the bytes allocated since the last GC, use the |
| 2327 // NewSpaceAllocationCounter() function. | 2329 // NewSpaceAllocationCounter() function. |
| 2328 size_t new_space_allocation_counter_; | 2330 size_t new_space_allocation_counter_; |
| 2329 | 2331 |
| 2330 // This counter is increased before each GC and never reset. To | 2332 // This counter is increased before each GC and never reset. To |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2854 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2853 | 2855 |
| 2854 private: | 2856 private: |
| 2855 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2857 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2856 }; | 2858 }; |
| 2857 #endif // DEBUG | 2859 #endif // DEBUG |
| 2858 } | 2860 } |
| 2859 } // namespace v8::internal | 2861 } // namespace v8::internal |
| 2860 | 2862 |
| 2861 #endif // V8_HEAP_HEAP_H_ | 2863 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |