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

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

Issue 2863953002: Revert of [heap] Reland "Make non-atomic markbit operations consistent with atomic ones." (Closed)
Patch Set: Created 3 years, 7 months 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
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 8 #include <deque>
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> 76 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
77 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj, 77 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj,
78 const MarkingState& state) { 78 const MarkingState& state) {
79 return Marking::IsBlackOrGrey<access_mode>(MarkBitFrom(obj, state)); 79 return Marking::IsBlackOrGrey<access_mode>(MarkBitFrom(obj, state));
80 } 80 }
81 81
82 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> 82 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
83 V8_INLINE static bool BlackToGrey(HeapObject* obj, 83 V8_INLINE static bool BlackToGrey(HeapObject* obj,
84 const MarkingState& state) { 84 const MarkingState& state) {
85 DCHECK(
86 (access_mode == MarkBit::ATOMIC || IsBlack<access_mode>(obj, state)));
85 MarkBit markbit = MarkBitFrom(obj, state); 87 MarkBit markbit = MarkBitFrom(obj, state);
86 if (!Marking::BlackToGrey<access_mode>(markbit)) return false; 88 if (!Marking::BlackToGrey<access_mode>(markbit)) return false;
87 state.IncrementLiveBytes<access_mode>(-obj->Size()); 89 state.IncrementLiveBytes<access_mode>(-obj->Size());
88 return true; 90 return true;
89 } 91 }
90 92
91 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> 93 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
92 V8_INLINE static bool WhiteToGrey(HeapObject* obj, 94 V8_INLINE static bool WhiteToGrey(HeapObject* obj,
93 const MarkingState& state) { 95 const MarkingState& state) {
96 DCHECK(
97 (access_mode == MarkBit::ATOMIC || IsWhite<access_mode>(obj, state)));
94 return Marking::WhiteToGrey<access_mode>(MarkBitFrom(obj, state)); 98 return Marking::WhiteToGrey<access_mode>(MarkBitFrom(obj, state));
95 } 99 }
96 100
97 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> 101 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
98 V8_INLINE static bool WhiteToBlack(HeapObject* obj, 102 V8_INLINE static bool WhiteToBlack(HeapObject* obj,
99 const MarkingState& state) { 103 const MarkingState& state) {
100 return ObjectMarking::WhiteToGrey<access_mode>(obj, state) && 104 DCHECK(
101 ObjectMarking::GreyToBlack<access_mode>(obj, state); 105 (access_mode == MarkBit::ATOMIC || IsWhite<access_mode>(obj, state)));
106 if (!ObjectMarking::WhiteToGrey<access_mode>(obj, state)) return false;
107 return ObjectMarking::GreyToBlack<access_mode>(obj, state);
102 } 108 }
103 109
104 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> 110 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
105 V8_INLINE static bool GreyToBlack(HeapObject* obj, 111 V8_INLINE static bool GreyToBlack(HeapObject* obj,
106 const MarkingState& state) { 112 const MarkingState& state) {
113 DCHECK((access_mode == MarkBit::ATOMIC || IsGrey<access_mode>(obj, state)));
107 MarkBit markbit = MarkBitFrom(obj, state); 114 MarkBit markbit = MarkBitFrom(obj, state);
108 if (!Marking::GreyToBlack<access_mode>(markbit)) return false; 115 if (!Marking::GreyToBlack<access_mode>(markbit)) return false;
109 state.IncrementLiveBytes<access_mode>(obj->Size()); 116 state.IncrementLiveBytes<access_mode>(obj->Size());
110 return true; 117 return true;
111 } 118 }
112 119
113 private: 120 private:
114 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); 121 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking);
115 }; 122 };
116 123
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 ~EvacuationScope() { collector_->set_evacuation(false); } 752 ~EvacuationScope() { collector_->set_evacuation(false); }
746 753
747 private: 754 private:
748 MarkCompactCollector* collector_; 755 MarkCompactCollector* collector_;
749 }; 756 };
750 757
751 } // namespace internal 758 } // namespace internal
752 } // namespace v8 759 } // namespace v8
753 760
754 #endif // V8_HEAP_MARK_COMPACT_H_ 761 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698