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

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 for DCHECK only variable 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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.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/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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } else { 1407 } else {
1408 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this->isolate()); 1408 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this->isolate());
1409 gc_epilogue_callbacks_[i].callback(isolate, gc_type, gc_callback_flags); 1409 gc_epilogue_callbacks_[i].callback(isolate, gc_type, gc_callback_flags);
1410 } 1410 }
1411 } 1411 }
1412 } 1412 }
1413 } 1413 }
1414 1414
1415 1415
1416 void Heap::MarkCompact() { 1416 void Heap::MarkCompact() {
1417 PauseInlineAllocationObserversScope pause_observers(new_space()); 1417 PauseAllocationObserversScope pause_observers(this);
1418 1418
1419 gc_state_ = MARK_COMPACT; 1419 gc_state_ = MARK_COMPACT;
1420 LOG(isolate_, ResourceEvent("markcompact", "begin")); 1420 LOG(isolate_, ResourceEvent("markcompact", "begin"));
1421 1421
1422 uint64_t size_of_objects_before_gc = SizeOfObjects(); 1422 uint64_t size_of_objects_before_gc = SizeOfObjects();
1423 1423
1424 mark_compact_collector()->Prepare(); 1424 mark_compact_collector()->Prepare();
1425 1425
1426 ms_count_++; 1426 ms_count_++;
1427 1427
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 void Heap::Scavenge() { 1608 void Heap::Scavenge() {
1609 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE); 1609 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE);
1610 RelocationLock relocation_lock(this); 1610 RelocationLock relocation_lock(this);
1611 // There are soft limits in the allocation code, designed to trigger a mark 1611 // There are soft limits in the allocation code, designed to trigger a mark
1612 // sweep collection by failing allocations. There is no sense in trying to 1612 // sweep collection by failing allocations. There is no sense in trying to
1613 // trigger one during scavenge: scavenges allocation should always succeed. 1613 // trigger one during scavenge: scavenges allocation should always succeed.
1614 AlwaysAllocateScope scope(isolate()); 1614 AlwaysAllocateScope scope(isolate());
1615 1615
1616 // Bump-pointer allocations done during scavenge are not real allocations. 1616 // Bump-pointer allocations done during scavenge are not real allocations.
1617 // Pause the inline allocation steps. 1617 // Pause the inline allocation steps.
1618 PauseInlineAllocationObserversScope pause_observers(new_space()); 1618 PauseAllocationObserversScope pause_observers(this);
1619 1619
1620 #ifdef VERIFY_HEAP 1620 #ifdef VERIFY_HEAP
1621 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); 1621 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this);
1622 #endif 1622 #endif
1623 1623
1624 gc_state_ = SCAVENGE; 1624 gc_state_ = SCAVENGE;
1625 1625
1626 // Implements Cheney's copying algorithm 1626 // Implements Cheney's copying algorithm
1627 LOG(isolate_, ResourceEvent("scavenge", "begin")); 1627 LOG(isolate_, ResourceEvent("scavenge", "begin"));
1628 1628
(...skipping 3511 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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
6214 } 6214 }
6215 6215
6216 6216
6217 // static 6217 // static
6218 int Heap::GetStaticVisitorIdForMap(Map* map) { 6218 int Heap::GetStaticVisitorIdForMap(Map* map) {
6219 return StaticVisitorBase::GetVisitorId(map); 6219 return StaticVisitorBase::GetVisitorId(map);
6220 } 6220 }
6221 6221
6222 } // namespace internal 6222 } // namespace internal
6223 } // namespace v8 6223 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698