Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2083)

Side by Side Diff: src/heap/mark-compact.h

Issue 769263002: Add support for enabling DCHECKs in release mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 BlackToGrey(MarkBitFrom(obj)); 73 BlackToGrey(MarkBitFrom(obj));
74 } 74 }
75 75
76 INLINE(static void AnyToGrey(MarkBit markbit)) { 76 INLINE(static void AnyToGrey(MarkBit markbit)) {
77 markbit.Set(); 77 markbit.Set();
78 markbit.Next().Set(); 78 markbit.Next().Set();
79 } 79 }
80 80
81 void TransferMark(Address old_start, Address new_start); 81 void TransferMark(Address old_start, Address new_start);
82 82
83 #ifdef DEBUG 83 #if DCHECK_IS_ON
84 enum ObjectColor { 84 enum ObjectColor {
85 BLACK_OBJECT, 85 BLACK_OBJECT,
86 WHITE_OBJECT, 86 WHITE_OBJECT,
87 GREY_OBJECT, 87 GREY_OBJECT,
88 IMPOSSIBLE_COLOR 88 IMPOSSIBLE_COLOR
89 }; 89 };
90 90
91 static const char* ColorName(ObjectColor color) { 91 static const char* ColorName(ObjectColor color) {
92 switch (color) { 92 switch (color) {
93 case BLACK_OBJECT: 93 case BLACK_OBJECT:
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 516
517 // Performs a global garbage collection. 517 // Performs a global garbage collection.
518 void CollectGarbage(); 518 void CollectGarbage();
519 519
520 enum CompactionMode { INCREMENTAL_COMPACTION, NON_INCREMENTAL_COMPACTION }; 520 enum CompactionMode { INCREMENTAL_COMPACTION, NON_INCREMENTAL_COMPACTION };
521 521
522 bool StartCompaction(CompactionMode mode); 522 bool StartCompaction(CompactionMode mode);
523 523
524 void AbortCompaction(); 524 void AbortCompaction();
525 525
526 #ifdef DEBUG 526 #if DCHECK_IS_ON
527 // Checks whether performing mark-compact collection. 527 // Checks whether performing mark-compact collection.
528 bool in_use() { return state_ > PREPARE_GC; } 528 bool in_use() { return state_ > PREPARE_GC; }
529 bool are_map_pointers_encoded() { return state_ == UPDATE_POINTERS; } 529 bool are_map_pointers_encoded() { return state_ == UPDATE_POINTERS; }
530 #endif 530 #endif
531 531
532 // Determine type of object and emit deletion log event. 532 // Determine type of object and emit deletion log event.
533 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); 533 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate);
534 534
535 // Distinguishable invalid map encodings (for single word and multiple words) 535 // Distinguishable invalid map encodings (for single word and multiple words)
536 // that indicate free regions. 536 // that indicate free regions.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 explicit MarkCompactCollector(Heap* heap); 669 explicit MarkCompactCollector(Heap* heap);
670 ~MarkCompactCollector(); 670 ~MarkCompactCollector();
671 671
672 bool MarkInvalidatedCode(); 672 bool MarkInvalidatedCode();
673 bool WillBeDeoptimized(Code* code); 673 bool WillBeDeoptimized(Code* code);
674 void RemoveDeadInvalidatedCode(); 674 void RemoveDeadInvalidatedCode();
675 void ProcessInvalidatedCode(ObjectVisitor* visitor); 675 void ProcessInvalidatedCode(ObjectVisitor* visitor);
676 676
677 void StartSweeperThreads(); 677 void StartSweeperThreads();
678 678
679 #ifdef DEBUG 679 #if DCHECK_IS_ON
680 enum CollectorState { 680 enum CollectorState {
681 IDLE, 681 IDLE,
682 PREPARE_GC, 682 PREPARE_GC,
683 MARK_LIVE_OBJECTS, 683 MARK_LIVE_OBJECTS,
684 SWEEP_SPACES, 684 SWEEP_SPACES,
685 ENCODE_FORWARDING_ADDRESSES, 685 ENCODE_FORWARDING_ADDRESSES,
686 UPDATE_POINTERS, 686 UPDATE_POINTERS,
687 RELOCATE_OBJECTS 687 RELOCATE_OBJECTS
688 }; 688 };
689 689
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 868
869 // Finalizes the parallel sweeping phase. Marks all the pages that were 869 // Finalizes the parallel sweeping phase. Marks all the pages that were
870 // swept in parallel. 870 // swept in parallel.
871 void ParallelSweepSpacesComplete(); 871 void ParallelSweepSpacesComplete();
872 872
873 void ParallelSweepSpaceComplete(PagedSpace* space); 873 void ParallelSweepSpaceComplete(PagedSpace* space);
874 874
875 // Updates store buffer and slot buffer for a pointer in a migrating object. 875 // Updates store buffer and slot buffer for a pointer in a migrating object.
876 void RecordMigratedSlot(Object* value, Address slot); 876 void RecordMigratedSlot(Object* value, Address slot);
877 877
878 #ifdef DEBUG
879 friend class MarkObjectVisitor;
880 static void VisitObject(HeapObject* obj);
881
882 friend class UnmarkObjectVisitor;
883 static void UnmarkObject(HeapObject* obj);
884 #endif
885
886 Heap* heap_; 878 Heap* heap_;
887 base::VirtualMemory* marking_deque_memory_; 879 base::VirtualMemory* marking_deque_memory_;
888 bool marking_deque_memory_committed_; 880 bool marking_deque_memory_committed_;
889 MarkingDeque marking_deque_; 881 MarkingDeque marking_deque_;
890 CodeFlusher* code_flusher_; 882 CodeFlusher* code_flusher_;
891 bool have_code_to_deoptimize_; 883 bool have_code_to_deoptimize_;
892 884
893 List<Page*> evacuation_candidates_; 885 List<Page*> evacuation_candidates_;
894 List<Code*> invalidated_code_; 886 List<Code*> invalidated_code_;
895 887
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 private: 945 private:
954 MarkCompactCollector* collector_; 946 MarkCompactCollector* collector_;
955 }; 947 };
956 948
957 949
958 const char* AllocationSpaceName(AllocationSpace space); 950 const char* AllocationSpaceName(AllocationSpace space);
959 } 951 }
960 } // namespace v8::internal 952 } // namespace v8::internal
961 953
962 #endif // V8_HEAP_MARK_COMPACT_H_ 954 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698