Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 136443006: Remove special charAt and charCodeAt handling in the ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 __ TailCallExternalReference( 1865 __ TailCallExternalReference(
1866 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); 1866 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1);
1867 1867
1868 HandlerFrontendFooter(&miss); 1868 HandlerFrontendFooter(&miss);
1869 1869
1870 // Return the generated code. 1870 // Return the generated code.
1871 return GetCode(type, name); 1871 return GetCode(type, name);
1872 } 1872 }
1873 1873
1874 1874
1875 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
1876 Handle<Object> object,
1877 Handle<JSObject> holder,
1878 Handle<Cell> cell,
1879 Handle<JSFunction> function,
1880 Handle<String> name,
1881 Code::StubType type) {
1882 // If object is not a string, bail out to regular call.
1883 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
1884
1885 Label miss;
1886 Label name_miss;
1887 Label index_out_of_range;
1888
1889 Label* index_out_of_range_label = &index_out_of_range;
1890
1891 if (kind_ == Code::CALL_IC &&
1892 (CallICBase::StringStubState::decode(extra_state()) ==
1893 DEFAULT_STRING_STUB)) {
1894 index_out_of_range_label = &miss;
1895 }
1896
1897 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss);
1898
1899 Register receiver = a0;
1900 Register index = t1;
1901 Register result = a1;
1902 const int argc = arguments().immediate();
1903 __ lw(receiver, MemOperand(sp, argc * kPointerSize));
1904 if (argc > 0) {
1905 __ lw(index, MemOperand(sp, (argc - 1) * kPointerSize));
1906 } else {
1907 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1908 }
1909
1910 StringCharCodeAtGenerator generator(receiver,
1911 index,
1912 result,
1913 &miss, // When not a string.
1914 &miss, // When not a number.
1915 index_out_of_range_label,
1916 STRING_INDEX_IS_NUMBER);
1917 generator.GenerateFast(masm());
1918 __ mov(v0, result);
1919 __ DropAndRet(argc + 1);
1920
1921 StubRuntimeCallHelper call_helper;
1922 generator.GenerateSlow(masm(), call_helper);
1923
1924 if (index_out_of_range.is_linked()) {
1925 __ bind(&index_out_of_range);
1926 __ LoadRoot(v0, Heap::kNanValueRootIndex);
1927 __ DropAndRet(argc + 1);
1928 }
1929
1930 __ bind(&miss);
1931 // Restore function name in a2.
1932 __ li(a2, name);
1933 HandlerFrontendFooter(&name_miss);
1934
1935 // Return the generated code.
1936 return GetCode(type, name);
1937 }
1938
1939
1940 Handle<Code> CallStubCompiler::CompileStringCharAtCall(
1941 Handle<Object> object,
1942 Handle<JSObject> holder,
1943 Handle<Cell> cell,
1944 Handle<JSFunction> function,
1945 Handle<String> name,
1946 Code::StubType type) {
1947 // If object is not a string, bail out to regular call.
1948 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
1949
1950 const int argc = arguments().immediate();
1951 Label miss;
1952 Label name_miss;
1953 Label index_out_of_range;
1954 Label* index_out_of_range_label = &index_out_of_range;
1955 if (kind_ == Code::CALL_IC &&
1956 (CallICBase::StringStubState::decode(extra_state()) ==
1957 DEFAULT_STRING_STUB)) {
1958 index_out_of_range_label = &miss;
1959 }
1960
1961 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss);
1962
1963 Register receiver = a0;
1964 Register index = t1;
1965 Register scratch = a3;
1966 Register result = a1;
1967 if (argc > 0) {
1968 __ lw(index, MemOperand(sp, (argc - 1) * kPointerSize));
1969 } else {
1970 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1971 }
1972
1973 StringCharAtGenerator generator(receiver,
1974 index,
1975 scratch,
1976 result,
1977 &miss, // When not a string.
1978 &miss, // When not a number.
1979 index_out_of_range_label,
1980 STRING_INDEX_IS_NUMBER);
1981 generator.GenerateFast(masm());
1982 __ mov(v0, result);
1983 __ DropAndRet(argc + 1);
1984
1985 StubRuntimeCallHelper call_helper;
1986 generator.GenerateSlow(masm(), call_helper);
1987
1988 if (index_out_of_range.is_linked()) {
1989 __ bind(&index_out_of_range);
1990 __ LoadRoot(v0, Heap::kempty_stringRootIndex);
1991 __ DropAndRet(argc + 1);
1992 }
1993
1994 __ bind(&miss);
1995 // Restore function name in a2.
1996 __ li(a2, name);
1997 HandlerFrontendFooter(&name_miss);
1998
1999 // Return the generated code.
2000 return GetCode(type, name);
2001 }
2002
2003
2004 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( 1875 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
2005 Handle<Object> object, 1876 Handle<Object> object,
2006 Handle<JSObject> holder, 1877 Handle<JSObject> holder,
2007 Handle<Cell> cell, 1878 Handle<Cell> cell,
2008 Handle<JSFunction> function, 1879 Handle<JSFunction> function,
2009 Handle<String> name, 1880 Handle<String> name,
2010 Code::StubType type) { 1881 Code::StubType type) {
2011 const int argc = arguments().immediate(); 1882 const int argc = arguments().immediate();
2012 1883
2013 // If the object is not a JSObject or we got an unexpected number of 1884 // If the object is not a JSObject or we got an unexpected number of
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 // ----------------------------------- 2723 // -----------------------------------
2853 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2724 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2854 } 2725 }
2855 2726
2856 2727
2857 #undef __ 2728 #undef __
2858 2729
2859 } } // namespace v8::internal 2730 } } // namespace v8::internal
2860 2731
2861 #endif // V8_TARGET_ARCH_MIPS 2732 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698