summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator_mips.cc
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2018-06-27 10:25:41 -0700
committerAlex Light <allight@google.com>2018-07-10 08:44:51 -0700
commitd109e30eab8ba25f8d89be2a83d9036e2d541af2 (patch)
tree24df91603efe9ce8c4a2efd09ac402aceb10df4e /compiler/optimizing/code_generator_mips.cc
parentc916736ca1e375c276df251446baf2ac8ff3eb13 (diff)
Don't use StringFactory.newEmptyString in compiled code
When compiling debuggable code we would compile a new-instance String instruction into a StringFactory.newEmptyString invoke. This additional invoke could be observed using tracing and is inconsistent with the interpreter, where the string is simply allocated directly. In order to bring these two modes into alignment we added a new AllocStringObject quick entrypoint that will be used instead of the normal AllocObject<...> entrypoints when allocating a string. This entrypoint directly allocates a new string in the same manner the interpreter does. Needs next CL for test to work. Bug: 110884646 Test: ./test/testrunner/testrunner.py --host --runtime-option=-Xjitthreshold:0 --jit Test: Manual inspection of compiled code. Change-Id: I7b4b084bcf7dd9a23485c0e3cd2cd04a04b43d3d
Diffstat (limited to 'compiler/optimizing/code_generator_mips.cc')
-rw-r--r--compiler/optimizing/code_generator_mips.cc23
1 files changed, 3 insertions, 20 deletions
diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc
index f0ef30ee37..c7295e4db1 100644
--- a/compiler/optimizing/code_generator_mips.cc
+++ b/compiler/optimizing/code_generator_mips.cc
@@ -8701,30 +8701,13 @@ void LocationsBuilderMIPS::VisitNewInstance(HNewInstance* instruction) {
LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(
instruction, LocationSummary::kCallOnMainOnly);
InvokeRuntimeCallingConvention calling_convention;
- if (instruction->IsStringAlloc()) {
- locations->AddTemp(Location::RegisterLocation(kMethodRegisterArgument));
- } else {
- locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
- }
+ locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
locations->SetOut(calling_convention.GetReturnLocation(DataType::Type::kReference));
}
void InstructionCodeGeneratorMIPS::VisitNewInstance(HNewInstance* instruction) {
- // Note: if heap poisoning is enabled, the entry point takes care
- // of poisoning the reference.
- if (instruction->IsStringAlloc()) {
- // String is allocated through StringFactory. Call NewEmptyString entry point.
- Register temp = instruction->GetLocations()->GetTemp(0).AsRegister<Register>();
- MemberOffset code_offset = ArtMethod::EntryPointFromQuickCompiledCodeOffset(kMipsPointerSize);
- __ LoadFromOffset(kLoadWord, temp, TR, QUICK_ENTRY_POINT(pNewEmptyString));
- __ LoadFromOffset(kLoadWord, T9, temp, code_offset.Int32Value());
- __ Jalr(T9);
- __ NopIfNoReordering();
- codegen_->RecordPcInfo(instruction, instruction->GetDexPc());
- } else {
- codegen_->InvokeRuntime(instruction->GetEntrypoint(), instruction, instruction->GetDexPc());
- CheckEntrypointTypes<kQuickAllocObjectWithChecks, void*, mirror::Class*>();
- }
+ codegen_->InvokeRuntime(instruction->GetEntrypoint(), instruction, instruction->GetDexPc());
+ CheckEntrypointTypes<kQuickAllocObjectWithChecks, void*, mirror::Class*>();
}
void LocationsBuilderMIPS::VisitNot(HNot* instruction) {