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

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

Issue 2209583002: [heap] Remove border page (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Allow empty intermediate generation Created 4 years, 3 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') | test/cctest/heap/test-heap.cc » ('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 0fd69dacfebd7b93b269bd9b093b53e39bca4866..5d444e5751bbafac88b7c5363af8f90ae199eac3 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -165,6 +165,22 @@ bool NewSpace::FromSpaceContainsSlow(Address a) {
bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); }
bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); }
+size_t NewSpace::AllocatedSinceLastGC() {
+ Page* top_page = Page::FromAllocationAreaAddress(top());
+ size_t allocated = 0;
+ // If top gets reset to be in the range of pages that are below the age
+ // mark, this loop will not trigger and we return 0 (invalid).
+ for (Page* current_page = top_page;
+ !current_page->InIntermediateGeneration() &&
+ current_page != to_space_.anchor();
+ current_page = current_page->prev_page()) {
+ allocated += (top_page == current_page)
+ ? static_cast<size_t>(top() - current_page->area_start())
+ : Page::kAllocatableMemory;
+ }
+ return allocated;
+}
+
// --------------------------------------------------------------------------
// AllocationResult
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698