| 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_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
| 6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
| 7 | 7 |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 | 10 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 // ------------------------------------------------------------------------- | 320 // ------------------------------------------------------------------------- |
| 321 // Mark-Compact collector | 321 // Mark-Compact collector |
| 322 class MarkCompactCollector { | 322 class MarkCompactCollector { |
| 323 public: | 323 public: |
| 324 enum IterationMode { | 324 enum IterationMode { |
| 325 kKeepMarking, | 325 kKeepMarking, |
| 326 kClearMarkbits, | 326 kClearMarkbits, |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 class EvacuateNewSpaceVisitor; | |
| 330 class EvacuateOldSpaceVisitor; | |
| 331 class HeapObjectVisitor; | |
| 332 | |
| 333 static void Initialize(); | 329 static void Initialize(); |
| 334 | 330 |
| 335 void SetUp(); | 331 void SetUp(); |
| 336 | 332 |
| 337 void TearDown(); | 333 void TearDown(); |
| 338 | 334 |
| 339 void CollectEvacuationCandidates(PagedSpace* space); | 335 void CollectEvacuationCandidates(PagedSpace* space); |
| 340 | 336 |
| 341 void AddEvacuationCandidate(Page* p); | 337 void AddEvacuationCandidate(Page* p); |
| 342 | 338 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 INLINE(void ForceRecordSlot(HeapObject* object, Object** slot, | 406 INLINE(void ForceRecordSlot(HeapObject* object, Object** slot, |
| 411 Object* target)); | 407 Object* target)); |
| 412 | 408 |
| 413 void UpdateSlots(SlotsBuffer* buffer); | 409 void UpdateSlots(SlotsBuffer* buffer); |
| 414 void UpdateSlotsRecordedIn(SlotsBuffer* buffer); | 410 void UpdateSlotsRecordedIn(SlotsBuffer* buffer); |
| 415 | 411 |
| 416 void MigrateObject(HeapObject* dst, HeapObject* src, int size, | 412 void MigrateObject(HeapObject* dst, HeapObject* src, int size, |
| 417 AllocationSpace to_old_space, | 413 AllocationSpace to_old_space, |
| 418 SlotsBuffer** evacuation_slots_buffer); | 414 SlotsBuffer** evacuation_slots_buffer); |
| 419 | 415 |
| 420 bool TryPromoteObject(HeapObject* object, int object_size); | |
| 421 | |
| 422 void InvalidateCode(Code* code); | 416 void InvalidateCode(Code* code); |
| 423 | 417 |
| 424 void ClearMarkbits(); | 418 void ClearMarkbits(); |
| 425 | 419 |
| 426 bool is_compacting() const { return compacting_; } | 420 bool is_compacting() const { return compacting_; } |
| 427 | 421 |
| 428 MarkingParity marking_parity() { return marking_parity_; } | 422 MarkingParity marking_parity() { return marking_parity_; } |
| 429 | 423 |
| 430 // Concurrent and parallel sweeping support. If required_freed_bytes was set | 424 // Concurrent and parallel sweeping support. If required_freed_bytes was set |
| 431 // to a value larger than 0, then sweeping returns after a block of at least | 425 // to a value larger than 0, then sweeping returns after a block of at least |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 503 } |
| 510 base::SmartPointer<FreeList>& free_list_code_space() { | 504 base::SmartPointer<FreeList>& free_list_code_space() { |
| 511 return free_list_code_space_; | 505 return free_list_code_space_; |
| 512 } | 506 } |
| 513 base::SmartPointer<FreeList>& free_list_map_space() { | 507 base::SmartPointer<FreeList>& free_list_map_space() { |
| 514 return free_list_map_space_; | 508 return free_list_map_space_; |
| 515 } | 509 } |
| 516 | 510 |
| 517 private: | 511 private: |
| 518 class CompactionTask; | 512 class CompactionTask; |
| 513 class EvacuateNewSpaceVisitor; |
| 514 class EvacuateOldSpaceVisitor; |
| 515 class EvacuateVisitorBase; |
| 516 class HeapObjectVisitor; |
| 519 class SweeperTask; | 517 class SweeperTask; |
| 520 | 518 |
| 521 explicit MarkCompactCollector(Heap* heap); | 519 explicit MarkCompactCollector(Heap* heap); |
| 522 ~MarkCompactCollector(); | 520 ~MarkCompactCollector(); |
| 523 | 521 |
| 524 bool WillBeDeoptimized(Code* code); | 522 bool WillBeDeoptimized(Code* code); |
| 525 void EvictPopularEvacuationCandidate(Page* page); | 523 void EvictPopularEvacuationCandidate(Page* page); |
| 526 void ClearInvalidStoreAndSlotsBufferEntries(); | 524 void ClearInvalidStoreAndSlotsBufferEntries(); |
| 527 | 525 |
| 528 void StartSweeperThreads(); | 526 void StartSweeperThreads(); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 private: | 865 private: |
| 868 MarkCompactCollector* collector_; | 866 MarkCompactCollector* collector_; |
| 869 }; | 867 }; |
| 870 | 868 |
| 871 | 869 |
| 872 const char* AllocationSpaceName(AllocationSpace space); | 870 const char* AllocationSpaceName(AllocationSpace space); |
| 873 } // namespace internal | 871 } // namespace internal |
| 874 } // namespace v8 | 872 } // namespace v8 |
| 875 | 873 |
| 876 #endif // V8_HEAP_MARK_COMPACT_H_ | 874 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |