Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 24266007: MIPS: Fixed a bug in CopyBytes() and new test cases for MIPS macro assembler. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: fix comments. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/cctest.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 lw(tmp, FieldMemOperand(src, i * kPointerSize)); 3213 lw(tmp, FieldMemOperand(src, i * kPointerSize));
3214 sw(tmp, FieldMemOperand(dst, i * kPointerSize)); 3214 sw(tmp, FieldMemOperand(dst, i * kPointerSize));
3215 } 3215 }
3216 } 3216 }
3217 3217
3218 3218
3219 void MacroAssembler::CopyBytes(Register src, 3219 void MacroAssembler::CopyBytes(Register src,
3220 Register dst, 3220 Register dst,
3221 Register length, 3221 Register length,
3222 Register scratch) { 3222 Register scratch) {
3223 Label align_loop, align_loop_1, word_loop, byte_loop, byte_loop_1, done; 3223 Label align_loop_1, word_loop, byte_loop, byte_loop_1, done;
3224 3224
3225 // Align src before copying in word size chunks. 3225 // Align src before copying in word size chunks.
3226 bind(&align_loop); 3226 Branch(&byte_loop, le, length, Operand(kPointerSize));
3227 Branch(&done, eq, length, Operand(zero_reg));
3228 bind(&align_loop_1); 3227 bind(&align_loop_1);
3229 And(scratch, src, kPointerSize - 1); 3228 And(scratch, src, kPointerSize - 1);
3230 Branch(&word_loop, eq, scratch, Operand(zero_reg)); 3229 Branch(&word_loop, eq, scratch, Operand(zero_reg));
3231 lbu(scratch, MemOperand(src)); 3230 lbu(scratch, MemOperand(src));
3232 Addu(src, src, 1); 3231 Addu(src, src, 1);
3233 sb(scratch, MemOperand(dst)); 3232 sb(scratch, MemOperand(dst));
3234 Addu(dst, dst, 1); 3233 Addu(dst, dst, 1);
3235 Subu(length, length, Operand(1)); 3234 Subu(length, length, Operand(1));
3236 Branch(&byte_loop_1, ne, length, Operand(zero_reg)); 3235 Branch(&align_loop_1, ne, length, Operand(zero_reg));
3237 3236
3238 // Copy bytes in word size chunks. 3237 // Copy bytes in word size chunks.
3239 bind(&word_loop); 3238 bind(&word_loop);
3240 if (emit_debug_code()) { 3239 if (emit_debug_code()) {
3241 And(scratch, src, kPointerSize - 1); 3240 And(scratch, src, kPointerSize - 1);
3242 Assert(eq, kExpectingAlignmentForCopyBytes, 3241 Assert(eq, kExpectingAlignmentForCopyBytes,
3243 scratch, Operand(zero_reg)); 3242 scratch, Operand(zero_reg));
3244 } 3243 }
3245 Branch(&byte_loop, lt, length, Operand(kPointerSize)); 3244 Branch(&byte_loop, lt, length, Operand(kPointerSize));
3246 lw(scratch, MemOperand(src)); 3245 lw(scratch, MemOperand(src));
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
5692 opcode == BGTZL); 5691 opcode == BGTZL);
5693 opcode = (cond == eq) ? BEQ : BNE; 5692 opcode = (cond == eq) ? BEQ : BNE;
5694 instr = (instr & ~kOpcodeMask) | opcode; 5693 instr = (instr & ~kOpcodeMask) | opcode;
5695 masm_.emit(instr); 5694 masm_.emit(instr);
5696 } 5695 }
5697 5696
5698 5697
5699 } } // namespace v8::internal 5698 } } // namespace v8::internal
5700 5699
5701 #endif // V8_TARGET_ARCH_MIPS 5700 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698