diff options
| author | 2015-09-01 13:36:35 +0100 | |
|---|---|---|
| committer | 2015-09-01 15:20:30 +0100 | |
| commit | a63f0d47edbcbe13a23411851a9c6e81f9342cc2 (patch) | |
| tree | db356acc0a4c4b211518b20529c7fc864dcabde9 /compiler/optimizing | |
| parent | 46637e6ad75751fa1db283aee160342dc7e2fd0f (diff) | |
Optimizing: Improve String.equals() thumb intrinsic.
Use SUBS for updating the loop counter and setting the loop
exit condition, so that we don't need to pre-calculate the
bound but still keep the same number of instructions in the
loop.
This reduces the size of boot.oat on Nexus 5 by 8KiB (when
compiled with Optimizing which is not the default yet).
Change-Id: I87d5a128e5e67f4ad177b71c28662d1367170a10
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/intrinsics_arm.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/optimizing/intrinsics_arm.cc b/compiler/optimizing/intrinsics_arm.cc index 806fd7a8f4..48711e6aa0 100644 --- a/compiler/optimizing/intrinsics_arm.cc +++ b/compiler/optimizing/intrinsics_arm.cc @@ -989,10 +989,7 @@ void IntrinsicCodeGeneratorARM::VisitStringEquals(HInvoke* invoke) { DCHECK_ALIGNED(value_offset, 4); static_assert(IsAligned<4>(kObjectAlignment), "String of odd length is not zero padded"); - // temp cannot overflow because we cannot allocate a String object with size 4GiB or greater. - __ add(temp, temp, ShifterOperand(temp)); __ LoadImmediate(temp1, value_offset); - __ add(temp, temp, ShifterOperand(value_offset)); // Loop to compare strings 2 characters at a time starting at the front of the string. // Ok to do this because strings with an odd length are zero-padded. @@ -1002,8 +999,8 @@ void IntrinsicCodeGeneratorARM::VisitStringEquals(HInvoke* invoke) { __ cmp(out, ShifterOperand(temp2)); __ b(&return_false, NE); __ add(temp1, temp1, ShifterOperand(sizeof(uint32_t))); - __ cmp(temp1, ShifterOperand(temp)); - __ b(&loop, LO); + __ subs(temp, temp, ShifterOperand(sizeof(uint32_t) / sizeof(uint16_t))); + __ b(&loop, GT); // Return true and exit the function. // If loop does not result in returning false, we return true. |