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

Unified Diff: test/cctest/test-heap.cc

Issue 932823002: Limit size of first page based on serialized data. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove printf debugging Created 5 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/snapshot-common.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index c3094a43b3dc7caeffb0641a3871acc35ec9c48c..ae3c1d365c4a3368d0f3ebdfafba323f342c7171 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5093,3 +5093,25 @@ TEST(PathTracer) {
CcTest::i_isolate()->heap()->TracePathToObject(*o);
}
#endif // DEBUG
+
+
+TEST(FirstPageFitsStartup) {
+ // Test that the first page sizes provided by the default snapshot are large
+ // enough to fit everything right after startup and creating one context.
+ // If this test fails, we are allocating too much aside from deserialization.
+ if (!Snapshot::HaveASnapshotToStartFrom()) return;
+ if (Snapshot::EmbedsScript()) return;
+ CcTest::InitializeVM();
+ LocalContext env;
+ PagedSpaces spaces(CcTest::heap());
+ for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) {
+ uint32_t default_size = s->AreaSize();
+ uint32_t reduced_size = Snapshot::SizeOfFirstPage(s->identity());
+ if (reduced_size == default_size) continue;
+ int counter = 0;
+ Page* page = NULL;
+ for (PageIterator it(s); it.has_next(); page = it.next()) counter++;
+ CHECK_LE(counter, 1);
+ CHECK(static_cast<uint32_t>(page->area_size()) == reduced_size);
+ }
+}
« no previous file with comments | « src/snapshot-common.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698