summaryrefslogtreecommitdiff
path: root/compiler/optimizing/codegen_test.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-09-11 10:30:02 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-09-11 10:32:12 +0100
commit8a16d97fb8f031822b206e65f9109a071da40563 (patch)
tree9dbbf5feaac15d2e4f54fbfc3c204fcdd6e8317a /compiler/optimizing/codegen_test.cc
parentc7f6b86c269727fe031146b9c18652d40916d46f (diff)
Fix valgrind errors.
For now just stack allocate the code generator. Will think about cleaning up the root problem later (CodeGenerator being an arena object). Change-Id: I161a6f61c5f27ea88851b446f3c1e12ee9c594d7
Diffstat (limited to 'compiler/optimizing/codegen_test.cc')
-rw-r--r--compiler/optimizing/codegen_test.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index d7ac10d164..672ff54b1d 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -15,7 +15,9 @@
*/
#include "builder.h"
-#include "code_generator.h"
+#include "code_generator_arm.h"
+#include "code_generator_x86.h"
+#include "code_generator_x86_64.h"
#include "common_compiler_test.h"
#include "dex_file.h"
#include "dex_instruction.h"
@@ -75,25 +77,25 @@ static void TestCode(const uint16_t* data, bool has_result = false, int32_t expe
ASSERT_NE(graph, nullptr);
InternalCodeAllocator allocator;
- CodeGenerator* codegen = CodeGenerator::Create(&arena, graph, kX86);
+ x86::CodeGeneratorX86 codegenX86(graph);
// We avoid doing a stack overflow check that requires the runtime being setup,
// by making sure the compiler knows the methods we are running are leaf methods.
- codegen->CompileBaseline(&allocator, true);
-#if defined(__i386__)
- Run(allocator, *codegen, has_result, expected);
-#endif
+ codegenX86.CompileBaseline(&allocator, true);
+ if (kRuntimeISA == kX86) {
+ Run(allocator, codegenX86, has_result, expected);
+ }
- codegen = CodeGenerator::Create(&arena, graph, kArm);
- codegen->CompileBaseline(&allocator, true);
-#if defined(__arm__)
- Run(allocator, *codegen, has_result, expected);
-#endif
+ arm::CodeGeneratorARM codegenARM(graph);
+ codegenARM.CompileBaseline(&allocator, true);
+ if (kRuntimeISA == kArm || kRuntimeISA == kThumb2) {
+ Run(allocator, codegenARM, has_result, expected);
+ }
- codegen = CodeGenerator::Create(&arena, graph, kX86_64);
- codegen->CompileBaseline(&allocator, true);
-#if defined(__x86_64__)
- Run(allocator, *codegen, has_result, expected);
-#endif
+ x86_64::CodeGeneratorX86_64 codegenX86_64(graph);
+ codegenX86_64.CompileBaseline(&allocator, true);
+ if (kRuntimeISA == kX86_64) {
+ Run(allocator, codegenX86_64, has_result, expected);
+ }
}
TEST(CodegenTest, ReturnVoid) {