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_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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 buffer->Add(slot); | 356 buffer->Add(slot); |
| 357 return true; | 357 return true; |
| 358 } | 358 } |
| 359 | 359 |
| 360 static bool IsTypedSlot(ObjectSlot slot); | 360 static bool IsTypedSlot(ObjectSlot slot); |
| 361 | 361 |
| 362 static bool AddTo(SlotsBufferAllocator* allocator, | 362 static bool AddTo(SlotsBufferAllocator* allocator, |
| 363 SlotsBuffer** buffer_address, SlotType type, Address addr, | 363 SlotsBuffer** buffer_address, SlotType type, Address addr, |
| 364 AdditionMode mode); | 364 AdditionMode mode); |
| 365 | 365 |
| 366 static void RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer); | |
|
Erik Corry
2015/03/24 15:11:45
It would be good with a 1-line comment to explain
Igor Sheludko
2015/03/24 15:17:56
Done.
| |
| 367 | |
| 368 // Ensures that there are no invalid slots in the chain of store buffers. | |
|
Hannes Payer (out of office)
2015/03/24 14:47:05
slot
Igor Sheludko
2015/03/24 15:10:25
Done.
| |
| 369 static void VerifySlots(Heap* heap, SlotsBuffer* buffer); | |
| 370 | |
| 366 static const int kNumberOfElements = 1021; | 371 static const int kNumberOfElements = 1021; |
| 367 | 372 |
| 368 private: | 373 private: |
| 369 static const int kChainLengthThreshold = 15; | 374 static const int kChainLengthThreshold = 15; |
| 370 | 375 |
| 371 intptr_t idx_; | 376 intptr_t idx_; |
| 372 intptr_t chain_length_; | 377 intptr_t chain_length_; |
| 373 SlotsBuffer* next_; | 378 SlotsBuffer* next_; |
| 374 ObjectSlot slots_[kNumberOfElements]; | 379 ObjectSlot slots_[kNumberOfElements]; |
| 375 }; | 380 }; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 | 677 |
| 673 void EnsureMarkingDequeIsCommittedAndInitialize(); | 678 void EnsureMarkingDequeIsCommittedAndInitialize(); |
| 674 | 679 |
| 675 void InitializeMarkingDeque(); | 680 void InitializeMarkingDeque(); |
| 676 | 681 |
| 677 void UncommitMarkingDeque(); | 682 void UncommitMarkingDeque(); |
| 678 | 683 |
| 679 // The following four methods can just be called after marking, when the | 684 // The following four methods can just be called after marking, when the |
| 680 // whole transitive closure is known. They must be called before sweeping | 685 // whole transitive closure is known. They must be called before sweeping |
| 681 // when mark bits are still intact. | 686 // when mark bits are still intact. |
| 682 bool IsSlotInBlackObject(Page* p, Address slot); | 687 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); |
| 683 bool IsSlotInBlackObjectSlow(Page* p, Address slot); | 688 bool IsSlotInBlackObjectSlow(Page* p, Address slot); |
| 684 bool IsSlotInLiveObject(HeapObject** address, HeapObject* object); | 689 bool IsSlotInLiveObject(Address slot); |
| 685 void VerifyIsSlotInLiveObject(HeapObject** address, HeapObject* object); | 690 void VerifyIsSlotInLiveObject(Address slot, HeapObject* object); |
| 686 | 691 |
| 687 private: | 692 private: |
| 688 class SweeperTask; | 693 class SweeperTask; |
| 689 | 694 |
| 690 explicit MarkCompactCollector(Heap* heap); | 695 explicit MarkCompactCollector(Heap* heap); |
| 691 ~MarkCompactCollector(); | 696 ~MarkCompactCollector(); |
| 692 | 697 |
| 693 bool MarkInvalidatedCode(); | 698 bool MarkInvalidatedCode(); |
| 694 bool WillBeDeoptimized(Code* code); | 699 bool WillBeDeoptimized(Code* code); |
| 695 void RemoveDeadInvalidatedCode(); | 700 void RemoveDeadInvalidatedCode(); |
| 696 void ProcessInvalidatedCode(ObjectVisitor* visitor); | 701 void ProcessInvalidatedCode(ObjectVisitor* visitor); |
| 702 void ClearInvalidSlotsBufferEntries(PagedSpace* space); | |
| 703 void ClearInvalidStoreAndSlotsBufferEntries(); | |
| 697 | 704 |
| 698 void StartSweeperThreads(); | 705 void StartSweeperThreads(); |
| 699 | 706 |
| 700 #ifdef DEBUG | 707 #ifdef DEBUG |
| 701 enum CollectorState { | 708 enum CollectorState { |
| 702 IDLE, | 709 IDLE, |
| 703 PREPARE_GC, | 710 PREPARE_GC, |
| 704 MARK_LIVE_OBJECTS, | 711 MARK_LIVE_OBJECTS, |
| 705 SWEEP_SPACES, | 712 SWEEP_SPACES, |
| 706 ENCODE_FORWARDING_ADDRESSES, | 713 ENCODE_FORWARDING_ADDRESSES, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 967 private: | 974 private: |
| 968 MarkCompactCollector* collector_; | 975 MarkCompactCollector* collector_; |
| 969 }; | 976 }; |
| 970 | 977 |
| 971 | 978 |
| 972 const char* AllocationSpaceName(AllocationSpace space); | 979 const char* AllocationSpaceName(AllocationSpace space); |
| 973 } | 980 } |
| 974 } // namespace v8::internal | 981 } // namespace v8::internal |
| 975 | 982 |
| 976 #endif // V8_HEAP_MARK_COMPACT_H_ | 983 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |