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

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

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/remembered-set.cc ('k') | src/heap/spaces.h » ('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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 heap->old_space()->AllocateRaw(object_size, alignment); 179 heap->old_space()->AllocateRaw(object_size, alignment);
180 180
181 HeapObject* target = NULL; // Initialization to please compiler. 181 HeapObject* target = NULL; // Initialization to please compiler.
182 if (allocation.To(&target)) { 182 if (allocation.To(&target)) {
183 MigrateObject(heap, object, target, object_size); 183 MigrateObject(heap, object, target, object_size);
184 184
185 // Update slot to new target. 185 // Update slot to new target.
186 *slot = target; 186 *slot = target;
187 187
188 if (object_contents == POINTER_OBJECT) { 188 if (object_contents == POINTER_OBJECT) {
189 heap->promotion_queue()->insert(target, object_size); 189 heap->promotion_queue()->insert(
190 target, object_size,
191 Marking::IsBlack(Marking::MarkBitFrom(object)));
190 } 192 }
191 heap->IncrementPromotedObjectsSize(object_size); 193 heap->IncrementPromotedObjectsSize(object_size);
192 return true; 194 return true;
193 } 195 }
194 return false; 196 return false;
195 } 197 }
196 198
197 199
198 template <ObjectContents object_contents, AllocationAlignment alignment> 200 template <ObjectContents object_contents, AllocationAlignment alignment>
199 static inline void EvacuateObject(Map* map, HeapObject** slot, 201 static inline void EvacuateObject(Map* map, HeapObject** slot,
(...skipping 29 matching lines...) Expand all
229 if (marks_handling == IGNORE_MARKS) return; 231 if (marks_handling == IGNORE_MARKS) return;
230 232
231 MapWord map_word = object->map_word(); 233 MapWord map_word = object->map_word();
232 DCHECK(map_word.IsForwardingAddress()); 234 DCHECK(map_word.IsForwardingAddress());
233 HeapObject* target = map_word.ToForwardingAddress(); 235 HeapObject* target = map_word.ToForwardingAddress();
234 236
235 MarkBit mark_bit = Marking::MarkBitFrom(target); 237 MarkBit mark_bit = Marking::MarkBitFrom(target);
236 if (Marking::IsBlack(mark_bit)) { 238 if (Marking::IsBlack(mark_bit)) {
237 // This object is black and it might not be rescanned by marker. 239 // This object is black and it might not be rescanned by marker.
238 // We should explicitly record code entry slot for compaction because 240 // We should explicitly record code entry slot for compaction because
239 // promotion queue processing (IterateAndMarkPointersToFromSpace) will 241 // promotion queue processing (IteratePromotedObjectPointers) will
240 // miss it as it is not HeapObject-tagged. 242 // miss it as it is not HeapObject-tagged.
241 Address code_entry_slot = 243 Address code_entry_slot =
242 target->address() + JSFunction::kCodeEntryOffset; 244 target->address() + JSFunction::kCodeEntryOffset;
243 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot)); 245 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot));
244 map->GetHeap()->mark_compact_collector()->RecordCodeEntrySlot( 246 map->GetHeap()->mark_compact_collector()->RecordCodeEntrySlot(
245 target, code_entry_slot, code); 247 target, code_entry_slot, code);
246 } 248 }
247 } 249 }
248 250
249 251
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 461
460 void ScavengeVisitor::ScavengePointer(Object** p) { 462 void ScavengeVisitor::ScavengePointer(Object** p) {
461 Object* object = *p; 463 Object* object = *p;
462 if (!heap_->InNewSpace(object)) return; 464 if (!heap_->InNewSpace(object)) return;
463 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), 465 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p),
464 reinterpret_cast<HeapObject*>(object)); 466 reinterpret_cast<HeapObject*>(object));
465 } 467 }
466 468
467 } // namespace internal 469 } // namespace internal
468 } // namespace v8 470 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/remembered-set.cc ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698