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

Unified Diff: src/heap/scavenger.cc

Issue 2639303002: Merged: [heap] Use CAS to update old to new slots in Scavenger. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/scavenger.cc
diff --git a/src/heap/scavenger.cc b/src/heap/scavenger.cc
index 7b0fec9d6bac85a7350f7d7c747a19293b235510..cad0e8af253b33cc3c02cc306caf50ec887e333c 100644
--- a/src/heap/scavenger.cc
+++ b/src/heap/scavenger.cc
@@ -185,8 +185,12 @@ class ScavengingVisitor : public StaticVisitorBase {
if (allocation.To(&target)) {
MigrateObject(heap, object, target, object_size);
- // Update slot to new target.
- *slot = target;
+ // Update slot to new target using CAS. A concurrent sweeper thread my
+ // filter the slot concurrently.
+ HeapObject* old = *slot;
+ base::Release_CompareAndSwap(reinterpret_cast<base::AtomicWord*>(slot),
+ reinterpret_cast<base::AtomicWord>(old),
+ reinterpret_cast<base::AtomicWord>(target));
if (object_contents == POINTER_OBJECT) {
heap->promotion_queue()->insert(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698