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

Unified Diff: src/heap/mark-compact.h

Issue 2492263002: [heap] Add atomics to mark bit operations. (Closed)
Patch Set: comment Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index 254748174fdfd3f1c1210b9bd8345f1b01c3c71a..375546353a0cbc4d93853fbca2689f57f1dfc57c 100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -47,59 +47,69 @@ class ObjectMarking : public AllStatic {
return Marking::Color(ObjectMarking::MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
V8_INLINE static bool IsImpossible(HeapObject* obj) {
- return Marking::IsImpossible(MarkBitFrom<mode>(obj));
+ return Marking::IsImpossible<access_mode>(MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
V8_INLINE static bool IsBlack(HeapObject* obj) {
- return Marking::IsBlack(MarkBitFrom<mode>(obj));
+ return Marking::IsBlack<access_mode>(MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
V8_INLINE static bool IsWhite(HeapObject* obj) {
- return Marking::IsWhite(MarkBitFrom<mode>(obj));
+ return Marking::IsWhite<access_mode>(MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
V8_INLINE static bool IsGrey(HeapObject* obj) {
- return Marking::IsGrey(MarkBitFrom<mode>(obj));
+ return Marking::IsGrey<access_mode>(MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
V8_INLINE static bool IsBlackOrGrey(HeapObject* obj) {
- return Marking::IsBlackOrGrey(MarkBitFrom<mode>(obj));
+ return Marking::IsBlackOrGrey<access_mode>(MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
- V8_INLINE static void BlackToGrey(HeapObject* obj) {
- DCHECK(IsBlack<mode>(obj));
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
+ V8_INLINE static bool BlackToGrey(HeapObject* obj) {
+ DCHECK((access_mode == MarkBit::ATOMIC || IsBlack<access_mode, mode>(obj)));
MarkBit markbit = MarkBitFrom<mode>(obj);
- Marking::BlackToGrey(markbit);
+ if (!Marking::BlackToGrey<access_mode>(markbit)) return false;
MemoryChunk::IncrementLiveBytes<mode>(obj, -obj->Size());
+ return true;
}
- template <MarkingMode mode = MarkingMode::FULL>
- V8_INLINE static void WhiteToGrey(HeapObject* obj) {
- DCHECK(IsWhite<mode>(obj));
- Marking::WhiteToGrey(MarkBitFrom<mode>(obj));
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
+ V8_INLINE static bool WhiteToGrey(HeapObject* obj) {
+ DCHECK((access_mode == MarkBit::ATOMIC || IsWhite<access_mode, mode>(obj)));
+ return Marking::WhiteToGrey<access_mode>(MarkBitFrom<mode>(obj));
}
- template <MarkingMode mode = MarkingMode::FULL>
- V8_INLINE static void WhiteToBlack(HeapObject* obj) {
- DCHECK(IsWhite<mode>(obj));
- MarkBit markbit = MarkBitFrom<mode>(obj);
- Marking::WhiteToBlack(markbit);
- MemoryChunk::IncrementLiveBytes<mode>(obj, obj->Size());
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
+ V8_INLINE static bool WhiteToBlack(HeapObject* obj) {
+ DCHECK((access_mode == MarkBit::ATOMIC || IsWhite<access_mode, mode>(obj)));
+ if (!ObjectMarking::WhiteToGrey<access_mode, mode>(obj)) return false;
+ return ObjectMarking::GreyToBlack<access_mode, mode>(obj);
}
- template <MarkingMode mode = MarkingMode::FULL>
- V8_INLINE static void GreyToBlack(HeapObject* obj) {
- DCHECK(IsGrey<mode>(obj));
+ template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC,
+ MarkingMode mode = MarkingMode::FULL>
+ V8_INLINE static bool GreyToBlack(HeapObject* obj) {
+ DCHECK((access_mode == MarkBit::ATOMIC || IsGrey<access_mode, mode>(obj)));
MarkBit markbit = MarkBitFrom<mode>(obj);
- Marking::GreyToBlack(markbit);
+ if (!Marking::GreyToBlack<access_mode>(markbit)) return false;
MemoryChunk::IncrementLiveBytes<mode>(obj, obj->Size());
+ return true;
}
private:
« 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