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

Side by Side Diff: src/x64/stub-cache-x64.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/type-info.cc ('k') | no next file » | 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 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 argc + 1, 1898 argc + 1,
1899 1); 1899 1);
1900 1900
1901 HandlerFrontendFooter(&miss); 1901 HandlerFrontendFooter(&miss);
1902 1902
1903 // Return the generated code. 1903 // Return the generated code.
1904 return GetCode(type, name); 1904 return GetCode(type, name);
1905 } 1905 }
1906 1906
1907 1907
1908 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
1909 Handle<Object> object,
1910 Handle<JSObject> holder,
1911 Handle<Cell> cell,
1912 Handle<JSFunction> function,
1913 Handle<String> name,
1914 Code::StubType type) {
1915 // If object is not a string, bail out to regular call.
1916 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
1917
1918 Label miss;
1919 Label name_miss;
1920 Label index_out_of_range;
1921 Label* index_out_of_range_label = &index_out_of_range;
1922 if (kind_ == Code::CALL_IC &&
1923 (CallICBase::StringStubState::decode(extra_state()) ==
1924 DEFAULT_STRING_STUB)) {
1925 index_out_of_range_label = &miss;
1926 }
1927
1928 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss);
1929
1930 Register receiver = rbx;
1931 Register index = rdi;
1932 Register result = rax;
1933 const int argc = arguments().immediate();
1934 StackArgumentsAccessor args(rsp, argc);
1935
1936 __ movq(receiver, args.GetReceiverOperand());
1937 if (argc > 0) {
1938 __ movq(index, args.GetArgumentOperand(1));
1939 } else {
1940 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1941 }
1942
1943 StringCharCodeAtGenerator generator(receiver,
1944 index,
1945 result,
1946 &miss, // When not a string.
1947 &miss, // When not a number.
1948 index_out_of_range_label,
1949 STRING_INDEX_IS_NUMBER);
1950 generator.GenerateFast(masm());
1951 __ ret((argc + 1) * kPointerSize);
1952
1953 StubRuntimeCallHelper call_helper;
1954 generator.GenerateSlow(masm(), call_helper);
1955
1956 if (index_out_of_range.is_linked()) {
1957 __ bind(&index_out_of_range);
1958 __ LoadRoot(rax, Heap::kNanValueRootIndex);
1959 __ ret((argc + 1) * kPointerSize);
1960 }
1961
1962 __ bind(&miss);
1963 // Restore function name in rcx.
1964 __ Move(rcx, name);
1965 HandlerFrontendFooter(&name_miss);
1966
1967 // Return the generated code.
1968 return GetCode(type, name);
1969 }
1970
1971
1972 Handle<Code> CallStubCompiler::CompileStringCharAtCall(
1973 Handle<Object> object,
1974 Handle<JSObject> holder,
1975 Handle<Cell> cell,
1976 Handle<JSFunction> function,
1977 Handle<String> name,
1978 Code::StubType type) {
1979 // If object is not a string, bail out to regular call.
1980 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
1981
1982 const int argc = arguments().immediate();
1983 StackArgumentsAccessor args(rsp, argc);
1984
1985 Label miss;
1986 Label name_miss;
1987 Label index_out_of_range;
1988 Label* index_out_of_range_label = &index_out_of_range;
1989 if (kind_ == Code::CALL_IC &&
1990 (CallICBase::StringStubState::decode(extra_state()) ==
1991 DEFAULT_STRING_STUB)) {
1992 index_out_of_range_label = &miss;
1993 }
1994
1995 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss);
1996
1997 Register receiver = rax;
1998 Register index = rdi;
1999 Register scratch = rdx;
2000 Register result = rax;
2001 __ movq(receiver, args.GetReceiverOperand());
2002 if (argc > 0) {
2003 __ movq(index, args.GetArgumentOperand(1));
2004 } else {
2005 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
2006 }
2007
2008 StringCharAtGenerator generator(receiver,
2009 index,
2010 scratch,
2011 result,
2012 &miss, // When not a string.
2013 &miss, // When not a number.
2014 index_out_of_range_label,
2015 STRING_INDEX_IS_NUMBER);
2016 generator.GenerateFast(masm());
2017 __ ret((argc + 1) * kPointerSize);
2018
2019 StubRuntimeCallHelper call_helper;
2020 generator.GenerateSlow(masm(), call_helper);
2021
2022 if (index_out_of_range.is_linked()) {
2023 __ bind(&index_out_of_range);
2024 __ LoadRoot(rax, Heap::kempty_stringRootIndex);
2025 __ ret((argc + 1) * kPointerSize);
2026 }
2027 __ bind(&miss);
2028 // Restore function name in rcx.
2029 __ Move(rcx, name);
2030 HandlerFrontendFooter(&name_miss);
2031
2032 // Return the generated code.
2033 return GetCode(type, name);
2034 }
2035
2036
2037 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( 1908 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
2038 Handle<Object> object, 1909 Handle<Object> object,
2039 Handle<JSObject> holder, 1910 Handle<JSObject> holder,
2040 Handle<Cell> cell, 1911 Handle<Cell> cell,
2041 Handle<JSFunction> function, 1912 Handle<JSFunction> function,
2042 Handle<String> name, 1913 Handle<String> name,
2043 Code::StubType type) { 1914 Code::StubType type) {
2044 // If the object is not a JSObject or we got an unexpected number of 1915 // If the object is not a JSObject or we got an unexpected number of
2045 // arguments, bail out to the regular call. 1916 // arguments, bail out to the regular call.
2046 const int argc = arguments().immediate(); 1917 const int argc = arguments().immediate();
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 // ----------------------------------- 2745 // -----------------------------------
2875 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2746 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2876 } 2747 }
2877 2748
2878 2749
2879 #undef __ 2750 #undef __
2880 2751
2881 } } // namespace v8::internal 2752 } } // namespace v8::internal
2882 2753
2883 #endif // V8_TARGET_ARCH_X64 2754 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698