Chromium Code Reviews| 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/atomic-utils.h" | 13 #include "src/atomic-utils.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/incremental-marking.h" | 16 #include "src/heap/incremental-marking.h" |
| 17 #include "src/heap/mark-compact.h" | 17 #include "src/heap/mark-compact.h" |
| 18 #include "src/heap/scavenge-job.h" | |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
Move this include to heap.cc
| |
| 18 #include "src/heap/spaces.h" | 19 #include "src/heap/spaces.h" |
| 19 #include "src/heap/store-buffer.h" | 20 #include "src/heap/store-buffer.h" |
| 20 #include "src/list.h" | 21 #include "src/list.h" |
| 21 | 22 |
| 22 namespace v8 { | 23 namespace v8 { |
| 23 namespace internal { | 24 namespace internal { |
| 24 | 25 |
| 25 // Defines all the roots in Heap. | 26 // Defines all the roots in Heap. |
| 26 #define STRONG_ROOT_LIST(V) \ | 27 #define STRONG_ROOT_LIST(V) \ |
| 27 V(Map, byte_array_map, ByteArrayMap) \ | 28 V(Map, byte_array_map, ByteArrayMap) \ |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1180 // Inline allocation. ======================================================== | 1181 // Inline allocation. ======================================================== |
| 1181 // =========================================================================== | 1182 // =========================================================================== |
| 1182 | 1183 |
| 1183 // Indicates whether inline bump-pointer allocation has been disabled. | 1184 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1184 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1185 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1185 | 1186 |
| 1186 // Switch whether inline bump-pointer allocation should be used. | 1187 // Switch whether inline bump-pointer allocation should be used. |
| 1187 void EnableInlineAllocation(); | 1188 void EnableInlineAllocation(); |
| 1188 void DisableInlineAllocation(); | 1189 void DisableInlineAllocation(); |
| 1189 | 1190 |
| 1191 // Update the inline allocation limit. | |
| 1192 void LowerInlineAllocationLimit(intptr_t step); | |
| 1193 void ResetInlineAllocationLimit(); | |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
We should not expose them on the public heap API.
ulan
2015/09/23 09:58:38
Incremental marker calls these functions.
Hannes Payer (out of office)
2015/09/23 14:16:39
As discussed offline, we make them friends and do
| |
| 1194 | |
| 1190 // =========================================================================== | 1195 // =========================================================================== |
| 1191 // Methods triggering GCs. =================================================== | 1196 // Methods triggering GCs. =================================================== |
| 1192 // =========================================================================== | 1197 // =========================================================================== |
| 1193 | 1198 |
| 1194 // Performs garbage collection operation. | 1199 // Performs garbage collection operation. |
| 1195 // Returns whether there is a chance that another major GC could | 1200 // Returns whether there is a chance that another major GC could |
| 1196 // collect more garbage. | 1201 // collect more garbage. |
| 1197 inline bool CollectGarbage( | 1202 inline bool CollectGarbage( |
| 1198 AllocationSpace space, const char* gc_reason = NULL, | 1203 AllocationSpace space, const char* gc_reason = NULL, |
| 1199 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 1204 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
| 1200 | 1205 |
| 1201 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is | 1206 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is |
| 1202 // non-zero, then the slower precise sweeper is used, which leaves the heap | 1207 // non-zero, then the slower precise sweeper is used, which leaves the heap |
| 1203 // in a state where we can iterate over the heap visiting all objects. | 1208 // in a state where we can iterate over the heap visiting all objects. |
| 1204 void CollectAllGarbage( | 1209 void CollectAllGarbage( |
| 1205 int flags = kFinalizeIncrementalMarkingMask, const char* gc_reason = NULL, | 1210 int flags = kFinalizeIncrementalMarkingMask, const char* gc_reason = NULL, |
| 1206 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 1211 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
| 1207 | 1212 |
| 1208 // Last hope GC, should try to squeeze as much as possible. | 1213 // Last hope GC, should try to squeeze as much as possible. |
| 1209 void CollectAllAvailableGarbage(const char* gc_reason = NULL); | 1214 void CollectAllAvailableGarbage(const char* gc_reason = NULL); |
| 1210 | 1215 |
| 1211 // Invoked when GC was requested via the stack guard. | 1216 // Invoked when GC was requested via the stack guard. |
| 1212 void HandleGCRequest(); | 1217 void HandleGCRequest(); |
| 1213 | 1218 |
| 1219 // Schedule idle scavenge job. | |
| 1220 void ScheduleIdleScavenge(int bytes_allocated); | |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
This one should be private as well.
ulan
2015/09/23 09:58:38
This is called by NewSpace on interrupt.
| |
| 1221 | |
| 1214 // =========================================================================== | 1222 // =========================================================================== |
| 1215 // Iterators. ================================================================ | 1223 // Iterators. ================================================================ |
| 1216 // =========================================================================== | 1224 // =========================================================================== |
| 1217 | 1225 |
| 1218 // Iterates over all roots in the heap. | 1226 // Iterates over all roots in the heap. |
| 1219 void IterateRoots(ObjectVisitor* v, VisitMode mode); | 1227 void IterateRoots(ObjectVisitor* v, VisitMode mode); |
| 1220 // Iterates over all strong roots in the heap. | 1228 // Iterates over all strong roots in the heap. |
| 1221 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); | 1229 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); |
| 1222 // Iterates over entries in the smi roots list. Only interesting to the | 1230 // Iterates over entries in the smi roots list. Only interesting to the |
| 1223 // serializer/deserializer, since GC does not care about smis. | 1231 // serializer/deserializer, since GC does not care about smis. |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2258 StoreBuffer store_buffer_; | 2266 StoreBuffer store_buffer_; |
| 2259 | 2267 |
| 2260 IncrementalMarking incremental_marking_; | 2268 IncrementalMarking incremental_marking_; |
| 2261 | 2269 |
| 2262 GCIdleTimeHandler gc_idle_time_handler_; | 2270 GCIdleTimeHandler gc_idle_time_handler_; |
| 2263 | 2271 |
| 2264 MemoryReducer* memory_reducer_; | 2272 MemoryReducer* memory_reducer_; |
| 2265 | 2273 |
| 2266 ObjectStats* object_stats_; | 2274 ObjectStats* object_stats_; |
| 2267 | 2275 |
| 2276 ScavengeJob scavenge_job_; | |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
If you make ScavengeJob a ScavengeJob*, you don't
ulan
2015/09/23 09:58:38
Done.
| |
| 2277 | |
| 2268 // These two counters are monotomically increasing and never reset. | 2278 // These two counters are monotomically increasing and never reset. |
| 2269 size_t full_codegen_bytes_generated_; | 2279 size_t full_codegen_bytes_generated_; |
| 2270 size_t crankshaft_codegen_bytes_generated_; | 2280 size_t crankshaft_codegen_bytes_generated_; |
| 2271 | 2281 |
| 2272 // This counter is increased before each GC and never reset. | 2282 // This counter is increased before each GC and never reset. |
| 2273 // To account for the bytes allocated since the last GC, use the | 2283 // To account for the bytes allocated since the last GC, use the |
| 2274 // NewSpaceAllocationCounter() function. | 2284 // NewSpaceAllocationCounter() function. |
| 2275 size_t new_space_allocation_counter_; | 2285 size_t new_space_allocation_counter_; |
| 2276 | 2286 |
| 2277 // This counter is increased before each GC and never reset. To | 2287 // This counter is increased before each GC and never reset. To |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2699 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2709 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2700 | 2710 |
| 2701 private: | 2711 private: |
| 2702 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2712 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2703 }; | 2713 }; |
| 2704 #endif // DEBUG | 2714 #endif // DEBUG |
| 2705 } | 2715 } |
| 2706 } // namespace v8::internal | 2716 } // namespace v8::internal |
| 2707 | 2717 |
| 2708 #endif // V8_HEAP_HEAP_H_ | 2718 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |