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

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

Issue 1269313003: [heap] Make the Marking class all static. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/mark-compact.h ('k') | no next file » | 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/v8.h" 5 #include "src/v8.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/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // to only refill them for the old space. 581 // to only refill them for the old space.
582 return; 582 return;
583 } 583 }
584 584
585 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); 585 intptr_t freed_bytes = space->free_list()->Concatenate(free_list);
586 space->AddToAccountingStats(freed_bytes); 586 space->AddToAccountingStats(freed_bytes);
587 space->DecrementUnsweptFreeBytes(freed_bytes); 587 space->DecrementUnsweptFreeBytes(freed_bytes);
588 } 588 }
589 589
590 590
591 void Marking::TransferMark(Address old_start, Address new_start) { 591 void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) {
592 // This is only used when resizing an object. 592 // This is only used when resizing an object.
593 DCHECK(MemoryChunk::FromAddress(old_start) == 593 DCHECK(MemoryChunk::FromAddress(old_start) ==
594 MemoryChunk::FromAddress(new_start)); 594 MemoryChunk::FromAddress(new_start));
595 595
596 if (!heap_->incremental_marking()->IsMarking()) return; 596 if (!heap->incremental_marking()->IsMarking()) return;
597 597
598 // If the mark doesn't move, we don't check the color of the object. 598 // If the mark doesn't move, we don't check the color of the object.
599 // It doesn't matter whether the object is black, since it hasn't changed 599 // It doesn't matter whether the object is black, since it hasn't changed
600 // size, so the adjustment to the live data count will be zero anyway. 600 // size, so the adjustment to the live data count will be zero anyway.
601 if (old_start == new_start) return; 601 if (old_start == new_start) return;
602 602
603 MarkBit new_mark_bit = MarkBitFrom(new_start); 603 MarkBit new_mark_bit = MarkBitFrom(new_start);
604 MarkBit old_mark_bit = MarkBitFrom(old_start); 604 MarkBit old_mark_bit = MarkBitFrom(old_start);
605 605
606 #ifdef DEBUG 606 #ifdef DEBUG
607 ObjectColor old_color = Color(old_mark_bit); 607 ObjectColor old_color = Color(old_mark_bit);
608 #endif 608 #endif
609 609
610 if (Marking::IsBlack(old_mark_bit)) { 610 if (Marking::IsBlack(old_mark_bit)) {
611 Marking::BlackToWhite(old_mark_bit); 611 Marking::BlackToWhite(old_mark_bit);
612 Marking::MarkBlack(new_mark_bit); 612 Marking::MarkBlack(new_mark_bit);
613 return; 613 return;
614 } else if (Marking::IsGrey(old_mark_bit)) { 614 } else if (Marking::IsGrey(old_mark_bit)) {
615 Marking::GreyToWhite(old_mark_bit); 615 Marking::GreyToWhite(old_mark_bit);
616 heap_->incremental_marking()->WhiteToGreyAndPush( 616 heap->incremental_marking()->WhiteToGreyAndPush(
617 HeapObject::FromAddress(new_start), new_mark_bit); 617 HeapObject::FromAddress(new_start), new_mark_bit);
618 heap_->incremental_marking()->RestartIfNotMarking(); 618 heap->incremental_marking()->RestartIfNotMarking();
619 } 619 }
620 620
621 #ifdef DEBUG 621 #ifdef DEBUG
622 ObjectColor new_color = Color(new_mark_bit); 622 ObjectColor new_color = Color(new_mark_bit);
623 DCHECK(new_color == old_color); 623 DCHECK(new_color == old_color);
624 #endif 624 #endif
625 } 625 }
626 626
627 627
628 const char* AllocationSpaceName(AllocationSpace space) { 628 const char* AllocationSpaceName(AllocationSpace space) {
(...skipping 4146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4775 SlotsBuffer* buffer = *buffer_address; 4775 SlotsBuffer* buffer = *buffer_address;
4776 while (buffer != NULL) { 4776 while (buffer != NULL) {
4777 SlotsBuffer* next_buffer = buffer->next(); 4777 SlotsBuffer* next_buffer = buffer->next();
4778 DeallocateBuffer(buffer); 4778 DeallocateBuffer(buffer);
4779 buffer = next_buffer; 4779 buffer = next_buffer;
4780 } 4780 }
4781 *buffer_address = NULL; 4781 *buffer_address = NULL;
4782 } 4782 }
4783 } // namespace internal 4783 } // namespace internal
4784 } // namespace v8 4784 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698