| 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
|
|
|