diff options
Diffstat (limited to 'compiler/optimizing/find_loops_test.cc')
-rw-r--r-- | compiler/optimizing/find_loops_test.cc | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/compiler/optimizing/find_loops_test.cc b/compiler/optimizing/find_loops_test.cc index fab9f7a5ec..c36b1436d3 100644 --- a/compiler/optimizing/find_loops_test.cc +++ b/compiler/optimizing/find_loops_test.cc @@ -27,9 +27,8 @@ namespace art { -static HGraph* TestCode(const uint16_t* data, ArenaPool* pool) { - ArenaAllocator allocator(pool); - HGraphBuilder builder(&allocator); +static HGraph* TestCode(const uint16_t* data, ArenaAllocator* allocator) { + HGraphBuilder builder(allocator); const DexFile::CodeItem* item = reinterpret_cast<const DexFile::CodeItem*>(data); HGraph* graph = builder.BuildGraph(*item); graph->BuildDominatorTree(); @@ -44,7 +43,8 @@ TEST(FindLoopsTest, CFG1) { Instruction::RETURN_VOID); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); for (size_t i = 0, e = graph->GetBlocks().Size(); i < e; ++i) { ASSERT_EQ(graph->GetBlocks().Get(i)->GetLoopInformation(), nullptr); } @@ -56,7 +56,8 @@ TEST(FindLoopsTest, CFG2) { Instruction::RETURN); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); for (size_t i = 0, e = graph->GetBlocks().Size(); i < e; ++i) { ASSERT_EQ(graph->GetBlocks().Get(i)->GetLoopInformation(), nullptr); } @@ -71,7 +72,8 @@ TEST(FindLoopsTest, CFG3) { Instruction::RETURN); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); for (size_t i = 0, e = graph->GetBlocks().Size(); i < e; ++i) { ASSERT_EQ(graph->GetBlocks().Get(i)->GetLoopInformation(), nullptr); } @@ -87,7 +89,8 @@ TEST(FindLoopsTest, CFG4) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); for (size_t i = 0, e = graph->GetBlocks().Size(); i < e; ++i) { ASSERT_EQ(graph->GetBlocks().Get(i)->GetLoopInformation(), nullptr); } @@ -101,7 +104,8 @@ TEST(FindLoopsTest, CFG5) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); for (size_t i = 0, e = graph->GetBlocks().Size(); i < e; ++i) { ASSERT_EQ(graph->GetBlocks().Get(i)->GetLoopInformation(), nullptr); } @@ -146,7 +150,8 @@ TEST(FindLoopsTest, Loop1) { Instruction::RETURN_VOID); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // pre header @@ -173,7 +178,8 @@ TEST(FindLoopsTest, Loop2) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // goto block @@ -197,7 +203,8 @@ TEST(FindLoopsTest, Loop3) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // goto block @@ -222,7 +229,8 @@ TEST(FindLoopsTest, Loop4) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // pre header @@ -248,7 +256,8 @@ TEST(FindLoopsTest, Loop5) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // pre header @@ -271,9 +280,9 @@ TEST(FindLoopsTest, InnerLoop) { Instruction::GOTO | 0xFB00, Instruction::RETURN | 0 << 8); - ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // pre header of outer loop @@ -302,9 +311,9 @@ TEST(FindLoopsTest, TwoLoops) { Instruction::GOTO | 0xFE00, // second loop Instruction::RETURN | 0 << 8); - ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // pre header of first loop @@ -333,7 +342,8 @@ TEST(FindLoopsTest, NonNaturalLoop) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); ASSERT_TRUE(graph->GetBlocks().Get(3)->IsLoopHeader()); HLoopInformation* info = graph->GetBlocks().Get(3)->GetLoopInformation(); ASSERT_FALSE(info->GetHeader()->Dominates(info->GetBackEdges().Get(0))); @@ -347,7 +357,8 @@ TEST(FindLoopsTest, DoWhileLoop) { Instruction::RETURN | 0 << 8); ArenaPool arena; - HGraph* graph = TestCode(data, &arena); + ArenaAllocator allocator(&arena); + HGraph* graph = TestCode(data, &allocator); TestBlock(graph, 0, false, -1); // entry block TestBlock(graph, 1, false, -1); // pre header of first loop |