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

Side by Side Diff: src/heap/heap.cc

Issue 1625753002: Allocation sampling for paged/lo spaces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use allspaces iterator and fix style issues Created 4 years, 10 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
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/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace v8 { 46 namespace v8 {
47 namespace internal { 47 namespace internal {
48 48
49 49
50 struct Heap::StrongRootsList { 50 struct Heap::StrongRootsList {
51 Object** start; 51 Object** start;
52 Object** end; 52 Object** end;
53 StrongRootsList* next; 53 StrongRootsList* next;
54 }; 54 };
55 55
56 class IdleScavengeObserver : public InlineAllocationObserver { 56 class IdleScavengeObserver : public AllocationObserver {
57 public: 57 public:
58 IdleScavengeObserver(Heap& heap, intptr_t step_size) 58 IdleScavengeObserver(Heap& heap, intptr_t step_size)
59 : InlineAllocationObserver(step_size), heap_(heap) {} 59 : AllocationObserver(step_size), heap_(heap) {}
60 60
61 void Step(int bytes_allocated, Address, size_t) override { 61 void Step(int bytes_allocated, Address, size_t) override {
62 heap_.ScheduleIdleScavengeIfNeeded(bytes_allocated); 62 heap_.ScheduleIdleScavengeIfNeeded(bytes_allocated);
63 } 63 }
64 64
65 private: 65 private:
66 Heap& heap_; 66 Heap& heap_;
67 }; 67 };
68 68
69 69
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 } else { 1415 } else {
1416 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this->isolate()); 1416 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this->isolate());
1417 gc_epilogue_callbacks_[i].callback(isolate, gc_type, gc_callback_flags); 1417 gc_epilogue_callbacks_[i].callback(isolate, gc_type, gc_callback_flags);
1418 } 1418 }
1419 } 1419 }
1420 } 1420 }
1421 } 1421 }
1422 1422
1423 1423
1424 void Heap::MarkCompact() { 1424 void Heap::MarkCompact() {
1425 PauseInlineAllocationObserversScope pause_observers(new_space()); 1425 PauseAllocationObserversScope pause_observers(this);
1426 1426
1427 gc_state_ = MARK_COMPACT; 1427 gc_state_ = MARK_COMPACT;
1428 LOG(isolate_, ResourceEvent("markcompact", "begin")); 1428 LOG(isolate_, ResourceEvent("markcompact", "begin"));
1429 1429
1430 uint64_t size_of_objects_before_gc = SizeOfObjects(); 1430 uint64_t size_of_objects_before_gc = SizeOfObjects();
1431 1431
1432 mark_compact_collector()->Prepare(); 1432 mark_compact_collector()->Prepare();
1433 1433
1434 ms_count_++; 1434 ms_count_++;
1435 1435
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 void Heap::Scavenge() { 1622 void Heap::Scavenge() {
1623 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE); 1623 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE);
1624 RelocationLock relocation_lock(this); 1624 RelocationLock relocation_lock(this);
1625 // There are soft limits in the allocation code, designed to trigger a mark 1625 // There are soft limits in the allocation code, designed to trigger a mark
1626 // sweep collection by failing allocations. There is no sense in trying to 1626 // sweep collection by failing allocations. There is no sense in trying to
1627 // trigger one during scavenge: scavenges allocation should always succeed. 1627 // trigger one during scavenge: scavenges allocation should always succeed.
1628 AlwaysAllocateScope scope(isolate()); 1628 AlwaysAllocateScope scope(isolate());
1629 1629
1630 // Bump-pointer allocations done during scavenge are not real allocations. 1630 // Bump-pointer allocations done during scavenge are not real allocations.
1631 // Pause the inline allocation steps. 1631 // Pause the inline allocation steps.
1632 PauseInlineAllocationObserversScope pause_observers(new_space()); 1632 PauseAllocationObserversScope pause_observers(this);
1633 1633
1634 #ifdef VERIFY_HEAP 1634 #ifdef VERIFY_HEAP
1635 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); 1635 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this);
1636 #endif 1636 #endif
1637 1637
1638 gc_state_ = SCAVENGE; 1638 gc_state_ = SCAVENGE;
1639 1639
1640 // Implements Cheney's copying algorithm 1640 // Implements Cheney's copying algorithm
1641 LOG(isolate_, ResourceEvent("scavenge", "begin")); 1641 LOG(isolate_, ResourceEvent("scavenge", "begin"));
1642 1642
(...skipping 3497 matching lines...) Expand 10 before | Expand all | Expand 10 after
5140 5140
5141 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 5141 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
5142 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 5142 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
5143 5143
5144 store_buffer()->SetUp(); 5144 store_buffer()->SetUp();
5145 5145
5146 mark_compact_collector()->SetUp(); 5146 mark_compact_collector()->SetUp();
5147 5147
5148 idle_scavenge_observer_ = new IdleScavengeObserver( 5148 idle_scavenge_observer_ = new IdleScavengeObserver(
5149 *this, ScavengeJob::kBytesAllocatedBeforeNextIdleTask); 5149 *this, ScavengeJob::kBytesAllocatedBeforeNextIdleTask);
5150 new_space()->AddInlineAllocationObserver(idle_scavenge_observer_); 5150 new_space()->AddAllocationObserver(idle_scavenge_observer_);
5151 5151
5152 return true; 5152 return true;
5153 } 5153 }
5154 5154
5155 5155
5156 bool Heap::CreateHeapObjects() { 5156 bool Heap::CreateHeapObjects() {
5157 // Create initial maps. 5157 // Create initial maps.
5158 if (!CreateInitialMaps()) return false; 5158 if (!CreateInitialMaps()) return false;
5159 CreateApiObjects(); 5159 CreateApiObjects();
5160 5160
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5240 map_space_->MaximumCommittedMemory()); 5240 map_space_->MaximumCommittedMemory());
5241 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ", 5241 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ",
5242 lo_space_->MaximumCommittedMemory()); 5242 lo_space_->MaximumCommittedMemory());
5243 PrintF("\n\n"); 5243 PrintF("\n\n");
5244 } 5244 }
5245 5245
5246 if (FLAG_verify_predictable) { 5246 if (FLAG_verify_predictable) {
5247 PrintAlloctionsHash(); 5247 PrintAlloctionsHash();
5248 } 5248 }
5249 5249
5250 new_space()->RemoveInlineAllocationObserver(idle_scavenge_observer_); 5250 new_space()->RemoveAllocationObserver(idle_scavenge_observer_);
5251 delete idle_scavenge_observer_; 5251 delete idle_scavenge_observer_;
5252 idle_scavenge_observer_ = nullptr; 5252 idle_scavenge_observer_ = nullptr;
5253 5253
5254 delete scavenge_collector_; 5254 delete scavenge_collector_;
5255 scavenge_collector_ = nullptr; 5255 scavenge_collector_ = nullptr;
5256 5256
5257 if (mark_compact_collector_ != nullptr) { 5257 if (mark_compact_collector_ != nullptr) {
5258 mark_compact_collector_->TearDown(); 5258 mark_compact_collector_->TearDown();
5259 delete mark_compact_collector_; 5259 delete mark_compact_collector_;
5260 mark_compact_collector_ = nullptr; 5260 mark_compact_collector_ = nullptr;
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
6222 } 6222 }
6223 6223
6224 6224
6225 // static 6225 // static
6226 int Heap::GetStaticVisitorIdForMap(Map* map) { 6226 int Heap::GetStaticVisitorIdForMap(Map* map) {
6227 return StaticVisitorBase::GetVisitorId(map); 6227 return StaticVisitorBase::GetVisitorId(map);
6228 } 6228 }
6229 6229
6230 } // namespace internal 6230 } // namespace internal
6231 } // namespace v8 6231 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | src/heap/incremental-marking.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698