Index: test/cctest/test-alloc.cc |
diff --git a/test/cctest/test-alloc.cc b/test/cctest/test-alloc.cc |
index 4d9c218a43d5490b3cb0c4679c5acbb339bc2171..97671923d9941910f217eaa5bfcb62ac1314538f 100644 |
--- a/test/cctest/test-alloc.cc |
+++ b/test/cctest/test-alloc.cc |
@@ -186,7 +186,9 @@ class Block { |
TEST(CodeRange) { |
const int code_range_size = 16*MB; |
OS::Setup(); |
- Isolate::Current()->code_range()->Setup(code_range_size); |
+ Isolate::Current()->InitializeLoggingAndCounters(); |
+ CodeRange* code_range = new CodeRange(Isolate::Current()); |
+ code_range->Setup(code_range_size); |
int current_allocated = 0; |
int total_allocated = 0; |
List<Block> blocks(1000); |
@@ -198,8 +200,7 @@ TEST(CodeRange) { |
size_t requested = (Page::kPageSize << (Pseudorandom() % 6)) + |
Pseudorandom() % 5000 + 1; |
size_t allocated = 0; |
- void* base = Isolate::Current()->code_range()-> |
- AllocateRawMemory(requested, &allocated); |
+ void* base = code_range->AllocateRawMemory(requested, &allocated); |
CHECK(base != NULL); |
blocks.Add(Block(base, static_cast<int>(allocated))); |
current_allocated += static_cast<int>(allocated); |
@@ -207,8 +208,7 @@ TEST(CodeRange) { |
} else { |
// Free a block. |
int index = Pseudorandom() % blocks.length(); |
- Isolate::Current()->code_range()->FreeRawMemory( |
- blocks[index].base, blocks[index].size); |
+ code_range->FreeRawMemory(blocks[index].base, blocks[index].size); |
current_allocated -= blocks[index].size; |
if (index < blocks.length() - 1) { |
blocks[index] = blocks.RemoveLast(); |
@@ -218,5 +218,6 @@ TEST(CodeRange) { |
} |
} |
- Isolate::Current()->code_range()->TearDown(); |
+ code_range->TearDown(); |
+ delete code_range; |
} |