OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 __ TailCallExternalReference( | 1882 __ TailCallExternalReference( |
1883 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | 1883 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); |
1884 | 1884 |
1885 HandlerFrontendFooter(&miss); | 1885 HandlerFrontendFooter(&miss); |
1886 | 1886 |
1887 // Return the generated code. | 1887 // Return the generated code. |
1888 return GetCode(type, name); | 1888 return GetCode(type, name); |
1889 } | 1889 } |
1890 | 1890 |
1891 | 1891 |
1892 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( | |
1893 Handle<Object> object, | |
1894 Handle<JSObject> holder, | |
1895 Handle<Cell> cell, | |
1896 Handle<JSFunction> function, | |
1897 Handle<String> name, | |
1898 Code::StubType type) { | |
1899 // If object is not a string, bail out to regular call. | |
1900 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); | |
1901 | |
1902 Label miss; | |
1903 Label name_miss; | |
1904 Label index_out_of_range; | |
1905 Label* index_out_of_range_label = &index_out_of_range; | |
1906 | |
1907 if (kind_ == Code::CALL_IC && | |
1908 (CallICBase::StringStubState::decode(extra_state()) == | |
1909 DEFAULT_STRING_STUB)) { | |
1910 index_out_of_range_label = &miss; | |
1911 } | |
1912 | |
1913 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); | |
1914 | |
1915 Register receiver = r0; | |
1916 Register index = r4; | |
1917 Register result = r1; | |
1918 const int argc = arguments().immediate(); | |
1919 __ ldr(receiver, MemOperand(sp, argc * kPointerSize)); | |
1920 if (argc > 0) { | |
1921 __ ldr(index, MemOperand(sp, (argc - 1) * kPointerSize)); | |
1922 } else { | |
1923 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | |
1924 } | |
1925 | |
1926 StringCharCodeAtGenerator generator(receiver, | |
1927 index, | |
1928 result, | |
1929 &miss, // When not a string. | |
1930 &miss, // When not a number. | |
1931 index_out_of_range_label, | |
1932 STRING_INDEX_IS_NUMBER); | |
1933 generator.GenerateFast(masm()); | |
1934 __ Drop(argc + 1); | |
1935 __ mov(r0, result); | |
1936 __ Ret(); | |
1937 | |
1938 StubRuntimeCallHelper call_helper; | |
1939 generator.GenerateSlow(masm(), call_helper); | |
1940 | |
1941 if (index_out_of_range.is_linked()) { | |
1942 __ bind(&index_out_of_range); | |
1943 __ LoadRoot(r0, Heap::kNanValueRootIndex); | |
1944 __ Drop(argc + 1); | |
1945 __ Ret(); | |
1946 } | |
1947 | |
1948 __ bind(&miss); | |
1949 // Restore function name in r2. | |
1950 __ Move(r2, name); | |
1951 HandlerFrontendFooter(&name_miss); | |
1952 | |
1953 // Return the generated code. | |
1954 return GetCode(type, name); | |
1955 } | |
1956 | |
1957 | |
1958 Handle<Code> CallStubCompiler::CompileStringCharAtCall( | |
1959 Handle<Object> object, | |
1960 Handle<JSObject> holder, | |
1961 Handle<Cell> cell, | |
1962 Handle<JSFunction> function, | |
1963 Handle<String> name, | |
1964 Code::StubType type) { | |
1965 // If object is not a string, bail out to regular call. | |
1966 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); | |
1967 | |
1968 const int argc = arguments().immediate(); | |
1969 Label miss; | |
1970 Label name_miss; | |
1971 Label index_out_of_range; | |
1972 Label* index_out_of_range_label = &index_out_of_range; | |
1973 if (kind_ == Code::CALL_IC && | |
1974 (CallICBase::StringStubState::decode(extra_state()) == | |
1975 DEFAULT_STRING_STUB)) { | |
1976 index_out_of_range_label = &miss; | |
1977 } | |
1978 | |
1979 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); | |
1980 | |
1981 Register receiver = r0; | |
1982 Register index = r4; | |
1983 Register scratch = r3; | |
1984 Register result = r1; | |
1985 if (argc > 0) { | |
1986 __ ldr(index, MemOperand(sp, (argc - 1) * kPointerSize)); | |
1987 } else { | |
1988 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | |
1989 } | |
1990 | |
1991 StringCharAtGenerator generator(receiver, | |
1992 index, | |
1993 scratch, | |
1994 result, | |
1995 &miss, // When not a string. | |
1996 &miss, // When not a number. | |
1997 index_out_of_range_label, | |
1998 STRING_INDEX_IS_NUMBER); | |
1999 generator.GenerateFast(masm()); | |
2000 __ Drop(argc + 1); | |
2001 __ mov(r0, result); | |
2002 __ Ret(); | |
2003 | |
2004 StubRuntimeCallHelper call_helper; | |
2005 generator.GenerateSlow(masm(), call_helper); | |
2006 | |
2007 if (index_out_of_range.is_linked()) { | |
2008 __ bind(&index_out_of_range); | |
2009 __ LoadRoot(r0, Heap::kempty_stringRootIndex); | |
2010 __ Drop(argc + 1); | |
2011 __ Ret(); | |
2012 } | |
2013 | |
2014 __ bind(&miss); | |
2015 // Restore function name in r2. | |
2016 __ Move(r2, name); | |
2017 HandlerFrontendFooter(&name_miss); | |
2018 | |
2019 // Return the generated code. | |
2020 return GetCode(type, name); | |
2021 } | |
2022 | |
2023 | |
2024 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( | 1892 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
2025 Handle<Object> object, | 1893 Handle<Object> object, |
2026 Handle<JSObject> holder, | 1894 Handle<JSObject> holder, |
2027 Handle<Cell> cell, | 1895 Handle<Cell> cell, |
2028 Handle<JSFunction> function, | 1896 Handle<JSFunction> function, |
2029 Handle<String> name, | 1897 Handle<String> name, |
2030 Code::StubType type) { | 1898 Code::StubType type) { |
2031 const int argc = arguments().immediate(); | 1899 const int argc = arguments().immediate(); |
2032 | 1900 |
2033 // If the object is not a JSObject or we got an unexpected number of | 1901 // If the object is not a JSObject or we got an unexpected number of |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2858 // ----------------------------------- | 2726 // ----------------------------------- |
2859 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2727 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2860 } | 2728 } |
2861 | 2729 |
2862 | 2730 |
2863 #undef __ | 2731 #undef __ |
2864 | 2732 |
2865 } } // namespace v8::internal | 2733 } } // namespace v8::internal |
2866 | 2734 |
2867 #endif // V8_TARGET_ARCH_ARM | 2735 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |