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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // when mark bits are still intact. | 483 // when mark bits are still intact. |
484 bool IsSlotInBlackObject(MemoryChunk* p, Address slot); | 484 bool IsSlotInBlackObject(MemoryChunk* p, Address slot); |
485 HeapObject* FindBlackObjectBySlotSlow(Address slot); | 485 HeapObject* FindBlackObjectBySlotSlow(Address slot); |
486 | 486 |
487 // Removes all the slots in the slot buffers that are within the given | 487 // Removes all the slots in the slot buffers that are within the given |
488 // address range. | 488 // address range. |
489 void RemoveObjectSlots(Address start_slot, Address end_slot); | 489 void RemoveObjectSlots(Address start_slot, Address end_slot); |
490 | 490 |
491 Sweeper& sweeper() { return sweeper_; } | 491 Sweeper& sweeper() { return sweeper_; } |
492 | 492 |
493 // =========================================================================== | |
494 // Embedder heap tracer support. ============================================= | |
495 // =========================================================================== | |
496 | |
497 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); | |
498 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; } | |
499 bool UsingEmbedderHeapTracer() { return embedder_heap_tracer(); } | |
500 | |
501 // In order to avoid running out of memory we force tracing wrappers if there | |
502 // are too many of them. | |
503 bool RequiresImmediateWrapperProcessing(); | |
504 | |
505 void RegisterWrappersWithEmbedderHeapTracer(); | |
506 | |
507 void TracePossibleWrapper(JSObject* js_object); | |
508 | |
509 size_t wrappers_to_trace() { return wrappers_to_trace_.size(); } | |
510 | |
511 private: | 493 private: |
512 class EvacuateNewSpacePageVisitor; | 494 class EvacuateNewSpacePageVisitor; |
513 class EvacuateNewSpaceVisitor; | 495 class EvacuateNewSpaceVisitor; |
514 class EvacuateOldSpaceVisitor; | 496 class EvacuateOldSpaceVisitor; |
515 class EvacuateRecordOnlyVisitor; | 497 class EvacuateRecordOnlyVisitor; |
516 class EvacuateVisitorBase; | 498 class EvacuateVisitorBase; |
517 class HeapObjectVisitor; | 499 class HeapObjectVisitor; |
518 class ObjectStatsVisitor; | 500 class ObjectStatsVisitor; |
519 | 501 |
520 explicit MarkCompactCollector(Heap* heap); | 502 explicit MarkCompactCollector(Heap* heap); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // candidates. | 722 // candidates. |
741 bool compacting_; | 723 bool compacting_; |
742 | 724 |
743 bool black_allocation_; | 725 bool black_allocation_; |
744 | 726 |
745 bool have_code_to_deoptimize_; | 727 bool have_code_to_deoptimize_; |
746 | 728 |
747 base::VirtualMemory* marking_deque_memory_; | 729 base::VirtualMemory* marking_deque_memory_; |
748 size_t marking_deque_memory_committed_; | 730 size_t marking_deque_memory_committed_; |
749 MarkingDeque marking_deque_; | 731 MarkingDeque marking_deque_; |
750 std::vector<std::pair<void*, void*>> wrappers_to_trace_; | |
751 | 732 |
752 CodeFlusher* code_flusher_; | 733 CodeFlusher* code_flusher_; |
753 | 734 |
754 EmbedderHeapTracer* embedder_heap_tracer_; | |
755 | |
756 List<Page*> evacuation_candidates_; | 735 List<Page*> evacuation_candidates_; |
757 List<Page*> newspace_evacuation_candidates_; | 736 List<Page*> newspace_evacuation_candidates_; |
758 | 737 |
759 Sweeper sweeper_; | 738 Sweeper sweeper_; |
760 | 739 |
761 friend class Heap; | 740 friend class Heap; |
762 friend class StoreBuffer; | 741 friend class StoreBuffer; |
763 }; | 742 }; |
764 | 743 |
765 | 744 |
766 class EvacuationScope BASE_EMBEDDED { | 745 class EvacuationScope BASE_EMBEDDED { |
767 public: | 746 public: |
768 explicit EvacuationScope(MarkCompactCollector* collector) | 747 explicit EvacuationScope(MarkCompactCollector* collector) |
769 : collector_(collector) { | 748 : collector_(collector) { |
770 collector_->set_evacuation(true); | 749 collector_->set_evacuation(true); |
771 } | 750 } |
772 | 751 |
773 ~EvacuationScope() { collector_->set_evacuation(false); } | 752 ~EvacuationScope() { collector_->set_evacuation(false); } |
774 | 753 |
775 private: | 754 private: |
776 MarkCompactCollector* collector_; | 755 MarkCompactCollector* collector_; |
777 }; | 756 }; |
778 | 757 |
779 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 758 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
780 } // namespace internal | 759 } // namespace internal |
781 } // namespace v8 | 760 } // namespace v8 |
782 | 761 |
783 #endif // V8_HEAP_MARK_COMPACT_H_ | 762 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |