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

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

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 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 | « test/cctest/test-profile-generator.cc ('k') | test/cctest/test-version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-spaces.cc
diff --git a/test/cctest/test-spaces.cc b/test/cctest/test-spaces.cc
index 051af2f2f96cbae7b1670864568f2769e679d29d..de0c41e2b83dfb9e32e46ebe7f72aedc8d2807cd 100644
--- a/test/cctest/test-spaces.cc
+++ b/test/cctest/test-spaces.cc
@@ -103,14 +103,14 @@ TEST(MemoryAllocator) {
OLD_POINTER_SPACE,
NOT_EXECUTABLE);
int total_pages = 0;
- int requested = 2;
+ int requested = MemoryAllocator::kPagesPerChunk;
int allocated;
- // If we request two pages, we should get one or two.
+ // If we request n pages, we should get n or n - 1.
Page* first_page =
isolate->memory_allocator()->AllocatePages(
requested, &allocated, &faked_space);
CHECK(first_page->is_valid());
- CHECK(allocated > 0 && allocated <= 2);
+ CHECK(allocated == requested || allocated == requested - 1);
total_pages += allocated;
Page* last_page = first_page;
@@ -119,12 +119,12 @@ TEST(MemoryAllocator) {
last_page = p;
}
- // Again, we should get one or two pages.
+ // Again, we should get n or n - 1 pages.
Page* others =
isolate->memory_allocator()->AllocatePages(
requested, &allocated, &faked_space);
CHECK(others->is_valid());
- CHECK(allocated > 0 && allocated <= 2);
+ CHECK(allocated == requested || allocated == requested - 1);
total_pages += allocated;
isolate->memory_allocator()->SetNextPage(last_page, others);
@@ -139,11 +139,10 @@ TEST(MemoryAllocator) {
CHECK(second_page->is_valid());
// Freeing pages at the first chunk starting at or after the second page
- // should free the entire second chunk. It will return the last page in the
- // first chunk (if the second page was in the first chunk) or else an
- // invalid page (if the second page was the start of the second chunk).
+ // should free the entire second chunk. It will return the page it was passed
+ // (since the second page was in the first chunk).
Page* free_return = isolate->memory_allocator()->FreePages(second_page);
- CHECK(free_return == last_page || !free_return->is_valid());
+ CHECK(free_return == second_page);
isolate->memory_allocator()->SetNextPage(first_page, free_return);
// Freeing pages in the first chunk starting at the first page should free
« no previous file with comments | « test/cctest/test-profile-generator.cc ('k') | test/cctest/test-version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698