diff options
| author | 2015-08-03 14:55:11 +0000 | |
|---|---|---|
| committer | 2015-08-03 14:55:11 +0000 | |
| commit | bc576cfd9c85a285f15b8c33a2cc7f947d999f49 (patch) | |
| tree | d60d2cb1531da35db509d719df610668708541d2 /compiler/optimizing | |
| parent | 855223fa12fc1efc926c068ea5c536663f30030d (diff) | |
| parent | aabdf8ad2e8d3de953dff5c7591e7b3df4d4f60b (diff) | |
Merge "Revert "Optimizing String.Equals as an intrinsic (x86)""
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/intrinsics.cc | 2 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_arm.cc | 1 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_arm64.cc | 1 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_list.h | 1 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_x86.cc | 91 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_x86_64.cc | 1 |
6 files changed, 0 insertions, 97 deletions
diff --git a/compiler/optimizing/intrinsics.cc b/compiler/optimizing/intrinsics.cc index f24b15289e..bc7da802b1 100644 --- a/compiler/optimizing/intrinsics.cc +++ b/compiler/optimizing/intrinsics.cc @@ -187,8 +187,6 @@ static Intrinsics GetIntrinsic(InlineMethod method) { return Intrinsics::kStringCharAt; case kIntrinsicCompareTo: return Intrinsics::kStringCompareTo; - case kIntrinsicEquals: - return Intrinsics::kStringEquals; case kIntrinsicGetCharsNoCheck: return Intrinsics::kStringGetCharsNoCheck; case kIntrinsicIsEmptyOrLength: diff --git a/compiler/optimizing/intrinsics_arm.cc b/compiler/optimizing/intrinsics_arm.cc index 3f157c6e36..b4dbf75f0a 100644 --- a/compiler/optimizing/intrinsics_arm.cc +++ b/compiler/optimizing/intrinsics_arm.cc @@ -1068,7 +1068,6 @@ UNIMPLEMENTED_INTRINSIC(UnsafeCASLong) // High register pressure. UNIMPLEMENTED_INTRINSIC(SystemArrayCopyChar) UNIMPLEMENTED_INTRINSIC(ReferenceGetReferent) UNIMPLEMENTED_INTRINSIC(StringGetCharsNoCheck) -UNIMPLEMENTED_INTRINSIC(StringEquals) #undef UNIMPLEMENTED_INTRINSIC diff --git a/compiler/optimizing/intrinsics_arm64.cc b/compiler/optimizing/intrinsics_arm64.cc index aeae5764a5..78ac167a87 100644 --- a/compiler/optimizing/intrinsics_arm64.cc +++ b/compiler/optimizing/intrinsics_arm64.cc @@ -1202,7 +1202,6 @@ void IntrinsicCodeGeneratorARM64::Visit ## Name(HInvoke* invoke ATTRIBUTE_UNUSED UNIMPLEMENTED_INTRINSIC(SystemArrayCopyChar) UNIMPLEMENTED_INTRINSIC(ReferenceGetReferent) UNIMPLEMENTED_INTRINSIC(StringGetCharsNoCheck) -UNIMPLEMENTED_INTRINSIC(StringEquals) #undef UNIMPLEMENTED_INTRINSIC diff --git a/compiler/optimizing/intrinsics_list.h b/compiler/optimizing/intrinsics_list.h index 6e6f17328d..2c9248f52c 100644 --- a/compiler/optimizing/intrinsics_list.h +++ b/compiler/optimizing/intrinsics_list.h @@ -60,7 +60,6 @@ V(MemoryPokeShortNative, kStatic) \ V(StringCharAt, kDirect) \ V(StringCompareTo, kDirect) \ - V(StringEquals, kDirect) \ V(StringGetCharsNoCheck, kDirect) \ V(StringIndexOf, kDirect) \ V(StringIndexOfAfter, kDirect) \ diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc index 6399ee80bc..0d6ca09f31 100644 --- a/compiler/optimizing/intrinsics_x86.cc +++ b/compiler/optimizing/intrinsics_x86.cc @@ -945,97 +945,6 @@ void IntrinsicCodeGeneratorX86::VisitStringCompareTo(HInvoke* invoke) { __ Bind(slow_path->GetExitLabel()); } -void IntrinsicLocationsBuilderX86::VisitStringEquals(HInvoke* invoke) { - LocationSummary* locations = new (arena_) LocationSummary(invoke, - LocationSummary::kNoCall, - kIntrinsified); - locations->SetInAt(0, Location::RequiresRegister()); - locations->SetInAt(1, Location::RequiresRegister()); - - // Request temporary registers, ECX and EDI needed for repe_cmpsw instruction. - locations->AddTemp(Location::RegisterLocation(ECX)); - locations->AddTemp(Location::RegisterLocation(EDI)); - - // Set output, ESI needed for repe_cmpsw instruction anyways. - locations->SetOut(Location::RegisterLocation(ESI)); -} - -void IntrinsicCodeGeneratorX86::VisitStringEquals(HInvoke* invoke) { - X86Assembler* assembler = GetAssembler(); - LocationSummary* locations = invoke->GetLocations(); - - Register str = locations->InAt(0).AsRegister<Register>(); - Register arg = locations->InAt(1).AsRegister<Register>(); - Register ecx = locations->GetTemp(0).AsRegister<Register>(); - Register edi = locations->GetTemp(1).AsRegister<Register>(); - Register esi = locations->Out().AsRegister<Register>(); - - Label end; - Label return_true; - Label return_false; - - // Get offsets of count, value, and class fields within a string object. - const uint32_t count_offset = mirror::String::CountOffset().Uint32Value(); - const uint32_t value_offset = mirror::String::ValueOffset().Uint32Value(); - const uint32_t class_offset = mirror::Object::ClassOffset().Uint32Value(); - - // Note that the null check must have been done earlier. - DCHECK(!invoke->CanDoImplicitNullCheckOn(invoke->InputAt(0))); - - // Check if input is null, return false if it is. - __ cmpl(arg, Immediate(0)); - __ j(kEqual, &return_false); - - // Instanceof check for the argument by comparing class fields. - // All string objects must have the same type since String cannot be subclassed. - // Receiver must be a string object, so its class field is equal to all strings' class fields. - // If the argument is a string object, its class field must be equal to receiver's class field. - __ movl(ecx, Address(str, class_offset)); - __ cmpl(ecx, Address(arg, class_offset)); - __ j(kNotEqual, &return_false); - - // Reference equality check, return true if same reference. - __ cmpl(str, arg); - __ j(kEqual, &return_true); - - // Load length of receiver string. - __ movl(ecx, Address(str, count_offset)); - // Check if lengths are equal, return false if they're not. - __ cmpl(ecx, Address(arg, count_offset)); - __ j(kNotEqual, &return_false); - // Return true if both strings are empty. - __ cmpl(ecx, Immediate(0)); - __ j(kEqual, &return_true); - - // Load starting addresses of string values into ESI/EDI as required for repe_cmpsw instruction. - __ leal(esi, Address(str, value_offset)); - __ leal(edi, Address(arg, value_offset)); - - // Divide string length by 2 to compare characters 2 at a time and adjust for odd lengths. - __ addl(ecx, Immediate(1)); - __ shrl(ecx, Immediate(1)); - - // Assertions that must hold in order to compare strings 2 characters at a time. - DCHECK_ALIGNED(value_offset, 4); - static_assert(IsAligned<4>(kObjectAlignment), "String of odd length is not zero padded"); - - // Loop to compare strings two characters at a time starting at the beginning of the string. - __ repe_cmpsl(); - // If strings are not equal, zero flag will be cleared. - __ j(kNotEqual, &return_false); - - // Return true and exit the function. - // If loop does not result in returning false, we return true. - __ Bind(&return_true); - __ movl(esi, Immediate(1)); - __ jmp(&end); - - // Return false and exit the function. - __ Bind(&return_false); - __ movl(esi, Immediate(0)); - __ Bind(&end); -} - static void CreateStringIndexOfLocations(HInvoke* invoke, ArenaAllocator* allocator, bool start_at_zero) { diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc index 6e737d6d3c..ea342e9382 100644 --- a/compiler/optimizing/intrinsics_x86_64.cc +++ b/compiler/optimizing/intrinsics_x86_64.cc @@ -1615,7 +1615,6 @@ void IntrinsicCodeGeneratorX86_64::Visit ## Name(HInvoke* invoke ATTRIBUTE_UNUSE UNIMPLEMENTED_INTRINSIC(StringGetCharsNoCheck) UNIMPLEMENTED_INTRINSIC(SystemArrayCopyChar) UNIMPLEMENTED_INTRINSIC(ReferenceGetReferent) -UNIMPLEMENTED_INTRINSIC(StringEquals) #undef UNIMPLEMENTED_INTRINSIC |