| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 7600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7611 // Smi-tagging is equivalent to multiplying by 2. | 7611 // Smi-tagging is equivalent to multiplying by 2. |
| 7612 STATIC_ASSERT(kSmiTag == 0); | 7612 STATIC_ASSERT(kSmiTag == 0); |
| 7613 STATIC_ASSERT(kSmiTagSize == 1); | 7613 STATIC_ASSERT(kSmiTagSize == 1); |
| 7614 | 7614 |
| 7615 // Check that both indices are smis. | 7615 // Check that both indices are smis. |
| 7616 __ mov(tmp2.reg(), index1.reg()); | 7616 __ mov(tmp2.reg(), index1.reg()); |
| 7617 __ or_(tmp2.reg(), Operand(index2.reg())); | 7617 __ or_(tmp2.reg(), Operand(index2.reg())); |
| 7618 __ test(tmp2.reg(), Immediate(kSmiTagMask)); | 7618 __ test(tmp2.reg(), Immediate(kSmiTagMask)); |
| 7619 deferred->Branch(not_zero); | 7619 deferred->Branch(not_zero); |
| 7620 | 7620 |
| 7621 // Check that both indices are valid. |
| 7622 __ mov(tmp2.reg(), FieldOperand(object.reg(), JSArray::kLengthOffset)); |
| 7623 __ cmp(tmp2.reg(), Operand(index1.reg())); |
| 7624 deferred->Branch(below_equal); |
| 7625 __ cmp(tmp2.reg(), Operand(index2.reg())); |
| 7626 deferred->Branch(below_equal); |
| 7627 |
| 7621 // Bring addresses into index1 and index2. | 7628 // Bring addresses into index1 and index2. |
| 7622 __ lea(index1.reg(), FixedArrayElementOperand(tmp1.reg(), index1.reg())); | 7629 __ lea(index1.reg(), FixedArrayElementOperand(tmp1.reg(), index1.reg())); |
| 7623 __ lea(index2.reg(), FixedArrayElementOperand(tmp1.reg(), index2.reg())); | 7630 __ lea(index2.reg(), FixedArrayElementOperand(tmp1.reg(), index2.reg())); |
| 7624 | 7631 |
| 7625 // Swap elements. | 7632 // Swap elements. |
| 7626 __ mov(object.reg(), Operand(index1.reg(), 0)); | 7633 __ mov(object.reg(), Operand(index1.reg(), 0)); |
| 7627 __ mov(tmp2.reg(), Operand(index2.reg(), 0)); | 7634 __ mov(tmp2.reg(), Operand(index2.reg(), 0)); |
| 7628 __ mov(Operand(index2.reg(), 0), object.reg()); | 7635 __ mov(Operand(index2.reg(), 0), object.reg()); |
| 7629 __ mov(Operand(index1.reg(), 0), tmp2.reg()); | 7636 __ mov(Operand(index1.reg(), 0), tmp2.reg()); |
| 7630 | 7637 |
| (...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10139 masm.GetCode(&desc); | 10146 masm.GetCode(&desc); |
| 10140 // Call the function from C++. | 10147 // Call the function from C++. |
| 10141 return FUNCTION_CAST<MemCopyFunction>(buffer); | 10148 return FUNCTION_CAST<MemCopyFunction>(buffer); |
| 10142 } | 10149 } |
| 10143 | 10150 |
| 10144 #undef __ | 10151 #undef __ |
| 10145 | 10152 |
| 10146 } } // namespace v8::internal | 10153 } } // namespace v8::internal |
| 10147 | 10154 |
| 10148 #endif // V8_TARGET_ARCH_IA32 | 10155 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |