Index: test/cctest/test-alloc.cc |
diff --git a/test/cctest/test-alloc.cc b/test/cctest/test-alloc.cc |
index e6e3bd1cc4b3216f65d1974965a2367634f534a5..670da58a150086bd6ca0d67b7255f17a51fde192 100644 |
--- a/test/cctest/test-alloc.cc |
+++ b/test/cctest/test-alloc.cc |
@@ -186,10 +186,9 @@ class Block { |
TEST(CodeRange) { |
const int code_range_size = 32*MB; |
- OS::SetUp(); |
- Isolate::Current()->InitializeLoggingAndCounters(); |
- CodeRange* code_range = new CodeRange(Isolate::Current()); |
- code_range->SetUp(code_range_size); |
+ CcTest::InitializeVM(); |
+ CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate())); |
+ code_range.SetUp(code_range_size); |
int current_allocated = 0; |
int total_allocated = 0; |
List<Block> blocks(1000); |
@@ -205,9 +204,9 @@ TEST(CodeRange) { |
(Page::kMaxNonCodeHeapObjectSize << (Pseudorandom() % 3)) + |
Pseudorandom() % 5000 + 1; |
size_t allocated = 0; |
- Address base = code_range->AllocateRawMemory(requested, |
- requested, |
- &allocated); |
+ Address base = code_range.AllocateRawMemory(requested, |
+ requested, |
+ &allocated); |
CHECK(base != NULL); |
blocks.Add(Block(base, static_cast<int>(allocated))); |
current_allocated += static_cast<int>(allocated); |
@@ -215,7 +214,7 @@ TEST(CodeRange) { |
} else { |
// Free a block. |
int index = Pseudorandom() % blocks.length(); |
- 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(); |
@@ -225,6 +224,5 @@ TEST(CodeRange) { |
} |
} |
- code_range->TearDown(); |
- delete code_range; |
+ code_range.TearDown(); |
} |