OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 } | 2382 } |
2383 ASSERT(!tmp.is(no_reg)); | 2383 ASSERT(!tmp.is(no_reg)); |
2384 | 2384 |
2385 for (int i = 0; i < field_count; i++) { | 2385 for (int i = 0; i < field_count; i++) { |
2386 ldr(tmp, FieldMemOperand(src, i * kPointerSize)); | 2386 ldr(tmp, FieldMemOperand(src, i * kPointerSize)); |
2387 str(tmp, FieldMemOperand(dst, i * kPointerSize)); | 2387 str(tmp, FieldMemOperand(dst, i * kPointerSize)); |
2388 } | 2388 } |
2389 } | 2389 } |
2390 | 2390 |
2391 | 2391 |
| 2392 void MacroAssembler::CopyBytes(Register src, |
| 2393 Register dst, |
| 2394 Register length, |
| 2395 Register scratch) { |
| 2396 Label align_loop, align_loop_1, word_loop, byte_loop, byte_loop_1, done; |
| 2397 |
| 2398 // Align src before copying in word size chunks. |
| 2399 bind(&align_loop); |
| 2400 cmp(length, Operand(0)); |
| 2401 b(eq, &done); |
| 2402 bind(&align_loop_1); |
| 2403 tst(src, Operand(kPointerSize - 1)); |
| 2404 b(eq, &word_loop); |
| 2405 ldrb(scratch, MemOperand(src, 1, PostIndex)); |
| 2406 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 2407 sub(length, length, Operand(1), SetCC); |
| 2408 b(ne, &byte_loop_1); |
| 2409 |
| 2410 // Copy bytes in word size chunks. |
| 2411 bind(&word_loop); |
| 2412 if (FLAG_debug_code) { |
| 2413 tst(src, Operand(kPointerSize - 1)); |
| 2414 Assert(eq, "Expecting alignment for CopyBytes"); |
| 2415 } |
| 2416 cmp(length, Operand(kPointerSize)); |
| 2417 b(lt, &byte_loop); |
| 2418 ldr(scratch, MemOperand(src, kPointerSize, PostIndex)); |
| 2419 #if CAN_USE_UNALIGNED_ACCESSES |
| 2420 str(scratch, MemOperand(dst, kPointerSize, PostIndex)); |
| 2421 #else |
| 2422 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 2423 mov(scratch, Operand(scratch, LSR, 8)); |
| 2424 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 2425 mov(scratch, Operand(scratch, LSR, 8)); |
| 2426 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 2427 mov(scratch, Operand(scratch, LSR, 8)); |
| 2428 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 2429 #endif |
| 2430 sub(length, length, Operand(kPointerSize)); |
| 2431 b(&word_loop); |
| 2432 |
| 2433 // Copy the last bytes if any left. |
| 2434 bind(&byte_loop); |
| 2435 cmp(length, Operand(0)); |
| 2436 b(eq, &done); |
| 2437 bind(&byte_loop_1); |
| 2438 ldrb(scratch, MemOperand(src, 1, PostIndex)); |
| 2439 strb(scratch, MemOperand(dst, 1, PostIndex)); |
| 2440 sub(length, length, Operand(1), SetCC); |
| 2441 b(ne, &byte_loop_1); |
| 2442 bind(&done); |
| 2443 } |
| 2444 |
| 2445 |
2392 void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. | 2446 void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. |
2393 Register source, // Input. | 2447 Register source, // Input. |
2394 Register scratch) { | 2448 Register scratch) { |
2395 ASSERT(!zeros.is(source) || !source.is(scratch)); | 2449 ASSERT(!zeros.is(source) || !source.is(scratch)); |
2396 ASSERT(!zeros.is(scratch)); | 2450 ASSERT(!zeros.is(scratch)); |
2397 ASSERT(!scratch.is(ip)); | 2451 ASSERT(!scratch.is(ip)); |
2398 ASSERT(!source.is(ip)); | 2452 ASSERT(!source.is(ip)); |
2399 ASSERT(!zeros.is(ip)); | 2453 ASSERT(!zeros.is(ip)); |
2400 #ifdef CAN_USE_ARMV5_INSTRUCTIONS | 2454 #ifdef CAN_USE_ARMV5_INSTRUCTIONS |
2401 clz(zeros, source); // This instruction is only supported after ARM5. | 2455 clz(zeros, source); // This instruction is only supported after ARM5. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 void CodePatcher::EmitCondition(Condition cond) { | 2623 void CodePatcher::EmitCondition(Condition cond) { |
2570 Instr instr = Assembler::instr_at(masm_.pc_); | 2624 Instr instr = Assembler::instr_at(masm_.pc_); |
2571 instr = (instr & ~kCondMask) | cond; | 2625 instr = (instr & ~kCondMask) | cond; |
2572 masm_.emit(instr); | 2626 masm_.emit(instr); |
2573 } | 2627 } |
2574 | 2628 |
2575 | 2629 |
2576 } } // namespace v8::internal | 2630 } } // namespace v8::internal |
2577 | 2631 |
2578 #endif // V8_TARGET_ARCH_ARM | 2632 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |