| 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 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 // Return the generated code. | 1870 // Return the generated code. |
| 1871 return GetCode(NORMAL, name); | 1871 return GetCode(NORMAL, name); |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 | 1874 |
| 1875 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 1875 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
| 1876 JSObject* receiver, | 1876 JSObject* receiver, |
| 1877 JSObject* holder, | 1877 JSObject* holder, |
| 1878 int index) { | 1878 int index) { |
| 1879 // ----------- S t a t e ------------- | 1879 // ----------- S t a t e ------------- |
| 1880 // -- eax : key |
| 1881 // -- edx : receiver |
| 1880 // -- esp[0] : return address | 1882 // -- esp[0] : return address |
| 1881 // -- esp[4] : name | |
| 1882 // -- esp[8] : receiver | |
| 1883 // ----------------------------------- | 1883 // ----------------------------------- |
| 1884 Label miss; | 1884 Label miss; |
| 1885 | 1885 |
| 1886 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1887 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 1888 __ IncrementCounter(&Counters::keyed_load_field, 1); | 1886 __ IncrementCounter(&Counters::keyed_load_field, 1); |
| 1889 | 1887 |
| 1890 // Check that the name has not changed. | 1888 // Check that the name has not changed. |
| 1891 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 1889 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 1892 __ j(not_equal, &miss, not_taken); | 1890 __ j(not_equal, &miss, not_taken); |
| 1893 | 1891 |
| 1894 GenerateLoadField(receiver, holder, ecx, ebx, edx, index, name, &miss); | 1892 GenerateLoadField(receiver, holder, edx, ebx, ecx, index, name, &miss); |
| 1895 | 1893 |
| 1896 __ bind(&miss); | 1894 __ bind(&miss); |
| 1897 __ DecrementCounter(&Counters::keyed_load_field, 1); | 1895 __ DecrementCounter(&Counters::keyed_load_field, 1); |
| 1898 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1896 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1899 | 1897 |
| 1900 // Return the generated code. | 1898 // Return the generated code. |
| 1901 return GetCode(FIELD, name); | 1899 return GetCode(FIELD, name); |
| 1902 } | 1900 } |
| 1903 | 1901 |
| 1904 | 1902 |
| 1905 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 1903 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, |
| 1906 JSObject* receiver, | 1904 JSObject* receiver, |
| 1907 JSObject* holder, | 1905 JSObject* holder, |
| 1908 AccessorInfo* callback) { | 1906 AccessorInfo* callback) { |
| 1909 // ----------- S t a t e ------------- | 1907 // ----------- S t a t e ------------- |
| 1908 // -- eax : key |
| 1909 // -- edx : receiver |
| 1910 // -- esp[0] : return address | 1910 // -- esp[0] : return address |
| 1911 // -- esp[4] : name | |
| 1912 // -- esp[8] : receiver | |
| 1913 // ----------------------------------- | 1911 // ----------------------------------- |
| 1914 Label miss; | 1912 Label miss; |
| 1915 | 1913 |
| 1916 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1917 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 1918 __ IncrementCounter(&Counters::keyed_load_callback, 1); | 1914 __ IncrementCounter(&Counters::keyed_load_callback, 1); |
| 1919 | 1915 |
| 1920 // Check that the name has not changed. | 1916 // Check that the name has not changed. |
| 1921 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 1917 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 1922 __ j(not_equal, &miss, not_taken); | 1918 __ j(not_equal, &miss, not_taken); |
| 1923 | 1919 |
| 1924 Failure* failure = Failure::InternalError(); | 1920 Failure* failure = Failure::InternalError(); |
| 1925 bool success = GenerateLoadCallback(receiver, holder, ecx, eax, ebx, edx, | 1921 bool success = GenerateLoadCallback(receiver, holder, edx, eax, ebx, ecx, |
| 1926 callback, name, &miss, &failure); | 1922 callback, name, &miss, &failure); |
| 1927 if (!success) return failure; | 1923 if (!success) return failure; |
| 1928 | 1924 |
| 1929 __ bind(&miss); | 1925 __ bind(&miss); |
| 1930 __ DecrementCounter(&Counters::keyed_load_callback, 1); | 1926 __ DecrementCounter(&Counters::keyed_load_callback, 1); |
| 1931 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1927 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1932 | 1928 |
| 1933 // Return the generated code. | 1929 // Return the generated code. |
| 1934 return GetCode(CALLBACKS, name); | 1930 return GetCode(CALLBACKS, name); |
| 1935 } | 1931 } |
| 1936 | 1932 |
| 1937 | 1933 |
| 1938 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 1934 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
| 1939 JSObject* receiver, | 1935 JSObject* receiver, |
| 1940 JSObject* holder, | 1936 JSObject* holder, |
| 1941 Object* value) { | 1937 Object* value) { |
| 1942 // ----------- S t a t e ------------- | 1938 // ----------- S t a t e ------------- |
| 1939 // -- eax : key |
| 1940 // -- edx : receiver |
| 1943 // -- esp[0] : return address | 1941 // -- esp[0] : return address |
| 1944 // -- esp[4] : name | |
| 1945 // -- esp[8] : receiver | |
| 1946 // ----------------------------------- | 1942 // ----------------------------------- |
| 1947 Label miss; | 1943 Label miss; |
| 1948 | 1944 |
| 1949 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1950 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 1951 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); | 1945 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); |
| 1952 | 1946 |
| 1953 // Check that the name has not changed. | 1947 // Check that the name has not changed. |
| 1954 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 1948 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 1955 __ j(not_equal, &miss, not_taken); | 1949 __ j(not_equal, &miss, not_taken); |
| 1956 | 1950 |
| 1957 GenerateLoadConstant(receiver, holder, ecx, ebx, edx, | 1951 GenerateLoadConstant(receiver, holder, edx, ebx, ecx, |
| 1958 value, name, &miss); | 1952 value, name, &miss); |
| 1959 __ bind(&miss); | 1953 __ bind(&miss); |
| 1960 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); | 1954 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); |
| 1961 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1955 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1962 | 1956 |
| 1963 // Return the generated code. | 1957 // Return the generated code. |
| 1964 return GetCode(CONSTANT_FUNCTION, name); | 1958 return GetCode(CONSTANT_FUNCTION, name); |
| 1965 } | 1959 } |
| 1966 | 1960 |
| 1967 | 1961 |
| 1968 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 1962 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
| 1969 JSObject* holder, | 1963 JSObject* holder, |
| 1970 String* name) { | 1964 String* name) { |
| 1971 // ----------- S t a t e ------------- | 1965 // ----------- S t a t e ------------- |
| 1966 // -- eax : key |
| 1967 // -- edx : receiver |
| 1972 // -- esp[0] : return address | 1968 // -- esp[0] : return address |
| 1973 // -- esp[4] : name | |
| 1974 // -- esp[8] : receiver | |
| 1975 // ----------------------------------- | 1969 // ----------------------------------- |
| 1976 Label miss; | 1970 Label miss; |
| 1977 | 1971 |
| 1978 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1979 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 1980 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); | 1972 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); |
| 1981 | 1973 |
| 1982 // Check that the name has not changed. | 1974 // Check that the name has not changed. |
| 1983 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 1975 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 1984 __ j(not_equal, &miss, not_taken); | 1976 __ j(not_equal, &miss, not_taken); |
| 1985 | 1977 |
| 1986 LookupResult lookup; | 1978 LookupResult lookup; |
| 1987 LookupPostInterceptor(holder, name, &lookup); | 1979 LookupPostInterceptor(holder, name, &lookup); |
| 1988 GenerateLoadInterceptor(receiver, | 1980 GenerateLoadInterceptor(receiver, |
| 1989 holder, | 1981 holder, |
| 1990 &lookup, | 1982 &lookup, |
| 1983 edx, |
| 1984 eax, |
| 1991 ecx, | 1985 ecx, |
| 1992 eax, | |
| 1993 edx, | |
| 1994 ebx, | 1986 ebx, |
| 1995 name, | 1987 name, |
| 1996 &miss); | 1988 &miss); |
| 1997 __ bind(&miss); | 1989 __ bind(&miss); |
| 1998 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); | 1990 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); |
| 1999 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1991 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 2000 | 1992 |
| 2001 // Return the generated code. | 1993 // Return the generated code. |
| 2002 return GetCode(INTERCEPTOR, name); | 1994 return GetCode(INTERCEPTOR, name); |
| 2003 } | 1995 } |
| 2004 | 1996 |
| 2005 | 1997 |
| 2006 | 1998 |
| 2007 | 1999 |
| 2008 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 2000 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
| 2009 // ----------- S t a t e ------------- | 2001 // ----------- S t a t e ------------- |
| 2002 // -- eax : key |
| 2003 // -- edx : receiver |
| 2010 // -- esp[0] : return address | 2004 // -- esp[0] : return address |
| 2011 // -- esp[4] : name | |
| 2012 // -- esp[8] : receiver | |
| 2013 // ----------------------------------- | 2005 // ----------------------------------- |
| 2014 Label miss; | 2006 Label miss; |
| 2015 | 2007 |
| 2016 __ mov(eax, Operand(esp, kPointerSize)); | |
| 2017 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 2018 __ IncrementCounter(&Counters::keyed_load_array_length, 1); | 2008 __ IncrementCounter(&Counters::keyed_load_array_length, 1); |
| 2019 | 2009 |
| 2020 // Check that the name has not changed. | 2010 // Check that the name has not changed. |
| 2021 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 2011 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 2022 __ j(not_equal, &miss, not_taken); | 2012 __ j(not_equal, &miss, not_taken); |
| 2023 | 2013 |
| 2024 GenerateLoadArrayLength(masm(), ecx, edx, &miss); | 2014 GenerateLoadArrayLength(masm(), edx, ecx, &miss); |
| 2025 __ bind(&miss); | 2015 __ bind(&miss); |
| 2026 __ DecrementCounter(&Counters::keyed_load_array_length, 1); | 2016 __ DecrementCounter(&Counters::keyed_load_array_length, 1); |
| 2027 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2017 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 2028 | 2018 |
| 2029 // Return the generated code. | 2019 // Return the generated code. |
| 2030 return GetCode(CALLBACKS, name); | 2020 return GetCode(CALLBACKS, name); |
| 2031 } | 2021 } |
| 2032 | 2022 |
| 2033 | 2023 |
| 2034 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 2024 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
| 2035 // ----------- S t a t e ------------- | 2025 // ----------- S t a t e ------------- |
| 2026 // -- eax : key |
| 2027 // -- edx : receiver |
| 2036 // -- esp[0] : return address | 2028 // -- esp[0] : return address |
| 2037 // -- esp[4] : name | |
| 2038 // -- esp[8] : receiver | |
| 2039 // ----------------------------------- | 2029 // ----------------------------------- |
| 2040 Label miss; | 2030 Label miss; |
| 2041 | 2031 |
| 2042 __ mov(eax, Operand(esp, kPointerSize)); | |
| 2043 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 2044 __ IncrementCounter(&Counters::keyed_load_string_length, 1); | 2032 __ IncrementCounter(&Counters::keyed_load_string_length, 1); |
| 2045 | 2033 |
| 2046 // Check that the name has not changed. | 2034 // Check that the name has not changed. |
| 2047 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 2035 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 2048 __ j(not_equal, &miss, not_taken); | 2036 __ j(not_equal, &miss, not_taken); |
| 2049 | 2037 |
| 2050 GenerateLoadStringLength(masm(), ecx, edx, ebx, &miss); | 2038 GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss); |
| 2051 __ bind(&miss); | 2039 __ bind(&miss); |
| 2052 __ DecrementCounter(&Counters::keyed_load_string_length, 1); | 2040 __ DecrementCounter(&Counters::keyed_load_string_length, 1); |
| 2053 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2041 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 2054 | 2042 |
| 2055 // Return the generated code. | 2043 // Return the generated code. |
| 2056 return GetCode(CALLBACKS, name); | 2044 return GetCode(CALLBACKS, name); |
| 2057 } | 2045 } |
| 2058 | 2046 |
| 2059 | 2047 |
| 2060 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 2048 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
| 2061 // ----------- S t a t e ------------- | 2049 // ----------- S t a t e ------------- |
| 2050 // -- eax : key |
| 2051 // -- edx : receiver |
| 2062 // -- esp[0] : return address | 2052 // -- esp[0] : return address |
| 2063 // -- esp[4] : name | |
| 2064 // -- esp[8] : receiver | |
| 2065 // ----------------------------------- | 2053 // ----------------------------------- |
| 2066 Label miss; | 2054 Label miss; |
| 2067 | 2055 |
| 2068 __ mov(eax, Operand(esp, kPointerSize)); | |
| 2069 __ mov(ecx, Operand(esp, 2 * kPointerSize)); | |
| 2070 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); | 2056 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); |
| 2071 | 2057 |
| 2072 // Check that the name has not changed. | 2058 // Check that the name has not changed. |
| 2073 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 2059 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 2074 __ j(not_equal, &miss, not_taken); | 2060 __ j(not_equal, &miss, not_taken); |
| 2075 | 2061 |
| 2076 GenerateLoadFunctionPrototype(masm(), ecx, edx, ebx, &miss); | 2062 GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss); |
| 2077 __ bind(&miss); | 2063 __ bind(&miss); |
| 2078 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); | 2064 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); |
| 2079 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2065 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 2080 | 2066 |
| 2081 // Return the generated code. | 2067 // Return the generated code. |
| 2082 return GetCode(CALLBACKS, name); | 2068 return GetCode(CALLBACKS, name); |
| 2083 } | 2069 } |
| 2084 | 2070 |
| 2085 | 2071 |
| 2086 // Specialized stub for constructing objects from functions which only have only | 2072 // Specialized stub for constructing objects from functions which only have only |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2202 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 2217 | 2203 |
| 2218 // Return the generated code. | 2204 // Return the generated code. |
| 2219 return GetCode(); | 2205 return GetCode(); |
| 2220 } | 2206 } |
| 2221 | 2207 |
| 2222 | 2208 |
| 2223 #undef __ | 2209 #undef __ |
| 2224 | 2210 |
| 2225 } } // namespace v8::internal | 2211 } } // namespace v8::internal |
| OLD | NEW |