OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 __ Branch(&too_few, Uless, a0, Operand(a2)); | 1751 __ Branch(&too_few, Uless, a0, Operand(a2)); |
1752 | 1752 |
1753 { // Enough parameters: actual >= expected. | 1753 { // Enough parameters: actual >= expected. |
1754 // a0: actual number of arguments as a smi | 1754 // a0: actual number of arguments as a smi |
1755 // a1: function | 1755 // a1: function |
1756 // a2: expected number of arguments | 1756 // a2: expected number of arguments |
1757 // a3: code entry to call | 1757 // a3: code entry to call |
1758 __ bind(&enough); | 1758 __ bind(&enough); |
1759 EnterArgumentsAdaptorFrame(masm); | 1759 EnterArgumentsAdaptorFrame(masm); |
1760 | 1760 |
1761 // Calculate copy start address into a0 and copy end address into a2. | 1761 // Calculate copy start address into a0 and copy end address into t1. |
1762 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); | 1762 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); |
1763 __ Addu(a0, fp, a0); | 1763 __ Addu(a0, fp, a0); |
1764 // Adjust for return address and receiver. | 1764 // Adjust for return address and receiver. |
1765 __ Addu(a0, a0, Operand(2 * kPointerSize)); | 1765 __ Addu(a0, a0, Operand(2 * kPointerSize)); |
1766 // Compute copy end address. | 1766 // Compute copy end address. |
1767 __ sll(a2, a2, kPointerSizeLog2); | 1767 __ sll(t1, a2, kPointerSizeLog2); |
1768 __ subu(a2, a0, a2); | 1768 __ subu(t1, a0, t1); |
1769 | 1769 |
1770 // Copy the arguments (including the receiver) to the new stack frame. | 1770 // Copy the arguments (including the receiver) to the new stack frame. |
1771 // a0: copy start address | 1771 // a0: copy start address |
1772 // a1: function | 1772 // a1: function |
1773 // a2: copy end address | 1773 // a2: expected number of arguments |
1774 // a3: code entry to call | 1774 // a3: code entry to call |
| 1775 // t1: copy end address |
1775 | 1776 |
1776 Label copy; | 1777 Label copy; |
1777 __ bind(©); | 1778 __ bind(©); |
1778 __ lw(t0, MemOperand(a0)); | 1779 __ lw(t0, MemOperand(a0)); |
1779 __ push(t0); | 1780 __ push(t0); |
1780 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a2)); | 1781 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(t1)); |
1781 __ addiu(a0, a0, -kPointerSize); // In delay slot. | 1782 __ addiu(a0, a0, -kPointerSize); // In delay slot. |
1782 | 1783 |
1783 __ jmp(&invoke); | 1784 __ jmp(&invoke); |
1784 } | 1785 } |
1785 | 1786 |
1786 { // Too few parameters: Actual < expected. | 1787 { // Too few parameters: Actual < expected. |
1787 __ bind(&too_few); | 1788 __ bind(&too_few); |
1788 | 1789 |
1789 // If the function is strong we need to throw an error. | 1790 // If the function is strong we need to throw an error. |
1790 Label no_strong_error; | 1791 Label no_strong_error; |
(...skipping 10 matching lines...) Expand all Loading... |
1801 | 1802 |
1802 { | 1803 { |
1803 FrameScope frame(masm, StackFrame::MANUAL); | 1804 FrameScope frame(masm, StackFrame::MANUAL); |
1804 EnterArgumentsAdaptorFrame(masm); | 1805 EnterArgumentsAdaptorFrame(masm); |
1805 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); | 1806 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); |
1806 } | 1807 } |
1807 | 1808 |
1808 __ bind(&no_strong_error); | 1809 __ bind(&no_strong_error); |
1809 EnterArgumentsAdaptorFrame(masm); | 1810 EnterArgumentsAdaptorFrame(masm); |
1810 | 1811 |
1811 // Calculate copy start address into a0 and copy end address is fp. | 1812 // Calculate copy start address into a0 and copy end address into t3. |
1812 // a0: actual number of arguments as a smi | 1813 // a0: actual number of arguments as a smi |
1813 // a1: function | 1814 // a1: function |
1814 // a2: expected number of arguments | 1815 // a2: expected number of arguments |
1815 // a3: code entry to call | 1816 // a3: code entry to call |
1816 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); | 1817 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); |
1817 __ Addu(a0, fp, a0); | 1818 __ Addu(a0, fp, a0); |
1818 // Adjust for return address and receiver. | 1819 // Adjust for return address and receiver. |
1819 __ Addu(a0, a0, Operand(2 * kPointerSize)); | 1820 __ Addu(a0, a0, Operand(2 * kPointerSize)); |
1820 // Compute copy end address. Also adjust for return address. | 1821 // Compute copy end address. Also adjust for return address. |
1821 __ Addu(t3, fp, kPointerSize); | 1822 __ Addu(t3, fp, kPointerSize); |
(...skipping 11 matching lines...) Expand all Loading... |
1833 __ Subu(a0, a0, kPointerSize); | 1834 __ Subu(a0, a0, kPointerSize); |
1834 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(t3)); | 1835 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(t3)); |
1835 __ sw(t0, MemOperand(sp)); // In the delay slot. | 1836 __ sw(t0, MemOperand(sp)); // In the delay slot. |
1836 | 1837 |
1837 // Fill the remaining expected arguments with undefined. | 1838 // Fill the remaining expected arguments with undefined. |
1838 // a1: function | 1839 // a1: function |
1839 // a2: expected number of arguments | 1840 // a2: expected number of arguments |
1840 // a3: code entry to call | 1841 // a3: code entry to call |
1841 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); | 1842 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); |
1842 __ sll(t2, a2, kPointerSizeLog2); | 1843 __ sll(t2, a2, kPointerSizeLog2); |
1843 __ Subu(a2, fp, Operand(t2)); | 1844 __ Subu(t1, fp, Operand(t2)); |
1844 // Adjust for frame. | 1845 // Adjust for frame. |
1845 __ Subu(a2, a2, Operand(StandardFrameConstants::kFixedFrameSizeFromFp + | 1846 __ Subu(t1, t1, Operand(StandardFrameConstants::kFixedFrameSizeFromFp + |
1846 2 * kPointerSize)); | 1847 2 * kPointerSize)); |
1847 | 1848 |
1848 Label fill; | 1849 Label fill; |
1849 __ bind(&fill); | 1850 __ bind(&fill); |
1850 __ Subu(sp, sp, kPointerSize); | 1851 __ Subu(sp, sp, kPointerSize); |
1851 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2)); | 1852 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(t1)); |
1852 __ sw(t0, MemOperand(sp)); | 1853 __ sw(t0, MemOperand(sp)); |
1853 } | 1854 } |
1854 | 1855 |
1855 // Call the entry point. | 1856 // Call the entry point. |
1856 __ bind(&invoke); | 1857 __ bind(&invoke); |
1857 | 1858 __ mov(a0, a2); |
| 1859 // a0 : expected number of arguments |
| 1860 // a1 : function (passed through to callee) |
1858 __ Call(a3); | 1861 __ Call(a3); |
1859 | 1862 |
1860 // Store offset of return address for deoptimizer. | 1863 // Store offset of return address for deoptimizer. |
1861 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); | 1864 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); |
1862 | 1865 |
1863 // Exit frame and return. | 1866 // Exit frame and return. |
1864 LeaveArgumentsAdaptorFrame(masm); | 1867 LeaveArgumentsAdaptorFrame(masm); |
1865 __ Ret(); | 1868 __ Ret(); |
1866 | 1869 |
1867 | 1870 |
(...skipping 12 matching lines...) Expand all Loading... |
1880 } | 1883 } |
1881 } | 1884 } |
1882 | 1885 |
1883 | 1886 |
1884 #undef __ | 1887 #undef __ |
1885 | 1888 |
1886 } // namespace internal | 1889 } // namespace internal |
1887 } // namespace v8 | 1890 } // namespace v8 |
1888 | 1891 |
1889 #endif // V8_TARGET_ARCH_MIPS | 1892 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |