| 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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 // =========================================================================== | 1355 // =========================================================================== |
| 1356 // Incremental marking API. ================================================== | 1356 // Incremental marking API. ================================================== |
| 1357 // =========================================================================== | 1357 // =========================================================================== |
| 1358 | 1358 |
| 1359 // Start incremental marking and ensure that idle time handler can perform | 1359 // Start incremental marking and ensure that idle time handler can perform |
| 1360 // incremental steps. | 1360 // incremental steps. |
| 1361 void StartIdleIncrementalMarking(); | 1361 void StartIdleIncrementalMarking(); |
| 1362 | 1362 |
| 1363 // Starts incremental marking assuming incremental marking is currently | 1363 // Starts incremental marking assuming incremental marking is currently |
| 1364 // stopped. | 1364 // stopped. |
| 1365 void StartIncrementalMarking(int gc_flags, | 1365 void StartIncrementalMarking(int gc_flags = kNoGCFlags, |
| 1366 const GCCallbackFlags gc_callback_flags, | 1366 const GCCallbackFlags gc_callback_flags = |
| 1367 GCCallbackFlags::kNoGCCallbackFlags, |
| 1367 const char* reason = nullptr); | 1368 const char* reason = nullptr); |
| 1368 | 1369 |
| 1369 // Performs incremental marking steps of step_size_in_bytes as long as | 1370 // Performs incremental marking steps of step_size_in_bytes as long as |
| 1370 // deadline_ins_ms is not reached. step_size_in_bytes can be 0 to compute | 1371 // deadline_ins_ms is not reached. step_size_in_bytes can be 0 to compute |
| 1371 // an estimate increment. Returns the remaining time that cannot be used | 1372 // an estimate increment. Returns the remaining time that cannot be used |
| 1372 // for incremental marking anymore because a single step would exceed the | 1373 // for incremental marking anymore because a single step would exceed the |
| 1373 // deadline. | 1374 // deadline. |
| 1374 double AdvanceIncrementalMarking( | 1375 double AdvanceIncrementalMarking( |
| 1375 intptr_t step_size_in_bytes, double deadline_in_ms, | 1376 intptr_t step_size_in_bytes, double deadline_in_ms, |
| 1376 IncrementalMarking::StepActions step_actions); | 1377 IncrementalMarking::StepActions step_actions); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 static AllocationSpace SelectSpace(int object_size, PretenureFlag pretenure) { | 1664 static AllocationSpace SelectSpace(int object_size, PretenureFlag pretenure) { |
| 1664 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; | 1665 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; |
| 1665 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; | 1666 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; |
| 1666 } | 1667 } |
| 1667 | 1668 |
| 1668 #define ROOT_ACCESSOR(type, name, camel_name) \ | 1669 #define ROOT_ACCESSOR(type, name, camel_name) \ |
| 1669 inline void set_##name(type* value); | 1670 inline void set_##name(type* value); |
| 1670 ROOT_LIST(ROOT_ACCESSOR) | 1671 ROOT_LIST(ROOT_ACCESSOR) |
| 1671 #undef ROOT_ACCESSOR | 1672 #undef ROOT_ACCESSOR |
| 1672 | 1673 |
| 1673 int current_gc_flags() { return current_gc_flags_; } | |
| 1674 | |
| 1675 void set_current_gc_flags(int flags) { | 1674 void set_current_gc_flags(int flags) { |
| 1676 current_gc_flags_ = flags; | 1675 current_gc_flags_ = flags; |
| 1677 DCHECK(!ShouldFinalizeIncrementalMarking() || | 1676 DCHECK(!ShouldFinalizeIncrementalMarking() || |
| 1678 !ShouldAbortIncrementalMarking()); | 1677 !ShouldAbortIncrementalMarking()); |
| 1679 } | 1678 } |
| 1680 | 1679 |
| 1681 inline bool ShouldReduceMemory() const { | 1680 inline bool ShouldReduceMemory() const { |
| 1682 return current_gc_flags_ & kReduceMemoryFootprintMask; | 1681 return current_gc_flags_ & kReduceMemoryFootprintMask; |
| 1683 } | 1682 } |
| 1684 | 1683 |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2339 // Shared state read by the scavenge collector and set by ScavengeObject. | 2338 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2340 PromotionQueue promotion_queue_; | 2339 PromotionQueue promotion_queue_; |
| 2341 | 2340 |
| 2342 // Flag is set when the heap has been configured. The heap can be repeatedly | 2341 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 2343 // configured through the API until it is set up. | 2342 // configured through the API until it is set up. |
| 2344 bool configured_; | 2343 bool configured_; |
| 2345 | 2344 |
| 2346 // Currently set GC flags that are respected by all GC components. | 2345 // Currently set GC flags that are respected by all GC components. |
| 2347 int current_gc_flags_; | 2346 int current_gc_flags_; |
| 2348 | 2347 |
| 2348 // Currently set GC callback flags that are used to pass information between |
| 2349 // the embedder and V8's GC. |
| 2350 GCCallbackFlags current_gc_callback_flags_; |
| 2351 |
| 2349 ExternalStringTable external_string_table_; | 2352 ExternalStringTable external_string_table_; |
| 2350 | 2353 |
| 2351 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2354 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 2352 | 2355 |
| 2353 MemoryChunk* chunks_queued_for_free_; | 2356 MemoryChunk* chunks_queued_for_free_; |
| 2354 | 2357 |
| 2355 base::Semaphore pending_unmap_job_semaphore_; | 2358 base::Semaphore pending_unmap_job_semaphore_; |
| 2356 | 2359 |
| 2357 base::Mutex relocation_mutex_; | 2360 base::Mutex relocation_mutex_; |
| 2358 | 2361 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2766 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2764 | 2767 |
| 2765 private: | 2768 private: |
| 2766 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2769 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2767 }; | 2770 }; |
| 2768 #endif // DEBUG | 2771 #endif // DEBUG |
| 2769 } | 2772 } |
| 2770 } // namespace v8::internal | 2773 } // namespace v8::internal |
| 2771 | 2774 |
| 2772 #endif // V8_HEAP_HEAP_H_ | 2775 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |