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 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a2)); | 1728 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a2)); |
1729 __ addiu(a0, a0, -kPointerSize); // In delay slot. | 1729 __ addiu(a0, a0, -kPointerSize); // In delay slot. |
1730 | 1730 |
1731 __ jmp(&invoke); | 1731 __ jmp(&invoke); |
1732 } | 1732 } |
1733 | 1733 |
1734 { // Too few parameters: Actual < expected. | 1734 { // Too few parameters: Actual < expected. |
1735 __ bind(&too_few); | 1735 __ bind(&too_few); |
1736 EnterArgumentsAdaptorFrame(masm); | 1736 EnterArgumentsAdaptorFrame(masm); |
1737 | 1737 |
1738 // TODO(MIPS): Optimize these loops. | |
1739 | |
1740 // Calculate copy start address into a0 and copy end address is fp. | 1738 // Calculate copy start address into a0 and copy end address is fp. |
1741 // a0: actual number of arguments as a smi | 1739 // a0: actual number of arguments as a smi |
1742 // a1: function | 1740 // a1: function |
1743 // a2: expected number of arguments | 1741 // a2: expected number of arguments |
1744 // a3: code entry to call | 1742 // a3: code entry to call |
1745 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); | 1743 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); |
1746 __ Addu(a0, fp, a0); | 1744 __ Addu(a0, fp, a0); |
1747 // Adjust for return address and receiver. | 1745 // Adjust for return address and receiver. |
1748 __ Addu(a0, a0, Operand(2 * kPointerSize)); | 1746 __ Addu(a0, a0, Operand(2 * kPointerSize)); |
1749 // Compute copy end address. Also adjust for return address. | 1747 // Compute copy end address. Also adjust for return address. |
1750 __ Addu(t3, fp, kPointerSize); | 1748 __ Addu(t3, fp, kPointerSize); |
1751 | 1749 |
1752 // Copy the arguments (including the receiver) to the new stack frame. | 1750 // Copy the arguments (including the receiver) to the new stack frame. |
1753 // a0: copy start address | 1751 // a0: copy start address |
1754 // a1: function | 1752 // a1: function |
1755 // a2: expected number of arguments | 1753 // a2: expected number of arguments |
1756 // a3: code entry to call | 1754 // a3: code entry to call |
1757 // t3: copy end address | 1755 // t3: copy end address |
1758 Label copy; | 1756 Label copy; |
1759 __ bind(©); | 1757 __ bind(©); |
1760 __ lw(t0, MemOperand(a0)); // Adjusted above for return addr and receiver. | 1758 __ lw(t0, MemOperand(a0)); // Adjusted above for return addr and receiver. |
1761 __ push(t0); | 1759 __ Subu(sp, sp, kPointerSize); |
1762 __ Subu(a0, a0, kPointerSize); | 1760 __ Subu(a0, a0, kPointerSize); |
1763 __ Branch(©, ne, a0, Operand(t3)); | 1761 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(t3)); |
| 1762 __ sw(t0, MemOperand(sp)); // In the delay slot. |
1764 | 1763 |
1765 // Fill the remaining expected arguments with undefined. | 1764 // Fill the remaining expected arguments with undefined. |
1766 // a1: function | 1765 // a1: function |
1767 // a2: expected number of arguments | 1766 // a2: expected number of arguments |
1768 // a3: code entry to call | 1767 // a3: code entry to call |
1769 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); | 1768 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); |
1770 __ sll(t2, a2, kPointerSizeLog2); | 1769 __ sll(t2, a2, kPointerSizeLog2); |
1771 __ Subu(a2, fp, Operand(t2)); | 1770 __ Subu(a2, fp, Operand(t2)); |
1772 __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame. | 1771 __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame. |
1773 | 1772 |
1774 Label fill; | 1773 Label fill; |
1775 __ bind(&fill); | 1774 __ bind(&fill); |
1776 __ push(t0); | 1775 __ Subu(sp, sp, kPointerSize); |
1777 __ Branch(&fill, ne, sp, Operand(a2)); | 1776 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2)); |
| 1777 __ sw(t0, MemOperand(sp)); |
1778 } | 1778 } |
1779 | 1779 |
1780 // Call the entry point. | 1780 // Call the entry point. |
1781 __ bind(&invoke); | 1781 __ bind(&invoke); |
1782 | 1782 |
1783 __ Call(a3); | 1783 __ Call(a3); |
1784 | 1784 |
1785 // Store offset of return address for deoptimizer. | 1785 // Store offset of return address for deoptimizer. |
1786 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); | 1786 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); |
1787 | 1787 |
1788 // Exit frame and return. | 1788 // Exit frame and return. |
1789 LeaveArgumentsAdaptorFrame(masm); | 1789 LeaveArgumentsAdaptorFrame(masm); |
1790 __ Ret(); | 1790 __ Ret(); |
1791 | 1791 |
1792 | 1792 |
1793 // ------------------------------------------- | 1793 // ------------------------------------------- |
1794 // Don't adapt arguments. | 1794 // Don't adapt arguments. |
1795 // ------------------------------------------- | 1795 // ------------------------------------------- |
1796 __ bind(&dont_adapt_arguments); | 1796 __ bind(&dont_adapt_arguments); |
1797 __ Jump(a3); | 1797 __ Jump(a3); |
1798 } | 1798 } |
1799 | 1799 |
1800 | 1800 |
1801 #undef __ | 1801 #undef __ |
1802 | 1802 |
1803 } } // namespace v8::internal | 1803 } } // namespace v8::internal |
1804 | 1804 |
1805 #endif // V8_TARGET_ARCH_MIPS | 1805 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |