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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 __ Branch(&too_few, Uless, a0, Operand(a2)); | 1750 __ Branch(&too_few, Uless, a0, Operand(a2)); |
1751 | 1751 |
1752 { // Enough parameters: actual >= expected. | 1752 { // Enough parameters: actual >= expected. |
1753 // a0: actual number of arguments as a smi | 1753 // a0: actual number of arguments as a smi |
1754 // a1: function | 1754 // a1: function |
1755 // a2: expected number of arguments | 1755 // a2: expected number of arguments |
1756 // a3: code entry to call | 1756 // a3: code entry to call |
1757 __ bind(&enough); | 1757 __ bind(&enough); |
1758 EnterArgumentsAdaptorFrame(masm); | 1758 EnterArgumentsAdaptorFrame(masm); |
1759 | 1759 |
1760 // Calculate copy start address into a0 and copy end address into a2. | 1760 // Calculate copy start address into a0 and copy end address into a4. |
1761 __ SmiScale(a0, a0, kPointerSizeLog2); | 1761 __ SmiScale(a0, a0, kPointerSizeLog2); |
1762 __ Daddu(a0, fp, a0); | 1762 __ Daddu(a0, fp, a0); |
1763 // Adjust for return address and receiver. | 1763 // Adjust for return address and receiver. |
1764 __ Daddu(a0, a0, Operand(2 * kPointerSize)); | 1764 __ Daddu(a0, a0, Operand(2 * kPointerSize)); |
1765 // Compute copy end address. | 1765 // Compute copy end address. |
1766 __ dsll(a2, a2, kPointerSizeLog2); | 1766 __ dsll(a4, a2, kPointerSizeLog2); |
1767 __ dsubu(a2, a0, a2); | 1767 __ dsubu(a4, a0, a4); |
1768 | 1768 |
1769 // Copy the arguments (including the receiver) to the new stack frame. | 1769 // Copy the arguments (including the receiver) to the new stack frame. |
1770 // a0: copy start address | 1770 // a0: copy start address |
1771 // a1: function | 1771 // a1: function |
1772 // a2: copy end address | 1772 // a2: expected number of arguments |
1773 // a3: code entry to call | 1773 // a3: code entry to call |
| 1774 // a4: copy end address |
1774 | 1775 |
1775 Label copy; | 1776 Label copy; |
1776 __ bind(©); | 1777 __ bind(©); |
1777 __ ld(a4, MemOperand(a0)); | 1778 __ ld(a5, MemOperand(a0)); |
1778 __ push(a4); | 1779 __ push(a5); |
1779 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a2)); | 1780 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a4)); |
1780 __ daddiu(a0, a0, -kPointerSize); // In delay slot. | 1781 __ daddiu(a0, a0, -kPointerSize); // In delay slot. |
1781 | 1782 |
1782 __ jmp(&invoke); | 1783 __ jmp(&invoke); |
1783 } | 1784 } |
1784 | 1785 |
1785 { // Too few parameters: Actual < expected. | 1786 { // Too few parameters: Actual < expected. |
1786 __ bind(&too_few); | 1787 __ bind(&too_few); |
1787 | 1788 |
1788 // If the function is strong we need to throw an error. | 1789 // If the function is strong we need to throw an error. |
1789 Label no_strong_error; | 1790 Label no_strong_error; |
(...skipping 10 matching lines...) Expand all Loading... |
1800 | 1801 |
1801 { | 1802 { |
1802 FrameScope frame(masm, StackFrame::MANUAL); | 1803 FrameScope frame(masm, StackFrame::MANUAL); |
1803 EnterArgumentsAdaptorFrame(masm); | 1804 EnterArgumentsAdaptorFrame(masm); |
1804 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); | 1805 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); |
1805 } | 1806 } |
1806 | 1807 |
1807 __ bind(&no_strong_error); | 1808 __ bind(&no_strong_error); |
1808 EnterArgumentsAdaptorFrame(masm); | 1809 EnterArgumentsAdaptorFrame(masm); |
1809 | 1810 |
1810 // Calculate copy start address into a0 and copy end address is fp. | 1811 // Calculate copy start address into a0 and copy end address into a7. |
1811 // a0: actual number of arguments as a smi | 1812 // a0: actual number of arguments as a smi |
1812 // a1: function | 1813 // a1: function |
1813 // a2: expected number of arguments | 1814 // a2: expected number of arguments |
1814 // a3: code entry to call | 1815 // a3: code entry to call |
1815 __ SmiScale(a0, a0, kPointerSizeLog2); | 1816 __ SmiScale(a0, a0, kPointerSizeLog2); |
1816 __ Daddu(a0, fp, a0); | 1817 __ Daddu(a0, fp, a0); |
1817 // Adjust for return address and receiver. | 1818 // Adjust for return address and receiver. |
1818 __ Daddu(a0, a0, Operand(2 * kPointerSize)); | 1819 __ Daddu(a0, a0, Operand(2 * kPointerSize)); |
1819 // Compute copy end address. Also adjust for return address. | 1820 // Compute copy end address. Also adjust for return address. |
1820 __ Daddu(a7, fp, kPointerSize); | 1821 __ Daddu(a7, fp, kPointerSize); |
1821 | 1822 |
1822 // Copy the arguments (including the receiver) to the new stack frame. | 1823 // Copy the arguments (including the receiver) to the new stack frame. |
1823 // a0: copy start address | 1824 // a0: copy start address |
1824 // a1: function | 1825 // a1: function |
1825 // a2: expected number of arguments | 1826 // a2: expected number of arguments |
1826 // a3: code entry to call | 1827 // a3: code entry to call |
1827 // a7: copy end address | 1828 // a7: copy end address |
1828 Label copy; | 1829 Label copy; |
1829 __ bind(©); | 1830 __ bind(©); |
1830 __ ld(a4, MemOperand(a0)); // Adjusted above for return addr and receiver. | 1831 __ ld(a4, MemOperand(a0)); // Adjusted above for return addr and receiver. |
1831 __ Dsubu(sp, sp, kPointerSize); | 1832 __ Dsubu(sp, sp, kPointerSize); |
1832 __ Dsubu(a0, a0, kPointerSize); | 1833 __ Dsubu(a0, a0, kPointerSize); |
1833 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a7)); | 1834 __ Branch(USE_DELAY_SLOT, ©, ne, a0, Operand(a7)); |
1834 __ sd(a4, MemOperand(sp)); // In the delay slot. | 1835 __ sd(a4, MemOperand(sp)); // In the delay slot. |
1835 | 1836 |
1836 // Fill the remaining expected arguments with undefined. | 1837 // Fill the remaining expected arguments with undefined. |
1837 // a1: function | 1838 // a1: function |
1838 // a2: expected number of arguments | 1839 // a2: expected number of arguments |
1839 // a3: code entry to call | 1840 // a3: code entry to call |
1840 __ LoadRoot(a4, Heap::kUndefinedValueRootIndex); | 1841 __ LoadRoot(a5, Heap::kUndefinedValueRootIndex); |
1841 __ dsll(a6, a2, kPointerSizeLog2); | 1842 __ dsll(a6, a2, kPointerSizeLog2); |
1842 __ Dsubu(a2, fp, Operand(a6)); | 1843 __ Dsubu(a4, fp, Operand(a6)); |
1843 // Adjust for frame. | 1844 // Adjust for frame. |
1844 __ Dsubu(a2, a2, Operand(StandardFrameConstants::kFixedFrameSizeFromFp + | 1845 __ Dsubu(a4, a4, Operand(StandardFrameConstants::kFixedFrameSizeFromFp + |
1845 2 * kPointerSize)); | 1846 2 * kPointerSize)); |
1846 | 1847 |
1847 Label fill; | 1848 Label fill; |
1848 __ bind(&fill); | 1849 __ bind(&fill); |
1849 __ Dsubu(sp, sp, kPointerSize); | 1850 __ Dsubu(sp, sp, kPointerSize); |
1850 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2)); | 1851 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a4)); |
1851 __ sd(a4, MemOperand(sp)); | 1852 __ sd(a5, MemOperand(sp)); |
1852 } | 1853 } |
1853 | 1854 |
1854 // Call the entry point. | 1855 // Call the entry point. |
1855 __ bind(&invoke); | 1856 __ bind(&invoke); |
1856 | 1857 __ mov(a0, a2); |
| 1858 // a0 : expected number of arguments |
| 1859 // a1 : function (passed through to callee) |
1857 __ Call(a3); | 1860 __ Call(a3); |
1858 | 1861 |
1859 // Store offset of return address for deoptimizer. | 1862 // Store offset of return address for deoptimizer. |
1860 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); | 1863 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); |
1861 | 1864 |
1862 // Exit frame and return. | 1865 // Exit frame and return. |
1863 LeaveArgumentsAdaptorFrame(masm); | 1866 LeaveArgumentsAdaptorFrame(masm); |
1864 __ Ret(); | 1867 __ Ret(); |
1865 | 1868 |
1866 | 1869 |
(...skipping 12 matching lines...) Expand all Loading... |
1879 } | 1882 } |
1880 } | 1883 } |
1881 | 1884 |
1882 | 1885 |
1883 #undef __ | 1886 #undef __ |
1884 | 1887 |
1885 } // namespace internal | 1888 } // namespace internal |
1886 } // namespace v8 | 1889 } // namespace v8 |
1887 | 1890 |
1888 #endif // V8_TARGET_ARCH_MIPS64 | 1891 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |