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

Side by Side Diff: src/heap/mark-compact.cc

Issue 2644523002: [heap] Provide ObjectMarking with marking transitions (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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/mark-compact.h" 5 #include "src/heap/mark-compact.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 392
393 void MarkCompactCollector::ClearMarkbits() { 393 void MarkCompactCollector::ClearMarkbits() {
394 ClearMarkbitsInPagedSpace(heap_->code_space()); 394 ClearMarkbitsInPagedSpace(heap_->code_space());
395 ClearMarkbitsInPagedSpace(heap_->map_space()); 395 ClearMarkbitsInPagedSpace(heap_->map_space());
396 ClearMarkbitsInPagedSpace(heap_->old_space()); 396 ClearMarkbitsInPagedSpace(heap_->old_space());
397 ClearMarkbitsInNewSpace(heap_->new_space()); 397 ClearMarkbitsInNewSpace(heap_->new_space());
398 398
399 LargeObjectIterator it(heap_->lo_space()); 399 LargeObjectIterator it(heap_->lo_space());
400 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { 400 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
401 Marking::MarkWhite(ObjectMarking::MarkBitFrom(obj)); 401 ObjectMarking::MarkWhite(obj);
402 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); 402 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
403 chunk->ResetProgressBar(); 403 chunk->ResetProgressBar();
404 chunk->ResetLiveBytes(); 404 chunk->ResetLiveBytes();
405 } 405 }
406 } 406 }
407 407
408 class MarkCompactCollector::Sweeper::SweeperTask : public v8::Task { 408 class MarkCompactCollector::Sweeper::SweeperTask : public v8::Task {
409 public: 409 public:
410 SweeperTask(Sweeper* sweeper, base::Semaphore* pending_sweeper_tasks, 410 SweeperTask(Sweeper* sweeper, base::Semaphore* pending_sweeper_tasks,
411 AllocationSpace space_to_start) 411 AllocationSpace space_to_start)
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 // is reached, whichever comes first. 1498 // is reached, whichever comes first.
1499 template <class T> 1499 template <class T>
1500 void MarkCompactCollector::DiscoverGreyObjectsWithIterator(T* it) { 1500 void MarkCompactCollector::DiscoverGreyObjectsWithIterator(T* it) {
1501 // The caller should ensure that the marking stack is initially not full, 1501 // The caller should ensure that the marking stack is initially not full,
1502 // so that we don't waste effort pointlessly scanning for objects. 1502 // so that we don't waste effort pointlessly scanning for objects.
1503 DCHECK(!marking_deque()->IsFull()); 1503 DCHECK(!marking_deque()->IsFull());
1504 1504
1505 Map* filler_map = heap()->one_pointer_filler_map(); 1505 Map* filler_map = heap()->one_pointer_filler_map();
1506 for (HeapObject* object = it->Next(); object != NULL; object = it->Next()) { 1506 for (HeapObject* object = it->Next(); object != NULL; object = it->Next()) {
1507 MarkBit markbit = ObjectMarking::MarkBitFrom(object); 1507 MarkBit markbit = ObjectMarking::MarkBitFrom(object);
1508 if ((object->map() != filler_map) && Marking::IsGrey(markbit)) { 1508 if ((object->map() != filler_map) && Marking::IsGrey(markbit)) {
Hannes Payer (out of office) 2017/01/18 14:43:35 It is a bit weird now that we still use MarkBit fo
Michael Lippautz 2017/01/18 15:58:07 Done.
1509 Marking::GreyToBlack(markbit); 1509 ObjectMarking::GreyToBlack(object);
1510 PushBlack(object); 1510 PushBlack(object);
1511 if (marking_deque()->IsFull()) return; 1511 if (marking_deque()->IsFull()) return;
1512 } 1512 }
1513 } 1513 }
1514 } 1514 }
1515 1515
1516 void MarkCompactCollector::DiscoverGreyObjectsOnPage(MemoryChunk* p) { 1516 void MarkCompactCollector::DiscoverGreyObjectsOnPage(MemoryChunk* p) {
1517 DCHECK(!marking_deque()->IsFull()); 1517 DCHECK(!marking_deque()->IsFull());
1518 LiveObjectIterator<kGreyObjects> it(p); 1518 LiveObjectIterator<kGreyObjects> it(p);
1519 HeapObject* object = NULL; 1519 HeapObject* object = NULL;
1520 while ((object = it.Next()) != NULL) { 1520 while ((object = it.Next()) != NULL) {
1521 MarkBit markbit = ObjectMarking::MarkBitFrom(object); 1521 MarkBit markbit = ObjectMarking::MarkBitFrom(object);
Hannes Payer (out of office) 2017/01/18 14:43:35 Same here.
Michael Lippautz 2017/01/18 15:58:07 Done.
1522 DCHECK(Marking::IsGrey(markbit)); 1522 DCHECK(Marking::IsGrey(markbit));
1523 Marking::GreyToBlack(markbit); 1523 ObjectMarking::GreyToBlack(object);
1524 PushBlack(object); 1524 PushBlack(object);
1525 if (marking_deque()->IsFull()) return; 1525 if (marking_deque()->IsFull()) return;
1526 } 1526 }
1527 } 1527 }
1528 1528
1529 class RecordMigratedSlotVisitor final : public ObjectVisitor { 1529 class RecordMigratedSlotVisitor final : public ObjectVisitor {
1530 public: 1530 public:
1531 explicit RecordMigratedSlotVisitor(MarkCompactCollector* collector) 1531 explicit RecordMigratedSlotVisitor(MarkCompactCollector* collector)
1532 : collector_(collector) {} 1532 : collector_(collector) {}
1533 1533
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
4084 // The target is always in old space, we don't have to record the slot in 4084 // The target is always in old space, we don't have to record the slot in
4085 // the old-to-new remembered set. 4085 // the old-to-new remembered set.
4086 DCHECK(!heap()->InNewSpace(target)); 4086 DCHECK(!heap()->InNewSpace(target));
4087 RecordRelocSlot(host, &rinfo, target); 4087 RecordRelocSlot(host, &rinfo, target);
4088 } 4088 }
4089 } 4089 }
4090 } 4090 }
4091 4091
4092 } // namespace internal 4092 } // namespace internal
4093 } // namespace v8 4093 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698