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

Unified Diff: src/objects-inl.h

Issue 3615009: Parallelize marking phase of mark-sweep/compact collection cycle. (Closed)
Patch Set: Created 10 years, 2 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/objects.h ('k') | src/objects-visiting.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index f63d6725ec2981afdf13b294c8a7de8a76d51f31..68664885349b21822a3fc0ab9049899952929ad1 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1110,11 +1110,35 @@ bool HeapObject::IsMarked() {
}
-void HeapObject::SetMark() {
- ASSERT(!IsMarked());
+bool HeapObject::SetMark() {
MapWord first_word = map_word();
- first_word.SetMark();
- set_map_word(first_word);
+
+ if (!first_word.IsMarked()) {
+ first_word.SetMark();
+ set_map_word(first_word);
+ return true;
+ }
+
+ return false;
+}
+
+
+bool HeapObject::SetMarkExclusively() {
+ MapWord first_word = map_word();
+
+ if (!first_word.IsMarked()) {
+ MapWord new_first_word = first_word;
+ new_first_word.SetMark();
+
+ AtomicWord* map_word_slot =
+ reinterpret_cast<AtomicWord*>(this->address() + kMapOffset);
+
+ return AtomicCompareAndSwap(map_word_slot,
+ static_cast<AtomicWord>(first_word.value_),
+ static_cast<AtomicWord>(new_first_word.value_));
+ }
+
+ return false;
}
« no previous file with comments | « src/objects.h ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698