Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3179 | 3179 |
| 3180 int remain = field_count % (DwVfpRegister::kSizeInBytes / kPointerSize); | 3180 int remain = field_count % (DwVfpRegister::kSizeInBytes / kPointerSize); |
| 3181 if (remain != 0) { | 3181 if (remain != 0) { |
| 3182 vldr(double_scratch.low(), | 3182 vldr(double_scratch.low(), |
| 3183 FieldMemOperand(src, (field_count - 1) * kPointerSize)); | 3183 FieldMemOperand(src, (field_count - 1) * kPointerSize)); |
| 3184 vstr(double_scratch.low(), | 3184 vstr(double_scratch.low(), |
| 3185 FieldMemOperand(dst, (field_count - 1) * kPointerSize)); | 3185 FieldMemOperand(dst, (field_count - 1) * kPointerSize)); |
| 3186 } | 3186 } |
| 3187 } | 3187 } |
| 3188 | 3188 |
| 3189 | |
| 3190 void MacroAssembler::CopyBytes(Register src, | 3189 void MacroAssembler::CopyBytes(Register src, |
| 3191 Register dst, | 3190 Register dst, |
| 3192 Register length, | 3191 Register length, |
| 3193 Register scratch) { | 3192 Register scratch) { |
| 3194 Label align_loop, align_loop_1, word_loop, byte_loop, byte_loop_1, done; | 3193 Label word_loop, byte_loop, byte_loop_1, done; |
| 3194 | |
| 3195 ASSERT(!AreAliased(src, dst, length, scratch)); | |
| 3196 | |
| 3197 cmp(length, Operand(8)); | |
| 3198 add(length, src, Operand(length)); | |
| 3199 b(lt, &byte_loop); | |
| 3200 sub(ip, length, Operand(4)); | |
|
Benedikt Meurer
2013/09/10 11:29:21
Hm, this use of ip doesn't sit well with me. Using
| |
| 3195 | 3201 |
| 3196 // Align src before copying in word size chunks. | 3202 // Align src before copying in word size chunks. |
| 3197 bind(&align_loop); | |
| 3198 cmp(length, Operand::Zero()); | |
| 3199 b(eq, &done); | |
| 3200 bind(&align_loop_1); | |
| 3201 tst(src, Operand(kPointerSize - 1)); | 3203 tst(src, Operand(kPointerSize - 1)); |
| 3202 b(eq, &word_loop); | 3204 b(eq, &word_loop); |
| 3203 ldrb(scratch, MemOperand(src, 1, PostIndex)); | 3205 ldrb(scratch, MemOperand(src, 1, PostIndex)); |
| 3206 tst(src, Operand(kPointerSize - 1)); | |
| 3204 strb(scratch, MemOperand(dst, 1, PostIndex)); | 3207 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 3205 sub(length, length, Operand(1), SetCC); | 3208 b(eq, &word_loop); |
| 3206 b(ne, &byte_loop_1); | 3209 ldrb(scratch, MemOperand(src, 1, PostIndex)); |
| 3210 tst(src, Operand(kPointerSize - 1)); | |
| 3211 strb(scratch, MemOperand(dst, 1, PostIndex)); | |
| 3212 b(eq, &word_loop); | |
| 3213 ldrb(scratch, MemOperand(src, 1, PostIndex)); | |
| 3214 strb(scratch, MemOperand(dst, 1, PostIndex)); | |
| 3207 | 3215 |
| 3208 // Copy bytes in word size chunks. | 3216 // Copy bytes in word size chunks. |
| 3209 bind(&word_loop); | 3217 bind(&word_loop); |
| 3210 if (emit_debug_code()) { | 3218 if (emit_debug_code()) { |
| 3211 tst(src, Operand(kPointerSize - 1)); | 3219 tst(src, Operand(kPointerSize - 1)); |
| 3212 Assert(eq, kExpectingAlignmentForCopyBytes); | 3220 Assert(eq, kExpectingAlignmentForCopyBytes); |
| 3213 } | 3221 } |
| 3214 cmp(length, Operand(kPointerSize)); | |
| 3215 b(lt, &byte_loop); | |
| 3216 ldr(scratch, MemOperand(src, kPointerSize, PostIndex)); | |
| 3217 if (CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) { | 3222 if (CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) { |
| 3223 ldr(scratch, MemOperand(src, kPointerSize, PostIndex)); | |
| 3224 cmp(src, Operand(ip)); | |
| 3218 str(scratch, MemOperand(dst, kPointerSize, PostIndex)); | 3225 str(scratch, MemOperand(dst, kPointerSize, PostIndex)); |
| 3226 b(le, &word_loop); | |
| 3227 sub(ip, length, Operand(src)); | |
| 3228 mov(ip, Operand(ip, LSL, 31), SetCC); | |
| 3229 ldrh(scratch, MemOperand(src, 2, PostIndex), cs); | |
| 3230 strh(scratch, MemOperand(dst, 2, PostIndex), cs); | |
| 3231 ldrb(scratch, MemOperand(src, 1, PostIndex), ne); | |
| 3232 strb(scratch, MemOperand(dst, 1, PostIndex), ne); | |
| 3233 b(&done); | |
| 3219 } else { | 3234 } else { |
| 3235 ldr(scratch, MemOperand(src, kPointerSize, PostIndex)); | |
| 3236 cmp(src, Operand(ip)); | |
| 3220 strb(scratch, MemOperand(dst, 1, PostIndex)); | 3237 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 3221 mov(scratch, Operand(scratch, LSR, 8)); | 3238 mov(scratch, Operand(scratch, LSR, 8)); |
| 3222 strb(scratch, MemOperand(dst, 1, PostIndex)); | 3239 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 3223 mov(scratch, Operand(scratch, LSR, 8)); | 3240 mov(scratch, Operand(scratch, LSR, 8)); |
| 3224 strb(scratch, MemOperand(dst, 1, PostIndex)); | 3241 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 3225 mov(scratch, Operand(scratch, LSR, 8)); | 3242 mov(scratch, Operand(scratch, LSR, 8)); |
| 3226 strb(scratch, MemOperand(dst, 1, PostIndex)); | 3243 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 3244 b(lt, &word_loop); | |
|
ulan
2013/09/13 09:26:27
Any reason why this is not "b(le, &word_loop)"? I
| |
| 3227 } | 3245 } |
| 3228 sub(length, length, Operand(kPointerSize)); | |
| 3229 b(&word_loop); | |
| 3230 | 3246 |
| 3231 // Copy the last bytes if any left. | 3247 // Copy the last bytes if any left. |
| 3232 bind(&byte_loop); | 3248 bind(&byte_loop); |
| 3233 cmp(length, Operand::Zero()); | 3249 cmp(src, Operand(length)); |
| 3234 b(eq, &done); | 3250 b(eq, &done); |
| 3235 bind(&byte_loop_1); | 3251 bind(&byte_loop_1); |
| 3236 ldrb(scratch, MemOperand(src, 1, PostIndex)); | 3252 ldrb(scratch, MemOperand(src, 1, PostIndex)); |
| 3253 cmp(src, Operand(length)); | |
| 3237 strb(scratch, MemOperand(dst, 1, PostIndex)); | 3254 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 3238 sub(length, length, Operand(1), SetCC); | 3255 b(lt, &byte_loop_1); |
| 3239 b(ne, &byte_loop_1); | |
| 3240 bind(&done); | 3256 bind(&done); |
| 3241 } | 3257 } |
| 3242 | 3258 |
| 3243 | |
| 3244 void MacroAssembler::InitializeFieldsWithFiller(Register start_offset, | 3259 void MacroAssembler::InitializeFieldsWithFiller(Register start_offset, |
| 3245 Register end_offset, | 3260 Register end_offset, |
| 3246 Register filler) { | 3261 Register filler) { |
| 3247 Label loop, entry; | 3262 Label loop, entry; |
| 3248 b(&entry); | 3263 b(&entry); |
| 3249 bind(&loop); | 3264 bind(&loop); |
| 3250 str(filler, MemOperand(start_offset, kPointerSize, PostIndex)); | 3265 str(filler, MemOperand(start_offset, kPointerSize, PostIndex)); |
| 3251 bind(&entry); | 3266 bind(&entry); |
| 3252 cmp(start_offset, end_offset); | 3267 cmp(start_offset, end_offset); |
| 3253 b(lt, &loop); | 3268 b(lt, &loop); |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3879 void CodePatcher::EmitCondition(Condition cond) { | 3894 void CodePatcher::EmitCondition(Condition cond) { |
| 3880 Instr instr = Assembler::instr_at(masm_.pc_); | 3895 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3881 instr = (instr & ~kCondMask) | cond; | 3896 instr = (instr & ~kCondMask) | cond; |
| 3882 masm_.emit(instr); | 3897 masm_.emit(instr); |
| 3883 } | 3898 } |
| 3884 | 3899 |
| 3885 | 3900 |
| 3886 } } // namespace v8::internal | 3901 } } // namespace v8::internal |
| 3887 | 3902 |
| 3888 #endif // V8_TARGET_ARCH_ARM | 3903 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |