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

Side by Side Diff: src/heap/scavenger.cc

Issue 2644523002: [heap] Provide ObjectMarking with marking transitions (Closed)
Patch Set: Rebase 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 | « src/heap/objects-visiting-inl.h ('k') | src/heap/spaces.cc » ('j') | 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 MigrateObject(heap, object, target, object_size); 193 MigrateObject(heap, object, target, object_size);
194 194
195 // Update slot to new target using CAS. A concurrent sweeper thread my 195 // Update slot to new target using CAS. A concurrent sweeper thread my
196 // filter the slot concurrently. 196 // filter the slot concurrently.
197 HeapObject* old = *slot; 197 HeapObject* old = *slot;
198 base::Release_CompareAndSwap(reinterpret_cast<base::AtomicWord*>(slot), 198 base::Release_CompareAndSwap(reinterpret_cast<base::AtomicWord*>(slot),
199 reinterpret_cast<base::AtomicWord>(old), 199 reinterpret_cast<base::AtomicWord>(old),
200 reinterpret_cast<base::AtomicWord>(target)); 200 reinterpret_cast<base::AtomicWord>(target));
201 201
202 if (object_contents == POINTER_OBJECT) { 202 if (object_contents == POINTER_OBJECT) {
203 heap->promotion_queue()->insert( 203 heap->promotion_queue()->insert(target, object_size,
204 target, object_size, 204 ObjectMarking::IsBlack(object));
205 Marking::IsBlack(ObjectMarking::MarkBitFrom(object)));
206 } 205 }
207 heap->IncrementPromotedObjectsSize(object_size); 206 heap->IncrementPromotedObjectsSize(object_size);
208 return true; 207 return true;
209 } 208 }
210 return false; 209 return false;
211 } 210 }
212 211
213 template <ObjectContents object_contents, AllocationAlignment alignment> 212 template <ObjectContents object_contents, AllocationAlignment alignment>
214 static inline void EvacuateObject(Map* map, HeapObject** slot, 213 static inline void EvacuateObject(Map* map, HeapObject** slot,
215 HeapObject* object, int object_size) { 214 HeapObject* object, int object_size) {
(...skipping 23 matching lines...) Expand all
239 static inline void EvacuateJSFunction(Map* map, HeapObject** slot, 238 static inline void EvacuateJSFunction(Map* map, HeapObject** slot,
240 HeapObject* object) { 239 HeapObject* object) {
241 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); 240 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object);
242 241
243 if (marks_handling == IGNORE_MARKS) return; 242 if (marks_handling == IGNORE_MARKS) return;
244 243
245 MapWord map_word = object->map_word(); 244 MapWord map_word = object->map_word();
246 DCHECK(map_word.IsForwardingAddress()); 245 DCHECK(map_word.IsForwardingAddress());
247 HeapObject* target = map_word.ToForwardingAddress(); 246 HeapObject* target = map_word.ToForwardingAddress();
248 247
249 MarkBit mark_bit = ObjectMarking::MarkBitFrom(target); 248 if (ObjectMarking::IsBlack(target)) {
250 if (Marking::IsBlack(mark_bit)) {
251 // This object is black and it might not be rescanned by marker. 249 // This object is black and it might not be rescanned by marker.
252 // We should explicitly record code entry slot for compaction because 250 // We should explicitly record code entry slot for compaction because
253 // promotion queue processing (IteratePromotedObjectPointers) will 251 // promotion queue processing (IteratePromotedObjectPointers) will
254 // miss it as it is not HeapObject-tagged. 252 // miss it as it is not HeapObject-tagged.
255 Address code_entry_slot = 253 Address code_entry_slot =
256 target->address() + JSFunction::kCodeEntryOffset; 254 target->address() + JSFunction::kCodeEntryOffset;
257 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot)); 255 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot));
258 map->GetHeap()->mark_compact_collector()->RecordCodeEntrySlot( 256 map->GetHeap()->mark_compact_collector()->RecordCodeEntrySlot(
259 target, code_entry_slot, code); 257 target, code_entry_slot, code);
260 } 258 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 void ScavengeVisitor::ScavengePointer(Object** p) { 468 void ScavengeVisitor::ScavengePointer(Object** p) {
471 Object* object = *p; 469 Object* object = *p;
472 if (!heap_->InNewSpace(object)) return; 470 if (!heap_->InNewSpace(object)) return;
473 471
474 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), 472 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p),
475 reinterpret_cast<HeapObject*>(object)); 473 reinterpret_cast<HeapObject*>(object));
476 } 474 }
477 475
478 } // namespace internal 476 } // namespace internal
479 } // namespace v8 477 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698