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