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

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

Issue 1961403002: Revert of [heap] Fine-grained JSArrayBuffer tracking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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.cc ('k') | src/heap/scavenger.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/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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 heap_->UpdateAllocationSite<Heap::kCached>(object, 1668 heap_->UpdateAllocationSite<Heap::kCached>(object,
1669 local_pretenuring_feedback_); 1669 local_pretenuring_feedback_);
1670 int size = object->Size(); 1670 int size = object->Size();
1671 HeapObject* target_object = nullptr; 1671 HeapObject* target_object = nullptr;
1672 if (heap_->ShouldBePromoted(object->address(), size) && 1672 if (heap_->ShouldBePromoted(object->address(), size) &&
1673 TryEvacuateObject(compaction_spaces_->Get(OLD_SPACE), object, 1673 TryEvacuateObject(compaction_spaces_->Get(OLD_SPACE), object,
1674 &target_object)) { 1674 &target_object)) {
1675 // If we end up needing more special cases, we should factor this out. 1675 // If we end up needing more special cases, we should factor this out.
1676 if (V8_UNLIKELY(target_object->IsJSArrayBuffer())) { 1676 if (V8_UNLIKELY(target_object->IsJSArrayBuffer())) {
1677 heap_->array_buffer_tracker()->Promote( 1677 heap_->array_buffer_tracker()->Promote(
1678 JSArrayBuffer::cast(target_object), 1678 JSArrayBuffer::cast(target_object));
1679 reinterpret_cast<JSArrayBuffer*>(object));
1680 } 1679 }
1681 promoted_size_ += size; 1680 promoted_size_ += size;
1682 return true; 1681 return true;
1683 } 1682 }
1684 HeapObject* target = nullptr; 1683 HeapObject* target = nullptr;
1685 AllocationSpace space = AllocateTargetObject(object, &target); 1684 AllocationSpace space = AllocateTargetObject(object, &target);
1686 MigrateObject(HeapObject::cast(target), object, size, space); 1685 MigrateObject(HeapObject::cast(target), object, size, space);
1687 if (V8_UNLIKELY(target->IsJSArrayBuffer())) { 1686 if (V8_UNLIKELY(target->IsJSArrayBuffer())) {
1688 heap_->array_buffer_tracker()->SemiSpaceCopy( 1687 heap_->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(target));
1689 JSArrayBuffer::cast(target),
1690 reinterpret_cast<JSArrayBuffer*>(object));
1691 } 1688 }
1692 semispace_copied_size_ += size; 1689 semispace_copied_size_ += size;
1693 return true; 1690 return true;
1694 } 1691 }
1695 1692
1696 intptr_t promoted_size() { return promoted_size_; } 1693 intptr_t promoted_size() { return promoted_size_; }
1697 intptr_t semispace_copied_size() { return semispace_copied_size_; } 1694 intptr_t semispace_copied_size() { return semispace_copied_size_; }
1698 1695
1699 private: 1696 private:
1700 enum NewSpaceAllocationMode { 1697 enum NewSpaceAllocationMode {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 static void TryMoveToOldSpace(Page* page, PagedSpace* owner) { 1804 static void TryMoveToOldSpace(Page* page, PagedSpace* owner) {
1808 if (page->heap()->new_space()->ReplaceWithEmptyPage(page)) { 1805 if (page->heap()->new_space()->ReplaceWithEmptyPage(page)) {
1809 Page* new_page = Page::ConvertNewToOld(page, owner); 1806 Page* new_page = Page::ConvertNewToOld(page, owner);
1810 new_page->SetFlag(Page::PAGE_NEW_OLD_PROMOTION); 1807 new_page->SetFlag(Page::PAGE_NEW_OLD_PROMOTION);
1811 } 1808 }
1812 } 1809 }
1813 1810
1814 inline bool Visit(HeapObject* object) { 1811 inline bool Visit(HeapObject* object) {
1815 if (V8_UNLIKELY(object->IsJSArrayBuffer())) { 1812 if (V8_UNLIKELY(object->IsJSArrayBuffer())) {
1816 object->GetHeap()->array_buffer_tracker()->Promote( 1813 object->GetHeap()->array_buffer_tracker()->Promote(
1817 JSArrayBuffer::cast(object), JSArrayBuffer::cast(object)); 1814 JSArrayBuffer::cast(object));
1818 } 1815 }
1819 RecordMigratedSlotVisitor visitor; 1816 RecordMigratedSlotVisitor visitor;
1820 object->IterateBodyFast(&visitor); 1817 object->IterateBodyFast(&visitor);
1821 promoted_size_ += object->Size(); 1818 promoted_size_ += object->Size();
1822 return true; 1819 return true;
1823 } 1820 }
1824 1821
1825 intptr_t promoted_size() { return promoted_size_; } 1822 intptr_t promoted_size() { return promoted_size_; }
1826 1823
1827 private: 1824 private:
1828 intptr_t promoted_size_; 1825 intptr_t promoted_size_;
1829 }; 1826 };
1830 1827
1831 class MarkCompactCollector::EvacuateOldSpaceVisitor final 1828 class MarkCompactCollector::EvacuateOldSpaceVisitor final
1832 : public MarkCompactCollector::EvacuateVisitorBase { 1829 : public MarkCompactCollector::EvacuateVisitorBase {
1833 public: 1830 public:
1834 EvacuateOldSpaceVisitor(Heap* heap, 1831 EvacuateOldSpaceVisitor(Heap* heap,
1835 CompactionSpaceCollection* compaction_spaces) 1832 CompactionSpaceCollection* compaction_spaces)
1836 : EvacuateVisitorBase(heap, compaction_spaces) {} 1833 : EvacuateVisitorBase(heap, compaction_spaces) {}
1837 1834
1838 inline bool Visit(HeapObject* object) override { 1835 inline bool Visit(HeapObject* object) override {
1839 CompactionSpace* target_space = compaction_spaces_->Get( 1836 CompactionSpace* target_space = compaction_spaces_->Get(
1840 Page::FromAddress(object->address())->owner()->identity()); 1837 Page::FromAddress(object->address())->owner()->identity());
1841 HeapObject* target_object = nullptr; 1838 HeapObject* target_object = nullptr;
1842 if (TryEvacuateObject(target_space, object, &target_object)) { 1839 if (TryEvacuateObject(target_space, object, &target_object)) {
1843 DCHECK(object->map_word().IsForwardingAddress()); 1840 DCHECK(object->map_word().IsForwardingAddress());
1844 if (V8_UNLIKELY(target_object->IsJSArrayBuffer())) {
1845 heap_->array_buffer_tracker()->Compact(
1846 JSArrayBuffer::cast(target_object),
1847 reinterpret_cast<JSArrayBuffer*>(object));
1848 }
1849 return true; 1841 return true;
1850 } 1842 }
1851 if (V8_UNLIKELY(object->IsJSArrayBuffer())) {
1852 heap_->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object));
1853 }
1854 return false; 1843 return false;
1855 } 1844 }
1856 }; 1845 };
1857 1846
1858 class MarkCompactCollector::EvacuateRecordOnlyVisitor final 1847 class MarkCompactCollector::EvacuateRecordOnlyVisitor final
1859 : public MarkCompactCollector::HeapObjectVisitor { 1848 : public MarkCompactCollector::HeapObjectVisitor {
1860 public: 1849 public:
1861 explicit EvacuateRecordOnlyVisitor(AllocationSpace space) : space_(space) {} 1850 explicit EvacuateRecordOnlyVisitor(AllocationSpace space) : space_(space) {}
1862 1851
1863 inline bool Visit(HeapObject* object) { 1852 inline bool Visit(HeapObject* object) {
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3958 MarkBit mark_bit = Marking::MarkBitFrom(host); 3947 MarkBit mark_bit = Marking::MarkBitFrom(host);
3959 if (Marking::IsBlack(mark_bit)) { 3948 if (Marking::IsBlack(mark_bit)) {
3960 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 3949 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
3961 RecordRelocSlot(host, &rinfo, target); 3950 RecordRelocSlot(host, &rinfo, target);
3962 } 3951 }
3963 } 3952 }
3964 } 3953 }
3965 3954
3966 } // namespace internal 3955 } // namespace internal
3967 } // namespace v8 3956 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698