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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/heap/scavenger.h" 5 #include "src/heap/scavenger.h"
6 6
7 #include "src/contexts.h" 7 #include "src/contexts.h"
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/heap/objects-visiting-inl.h" 9 #include "src/heap/objects-visiting-inl.h"
10 #include "src/heap/scavenger-inl.h" 10 #include "src/heap/scavenger-inl.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 HeapObject* object, int object_size) { 178 HeapObject* object, int object_size) {
179 Heap* heap = map->GetHeap(); 179 Heap* heap = map->GetHeap();
180 180
181 AllocationResult allocation = 181 AllocationResult allocation =
182 heap->old_space()->AllocateRaw(object_size, alignment); 182 heap->old_space()->AllocateRaw(object_size, alignment);
183 183
184 HeapObject* target = NULL; // Initialization to please compiler. 184 HeapObject* target = NULL; // Initialization to please compiler.
185 if (allocation.To(&target)) { 185 if (allocation.To(&target)) {
186 MigrateObject(heap, object, target, object_size); 186 MigrateObject(heap, object, target, object_size);
187 187
188 // Update slot to new target. 188 // Update slot to new target using CAS. A concurrent sweeper thread my
189 *slot = target; 189 // filter the slot concurrently.
190 HeapObject* old = *slot;
191 base::Release_CompareAndSwap(reinterpret_cast<base::AtomicWord*>(slot),
192 reinterpret_cast<base::AtomicWord>(old),
193 reinterpret_cast<base::AtomicWord>(target));
190 194
191 if (object_contents == POINTER_OBJECT) { 195 if (object_contents == POINTER_OBJECT) {
192 heap->promotion_queue()->insert( 196 heap->promotion_queue()->insert(
193 target, object_size, 197 target, object_size,
194 Marking::IsBlack(ObjectMarking::MarkBitFrom(object))); 198 Marking::IsBlack(ObjectMarking::MarkBitFrom(object)));
195 } 199 }
196 heap->IncrementPromotedObjectsSize(object_size); 200 heap->IncrementPromotedObjectsSize(object_size);
197 return true; 201 return true;
198 } 202 }
199 return false; 203 return false;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 void ScavengeVisitor::ScavengePointer(Object** p) { 443 void ScavengeVisitor::ScavengePointer(Object** p) {
440 Object* object = *p; 444 Object* object = *p;
441 if (!heap_->InNewSpace(object)) return; 445 if (!heap_->InNewSpace(object)) return;
442 446
443 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), 447 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p),
444 reinterpret_cast<HeapObject*>(object)); 448 reinterpret_cast<HeapObject*>(object));
445 } 449 }
446 450
447 } // namespace internal 451 } // namespace internal
448 } // namespace v8 452 } // namespace v8
OLDNEW
« 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