diff options
author | Jeff Hao <jeffhao@google.com> | 2015-04-28 02:04:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-28 02:04:09 +0000 |
commit | 9d1e19035a59ff8bf05a09ad880ede99806ba73f (patch) | |
tree | 7eb3c9eb01d4f581f3e354d947300547582fdd38 /compiler/dex/quick/x86/target_x86.cc | |
parent | 3fd79afbb7490f52817f737ecceb694f6618dcf9 (diff) | |
parent | 848f70a3d73833fc1bf3032a9ff6812e429661d9 (diff) | |
download | art-9d1e19035a59ff8bf05a09ad880ede99806ba73f.zip art-9d1e19035a59ff8bf05a09ad880ede99806ba73f.tar.gz art-9d1e19035a59ff8bf05a09ad880ede99806ba73f.tar.bz2 |
Merge "Replace String CharArray with internal uint16_t array."
Diffstat (limited to 'compiler/dex/quick/x86/target_x86.cc')
-rwxr-xr-x | compiler/dex/quick/x86/target_x86.cc | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/compiler/dex/quick/x86/target_x86.cc b/compiler/dex/quick/x86/target_x86.cc index b460379..2f211da 100755 --- a/compiler/dex/quick/x86/target_x86.cc +++ b/compiler/dex/quick/x86/target_x86.cc @@ -1302,10 +1302,6 @@ bool X86Mir2Lir::GenInlinedIndexOf(CallInfo* info, bool zero_based) { int value_offset = mirror::String::ValueOffset().Int32Value(); // Location of count within the String object. int count_offset = mirror::String::CountOffset().Int32Value(); - // Starting offset within data array. - int offset_offset = mirror::String::OffsetOffset().Int32Value(); - // Start of char data with array_. - int data_offset = mirror::Array::DataOffset(sizeof(uint16_t)).Int32Value(); // Compute the number of words to search in to rCX. Load32Disp(rs_rDX, count_offset, rs_rCX); @@ -1388,15 +1384,13 @@ bool X86Mir2Lir::GenInlinedIndexOf(CallInfo* info, bool zero_based) { // Load the address of the string into EDI. // In case of start index we have to add the address to existing value in EDI. - // The string starts at VALUE(String) + 2 * OFFSET(String) + DATA_OFFSET. if (zero_based || (!zero_based && rl_start.is_const && start_value == 0)) { - Load32Disp(rs_rDX, offset_offset, rs_rDI); + OpRegRegImm(kOpAdd, rs_rDI, rs_rDX, value_offset); } else { - OpRegMem(kOpAdd, rs_rDI, rs_rDX, offset_offset); + OpRegImm(kOpLsl, rs_rDI, 1); + OpRegReg(kOpAdd, rs_rDI, rs_rDX); + OpRegImm(kOpAdd, rs_rDI, value_offset); } - OpRegImm(kOpLsl, rs_rDI, 1); - OpRegMem(kOpAdd, rs_rDI, rs_rDX, value_offset); - OpRegImm(kOpAdd, rs_rDI, data_offset); // EDI now contains the start of the string to be searched. // We are all prepared to do the search for the character. @@ -2423,24 +2417,15 @@ bool X86Mir2Lir::GenInlinedCharAt(CallInfo* info) { int value_offset = mirror::String::ValueOffset().Int32Value(); // Location of count int count_offset = mirror::String::CountOffset().Int32Value(); - // Starting offset within data array - int offset_offset = mirror::String::OffsetOffset().Int32Value(); - // Start of char data with array_ - int data_offset = mirror::Array::DataOffset(sizeof(uint16_t)).Int32Value(); RegLocation rl_obj = info->args[0]; RegLocation rl_idx = info->args[1]; rl_obj = LoadValue(rl_obj, kRefReg); - // X86 wants to avoid putting a constant index into a register. - if (!rl_idx.is_const) { - rl_idx = LoadValue(rl_idx, kCoreReg); - } + rl_idx = LoadValue(rl_idx, kCoreReg); RegStorage reg_max; GenNullCheck(rl_obj.reg, info->opt_flags); bool range_check = (!(info->opt_flags & MIR_IGNORE_RANGE_CHECK)); LIR* range_check_branch = nullptr; - RegStorage reg_off; - RegStorage reg_ptr; if (range_check) { // On x86, we can compare to memory directly // Set up a launch pad to allow retry in case of bounds violation */ @@ -2456,24 +2441,11 @@ bool X86Mir2Lir::GenInlinedCharAt(CallInfo* info) { range_check_branch = OpCondBranch(kCondUge, nullptr); } } - reg_off = AllocTemp(); - reg_ptr = AllocTempRef(); - Load32Disp(rl_obj.reg, offset_offset, reg_off); - LoadRefDisp(rl_obj.reg, value_offset, reg_ptr, kNotVolatile); - if (rl_idx.is_const) { - OpRegImm(kOpAdd, reg_off, mir_graph_->ConstantValue(rl_idx.orig_sreg)); - } else { - OpRegReg(kOpAdd, reg_off, rl_idx.reg); - } - FreeTemp(rl_obj.reg); - if (rl_idx.location == kLocPhysReg) { - FreeTemp(rl_idx.reg); - } RegLocation rl_dest = InlineTarget(info); RegLocation rl_result = EvalLoc(rl_dest, kCoreReg, true); - LoadBaseIndexedDisp(reg_ptr, reg_off, 1, data_offset, rl_result.reg, kUnsignedHalf); - FreeTemp(reg_off); - FreeTemp(reg_ptr); + LoadBaseIndexedDisp(rl_obj.reg, rl_idx.reg, 1, value_offset, rl_result.reg, kUnsignedHalf); + FreeTemp(rl_idx.reg); + FreeTemp(rl_obj.reg); StoreValue(rl_dest, rl_result); if (range_check) { DCHECK(range_check_branch != nullptr); |