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

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

Issue 2010243003: Move hashmap into base/. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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/spaces.h » ('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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 }; 1729 };
1730 1730
1731 class MarkCompactCollector::EvacuateNewSpaceVisitor final 1731 class MarkCompactCollector::EvacuateNewSpaceVisitor final
1732 : public MarkCompactCollector::EvacuateVisitorBase { 1732 : public MarkCompactCollector::EvacuateVisitorBase {
1733 public: 1733 public:
1734 static const intptr_t kLabSize = 4 * KB; 1734 static const intptr_t kLabSize = 4 * KB;
1735 static const intptr_t kMaxLabObjectSize = 256; 1735 static const intptr_t kMaxLabObjectSize = 256;
1736 1736
1737 explicit EvacuateNewSpaceVisitor(Heap* heap, 1737 explicit EvacuateNewSpaceVisitor(Heap* heap,
1738 CompactionSpaceCollection* compaction_spaces, 1738 CompactionSpaceCollection* compaction_spaces,
1739 HashMap* local_pretenuring_feedback) 1739 base::HashMap* local_pretenuring_feedback)
1740 : EvacuateVisitorBase(heap, compaction_spaces), 1740 : EvacuateVisitorBase(heap, compaction_spaces),
1741 buffer_(LocalAllocationBuffer::InvalidBuffer()), 1741 buffer_(LocalAllocationBuffer::InvalidBuffer()),
1742 space_to_allocate_(NEW_SPACE), 1742 space_to_allocate_(NEW_SPACE),
1743 promoted_size_(0), 1743 promoted_size_(0),
1744 semispace_copied_size_(0), 1744 semispace_copied_size_(0),
1745 local_pretenuring_feedback_(local_pretenuring_feedback) {} 1745 local_pretenuring_feedback_(local_pretenuring_feedback) {}
1746 1746
1747 inline bool Visit(HeapObject* object) override { 1747 inline bool Visit(HeapObject* object) override {
1748 heap_->UpdateAllocationSite<Heap::kCached>(object, 1748 heap_->UpdateAllocationSite<Heap::kCached>(object,
1749 local_pretenuring_feedback_); 1749 local_pretenuring_feedback_);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 } 1858 }
1859 } 1859 }
1860 } 1860 }
1861 return allocation; 1861 return allocation;
1862 } 1862 }
1863 1863
1864 LocalAllocationBuffer buffer_; 1864 LocalAllocationBuffer buffer_;
1865 AllocationSpace space_to_allocate_; 1865 AllocationSpace space_to_allocate_;
1866 intptr_t promoted_size_; 1866 intptr_t promoted_size_;
1867 intptr_t semispace_copied_size_; 1867 intptr_t semispace_copied_size_;
1868 HashMap* local_pretenuring_feedback_; 1868 base::HashMap* local_pretenuring_feedback_;
1869 }; 1869 };
1870 1870
1871 class MarkCompactCollector::EvacuateNewSpacePageVisitor final 1871 class MarkCompactCollector::EvacuateNewSpacePageVisitor final
1872 : public MarkCompactCollector::HeapObjectVisitor { 1872 : public MarkCompactCollector::HeapObjectVisitor {
1873 public: 1873 public:
1874 explicit EvacuateNewSpacePageVisitor(Heap* heap) 1874 explicit EvacuateNewSpacePageVisitor(Heap* heap)
1875 : heap_(heap), promoted_size_(0) {} 1875 : heap_(heap), promoted_size_(0) {}
1876 1876
1877 static void TryMoveToOldSpace(Page* page, PagedSpace* owner) { 1877 static void TryMoveToOldSpace(Page* page, PagedSpace* owner) {
1878 if (page->heap()->new_space()->ReplaceWithEmptyPage(page)) { 1878 if (page->heap()->new_space()->ReplaceWithEmptyPage(page)) {
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 // evacuation. 3046 // evacuation.
3047 static int PageEvacuationThreshold() { 3047 static int PageEvacuationThreshold() {
3048 if (FLAG_page_promotion) 3048 if (FLAG_page_promotion)
3049 return FLAG_page_promotion_threshold * Page::kAllocatableMemory / 100; 3049 return FLAG_page_promotion_threshold * Page::kAllocatableMemory / 100;
3050 return Page::kAllocatableMemory + kPointerSize; 3050 return Page::kAllocatableMemory + kPointerSize;
3051 } 3051 }
3052 3052
3053 explicit Evacuator(MarkCompactCollector* collector) 3053 explicit Evacuator(MarkCompactCollector* collector)
3054 : collector_(collector), 3054 : collector_(collector),
3055 compaction_spaces_(collector->heap()), 3055 compaction_spaces_(collector->heap()),
3056 local_pretenuring_feedback_(HashMap::PointersMatch, 3056 local_pretenuring_feedback_(base::HashMap::PointersMatch,
3057 kInitialLocalPretenuringFeedbackCapacity), 3057 kInitialLocalPretenuringFeedbackCapacity),
3058 new_space_visitor_(collector->heap(), &compaction_spaces_, 3058 new_space_visitor_(collector->heap(), &compaction_spaces_,
3059 &local_pretenuring_feedback_), 3059 &local_pretenuring_feedback_),
3060 new_space_page_visitor(collector->heap()), 3060 new_space_page_visitor(collector->heap()),
3061 old_space_visitor_(collector->heap(), &compaction_spaces_), 3061 old_space_visitor_(collector->heap(), &compaction_spaces_),
3062 duration_(0.0), 3062 duration_(0.0),
3063 bytes_compacted_(0) {} 3063 bytes_compacted_(0) {}
3064 3064
3065 inline bool EvacuatePage(Page* chunk); 3065 inline bool EvacuatePage(Page* chunk);
3066 3066
(...skipping 28 matching lines...) Expand all
3095 bytes_compacted_ += bytes_compacted; 3095 bytes_compacted_ += bytes_compacted;
3096 } 3096 }
3097 3097
3098 template <IterationMode mode, class Visitor> 3098 template <IterationMode mode, class Visitor>
3099 inline bool EvacuateSinglePage(Page* p, Visitor* visitor); 3099 inline bool EvacuateSinglePage(Page* p, Visitor* visitor);
3100 3100
3101 MarkCompactCollector* collector_; 3101 MarkCompactCollector* collector_;
3102 3102
3103 // Locally cached collector data. 3103 // Locally cached collector data.
3104 CompactionSpaceCollection compaction_spaces_; 3104 CompactionSpaceCollection compaction_spaces_;
3105 HashMap local_pretenuring_feedback_; 3105 base::HashMap local_pretenuring_feedback_;
3106 3106
3107 // Visitors for the corresponding spaces. 3107 // Visitors for the corresponding spaces.
3108 EvacuateNewSpaceVisitor new_space_visitor_; 3108 EvacuateNewSpaceVisitor new_space_visitor_;
3109 EvacuateNewSpacePageVisitor new_space_page_visitor; 3109 EvacuateNewSpacePageVisitor new_space_page_visitor;
3110 EvacuateOldSpaceVisitor old_space_visitor_; 3110 EvacuateOldSpaceVisitor old_space_visitor_;
3111 3111
3112 // Book keeping info. 3112 // Book keeping info.
3113 double duration_; 3113 double duration_;
3114 intptr_t bytes_compacted_; 3114 intptr_t bytes_compacted_;
3115 }; 3115 };
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
3993 MarkBit mark_bit = Marking::MarkBitFrom(host); 3993 MarkBit mark_bit = Marking::MarkBitFrom(host);
3994 if (Marking::IsBlack(mark_bit)) { 3994 if (Marking::IsBlack(mark_bit)) {
3995 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 3995 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
3996 RecordRelocSlot(host, &rinfo, target); 3996 RecordRelocSlot(host, &rinfo, target);
3997 } 3997 }
3998 } 3998 }
3999 } 3999 }
4000 4000
4001 } // namespace internal 4001 } // namespace internal
4002 } // namespace v8 4002 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698