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 // Clients of this interface shouldn't depend on lots of heap internals. | 11 // Clients of this interface shouldn't depend on lots of heap internals. |
12 // Do not include anything from src/heap here! | 12 // Do not include anything from src/heap here! |
13 #include "include/v8.h" | 13 #include "include/v8.h" |
14 #include "src/allocation.h" | 14 #include "src/allocation.h" |
15 #include "src/assert-scope.h" | 15 #include "src/assert-scope.h" |
16 #include "src/base/atomic-utils.h" | 16 #include "src/base/atomic-utils.h" |
17 #include "src/globals.h" | 17 #include "src/globals.h" |
18 #include "src/heap-symbols.h" | 18 #include "src/heap-symbols.h" |
19 // TODO(mstarzinger): Two more includes to kill! | 19 // TODO(mstarzinger): One more include to kill! |
20 #include "src/heap/spaces.h" | 20 #include "src/heap/spaces.h" |
21 #include "src/heap/store-buffer.h" | |
22 #include "src/list.h" | 21 #include "src/list.h" |
23 | 22 |
24 namespace v8 { | 23 namespace v8 { |
25 namespace internal { | 24 namespace internal { |
26 | 25 |
27 using v8::MemoryPressureLevel; | 26 using v8::MemoryPressureLevel; |
28 | 27 |
29 // Defines all the roots in Heap. | 28 // Defines all the roots in Heap. |
30 #define STRONG_ROOT_LIST(V) \ | 29 #define STRONG_ROOT_LIST(V) \ |
31 /* Cluster the most popular ones in a few cache lines here at the top. */ \ | 30 /* Cluster the most popular ones in a few cache lines here at the top. */ \ |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 class GCIdleTimeHeapState; | 318 class GCIdleTimeHeapState; |
320 class GCTracer; | 319 class GCTracer; |
321 class HeapObjectsFilter; | 320 class HeapObjectsFilter; |
322 class HeapStats; | 321 class HeapStats; |
323 class HistogramTimer; | 322 class HistogramTimer; |
324 class Isolate; | 323 class Isolate; |
325 class MemoryReducer; | 324 class MemoryReducer; |
326 class ObjectStats; | 325 class ObjectStats; |
327 class Scavenger; | 326 class Scavenger; |
328 class ScavengeJob; | 327 class ScavengeJob; |
| 328 class StoreBuffer; |
329 class WeakObjectRetainer; | 329 class WeakObjectRetainer; |
330 | 330 |
331 enum PromotionMode { PROMOTE_MARKED, DEFAULT_PROMOTION }; | 331 enum PromotionMode { PROMOTE_MARKED, DEFAULT_PROMOTION }; |
332 | 332 |
333 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); | 333 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); |
334 | 334 |
335 // A queue of objects promoted during scavenge. Each object is accompanied | 335 // A queue of objects promoted during scavenge. Each object is accompanied |
336 // by it's size to avoid dereferencing a map pointer for scanning. | 336 // by it's size to avoid dereferencing a map pointer for scanning. |
337 // The last page in to-space is used for the promotion queue. On conflict | 337 // The last page in to-space is used for the promotion queue. On conflict |
338 // during scavenge, the promotion queue is allocated externally and all | 338 // during scavenge, the promotion queue is allocated externally and all |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 // Store buffer API. ========================================================= | 1121 // Store buffer API. ========================================================= |
1122 // =========================================================================== | 1122 // =========================================================================== |
1123 | 1123 |
1124 // Write barrier support for object[offset] = o; | 1124 // Write barrier support for object[offset] = o; |
1125 inline void RecordWrite(Object* object, int offset, Object* o); | 1125 inline void RecordWrite(Object* object, int offset, Object* o); |
1126 inline void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* target); | 1126 inline void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* target); |
1127 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* target); | 1127 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* target); |
1128 inline void RecordFixedArrayElements(FixedArray* array, int offset, | 1128 inline void RecordFixedArrayElements(FixedArray* array, int offset, |
1129 int length); | 1129 int length); |
1130 | 1130 |
1131 Address* store_buffer_top_address() { return store_buffer()->top_address(); } | 1131 inline Address* store_buffer_top_address(); |
1132 | 1132 |
1133 void ClearRecordedSlot(HeapObject* object, Object** slot); | 1133 void ClearRecordedSlot(HeapObject* object, Object** slot); |
1134 void ClearRecordedSlotRange(Address start, Address end); | 1134 void ClearRecordedSlotRange(Address start, Address end); |
1135 | 1135 |
1136 // =========================================================================== | 1136 // =========================================================================== |
1137 // Incremental marking API. ================================================== | 1137 // Incremental marking API. ================================================== |
1138 // =========================================================================== | 1138 // =========================================================================== |
1139 | 1139 |
1140 // Start incremental marking and ensure that idle time handler can perform | 1140 // Start incremental marking and ensure that idle time handler can perform |
1141 // incremental steps. | 1141 // incremental steps. |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 // Selects the proper allocation space based on the pretenuring decision. | 1544 // Selects the proper allocation space based on the pretenuring decision. |
1545 static AllocationSpace SelectSpace(PretenureFlag pretenure) { | 1545 static AllocationSpace SelectSpace(PretenureFlag pretenure) { |
1546 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; | 1546 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; |
1547 } | 1547 } |
1548 | 1548 |
1549 #define ROOT_ACCESSOR(type, name, camel_name) \ | 1549 #define ROOT_ACCESSOR(type, name, camel_name) \ |
1550 inline void set_##name(type* value); | 1550 inline void set_##name(type* value); |
1551 ROOT_LIST(ROOT_ACCESSOR) | 1551 ROOT_LIST(ROOT_ACCESSOR) |
1552 #undef ROOT_ACCESSOR | 1552 #undef ROOT_ACCESSOR |
1553 | 1553 |
1554 StoreBuffer* store_buffer() { return &store_buffer_; } | 1554 StoreBuffer* store_buffer() { return store_buffer_; } |
1555 | 1555 |
1556 void set_current_gc_flags(int flags) { | 1556 void set_current_gc_flags(int flags) { |
1557 current_gc_flags_ = flags; | 1557 current_gc_flags_ = flags; |
1558 DCHECK(!ShouldFinalizeIncrementalMarking() || | 1558 DCHECK(!ShouldFinalizeIncrementalMarking() || |
1559 !ShouldAbortIncrementalMarking()); | 1559 !ShouldAbortIncrementalMarking()); |
1560 } | 1560 } |
1561 | 1561 |
1562 inline bool ShouldReduceMemory() const { | 1562 inline bool ShouldReduceMemory() const { |
1563 return current_gc_flags_ & kReduceMemoryFootprintMask; | 1563 return current_gc_flags_ & kReduceMemoryFootprintMask; |
1564 } | 1564 } |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 | 2186 |
2187 // Last time a garbage collection happened. | 2187 // Last time a garbage collection happened. |
2188 double last_gc_time_; | 2188 double last_gc_time_; |
2189 | 2189 |
2190 Scavenger* scavenge_collector_; | 2190 Scavenger* scavenge_collector_; |
2191 | 2191 |
2192 MarkCompactCollector* mark_compact_collector_; | 2192 MarkCompactCollector* mark_compact_collector_; |
2193 | 2193 |
2194 MemoryAllocator* memory_allocator_; | 2194 MemoryAllocator* memory_allocator_; |
2195 | 2195 |
2196 StoreBuffer store_buffer_; | 2196 StoreBuffer* store_buffer_; |
2197 | 2197 |
2198 IncrementalMarking* incremental_marking_; | 2198 IncrementalMarking* incremental_marking_; |
2199 | 2199 |
2200 GCIdleTimeHandler* gc_idle_time_handler_; | 2200 GCIdleTimeHandler* gc_idle_time_handler_; |
2201 | 2201 |
2202 MemoryReducer* memory_reducer_; | 2202 MemoryReducer* memory_reducer_; |
2203 | 2203 |
2204 ObjectStats* live_object_stats_; | 2204 ObjectStats* live_object_stats_; |
2205 ObjectStats* dead_object_stats_; | 2205 ObjectStats* dead_object_stats_; |
2206 | 2206 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 friend class LargeObjectSpace; | 2693 friend class LargeObjectSpace; |
2694 friend class NewSpace; | 2694 friend class NewSpace; |
2695 friend class PagedSpace; | 2695 friend class PagedSpace; |
2696 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2696 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2697 }; | 2697 }; |
2698 | 2698 |
2699 } // namespace internal | 2699 } // namespace internal |
2700 } // namespace v8 | 2700 } // namespace v8 |
2701 | 2701 |
2702 #endif // V8_HEAP_HEAP_H_ | 2702 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |