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

Side by Side Diff: src/heap/incremental-marking.cc

Issue 1488593003: Optimize clearing of map transitions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: base Created 5 years 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/incremental-marking.h" 5 #include "src/heap/incremental-marking.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/heap/gc-idle-time-handler.h" 10 #include "src/heap/gc-idle-time-handler.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); 645 heap_->isolate()->global_handles()->RemoveImplicitRefGroups();
646 heap_->isolate()->global_handles()->RemoveObjectGroups(); 646 heap_->isolate()->global_handles()->RemoveObjectGroups();
647 } 647 }
648 648
649 649
650 void IncrementalMarking::ProcessWeakCells() { 650 void IncrementalMarking::ProcessWeakCells() {
651 DCHECK(FLAG_finalize_marking_incrementally); 651 DCHECK(FLAG_finalize_marking_incrementally);
652 DCHECK(!finalize_marking_completed_); 652 DCHECK(!finalize_marking_completed_);
653 DCHECK(IsMarking()); 653 DCHECK(IsMarking());
654 654
655 Object* the_hole_value = heap()->the_hole_value();
655 Object* weak_cell_obj = heap()->encountered_weak_cells(); 656 Object* weak_cell_obj = heap()->encountered_weak_cells();
656 Object* weak_cell_head = Smi::FromInt(0); 657 Object* weak_cell_head = Smi::FromInt(0);
657 WeakCell* prev_weak_cell_obj = NULL; 658 WeakCell* prev_weak_cell_obj = NULL;
658 while (weak_cell_obj != Smi::FromInt(0)) { 659 while (weak_cell_obj != Smi::FromInt(0)) {
659 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 660 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
660 // We do not insert cleared weak cells into the list, so the value 661 // We do not insert cleared weak cells into the list, so the value
661 // cannot be a Smi here. 662 // cannot be a Smi here.
662 HeapObject* value = HeapObject::cast(weak_cell->value()); 663 HeapObject* value = HeapObject::cast(weak_cell->value());
663 // Remove weak cells with live objects from the list, they do not need 664 // Remove weak cells with live objects from the list, they do not need
664 // clearing. 665 // clearing.
665 if (MarkCompactCollector::IsMarked(value)) { 666 if (MarkCompactCollector::IsMarked(value)) {
666 // Record slot, if value is pointing to an evacuation candidate. 667 // Record slot, if value is pointing to an evacuation candidate.
667 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); 668 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
668 heap_->mark_compact_collector()->RecordSlot(weak_cell, slot, *slot); 669 heap_->mark_compact_collector()->RecordSlot(weak_cell, slot, *slot);
669 // Remove entry somewhere after top. 670 // Remove entry somewhere after top.
670 if (prev_weak_cell_obj != NULL) { 671 if (prev_weak_cell_obj != NULL) {
671 prev_weak_cell_obj->set_next(weak_cell->next()); 672 prev_weak_cell_obj->set_next(weak_cell->next());
672 } 673 }
673 weak_cell_obj = weak_cell->next(); 674 weak_cell_obj = weak_cell->next();
674 weak_cell->clear_next(heap()); 675 weak_cell->clear_next(the_hole_value);
675 } else { 676 } else {
676 if (weak_cell_head == Smi::FromInt(0)) { 677 if (weak_cell_head == Smi::FromInt(0)) {
677 weak_cell_head = weak_cell; 678 weak_cell_head = weak_cell;
678 } 679 }
679 prev_weak_cell_obj = weak_cell; 680 prev_weak_cell_obj = weak_cell;
680 weak_cell_obj = weak_cell->next(); 681 weak_cell_obj = weak_cell->next();
681 } 682 }
682 } 683 }
683 // Top may have changed. 684 // Top may have changed.
684 heap()->set_encountered_weak_cells(weak_cell_head); 685 heap()->set_encountered_weak_cells(weak_cell_head);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1196 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1196 idle_marking_delay_counter_++; 1197 idle_marking_delay_counter_++;
1197 } 1198 }
1198 1199
1199 1200
1200 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1201 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1201 idle_marking_delay_counter_ = 0; 1202 idle_marking_delay_counter_ = 0;
1202 } 1203 }
1203 } // namespace internal 1204 } // namespace internal
1204 } // namespace v8 1205 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698