diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-04-03 18:49:58 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-04-04 09:59:06 +0100 |
commit | 2e7038ac5848468740d6a419434d3dde8c585a53 (patch) | |
tree | 465940d5cc57b28c4f5b5ad588f6d86ee72097ed /compiler/optimizing/code_generator_x86.cc | |
parent | a7b2826fa469c626ff2c3ff26fd848c28bccc092 (diff) | |
download | art-2e7038ac5848468740d6a419434d3dde8c585a53.zip art-2e7038ac5848468740d6a419434d3dde8c585a53.tar.gz art-2e7038ac5848468740d6a419434d3dde8c585a53.tar.bz2 |
Add support for new-instance and invoke-direct.
Change-Id: I2daed646904f7711972a7da15d88be7573426932
Diffstat (limited to 'compiler/optimizing/code_generator_x86.cc')
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 7b0a087..882541b 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -188,7 +188,7 @@ void InstructionCodeGeneratorX86::VisitReturn(HReturn* ret) { } static constexpr Register kParameterCoreRegisters[] = { ECX, EDX, EBX }; -static constexpr int kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters); +static constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters); class InvokeStaticCallingConvention : public CallingConvention<Register> { public: @@ -199,6 +199,20 @@ class InvokeStaticCallingConvention : public CallingConvention<Register> { DISALLOW_COPY_AND_ASSIGN(InvokeStaticCallingConvention); }; +static constexpr Register kRuntimeParameterCoreRegisters[] = { EAX, ECX, EDX }; +static constexpr size_t kRuntimeParameterCoreRegistersLength = + arraysize(kRuntimeParameterCoreRegisters); + +class InvokeRuntimeCallingConvention : public CallingConvention<Register> { + public: + InvokeRuntimeCallingConvention() + : CallingConvention(kRuntimeParameterCoreRegisters, + kRuntimeParameterCoreRegistersLength) {} + + private: + DISALLOW_COPY_AND_ASSIGN(InvokeRuntimeCallingConvention); +}; + void LocationsBuilderX86::VisitPushArgument(HPushArgument* argument) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(argument); InvokeStaticCallingConvention calling_convention; @@ -284,5 +298,22 @@ void InstructionCodeGeneratorX86::VisitAdd(HAdd* add) { } } +void LocationsBuilderX86::VisitNewInstance(HNewInstance* instruction) { + LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction); + locations->SetOut(Location(EAX)); + instruction->SetLocations(locations); +} + +void InstructionCodeGeneratorX86::VisitNewInstance(HNewInstance* instruction) { + InvokeRuntimeCallingConvention calling_convention; + LoadCurrentMethod(calling_convention.GetRegisterAt(1)); + __ movl(calling_convention.GetRegisterAt(0), + Immediate(instruction->GetTypeIndex())); + + __ fs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kWordSize, pAllocObjectWithAccessCheck))); + + codegen_->RecordPcInfo(instruction->GetDexPc()); +} + } // namespace x86 } // namespace art |