OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 return GetCode(NORMAL, name); | 1819 return GetCode(NORMAL, name); |
1820 } | 1820 } |
1821 | 1821 |
1822 | 1822 |
1823 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 1823 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
1824 JSObject* receiver, | 1824 JSObject* receiver, |
1825 JSObject* holder, | 1825 JSObject* holder, |
1826 int index) { | 1826 int index) { |
1827 // ----------- S t a t e ------------- | 1827 // ----------- S t a t e ------------- |
1828 // -- lr : return address | 1828 // -- lr : return address |
| 1829 // -- r0 : key |
1829 // -- sp[0] : key | 1830 // -- sp[0] : key |
1830 // -- sp[4] : receiver | 1831 // -- sp[4] : receiver |
1831 // ----------------------------------- | 1832 // ----------------------------------- |
1832 Label miss; | 1833 Label miss; |
1833 | 1834 |
1834 __ ldr(r2, MemOperand(sp, 0)); | 1835 // Check the key is the cached one. |
1835 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1836 __ cmp(r0, Operand(Handle<String>(name))); |
1836 | |
1837 __ cmp(r2, Operand(Handle<String>(name))); | |
1838 __ b(ne, &miss); | 1837 __ b(ne, &miss); |
1839 | 1838 |
1840 GenerateLoadField(receiver, holder, r0, r3, r1, index, name, &miss); | 1839 __ ldr(r1, MemOperand(sp, kPointerSize)); // Receiver. |
| 1840 GenerateLoadField(receiver, holder, r1, r2, r3, index, name, &miss); |
1841 __ bind(&miss); | 1841 __ bind(&miss); |
1842 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1842 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1843 | 1843 |
1844 return GetCode(FIELD, name); | 1844 return GetCode(FIELD, name); |
1845 } | 1845 } |
1846 | 1846 |
1847 | 1847 |
1848 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 1848 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, |
1849 JSObject* receiver, | 1849 JSObject* receiver, |
1850 JSObject* holder, | 1850 JSObject* holder, |
1851 AccessorInfo* callback) { | 1851 AccessorInfo* callback) { |
1852 // ----------- S t a t e ------------- | 1852 // ----------- S t a t e ------------- |
1853 // -- lr : return address | 1853 // -- lr : return address |
| 1854 // -- r0 : key |
1854 // -- sp[0] : key | 1855 // -- sp[0] : key |
1855 // -- sp[4] : receiver | 1856 // -- sp[4] : receiver |
1856 // ----------------------------------- | 1857 // ----------------------------------- |
1857 Label miss; | 1858 Label miss; |
1858 | 1859 |
1859 __ ldr(r2, MemOperand(sp, 0)); | 1860 // Check the key is the cached one. |
1860 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1861 __ cmp(r0, Operand(Handle<String>(name))); |
1861 | |
1862 __ cmp(r2, Operand(Handle<String>(name))); | |
1863 __ b(ne, &miss); | 1862 __ b(ne, &miss); |
1864 | 1863 |
1865 Failure* failure = Failure::InternalError(); | 1864 Failure* failure = Failure::InternalError(); |
1866 bool success = GenerateLoadCallback(receiver, holder, r0, r2, r3, r1, | 1865 __ ldr(r1, MemOperand(sp, kPointerSize)); // Receiver. |
| 1866 bool success = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, |
1867 callback, name, &miss, &failure); | 1867 callback, name, &miss, &failure); |
1868 if (!success) return failure; | 1868 if (!success) return failure; |
1869 | 1869 |
1870 __ bind(&miss); | 1870 __ bind(&miss); |
1871 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1871 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1872 | 1872 |
1873 return GetCode(CALLBACKS, name); | 1873 return GetCode(CALLBACKS, name); |
1874 } | 1874 } |
1875 | 1875 |
1876 | 1876 |
1877 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 1877 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
1878 JSObject* receiver, | 1878 JSObject* receiver, |
1879 JSObject* holder, | 1879 JSObject* holder, |
1880 Object* value) { | 1880 Object* value) { |
1881 // ----------- S t a t e ------------- | 1881 // ----------- S t a t e ------------- |
1882 // -- lr : return address | 1882 // -- lr : return address |
| 1883 // -- r0 : key |
1883 // -- sp[0] : key | 1884 // -- sp[0] : key |
1884 // -- sp[4] : receiver | 1885 // -- sp[4] : receiver |
1885 // ----------------------------------- | 1886 // ----------------------------------- |
1886 Label miss; | 1887 Label miss; |
1887 | 1888 |
1888 // Check the key is the cached one | 1889 // Check the key is the cached one. |
1889 __ ldr(r2, MemOperand(sp, 0)); | 1890 __ cmp(r0, Operand(Handle<String>(name))); |
1890 __ ldr(r0, MemOperand(sp, kPointerSize)); | |
1891 | |
1892 __ cmp(r2, Operand(Handle<String>(name))); | |
1893 __ b(ne, &miss); | 1891 __ b(ne, &miss); |
1894 | 1892 |
1895 GenerateLoadConstant(receiver, holder, r0, r3, r1, value, name, &miss); | 1893 __ ldr(r1, MemOperand(sp, kPointerSize)); // Receiver. |
| 1894 GenerateLoadConstant(receiver, holder, r1, r2, r3, value, name, &miss); |
1896 __ bind(&miss); | 1895 __ bind(&miss); |
1897 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1896 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1898 | 1897 |
1899 // Return the generated code. | 1898 // Return the generated code. |
1900 return GetCode(CONSTANT_FUNCTION, name); | 1899 return GetCode(CONSTANT_FUNCTION, name); |
1901 } | 1900 } |
1902 | 1901 |
1903 | 1902 |
1904 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 1903 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
1905 JSObject* holder, | 1904 JSObject* holder, |
1906 String* name) { | 1905 String* name) { |
1907 // ----------- S t a t e ------------- | 1906 // ----------- S t a t e ------------- |
1908 // -- lr : return address | 1907 // -- lr : return address |
| 1908 // -- r0 : key |
1909 // -- sp[0] : key | 1909 // -- sp[0] : key |
1910 // -- sp[4] : receiver | 1910 // -- sp[4] : receiver |
1911 // ----------------------------------- | 1911 // ----------------------------------- |
1912 Label miss; | 1912 Label miss; |
1913 | 1913 |
1914 // Check the key is the cached one | 1914 // Check the key is the cached one. |
1915 __ ldr(r2, MemOperand(sp, 0)); | 1915 __ cmp(r0, Operand(Handle<String>(name))); |
1916 __ ldr(r0, MemOperand(sp, kPointerSize)); | |
1917 | |
1918 __ cmp(r2, Operand(Handle<String>(name))); | |
1919 __ b(ne, &miss); | 1916 __ b(ne, &miss); |
1920 | 1917 |
1921 LookupResult lookup; | 1918 LookupResult lookup; |
1922 LookupPostInterceptor(holder, name, &lookup); | 1919 LookupPostInterceptor(holder, name, &lookup); |
| 1920 __ ldr(r1, MemOperand(sp, kPointerSize)); // Receiver. |
1923 GenerateLoadInterceptor(receiver, | 1921 GenerateLoadInterceptor(receiver, |
1924 holder, | 1922 holder, |
1925 &lookup, | 1923 &lookup, |
| 1924 r1, |
1926 r0, | 1925 r0, |
1927 r2, | 1926 r2, |
1928 r3, | 1927 r3, |
1929 r1, | |
1930 name, | 1928 name, |
1931 &miss); | 1929 &miss); |
1932 __ bind(&miss); | 1930 __ bind(&miss); |
1933 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1931 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1934 | 1932 |
1935 return GetCode(INTERCEPTOR, name); | 1933 return GetCode(INTERCEPTOR, name); |
1936 } | 1934 } |
1937 | 1935 |
1938 | 1936 |
1939 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 1937 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
1940 // ----------- S t a t e ------------- | 1938 // ----------- S t a t e ------------- |
1941 // -- lr : return address | 1939 // -- lr : return address |
| 1940 // -- r0 : key |
1942 // -- sp[0] : key | 1941 // -- sp[0] : key |
1943 // -- sp[4] : receiver | 1942 // -- sp[4] : receiver |
1944 // ----------------------------------- | 1943 // ----------------------------------- |
1945 Label miss; | 1944 Label miss; |
1946 | 1945 |
1947 // Check the key is the cached one | 1946 // Check the key is the cached one. |
1948 __ ldr(r2, MemOperand(sp, 0)); | 1947 __ cmp(r0, Operand(Handle<String>(name))); |
1949 __ ldr(r0, MemOperand(sp, kPointerSize)); | |
1950 | |
1951 __ cmp(r2, Operand(Handle<String>(name))); | |
1952 __ b(ne, &miss); | 1948 __ b(ne, &miss); |
1953 | 1949 |
1954 GenerateLoadArrayLength(masm(), r0, r3, &miss); | 1950 __ ldr(r1, MemOperand(sp, kPointerSize)); // Receiver. |
| 1951 GenerateLoadArrayLength(masm(), r1, r2, &miss); |
1955 __ bind(&miss); | 1952 __ bind(&miss); |
1956 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1953 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1957 | 1954 |
1958 return GetCode(CALLBACKS, name); | 1955 return GetCode(CALLBACKS, name); |
1959 } | 1956 } |
1960 | 1957 |
1961 | 1958 |
1962 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 1959 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
1963 // ----------- S t a t e ------------- | 1960 // ----------- S t a t e ------------- |
1964 // -- lr : return address | 1961 // -- lr : return address |
| 1962 // -- r0 : key |
1965 // -- sp[0] : key | 1963 // -- sp[0] : key |
1966 // -- sp[4] : receiver | 1964 // -- sp[4] : receiver |
1967 // ----------------------------------- | 1965 // ----------------------------------- |
1968 Label miss; | 1966 Label miss; |
1969 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1967 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
1970 | 1968 |
1971 __ ldr(r2, MemOperand(sp)); | 1969 // Check the key is the cached one. |
1972 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver | 1970 __ cmp(r0, Operand(Handle<String>(name))); |
1973 | |
1974 __ cmp(r2, Operand(Handle<String>(name))); | |
1975 __ b(ne, &miss); | 1971 __ b(ne, &miss); |
1976 | 1972 |
1977 GenerateLoadStringLength(masm(), r0, r1, r3, &miss); | 1973 __ ldr(r1, MemOperand(sp, kPointerSize)); // Receiver. |
| 1974 GenerateLoadStringLength(masm(), r1, r2, r3, &miss); |
1978 __ bind(&miss); | 1975 __ bind(&miss); |
1979 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1976 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
1980 | 1977 |
1981 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1978 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1982 | 1979 |
1983 return GetCode(CALLBACKS, name); | 1980 return GetCode(CALLBACKS, name); |
1984 } | 1981 } |
1985 | 1982 |
1986 | 1983 |
1987 // TODO(1224671): implement the fast case. | 1984 // TODO(1224671): implement the fast case. |
1988 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 1985 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
1989 // ----------- S t a t e ------------- | 1986 // ----------- S t a t e ------------- |
1990 // -- lr : return address | 1987 // -- lr : return address |
| 1988 // -- r0 : key |
1991 // -- sp[0] : key | 1989 // -- sp[0] : key |
1992 // -- sp[4] : receiver | 1990 // -- sp[4] : receiver |
1993 // ----------------------------------- | 1991 // ----------------------------------- |
1994 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1992 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1995 | 1993 |
1996 return GetCode(CALLBACKS, name); | 1994 return GetCode(CALLBACKS, name); |
1997 } | 1995 } |
1998 | 1996 |
1999 | 1997 |
2000 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 1998 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 2173 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
2176 | 2174 |
2177 // Return the generated code. | 2175 // Return the generated code. |
2178 return GetCode(); | 2176 return GetCode(); |
2179 } | 2177 } |
2180 | 2178 |
2181 | 2179 |
2182 #undef __ | 2180 #undef __ |
2183 | 2181 |
2184 } } // namespace v8::internal | 2182 } } // namespace v8::internal |
OLD | NEW |