| 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 7658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7669 // Smi-tagging is equivalent to multiplying by 2. | 7669 // Smi-tagging is equivalent to multiplying by 2. |
| 7670 STATIC_ASSERT(kSmiTag == 0); | 7670 STATIC_ASSERT(kSmiTag == 0); |
| 7671 STATIC_ASSERT(kSmiTagSize == 1); | 7671 STATIC_ASSERT(kSmiTagSize == 1); |
| 7672 | 7672 |
| 7673 // Check that both indices are smis. | 7673 // Check that both indices are smis. |
| 7674 __ mov(tmp2.reg(), index1.reg()); | 7674 __ mov(tmp2.reg(), index1.reg()); |
| 7675 __ or_(tmp2.reg(), Operand(index2.reg())); | 7675 __ or_(tmp2.reg(), Operand(index2.reg())); |
| 7676 __ test(tmp2.reg(), Immediate(kSmiTagMask)); | 7676 __ test(tmp2.reg(), Immediate(kSmiTagMask)); |
| 7677 deferred->Branch(not_zero); | 7677 deferred->Branch(not_zero); |
| 7678 | 7678 |
| 7679 // Check that both indices are valid. |
| 7680 __ mov(tmp2.reg(), FieldOperand(object.reg(), JSArray::kLengthOffset)); |
| 7681 __ cmp(tmp2.reg(), Operand(index1.reg())); |
| 7682 deferred->Branch(less_equal); |
| 7683 __ cmp(tmp2.reg(), Operand(index2.reg())); |
| 7684 deferred->Branch(less_equal); |
| 7685 |
| 7679 // Bring addresses into index1 and index2. | 7686 // Bring addresses into index1 and index2. |
| 7680 __ lea(index1.reg(), FixedArrayElementOperand(tmp1.reg(), index1.reg())); | 7687 __ lea(index1.reg(), FixedArrayElementOperand(tmp1.reg(), index1.reg())); |
| 7681 __ lea(index2.reg(), FixedArrayElementOperand(tmp1.reg(), index2.reg())); | 7688 __ lea(index2.reg(), FixedArrayElementOperand(tmp1.reg(), index2.reg())); |
| 7682 | 7689 |
| 7683 // Swap elements. | 7690 // Swap elements. |
| 7684 __ mov(object.reg(), Operand(index1.reg(), 0)); | 7691 __ mov(object.reg(), Operand(index1.reg(), 0)); |
| 7685 __ mov(tmp2.reg(), Operand(index2.reg(), 0)); | 7692 __ mov(tmp2.reg(), Operand(index2.reg(), 0)); |
| 7686 __ mov(Operand(index2.reg(), 0), object.reg()); | 7693 __ mov(Operand(index2.reg(), 0), object.reg()); |
| 7687 __ mov(Operand(index1.reg(), 0), tmp2.reg()); | 7694 __ mov(Operand(index1.reg(), 0), tmp2.reg()); |
| 7688 | 7695 |
| (...skipping 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10217 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 10224 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
| 10218 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 10225 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
| 10219 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); | 10226 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); |
| 10220 } | 10227 } |
| 10221 | 10228 |
| 10222 #undef __ | 10229 #undef __ |
| 10223 | 10230 |
| 10224 } } // namespace v8::internal | 10231 } } // namespace v8::internal |
| 10225 | 10232 |
| 10226 #endif // V8_TARGET_ARCH_IA32 | 10233 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |