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