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

Unified Diff: src/heap/spaces-inl.h

Issue 1686413002: [heap] Cleanup MemoryChunk's declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces-inl.h
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h
index ef081fa00a6b982132feddce542beb39e59e0ca4..d578055229cf4638bba94097bd4e89ad7492234a 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -251,6 +251,36 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable,
return page;
}
+void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) {
+ MemoryChunk::FromAddress(object->address())->IncrementLiveBytes(by);
+}
+
+void MemoryChunk::ResetLiveBytes() {
+ if (FLAG_trace_live_bytes) {
+ PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", this,
+ live_byte_count_);
+ }
+ live_byte_count_ = 0;
+}
+
+void MemoryChunk::IncrementLiveBytes(int by) {
+ if (FLAG_trace_live_bytes) {
+ PrintIsolate(heap()->isolate(),
+ "live-bytes: update page=%p delta=%d %d->%d\n", this, by,
+ live_byte_count_, live_byte_count_ + by);
+ }
+ live_byte_count_ += by;
+ DCHECK_GE(live_byte_count_, 0);
+ DCHECK_LE(static_cast<size_t>(live_byte_count_), size_);
+}
+
+void MemoryChunk::IncrementLiveBytesFromMutator(HeapObject* object, int by) {
+ MemoryChunk* chunk = MemoryChunk::FromAddress(object->address());
+ if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->SweepingDone()) {
+ static_cast<PagedSpace*>(chunk->owner())->Allocate(by);
+ }
+ chunk->IncrementLiveBytes(by);
+}
bool PagedSpace::Contains(Address addr) {
Page* p = Page::FromAddress(addr);
« no previous file with comments | « src/heap/spaces.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698