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

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

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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/heap-inl.h ('k') | src/heap/mark-compact.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 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 heap_->isolate()->global_handles()->RemoveObjectGroups(); 621 heap_->isolate()->global_handles()->RemoveObjectGroups();
622 } 622 }
623 623
624 624
625 void IncrementalMarking::ProcessWeakCells() { 625 void IncrementalMarking::ProcessWeakCells() {
626 DCHECK(!finalize_marking_completed_); 626 DCHECK(!finalize_marking_completed_);
627 DCHECK(IsMarking()); 627 DCHECK(IsMarking());
628 628
629 Object* the_hole_value = heap()->the_hole_value(); 629 Object* the_hole_value = heap()->the_hole_value();
630 Object* weak_cell_obj = heap()->encountered_weak_cells(); 630 Object* weak_cell_obj = heap()->encountered_weak_cells();
631 Object* weak_cell_head = Smi::kZero; 631 Object* weak_cell_head = Smi::FromInt(0);
632 WeakCell* prev_weak_cell_obj = NULL; 632 WeakCell* prev_weak_cell_obj = NULL;
633 while (weak_cell_obj != Smi::kZero) { 633 while (weak_cell_obj != Smi::FromInt(0)) {
634 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 634 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
635 // We do not insert cleared weak cells into the list, so the value 635 // We do not insert cleared weak cells into the list, so the value
636 // cannot be a Smi here. 636 // cannot be a Smi here.
637 HeapObject* value = HeapObject::cast(weak_cell->value()); 637 HeapObject* value = HeapObject::cast(weak_cell->value());
638 // Remove weak cells with live objects from the list, they do not need 638 // Remove weak cells with live objects from the list, they do not need
639 // clearing. 639 // clearing.
640 if (MarkCompactCollector::IsMarked(value)) { 640 if (MarkCompactCollector::IsMarked(value)) {
641 // Record slot, if value is pointing to an evacuation candidate. 641 // Record slot, if value is pointing to an evacuation candidate.
642 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); 642 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
643 heap_->mark_compact_collector()->RecordSlot(weak_cell, slot, *slot); 643 heap_->mark_compact_collector()->RecordSlot(weak_cell, slot, *slot);
644 // Remove entry somewhere after top. 644 // Remove entry somewhere after top.
645 if (prev_weak_cell_obj != NULL) { 645 if (prev_weak_cell_obj != NULL) {
646 prev_weak_cell_obj->set_next(weak_cell->next()); 646 prev_weak_cell_obj->set_next(weak_cell->next());
647 } 647 }
648 weak_cell_obj = weak_cell->next(); 648 weak_cell_obj = weak_cell->next();
649 weak_cell->clear_next(the_hole_value); 649 weak_cell->clear_next(the_hole_value);
650 } else { 650 } else {
651 if (weak_cell_head == Smi::kZero) { 651 if (weak_cell_head == Smi::FromInt(0)) {
652 weak_cell_head = weak_cell; 652 weak_cell_head = weak_cell;
653 } 653 }
654 prev_weak_cell_obj = weak_cell; 654 prev_weak_cell_obj = weak_cell;
655 weak_cell_obj = weak_cell->next(); 655 weak_cell_obj = weak_cell->next();
656 } 656 }
657 } 657 }
658 // Top may have changed. 658 // Top may have changed.
659 heap()->set_encountered_weak_cells(weak_cell_head); 659 heap()->set_encountered_weak_cells(weak_cell_head);
660 } 660 }
661 661
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 idle_marking_delay_counter_++; 1196 idle_marking_delay_counter_++;
1197 } 1197 }
1198 1198
1199 1199
1200 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1200 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1201 idle_marking_delay_counter_ = 0; 1201 idle_marking_delay_counter_ = 0;
1202 } 1202 }
1203 1203
1204 } // namespace internal 1204 } // namespace internal
1205 } // namespace v8 1205 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698