diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2016-11-10 13:58:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-11-10 13:58:34 +0000 |
commit | 16593ed1d3914308052f98542bb9bf38ed588d53 (patch) | |
tree | 783e1081ec6828731ef88df679193d0c4c2f5919 /compiler/optimizing/code_generator_arm.cc | |
parent | af0cac6ed7221303c8bd8a77f6c41f4af8045d60 (diff) | |
parent | fdaf0f45510374d3a122fdc85d68793e2431175e (diff) |
Merge "Change string compression encoding."
Diffstat (limited to 'compiler/optimizing/code_generator_arm.cc')
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 08227fc8c8..25d3855e39 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -4864,16 +4864,21 @@ void InstructionCodeGeneratorARM::VisitArrayGet(HArrayGet* instruction) { case Primitive::kPrimShort: case Primitive::kPrimChar: case Primitive::kPrimInt: { + Register length; + if (maybe_compressed_char_at) { + length = locations->GetTemp(0).AsRegister<Register>(); + uint32_t count_offset = mirror::String::CountOffset().Uint32Value(); + __ LoadFromOffset(kLoadWord, length, obj, count_offset); + codegen_->MaybeRecordImplicitNullCheck(instruction); + } if (index.IsConstant()) { int32_t const_index = index.GetConstant()->AsIntConstant()->GetValue(); if (maybe_compressed_char_at) { - Register length = IP; Label uncompressed_load, done; - uint32_t count_offset = mirror::String::CountOffset().Uint32Value(); - __ LoadFromOffset(kLoadWord, length, obj, count_offset); - codegen_->MaybeRecordImplicitNullCheck(instruction); - __ cmp(length, ShifterOperand(0)); - __ b(&uncompressed_load, GE); + __ Lsrs(length, length, 1u); // LSRS has a 16-bit encoding, TST (immediate) does not. + static_assert(static_cast<uint32_t>(mirror::StringCompressionFlag::kCompressed) == 0u, + "Expecting 0=compressed, 1=uncompressed"); + __ b(&uncompressed_load, CS); __ LoadFromOffset(kLoadUnsignedByte, out_loc.AsRegister<Register>(), obj, @@ -4908,12 +4913,10 @@ void InstructionCodeGeneratorARM::VisitArrayGet(HArrayGet* instruction) { } if (maybe_compressed_char_at) { Label uncompressed_load, done; - uint32_t count_offset = mirror::String::CountOffset().Uint32Value(); - Register length = locations->GetTemp(0).AsRegister<Register>(); - __ LoadFromOffset(kLoadWord, length, obj, count_offset); - codegen_->MaybeRecordImplicitNullCheck(instruction); - __ cmp(length, ShifterOperand(0)); - __ b(&uncompressed_load, GE); + __ Lsrs(length, length, 1u); // LSRS has a 16-bit encoding, TST (immediate) does not. + static_assert(static_cast<uint32_t>(mirror::StringCompressionFlag::kCompressed) == 0u, + "Expecting 0=compressed, 1=uncompressed"); + __ b(&uncompressed_load, CS); __ ldrb(out_loc.AsRegister<Register>(), Address(temp, index.AsRegister<Register>(), Shift::LSL, 0)); __ b(&done); @@ -5318,7 +5321,7 @@ void InstructionCodeGeneratorARM::VisitArrayLength(HArrayLength* instruction) { codegen_->MaybeRecordImplicitNullCheck(instruction); // Mask out compression flag from String's array length. if (mirror::kUseStringCompression && instruction->IsStringLength()) { - __ bic(out, out, ShifterOperand(1u << 31)); + __ Lsr(out, out, 1u); } } |