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

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

Issue 1991253002: [heap] Bundle platform-specific constants for CodeRange (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/heap/test-alloc.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-spaces.cc
diff --git a/test/cctest/heap/test-spaces.cc b/test/cctest/heap/test-spaces.cc
index da364c51408b8709d7d5373fd7cc30f1d96bb99f..d863d3c9d5d60e9b5826eb91e3cbf7212a04f3ac 100644
--- a/test/cctest/heap/test-spaces.cc
+++ b/test/cctest/heap/test-spaces.cc
@@ -203,36 +203,31 @@ static void VerifyMemoryChunk(Isolate* isolate,
TEST(Regress3540) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- const int pageSize = Page::kPageSize;
MemoryAllocator* memory_allocator = new MemoryAllocator(isolate);
CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(),
0));
TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator);
CodeRange* code_range = new CodeRange(isolate);
- const size_t code_range_size = 4 * pageSize;
- if (!code_range->SetUp(
- code_range_size +
- RoundUp(v8::base::OS::CommitPageSize() * kReservedCodeRangePages,
- MemoryChunk::kAlignment) +
- v8::internal::MemoryAllocator::CodePageAreaSize())) {
+ const size_t code_range_size = 4 * Page::kPageSize;
+ if (!code_range->SetUp(code_range_size)) {
return;
}
Address address;
size_t size;
- size_t request_size = code_range_size - 2 * pageSize;
+ size_t request_size = code_range_size - 2 * Page::kPageSize;
address = code_range->AllocateRawMemory(
request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()),
&size);
- CHECK(address != NULL);
+ CHECK_NOT_NULL(address);
Address null_address;
size_t null_size;
- request_size = code_range_size - pageSize;
+ request_size = code_range_size - Page::kPageSize;
null_address = code_range->AllocateRawMemory(
request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()),
&null_size);
- CHECK(null_address == NULL);
+ CHECK_NULL(null_address);
code_range->FreeRawMemory(address, size);
delete code_range;
@@ -281,8 +276,8 @@ TEST(MemoryChunk) {
NOT_EXECUTABLE);
delete code_range;
- // Without CodeRange.
- code_range = NULL;
+ // Without a valid CodeRange, i.e., omitting SetUp.
+ code_range = new CodeRange(isolate);
VerifyMemoryChunk(isolate,
heap,
code_range,
@@ -298,6 +293,7 @@ TEST(MemoryChunk) {
initial_commit_area_size,
second_commit_area_size,
NOT_EXECUTABLE);
+ delete code_range;
}
}
« no previous file with comments | « test/cctest/heap/test-alloc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698