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

Side by Side Diff: src/ia32/stub-cache-ia32.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/code-stubs.h ('k') | src/ic.h » ('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 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 argc + 1, 1974 argc + 1,
1975 1); 1975 1);
1976 1976
1977 HandlerFrontendFooter(&miss); 1977 HandlerFrontendFooter(&miss);
1978 1978
1979 // Return the generated code. 1979 // Return the generated code.
1980 return GetCode(type, name); 1980 return GetCode(type, name);
1981 } 1981 }
1982 1982
1983 1983
1984 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
1985 Handle<Object> object,
1986 Handle<JSObject> holder,
1987 Handle<Cell> cell,
1988 Handle<JSFunction> function,
1989 Handle<String> name,
1990 Code::StubType type) {
1991 // If object is not a string, bail out to regular call.
1992 if (!object->IsString() || !cell.is_null()) {
1993 return Handle<Code>::null();
1994 }
1995
1996 const int argc = arguments().immediate();
1997
1998 Label miss;
1999 Label name_miss;
2000 Label index_out_of_range;
2001 Label* index_out_of_range_label = &index_out_of_range;
2002
2003 if (kind_ == Code::CALL_IC &&
2004 (CallICBase::StringStubState::decode(extra_state()) ==
2005 DEFAULT_STRING_STUB)) {
2006 index_out_of_range_label = &miss;
2007 }
2008
2009 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss);
2010
2011 Register receiver = ebx;
2012 Register index = edi;
2013 Register result = eax;
2014 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
2015 if (argc > 0) {
2016 __ mov(index, Operand(esp, (argc - 0) * kPointerSize));
2017 } else {
2018 __ Set(index, Immediate(factory()->undefined_value()));
2019 }
2020
2021 StringCharCodeAtGenerator generator(receiver,
2022 index,
2023 result,
2024 &miss, // When not a string.
2025 &miss, // When not a number.
2026 index_out_of_range_label,
2027 STRING_INDEX_IS_NUMBER);
2028 generator.GenerateFast(masm());
2029 __ ret((argc + 1) * kPointerSize);
2030
2031 StubRuntimeCallHelper call_helper;
2032 generator.GenerateSlow(masm(), call_helper);
2033
2034 if (index_out_of_range.is_linked()) {
2035 __ bind(&index_out_of_range);
2036 __ Set(eax, Immediate(factory()->nan_value()));
2037 __ ret((argc + 1) * kPointerSize);
2038 }
2039
2040 __ bind(&miss);
2041 // Restore function name in ecx.
2042 __ Set(ecx, Immediate(name));
2043 HandlerFrontendFooter(&name_miss);
2044
2045 // Return the generated code.
2046 return GetCode(type, name);
2047 }
2048
2049
2050 Handle<Code> CallStubCompiler::CompileStringCharAtCall(
2051 Handle<Object> object,
2052 Handle<JSObject> holder,
2053 Handle<Cell> cell,
2054 Handle<JSFunction> function,
2055 Handle<String> name,
2056 Code::StubType type) {
2057 // If object is not a string, bail out to regular call.
2058 if (!object->IsString() || !cell.is_null()) {
2059 return Handle<Code>::null();
2060 }
2061
2062 const int argc = arguments().immediate();
2063
2064 Label miss;
2065 Label name_miss;
2066 Label index_out_of_range;
2067 Label* index_out_of_range_label = &index_out_of_range;
2068
2069 if (kind_ == Code::CALL_IC &&
2070 (CallICBase::StringStubState::decode(extra_state()) ==
2071 DEFAULT_STRING_STUB)) {
2072 index_out_of_range_label = &miss;
2073 }
2074
2075 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss);
2076
2077 Register receiver = eax;
2078 Register index = edi;
2079 Register scratch = edx;
2080 Register result = eax;
2081 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
2082 if (argc > 0) {
2083 __ mov(index, Operand(esp, (argc - 0) * kPointerSize));
2084 } else {
2085 __ Set(index, Immediate(factory()->undefined_value()));
2086 }
2087
2088 StringCharAtGenerator generator(receiver,
2089 index,
2090 scratch,
2091 result,
2092 &miss, // When not a string.
2093 &miss, // When not a number.
2094 index_out_of_range_label,
2095 STRING_INDEX_IS_NUMBER);
2096 generator.GenerateFast(masm());
2097 __ ret((argc + 1) * kPointerSize);
2098
2099 StubRuntimeCallHelper call_helper;
2100 generator.GenerateSlow(masm(), call_helper);
2101
2102 if (index_out_of_range.is_linked()) {
2103 __ bind(&index_out_of_range);
2104 __ Set(eax, Immediate(factory()->empty_string()));
2105 __ ret((argc + 1) * kPointerSize);
2106 }
2107
2108 __ bind(&miss);
2109 // Restore function name in ecx.
2110 __ Set(ecx, Immediate(name));
2111 HandlerFrontendFooter(&name_miss);
2112
2113 // Return the generated code.
2114 return GetCode(type, name);
2115 }
2116
2117
2118 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( 1984 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
2119 Handle<Object> object, 1985 Handle<Object> object,
2120 Handle<JSObject> holder, 1986 Handle<JSObject> holder,
2121 Handle<Cell> cell, 1987 Handle<Cell> cell,
2122 Handle<JSFunction> function, 1988 Handle<JSFunction> function,
2123 Handle<String> name, 1989 Handle<String> name,
2124 Code::StubType type) { 1990 Code::StubType type) {
2125 const int argc = arguments().immediate(); 1991 const int argc = arguments().immediate();
2126 1992
2127 // If the object is not a JSObject or we got an unexpected number of 1993 // If the object is not a JSObject or we got an unexpected number of
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2960 // ----------------------------------- 2826 // -----------------------------------
2961 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2827 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2962 } 2828 }
2963 2829
2964 2830
2965 #undef __ 2831 #undef __
2966 2832
2967 } } // namespace v8::internal 2833 } } // namespace v8::internal
2968 2834
2969 #endif // V8_TARGET_ARCH_IA32 2835 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698