OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 | 1652 |
1653 // Slow case: handle non-smi or out-of-bounds access to arguments by calling | 1653 // Slow case: handle non-smi or out-of-bounds access to arguments by calling |
1654 // the runtime system. | 1654 // the runtime system. |
1655 __ Bind(&slow); | 1655 __ Bind(&slow); |
1656 __ Push(key); | 1656 __ Push(key); |
1657 __ TailCallRuntime(Runtime::kArguments, 1, 1); | 1657 __ TailCallRuntime(Runtime::kArguments, 1, 1); |
1658 } | 1658 } |
1659 | 1659 |
1660 | 1660 |
1661 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { | 1661 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
1662 // Stack layout on entry. | 1662 // x1 : function |
1663 // jssp[0]: number of parameters (tagged) | 1663 // x2 : number of parameters (tagged) |
1664 // jssp[8]: address of receiver argument | 1664 // x3 : parameters pointer |
1665 // jssp[16]: function | 1665 |
| 1666 DCHECK(x1.is(ArgumentsAccessNewDescriptor::function())); |
| 1667 DCHECK(x2.is(ArgumentsAccessNewDescriptor::parameter_count())); |
| 1668 DCHECK(x3.is(ArgumentsAccessNewDescriptor::parameter_pointer())); |
1666 | 1669 |
1667 // Check if the calling frame is an arguments adaptor frame. | 1670 // Check if the calling frame is an arguments adaptor frame. |
1668 Label runtime; | 1671 Label runtime; |
1669 Register caller_fp = x10; | 1672 Register caller_fp = x10; |
1670 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1673 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1671 // Load and untag the context. | 1674 // Load and untag the context. |
1672 __ Ldr(w11, UntagSmiMemOperand(caller_fp, | 1675 __ Ldr(w11, UntagSmiMemOperand(caller_fp, |
1673 StandardFrameConstants::kContextOffset)); | 1676 StandardFrameConstants::kContextOffset)); |
1674 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); | 1677 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); |
1675 __ B(ne, &runtime); | 1678 __ B(ne, &runtime); |
1676 | 1679 |
1677 // Patch the arguments.length and parameters pointer in the current frame. | 1680 // Patch the arguments.length and parameters pointer in the current frame. |
1678 __ Ldr(x11, MemOperand(caller_fp, | 1681 __ Ldr(x2, |
1679 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1682 MemOperand(caller_fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1680 __ Poke(x11, 0 * kXRegSize); | 1683 __ Add(x3, caller_fp, Operand::UntagSmiAndScale(x2, kPointerSizeLog2)); |
1681 __ Add(x10, caller_fp, Operand::UntagSmiAndScale(x11, kPointerSizeLog2)); | 1684 __ Add(x3, x3, StandardFrameConstants::kCallerSPOffset); |
1682 __ Add(x10, x10, StandardFrameConstants::kCallerSPOffset); | |
1683 __ Poke(x10, 1 * kXRegSize); | |
1684 | 1685 |
1685 __ Bind(&runtime); | 1686 __ Bind(&runtime); |
| 1687 __ Push(x1, x3, x2); |
1686 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); | 1688 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); |
1687 } | 1689 } |
1688 | 1690 |
1689 | 1691 |
1690 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { | 1692 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
1691 // Stack layout on entry. | 1693 // x1 : function |
1692 // jssp[0]: number of parameters (tagged) | 1694 // x2 : number of parameters (tagged) |
1693 // jssp[8]: address of receiver argument | 1695 // x3 : parameters pointer |
1694 // jssp[16]: function | |
1695 // | 1696 // |
1696 // Returns pointer to result object in x0. | 1697 // Returns pointer to result object in x0. |
1697 | 1698 |
| 1699 DCHECK(x1.is(ArgumentsAccessNewDescriptor::function())); |
| 1700 DCHECK(x2.is(ArgumentsAccessNewDescriptor::parameter_count())); |
| 1701 DCHECK(x3.is(ArgumentsAccessNewDescriptor::parameter_pointer())); |
| 1702 |
| 1703 // Make an untagged copy of the parameter count. |
1698 // Note: arg_count_smi is an alias of param_count_smi. | 1704 // Note: arg_count_smi is an alias of param_count_smi. |
1699 Register arg_count_smi = x3; | 1705 Register function = x1; |
1700 Register param_count_smi = x3; | 1706 Register arg_count_smi = x2; |
| 1707 Register param_count_smi = x2; |
| 1708 Register recv_arg = x3; |
1701 Register param_count = x7; | 1709 Register param_count = x7; |
1702 Register recv_arg = x14; | |
1703 Register function = x4; | |
1704 __ Pop(param_count_smi, recv_arg, function); | |
1705 __ SmiUntag(param_count, param_count_smi); | 1710 __ SmiUntag(param_count, param_count_smi); |
1706 | 1711 |
1707 // Check if the calling frame is an arguments adaptor frame. | 1712 // Check if the calling frame is an arguments adaptor frame. |
1708 Register caller_fp = x11; | 1713 Register caller_fp = x11; |
1709 Register caller_ctx = x12; | 1714 Register caller_ctx = x12; |
1710 Label runtime; | 1715 Label runtime; |
1711 Label adaptor_frame, try_allocate; | 1716 Label adaptor_frame, try_allocate; |
1712 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1717 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1713 __ Ldr(caller_ctx, MemOperand(caller_fp, | 1718 __ Ldr(caller_ctx, MemOperand(caller_fp, |
1714 StandardFrameConstants::kContextOffset)); | 1719 StandardFrameConstants::kContextOffset)); |
1715 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1720 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
1716 __ B(eq, &adaptor_frame); | 1721 __ B(eq, &adaptor_frame); |
1717 | 1722 |
1718 // No adaptor, parameter count = argument count. | 1723 // No adaptor, parameter count = argument count. |
1719 | 1724 |
1720 // x1 mapped_params number of mapped params, min(params, args) (uninit) | 1725 // x1 function function pointer |
1721 // x2 arg_count number of function arguments (uninit) | 1726 // x2 arg_count_smi number of function arguments (smi) |
1722 // x3 arg_count_smi number of function arguments (smi) | 1727 // x3 recv_arg pointer to receiver arguments |
1723 // x4 function function pointer | 1728 // x4 mapped_params number of mapped params, min(params, args) (uninit) |
1724 // x7 param_count number of function parameters | 1729 // x7 param_count number of function parameters |
1725 // x11 caller_fp caller's frame pointer | 1730 // x11 caller_fp caller's frame pointer |
1726 // x14 recv_arg pointer to receiver arguments | 1731 // x14 arg_count number of function arguments (uninit) |
1727 | 1732 |
1728 Register arg_count = x2; | 1733 Register arg_count = x14; |
| 1734 Register mapped_params = x4; |
1729 __ Mov(arg_count, param_count); | 1735 __ Mov(arg_count, param_count); |
| 1736 __ Mov(mapped_params, param_count); |
1730 __ B(&try_allocate); | 1737 __ B(&try_allocate); |
1731 | 1738 |
1732 // We have an adaptor frame. Patch the parameters pointer. | 1739 // We have an adaptor frame. Patch the parameters pointer. |
1733 __ Bind(&adaptor_frame); | 1740 __ Bind(&adaptor_frame); |
1734 __ Ldr(arg_count_smi, | 1741 __ Ldr(arg_count_smi, |
1735 MemOperand(caller_fp, | 1742 MemOperand(caller_fp, |
1736 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1743 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1737 __ SmiUntag(arg_count, arg_count_smi); | 1744 __ SmiUntag(arg_count, arg_count_smi); |
1738 __ Add(x10, caller_fp, Operand(arg_count, LSL, kPointerSizeLog2)); | 1745 __ Add(x10, caller_fp, Operand(arg_count, LSL, kPointerSizeLog2)); |
1739 __ Add(recv_arg, x10, StandardFrameConstants::kCallerSPOffset); | 1746 __ Add(recv_arg, x10, StandardFrameConstants::kCallerSPOffset); |
1740 | 1747 |
1741 // Compute the mapped parameter count = min(param_count, arg_count) | 1748 // Compute the mapped parameter count = min(param_count, arg_count) |
1742 Register mapped_params = x1; | |
1743 __ Cmp(param_count, arg_count); | 1749 __ Cmp(param_count, arg_count); |
1744 __ Csel(mapped_params, param_count, arg_count, lt); | 1750 __ Csel(mapped_params, param_count, arg_count, lt); |
1745 | 1751 |
1746 __ Bind(&try_allocate); | 1752 __ Bind(&try_allocate); |
1747 | 1753 |
1748 // x0 alloc_obj pointer to allocated objects: param map, backing | 1754 // x0 alloc_obj pointer to allocated objects: param map, backing |
1749 // store, arguments (uninit) | 1755 // store, arguments (uninit) |
1750 // x1 mapped_params number of mapped parameters, min(params, args) | 1756 // x1 function function pointer |
1751 // x2 arg_count number of function arguments | 1757 // x2 arg_count_smi number of function arguments (smi) |
1752 // x3 arg_count_smi number of function arguments (smi) | 1758 // x3 recv_arg pointer to receiver arguments |
1753 // x4 function function pointer | 1759 // x4 mapped_params number of mapped parameters, min(params, args) |
1754 // x7 param_count number of function parameters | 1760 // x7 param_count number of function parameters |
1755 // x10 size size of objects to allocate (uninit) | 1761 // x10 size size of objects to allocate (uninit) |
1756 // x14 recv_arg pointer to receiver arguments | 1762 // x14 arg_count number of function arguments |
1757 | 1763 |
1758 // Compute the size of backing store, parameter map, and arguments object. | 1764 // Compute the size of backing store, parameter map, and arguments object. |
1759 // 1. Parameter map, has two extra words containing context and backing | 1765 // 1. Parameter map, has two extra words containing context and backing |
1760 // store. | 1766 // store. |
1761 const int kParameterMapHeaderSize = | 1767 const int kParameterMapHeaderSize = |
1762 FixedArray::kHeaderSize + 2 * kPointerSize; | 1768 FixedArray::kHeaderSize + 2 * kPointerSize; |
1763 | 1769 |
1764 // Calculate the parameter map size, assuming it exists. | 1770 // Calculate the parameter map size, assuming it exists. |
1765 Register size = x10; | 1771 Register size = x10; |
1766 __ Mov(size, Operand(mapped_params, LSL, kPointerSizeLog2)); | 1772 __ Mov(size, Operand(mapped_params, LSL, kPointerSizeLog2)); |
(...skipping 11 matching lines...) Expand all Loading... |
1778 | 1784 |
1779 // Do the allocation of all three objects in one go. Assign this to x0, as it | 1785 // Do the allocation of all three objects in one go. Assign this to x0, as it |
1780 // will be returned to the caller. | 1786 // will be returned to the caller. |
1781 Register alloc_obj = x0; | 1787 Register alloc_obj = x0; |
1782 __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); | 1788 __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); |
1783 | 1789 |
1784 // Get the arguments boilerplate from the current (global) context. | 1790 // Get the arguments boilerplate from the current (global) context. |
1785 | 1791 |
1786 // x0 alloc_obj pointer to allocated objects (param map, backing | 1792 // x0 alloc_obj pointer to allocated objects (param map, backing |
1787 // store, arguments) | 1793 // store, arguments) |
1788 // x1 mapped_params number of mapped parameters, min(params, args) | 1794 // x1 function function pointer |
1789 // x2 arg_count number of function arguments | 1795 // x2 arg_count_smi number of function arguments (smi) |
1790 // x3 arg_count_smi number of function arguments (smi) | 1796 // x3 recv_arg pointer to receiver arguments |
1791 // x4 function function pointer | 1797 // x4 mapped_params number of mapped parameters, min(params, args) |
1792 // x7 param_count number of function parameters | 1798 // x7 param_count number of function parameters |
1793 // x11 sloppy_args_map offset to args (or aliased args) map (uninit) | 1799 // x11 sloppy_args_map offset to args (or aliased args) map (uninit) |
1794 // x14 recv_arg pointer to receiver arguments | 1800 // x14 arg_count number of function arguments |
1795 | 1801 |
1796 Register global_object = x10; | 1802 Register global_object = x10; |
1797 Register global_ctx = x10; | 1803 Register global_ctx = x10; |
1798 Register sloppy_args_map = x11; | 1804 Register sloppy_args_map = x11; |
1799 Register aliased_args_map = x10; | 1805 Register aliased_args_map = x10; |
1800 __ Ldr(global_object, GlobalObjectMemOperand()); | 1806 __ Ldr(global_object, GlobalObjectMemOperand()); |
1801 __ Ldr(global_ctx, FieldMemOperand(global_object, | 1807 __ Ldr(global_ctx, FieldMemOperand(global_object, |
1802 GlobalObject::kNativeContextOffset)); | 1808 GlobalObject::kNativeContextOffset)); |
1803 | 1809 |
1804 __ Ldr(sloppy_args_map, | 1810 __ Ldr(sloppy_args_map, |
(...skipping 22 matching lines...) Expand all Loading... |
1827 const int kLengthOffset = JSObject::kHeaderSize + | 1833 const int kLengthOffset = JSObject::kHeaderSize + |
1828 Heap::kArgumentsLengthIndex * kPointerSize; | 1834 Heap::kArgumentsLengthIndex * kPointerSize; |
1829 __ Str(arg_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); | 1835 __ Str(arg_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); |
1830 | 1836 |
1831 // Set up the elements pointer in the allocated arguments object. | 1837 // Set up the elements pointer in the allocated arguments object. |
1832 // If we allocated a parameter map, "elements" will point there, otherwise | 1838 // If we allocated a parameter map, "elements" will point there, otherwise |
1833 // it will point to the backing store. | 1839 // it will point to the backing store. |
1834 | 1840 |
1835 // x0 alloc_obj pointer to allocated objects (param map, backing | 1841 // x0 alloc_obj pointer to allocated objects (param map, backing |
1836 // store, arguments) | 1842 // store, arguments) |
1837 // x1 mapped_params number of mapped parameters, min(params, args) | 1843 // x1 function function pointer |
1838 // x2 arg_count number of function arguments | 1844 // x2 arg_count_smi number of function arguments (smi) |
1839 // x3 arg_count_smi number of function arguments (smi) | 1845 // x3 recv_arg pointer to receiver arguments |
1840 // x4 function function pointer | 1846 // x4 mapped_params number of mapped parameters, min(params, args) |
1841 // x5 elements pointer to parameter map or backing store (uninit) | 1847 // x5 elements pointer to parameter map or backing store (uninit) |
1842 // x6 backing_store pointer to backing store (uninit) | 1848 // x6 backing_store pointer to backing store (uninit) |
1843 // x7 param_count number of function parameters | 1849 // x7 param_count number of function parameters |
1844 // x14 recv_arg pointer to receiver arguments | 1850 // x14 arg_count number of function arguments |
1845 | 1851 |
1846 Register elements = x5; | 1852 Register elements = x5; |
1847 __ Add(elements, alloc_obj, Heap::kSloppyArgumentsObjectSize); | 1853 __ Add(elements, alloc_obj, Heap::kSloppyArgumentsObjectSize); |
1848 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); | 1854 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
1849 | 1855 |
1850 // Initialize parameter map. If there are no mapped arguments, we're done. | 1856 // Initialize parameter map. If there are no mapped arguments, we're done. |
1851 Label skip_parameter_map; | 1857 Label skip_parameter_map; |
1852 __ Cmp(mapped_params, 0); | 1858 __ Cmp(mapped_params, 0); |
1853 // Set up backing store address, because it is needed later for filling in | 1859 // Set up backing store address, because it is needed later for filling in |
1854 // the unmapped arguments. | 1860 // the unmapped arguments. |
(...skipping 21 matching lines...) Expand all Loading... |
1876 // | 1882 // |
1877 // The mapped parameter thus needs to get indices: | 1883 // The mapped parameter thus needs to get indices: |
1878 // | 1884 // |
1879 // MIN_CONTEXT_SLOTS + parameter_count - 1 .. | 1885 // MIN_CONTEXT_SLOTS + parameter_count - 1 .. |
1880 // MIN_CONTEXT_SLOTS + parameter_count - mapped_parameter_count | 1886 // MIN_CONTEXT_SLOTS + parameter_count - mapped_parameter_count |
1881 // | 1887 // |
1882 // We loop from right to left. | 1888 // We loop from right to left. |
1883 | 1889 |
1884 // x0 alloc_obj pointer to allocated objects (param map, backing | 1890 // x0 alloc_obj pointer to allocated objects (param map, backing |
1885 // store, arguments) | 1891 // store, arguments) |
1886 // x1 mapped_params number of mapped parameters, min(params, args) | 1892 // x1 function function pointer |
1887 // x2 arg_count number of function arguments | 1893 // x2 arg_count_smi number of function arguments (smi) |
1888 // x3 arg_count_smi number of function arguments (smi) | 1894 // x3 recv_arg pointer to receiver arguments |
1889 // x4 function function pointer | 1895 // x4 mapped_params number of mapped parameters, min(params, args) |
1890 // x5 elements pointer to parameter map or backing store (uninit) | 1896 // x5 elements pointer to parameter map or backing store (uninit) |
1891 // x6 backing_store pointer to backing store (uninit) | 1897 // x6 backing_store pointer to backing store (uninit) |
1892 // x7 param_count number of function parameters | 1898 // x7 param_count number of function parameters |
1893 // x11 loop_count parameter loop counter (uninit) | 1899 // x11 loop_count parameter loop counter (uninit) |
1894 // x12 index parameter index (smi, uninit) | 1900 // x12 index parameter index (smi, uninit) |
1895 // x13 the_hole hole value (uninit) | 1901 // x13 the_hole hole value (uninit) |
1896 // x14 recv_arg pointer to receiver arguments | 1902 // x14 arg_count number of function arguments |
1897 | 1903 |
1898 Register loop_count = x11; | 1904 Register loop_count = x11; |
1899 Register index = x12; | 1905 Register index = x12; |
1900 Register the_hole = x13; | 1906 Register the_hole = x13; |
1901 Label parameters_loop, parameters_test; | 1907 Label parameters_loop, parameters_test; |
1902 __ Mov(loop_count, mapped_params); | 1908 __ Mov(loop_count, mapped_params); |
1903 __ Add(index, param_count, static_cast<int>(Context::MIN_CONTEXT_SLOTS)); | 1909 __ Add(index, param_count, static_cast<int>(Context::MIN_CONTEXT_SLOTS)); |
1904 __ Sub(index, index, mapped_params); | 1910 __ Sub(index, index, mapped_params); |
1905 __ SmiTag(index); | 1911 __ SmiTag(index); |
1906 __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); | 1912 __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); |
(...skipping 15 matching lines...) Expand all Loading... |
1922 | 1928 |
1923 __ Bind(&skip_parameter_map); | 1929 __ Bind(&skip_parameter_map); |
1924 // Copy arguments header and remaining slots (if there are any.) | 1930 // Copy arguments header and remaining slots (if there are any.) |
1925 __ LoadRoot(x10, Heap::kFixedArrayMapRootIndex); | 1931 __ LoadRoot(x10, Heap::kFixedArrayMapRootIndex); |
1926 __ Str(x10, FieldMemOperand(backing_store, FixedArray::kMapOffset)); | 1932 __ Str(x10, FieldMemOperand(backing_store, FixedArray::kMapOffset)); |
1927 __ Str(arg_count_smi, FieldMemOperand(backing_store, | 1933 __ Str(arg_count_smi, FieldMemOperand(backing_store, |
1928 FixedArray::kLengthOffset)); | 1934 FixedArray::kLengthOffset)); |
1929 | 1935 |
1930 // x0 alloc_obj pointer to allocated objects (param map, backing | 1936 // x0 alloc_obj pointer to allocated objects (param map, backing |
1931 // store, arguments) | 1937 // store, arguments) |
1932 // x1 mapped_params number of mapped parameters, min(params, args) | 1938 // x1 function function pointer |
1933 // x2 arg_count number of function arguments | 1939 // x2 arg_count_smi number of function arguments (smi) |
1934 // x4 function function pointer | 1940 // x3 recv_arg pointer to receiver arguments |
1935 // x3 arg_count_smi number of function arguments (smi) | 1941 // x4 mapped_params number of mapped parameters, min(params, args) |
1936 // x6 backing_store pointer to backing store (uninit) | 1942 // x6 backing_store pointer to backing store (uninit) |
1937 // x14 recv_arg pointer to receiver arguments | 1943 // x14 arg_count number of function arguments |
1938 | 1944 |
1939 Label arguments_loop, arguments_test; | 1945 Label arguments_loop, arguments_test; |
1940 __ Mov(x10, mapped_params); | 1946 __ Mov(x10, mapped_params); |
1941 __ Sub(recv_arg, recv_arg, Operand(x10, LSL, kPointerSizeLog2)); | 1947 __ Sub(recv_arg, recv_arg, Operand(x10, LSL, kPointerSizeLog2)); |
1942 __ B(&arguments_test); | 1948 __ B(&arguments_test); |
1943 | 1949 |
1944 __ Bind(&arguments_loop); | 1950 __ Bind(&arguments_loop); |
1945 __ Sub(recv_arg, recv_arg, kPointerSize); | 1951 __ Sub(recv_arg, recv_arg, kPointerSize); |
1946 __ Ldr(x11, MemOperand(recv_arg)); | 1952 __ Ldr(x11, MemOperand(recv_arg)); |
1947 __ Add(x12, backing_store, Operand(x10, LSL, kPointerSizeLog2)); | 1953 __ Add(x12, backing_store, Operand(x10, LSL, kPointerSizeLog2)); |
(...skipping 27 matching lines...) Expand all Loading... |
1975 __ Push(receiver, key); | 1981 __ Push(receiver, key); |
1976 __ TailCallRuntime(Runtime::kLoadElementWithInterceptor, 2, 1); | 1982 __ TailCallRuntime(Runtime::kLoadElementWithInterceptor, 2, 1); |
1977 | 1983 |
1978 __ Bind(&slow); | 1984 __ Bind(&slow); |
1979 PropertyAccessCompiler::TailCallBuiltin( | 1985 PropertyAccessCompiler::TailCallBuiltin( |
1980 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1986 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
1981 } | 1987 } |
1982 | 1988 |
1983 | 1989 |
1984 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { | 1990 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
1985 // Stack layout on entry. | 1991 // x1 : function |
1986 // jssp[0]: number of parameters (tagged) | 1992 // x2 : number of parameters (tagged) |
1987 // jssp[8]: address of receiver argument | 1993 // x3 : parameters pointer |
1988 // jssp[16]: function | |
1989 // | 1994 // |
1990 // Returns pointer to result object in x0. | 1995 // Returns pointer to result object in x0. |
1991 | 1996 |
1992 // Get the stub arguments from the frame, and make an untagged copy of the | 1997 DCHECK(x1.is(ArgumentsAccessNewDescriptor::function())); |
1993 // parameter count. | 1998 DCHECK(x2.is(ArgumentsAccessNewDescriptor::parameter_count())); |
1994 Register param_count_smi = x1; | 1999 DCHECK(x3.is(ArgumentsAccessNewDescriptor::parameter_pointer())); |
1995 Register params = x2; | 2000 |
1996 Register function = x3; | 2001 // Make an untagged copy of the parameter count. |
| 2002 Register function = x1; |
| 2003 Register param_count_smi = x2; |
| 2004 Register params = x3; |
1997 Register param_count = x13; | 2005 Register param_count = x13; |
1998 __ Pop(param_count_smi, params, function); | |
1999 __ SmiUntag(param_count, param_count_smi); | 2006 __ SmiUntag(param_count, param_count_smi); |
2000 | 2007 |
2001 // Test if arguments adaptor needed. | 2008 // Test if arguments adaptor needed. |
2002 Register caller_fp = x11; | 2009 Register caller_fp = x11; |
2003 Register caller_ctx = x12; | 2010 Register caller_ctx = x12; |
2004 Label try_allocate, runtime; | 2011 Label try_allocate, runtime; |
2005 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2012 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2006 __ Ldr(caller_ctx, MemOperand(caller_fp, | 2013 __ Ldr(caller_ctx, MemOperand(caller_fp, |
2007 StandardFrameConstants::kContextOffset)); | 2014 StandardFrameConstants::kContextOffset)); |
2008 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 2015 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
2009 __ B(ne, &try_allocate); | 2016 __ B(ne, &try_allocate); |
2010 | 2017 |
2011 // x1 param_count_smi number of parameters passed to function (smi) | 2018 // x1 function function pointer |
2012 // x2 params pointer to parameters | 2019 // x2 param_count_smi number of parameters passed to function (smi) |
2013 // x3 function function pointer | 2020 // x3 params pointer to parameters |
2014 // x11 caller_fp caller's frame pointer | 2021 // x11 caller_fp caller's frame pointer |
2015 // x13 param_count number of parameters passed to function | 2022 // x13 param_count number of parameters passed to function |
2016 | 2023 |
2017 // Patch the argument length and parameters pointer. | 2024 // Patch the argument length and parameters pointer. |
2018 __ Ldr(param_count_smi, | 2025 __ Ldr(param_count_smi, |
2019 MemOperand(caller_fp, | 2026 MemOperand(caller_fp, |
2020 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2027 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2021 __ SmiUntag(param_count, param_count_smi); | 2028 __ SmiUntag(param_count, param_count_smi); |
2022 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); | 2029 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); |
2023 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); | 2030 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); |
(...skipping 18 matching lines...) Expand all Loading... |
2042 Register global_ctx = x10; | 2049 Register global_ctx = x10; |
2043 Register strict_args_map = x4; | 2050 Register strict_args_map = x4; |
2044 __ Ldr(global_object, GlobalObjectMemOperand()); | 2051 __ Ldr(global_object, GlobalObjectMemOperand()); |
2045 __ Ldr(global_ctx, FieldMemOperand(global_object, | 2052 __ Ldr(global_ctx, FieldMemOperand(global_object, |
2046 GlobalObject::kNativeContextOffset)); | 2053 GlobalObject::kNativeContextOffset)); |
2047 __ Ldr(strict_args_map, | 2054 __ Ldr(strict_args_map, |
2048 ContextMemOperand(global_ctx, Context::STRICT_ARGUMENTS_MAP_INDEX)); | 2055 ContextMemOperand(global_ctx, Context::STRICT_ARGUMENTS_MAP_INDEX)); |
2049 | 2056 |
2050 // x0 alloc_obj pointer to allocated objects: parameter array and | 2057 // x0 alloc_obj pointer to allocated objects: parameter array and |
2051 // arguments object | 2058 // arguments object |
2052 // x1 param_count_smi number of parameters passed to function (smi) | 2059 // x1 function function pointer |
2053 // x2 params pointer to parameters | 2060 // x2 param_count_smi number of parameters passed to function (smi) |
2054 // x3 function function pointer | 2061 // x3 params pointer to parameters |
2055 // x4 strict_args_map offset to arguments map | 2062 // x4 strict_args_map offset to arguments map |
2056 // x13 param_count number of parameters passed to function | 2063 // x13 param_count number of parameters passed to function |
2057 __ Str(strict_args_map, FieldMemOperand(alloc_obj, JSObject::kMapOffset)); | 2064 __ Str(strict_args_map, FieldMemOperand(alloc_obj, JSObject::kMapOffset)); |
2058 __ LoadRoot(x5, Heap::kEmptyFixedArrayRootIndex); | 2065 __ LoadRoot(x5, Heap::kEmptyFixedArrayRootIndex); |
2059 __ Str(x5, FieldMemOperand(alloc_obj, JSObject::kPropertiesOffset)); | 2066 __ Str(x5, FieldMemOperand(alloc_obj, JSObject::kPropertiesOffset)); |
2060 __ Str(x5, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); | 2067 __ Str(x5, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
2061 | 2068 |
2062 // Set the smi-tagged length as an in-object property. | 2069 // Set the smi-tagged length as an in-object property. |
2063 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2070 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2064 const int kLengthOffset = JSObject::kHeaderSize + | 2071 const int kLengthOffset = JSObject::kHeaderSize + |
2065 Heap::kArgumentsLengthIndex * kPointerSize; | 2072 Heap::kArgumentsLengthIndex * kPointerSize; |
2066 __ Str(param_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); | 2073 __ Str(param_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); |
2067 | 2074 |
2068 // If there are no actual arguments, we're done. | 2075 // If there are no actual arguments, we're done. |
2069 Label done; | 2076 Label done; |
2070 __ Cbz(param_count, &done); | 2077 __ Cbz(param_count, &done); |
2071 | 2078 |
2072 // Set up the elements pointer in the allocated arguments object and | 2079 // Set up the elements pointer in the allocated arguments object and |
2073 // initialize the header in the elements fixed array. | 2080 // initialize the header in the elements fixed array. |
2074 Register elements = x5; | 2081 Register elements = x5; |
2075 __ Add(elements, alloc_obj, Heap::kStrictArgumentsObjectSize); | 2082 __ Add(elements, alloc_obj, Heap::kStrictArgumentsObjectSize); |
2076 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); | 2083 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
2077 __ LoadRoot(x10, Heap::kFixedArrayMapRootIndex); | 2084 __ LoadRoot(x10, Heap::kFixedArrayMapRootIndex); |
2078 __ Str(x10, FieldMemOperand(elements, FixedArray::kMapOffset)); | 2085 __ Str(x10, FieldMemOperand(elements, FixedArray::kMapOffset)); |
2079 __ Str(param_count_smi, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 2086 __ Str(param_count_smi, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
2080 | 2087 |
2081 // x0 alloc_obj pointer to allocated objects: parameter array and | 2088 // x0 alloc_obj pointer to allocated objects: parameter array and |
2082 // arguments object | 2089 // arguments object |
2083 // x1 param_count_smi number of parameters passed to function (smi) | 2090 // x1 function function pointer |
2084 // x2 params pointer to parameters | 2091 // x2 param_count_smi number of parameters passed to function (smi) |
2085 // x3 function function pointer | 2092 // x3 params pointer to parameters |
2086 // x4 array pointer to array slot (uninit) | 2093 // x4 array pointer to array slot (uninit) |
2087 // x5 elements pointer to elements array of alloc_obj | 2094 // x5 elements pointer to elements array of alloc_obj |
2088 // x13 param_count number of parameters passed to function | 2095 // x13 param_count number of parameters passed to function |
2089 | 2096 |
2090 // Copy the fixed array slots. | 2097 // Copy the fixed array slots. |
2091 Label loop; | 2098 Label loop; |
2092 Register array = x4; | 2099 Register array = x4; |
2093 // Set up pointer to first array slot. | 2100 // Set up pointer to first array slot. |
2094 __ Add(array, elements, FixedArray::kHeaderSize - kHeapObjectTag); | 2101 __ Add(array, elements, FixedArray::kHeaderSize - kHeapObjectTag); |
2095 | 2102 |
(...skipping 3893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5989 MemOperand(fp, 6 * kPointerSize), NULL); | 5996 MemOperand(fp, 6 * kPointerSize), NULL); |
5990 } | 5997 } |
5991 | 5998 |
5992 | 5999 |
5993 #undef __ | 6000 #undef __ |
5994 | 6001 |
5995 } // namespace internal | 6002 } // namespace internal |
5996 } // namespace v8 | 6003 } // namespace v8 |
5997 | 6004 |
5998 #endif // V8_TARGET_ARCH_ARM64 | 6005 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |