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

Unified Diff: src/heap/scavenger.cc

Issue 2628853002: [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 aea41dd552ae06151a6c21ddc3e23cbed346f72c..f2722e81de5e27a1d415991b955ce3f91cc1e38f 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