summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-04-12 18:51:43 +0100
committer Vladimir Marko <vmarko@google.com> 2016-04-12 21:04:13 +0100
commitd58b837ae41c6d8ce010c362e8f85bd938715900 (patch)
treea7c8e90ff825838bb27707d14487c0333f2cc5f6 /compiler/optimizing/code_generator.cc
parentec9a828fa4a4638d2d17124c4fa835f15c7c5589 (diff)
Allocate code generators on the arena.
Change-Id: If8cf0ee43711f6e13171443e3c057ff370ccfbaa
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r--compiler/optimizing/code_generator.cc65
1 files changed, 36 insertions, 29 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 953c0ae418..a771cc1567 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -552,59 +552,66 @@ void CodeGenerator::MaybeRecordStat(MethodCompilationStat compilation_stat, size
}
}
-CodeGenerator* CodeGenerator::Create(HGraph* graph,
- InstructionSet instruction_set,
- const InstructionSetFeatures& isa_features,
- const CompilerOptions& compiler_options,
- OptimizingCompilerStats* stats) {
+std::unique_ptr<CodeGenerator> CodeGenerator::Create(HGraph* graph,
+ InstructionSet instruction_set,
+ const InstructionSetFeatures& isa_features,
+ const CompilerOptions& compiler_options,
+ OptimizingCompilerStats* stats) {
+ ArenaAllocator* arena = graph->GetArena();
switch (instruction_set) {
#ifdef ART_ENABLE_CODEGEN_arm
case kArm:
case kThumb2: {
- return new arm::CodeGeneratorARM(graph,
- *isa_features.AsArmInstructionSetFeatures(),
- compiler_options,
- stats);
+ return std::unique_ptr<CodeGenerator>(
+ new (arena) arm::CodeGeneratorARM(graph,
+ *isa_features.AsArmInstructionSetFeatures(),
+ compiler_options,
+ stats));
}
#endif
#ifdef ART_ENABLE_CODEGEN_arm64
case kArm64: {
- return new arm64::CodeGeneratorARM64(graph,
- *isa_features.AsArm64InstructionSetFeatures(),
- compiler_options,
- stats);
+ return std::unique_ptr<CodeGenerator>(
+ new (arena) arm64::CodeGeneratorARM64(graph,
+ *isa_features.AsArm64InstructionSetFeatures(),
+ compiler_options,
+ stats));
}
#endif
#ifdef ART_ENABLE_CODEGEN_mips
case kMips: {
- return new mips::CodeGeneratorMIPS(graph,
- *isa_features.AsMipsInstructionSetFeatures(),
- compiler_options,
- stats);
+ return std::unique_ptr<CodeGenerator>(
+ new (arena) mips::CodeGeneratorMIPS(graph,
+ *isa_features.AsMipsInstructionSetFeatures(),
+ compiler_options,
+ stats));
}
#endif
#ifdef ART_ENABLE_CODEGEN_mips64
case kMips64: {
- return new mips64::CodeGeneratorMIPS64(graph,
- *isa_features.AsMips64InstructionSetFeatures(),
- compiler_options,
- stats);
+ return std::unique_ptr<CodeGenerator>(
+ new (arena) mips64::CodeGeneratorMIPS64(graph,
+ *isa_features.AsMips64InstructionSetFeatures(),
+ compiler_options,
+ stats));
}
#endif
#ifdef ART_ENABLE_CODEGEN_x86
case kX86: {
- return new x86::CodeGeneratorX86(graph,
- *isa_features.AsX86InstructionSetFeatures(),
- compiler_options,
- stats);
+ return std::unique_ptr<CodeGenerator>(
+ new (arena) x86::CodeGeneratorX86(graph,
+ *isa_features.AsX86InstructionSetFeatures(),
+ compiler_options,
+ stats));
}
#endif
#ifdef ART_ENABLE_CODEGEN_x86_64
case kX86_64: {
- return new x86_64::CodeGeneratorX86_64(graph,
- *isa_features.AsX86_64InstructionSetFeatures(),
- compiler_options,
- stats);
+ return std::unique_ptr<CodeGenerator>(
+ new (arena) x86_64::CodeGeneratorX86_64(graph,
+ *isa_features.AsX86_64InstructionSetFeatures(),
+ compiler_options,
+ stats));
}
#endif
default: