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

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

Issue 17447004: MIPS: Use type feedback for Array (non-constructor) call sites. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « no previous file | 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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 1707
1708 // Handle call cache miss. 1708 // Handle call cache miss.
1709 __ bind(&miss); 1709 __ bind(&miss);
1710 GenerateMissBranch(); 1710 GenerateMissBranch();
1711 1711
1712 // Return the generated code. 1712 // Return the generated code.
1713 return GetCode(Code::FIELD, name); 1713 return GetCode(Code::FIELD, name);
1714 } 1714 }
1715 1715
1716 1716
1717 Handle<Code> CallStubCompiler::CompileArrayCodeCall(
1718 Handle<Object> object,
1719 Handle<JSObject> holder,
1720 Handle<Cell> cell,
1721 Handle<JSFunction> function,
1722 Handle<String> name,
1723 Code::StubType type) {
1724 Label miss;
1725
1726 // Check that function is still array
Paul Lind 2013/06/19 16:33:31 nit, end with period.
1727 const int argc = arguments().immediate();
1728 GenerateNameCheck(name, &miss);
1729 Register receiver = a1;
1730
1731 if (cell.is_null()) {
1732 __ lw(receiver, MemOperand(sp, argc * kPointerSize));
1733
1734 // Check that the receiver isn't a smi.
1735 __ JumpIfSmi(receiver, &miss);
1736
1737 // Check that the maps haven't changed.
1738 CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, a3, a0,
1739 t0, name, &miss);
1740 } else {
1741 ASSERT(cell->value() == *function);
1742 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
1743 &miss);
1744 GenerateLoadFunctionFromCell(cell, function, &miss);
1745 }
1746
1747 Handle<Smi> kind(Smi::FromInt(GetInitialFastElementsKind()), isolate());
1748 Handle<Cell> kind_feedback_cell =
1749 isolate()->factory()->NewCell(kind);
1750 __ li(a0, Operand(argc));
1751 __ li(a2, Operand(kind_feedback_cell));
1752 __ li(a1, Operand(function));
1753
1754 ArrayConstructorStub stub(isolate());
1755 __ TailCallStub(&stub);
1756
1757 __ bind(&miss);
1758 GenerateMissBranch();
1759
1760 // Return the generated code.
1761 return GetCode(type, name);
1762 }
1763
1764
1717 Handle<Code> CallStubCompiler::CompileArrayPushCall( 1765 Handle<Code> CallStubCompiler::CompileArrayPushCall(
1718 Handle<Object> object, 1766 Handle<Object> object,
1719 Handle<JSObject> holder, 1767 Handle<JSObject> holder,
1720 Handle<Cell> cell, 1768 Handle<Cell> cell,
1721 Handle<JSFunction> function, 1769 Handle<JSFunction> function,
1722 Handle<String> name) { 1770 Handle<String> name,
1771 Code::StubType type) {
1723 // ----------- S t a t e ------------- 1772 // ----------- S t a t e -------------
1724 // -- a2 : name 1773 // -- a2 : name
1725 // -- ra : return address 1774 // -- ra : return address
1726 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 1775 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1727 // -- ... 1776 // -- ...
1728 // -- sp[argc * 4] : receiver 1777 // -- sp[argc * 4] : receiver
1729 // ----------------------------------- 1778 // -----------------------------------
1730 1779
1731 // If object is not an array, bail out to regular call. 1780 // If object is not an array, bail out to regular call.
1732 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); 1781 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 __ bind(&call_builtin); 2006 __ bind(&call_builtin);
1958 __ TailCallExternalReference( 2007 __ TailCallExternalReference(
1959 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); 2008 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1);
1960 } 2009 }
1961 2010
1962 // Handle call cache miss. 2011 // Handle call cache miss.
1963 __ bind(&miss); 2012 __ bind(&miss);
1964 GenerateMissBranch(); 2013 GenerateMissBranch();
1965 2014
1966 // Return the generated code. 2015 // Return the generated code.
1967 return GetCode(function); 2016 return GetCode(type, name);
1968 } 2017 }
1969 2018
1970 2019
1971 Handle<Code> CallStubCompiler::CompileArrayPopCall( 2020 Handle<Code> CallStubCompiler::CompileArrayPopCall(
1972 Handle<Object> object, 2021 Handle<Object> object,
1973 Handle<JSObject> holder, 2022 Handle<JSObject> holder,
1974 Handle<Cell> cell, 2023 Handle<Cell> cell,
1975 Handle<JSFunction> function, 2024 Handle<JSFunction> function,
1976 Handle<String> name) { 2025 Handle<String> name,
2026 Code::StubType type) {
1977 // ----------- S t a t e ------------- 2027 // ----------- S t a t e -------------
1978 // -- a2 : name 2028 // -- a2 : name
1979 // -- ra : return address 2029 // -- ra : return address
1980 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2030 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1981 // -- ... 2031 // -- ...
1982 // -- sp[argc * 4] : receiver 2032 // -- sp[argc * 4] : receiver
1983 // ----------------------------------- 2033 // -----------------------------------
1984 2034
1985 // If object is not an array, bail out to regular call. 2035 // If object is not an array, bail out to regular call.
1986 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); 2036 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2089
2040 __ bind(&call_builtin); 2090 __ bind(&call_builtin);
2041 __ TailCallExternalReference( 2091 __ TailCallExternalReference(
2042 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); 2092 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1);
2043 2093
2044 // Handle call cache miss. 2094 // Handle call cache miss.
2045 __ bind(&miss); 2095 __ bind(&miss);
2046 GenerateMissBranch(); 2096 GenerateMissBranch();
2047 2097
2048 // Return the generated code. 2098 // Return the generated code.
2049 return GetCode(function); 2099 return GetCode(type, name);
2050 } 2100 }
2051 2101
2052 2102
2053 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( 2103 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
2054 Handle<Object> object, 2104 Handle<Object> object,
2055 Handle<JSObject> holder, 2105 Handle<JSObject> holder,
2056 Handle<Cell> cell, 2106 Handle<Cell> cell,
2057 Handle<JSFunction> function, 2107 Handle<JSFunction> function,
2058 Handle<String> name) { 2108 Handle<String> name,
2109 Code::StubType type) {
2059 // ----------- S t a t e ------------- 2110 // ----------- S t a t e -------------
2060 // -- a2 : function name 2111 // -- a2 : function name
2061 // -- ra : return address 2112 // -- ra : return address
2062 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2113 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2063 // -- ... 2114 // -- ...
2064 // -- sp[argc * 4] : receiver 2115 // -- sp[argc * 4] : receiver
2065 // ----------------------------------- 2116 // -----------------------------------
2066 2117
2067 // If object is not a string, bail out to regular call. 2118 // If object is not a string, bail out to regular call.
2068 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); 2119 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 __ DropAndRet(argc + 1); 2172 __ DropAndRet(argc + 1);
2122 } 2173 }
2123 2174
2124 __ bind(&miss); 2175 __ bind(&miss);
2125 // Restore function name in a2. 2176 // Restore function name in a2.
2126 __ li(a2, name); 2177 __ li(a2, name);
2127 __ bind(&name_miss); 2178 __ bind(&name_miss);
2128 GenerateMissBranch(); 2179 GenerateMissBranch();
2129 2180
2130 // Return the generated code. 2181 // Return the generated code.
2131 return GetCode(function); 2182 return GetCode(type, name);
2132 } 2183 }
2133 2184
2134 2185
2135 Handle<Code> CallStubCompiler::CompileStringCharAtCall( 2186 Handle<Code> CallStubCompiler::CompileStringCharAtCall(
2136 Handle<Object> object, 2187 Handle<Object> object,
2137 Handle<JSObject> holder, 2188 Handle<JSObject> holder,
2138 Handle<Cell> cell, 2189 Handle<Cell> cell,
2139 Handle<JSFunction> function, 2190 Handle<JSFunction> function,
2140 Handle<String> name) { 2191 Handle<String> name,
2192 Code::StubType type) {
2141 // ----------- S t a t e ------------- 2193 // ----------- S t a t e -------------
2142 // -- a2 : function name 2194 // -- a2 : function name
2143 // -- ra : return address 2195 // -- ra : return address
2144 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2196 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2145 // -- ... 2197 // -- ...
2146 // -- sp[argc * 4] : receiver 2198 // -- sp[argc * 4] : receiver
2147 // ----------------------------------- 2199 // -----------------------------------
2148 2200
2149 // If object is not a string, bail out to regular call. 2201 // If object is not a string, bail out to regular call.
2150 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); 2202 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 __ DropAndRet(argc + 1); 2254 __ DropAndRet(argc + 1);
2203 } 2255 }
2204 2256
2205 __ bind(&miss); 2257 __ bind(&miss);
2206 // Restore function name in a2. 2258 // Restore function name in a2.
2207 __ li(a2, name); 2259 __ li(a2, name);
2208 __ bind(&name_miss); 2260 __ bind(&name_miss);
2209 GenerateMissBranch(); 2261 GenerateMissBranch();
2210 2262
2211 // Return the generated code. 2263 // Return the generated code.
2212 return GetCode(function); 2264 return GetCode(type, name);
2213 } 2265 }
2214 2266
2215 2267
2216 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( 2268 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
2217 Handle<Object> object, 2269 Handle<Object> object,
2218 Handle<JSObject> holder, 2270 Handle<JSObject> holder,
2219 Handle<Cell> cell, 2271 Handle<Cell> cell,
2220 Handle<JSFunction> function, 2272 Handle<JSFunction> function,
2221 Handle<String> name) { 2273 Handle<String> name,
2274 Code::StubType type) {
2222 // ----------- S t a t e ------------- 2275 // ----------- S t a t e -------------
2223 // -- a2 : function name 2276 // -- a2 : function name
2224 // -- ra : return address 2277 // -- ra : return address
2225 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2278 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2226 // -- ... 2279 // -- ...
2227 // -- sp[argc * 4] : receiver 2280 // -- sp[argc * 4] : receiver
2228 // ----------------------------------- 2281 // -----------------------------------
2229 2282
2230 const int argc = arguments().immediate(); 2283 const int argc = arguments().immediate();
2231 2284
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 __ bind(&slow); 2328 __ bind(&slow);
2276 ParameterCount expected(function); 2329 ParameterCount expected(function);
2277 __ InvokeFunction(function, expected, arguments(), 2330 __ InvokeFunction(function, expected, arguments(),
2278 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2331 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2279 2332
2280 __ bind(&miss); 2333 __ bind(&miss);
2281 // a2: function name. 2334 // a2: function name.
2282 GenerateMissBranch(); 2335 GenerateMissBranch();
2283 2336
2284 // Return the generated code. 2337 // Return the generated code.
2285 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2338 return GetCode(type, name);
2286 } 2339 }
2287 2340
2288 2341
2289 Handle<Code> CallStubCompiler::CompileMathFloorCall( 2342 Handle<Code> CallStubCompiler::CompileMathFloorCall(
2290 Handle<Object> object, 2343 Handle<Object> object,
2291 Handle<JSObject> holder, 2344 Handle<JSObject> holder,
2292 Handle<Cell> cell, 2345 Handle<Cell> cell,
2293 Handle<JSFunction> function, 2346 Handle<JSFunction> function,
2294 Handle<String> name) { 2347 Handle<String> name,
2348 Code::StubType type) {
2295 // ----------- S t a t e ------------- 2349 // ----------- S t a t e -------------
2296 // -- a2 : function name 2350 // -- a2 : function name
2297 // -- ra : return address 2351 // -- ra : return address
2298 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2352 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2299 // -- ... 2353 // -- ...
2300 // -- sp[argc * 4] : receiver 2354 // -- sp[argc * 4] : receiver
2301 // ----------------------------------- 2355 // -----------------------------------
2302 2356
2303 2357
2304 const int argc = arguments().immediate(); 2358 const int argc = arguments().immediate();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 // because the function makes no use of it. 2458 // because the function makes no use of it.
2405 ParameterCount expected(function); 2459 ParameterCount expected(function);
2406 __ InvokeFunction(function, expected, arguments(), 2460 __ InvokeFunction(function, expected, arguments(),
2407 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2461 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2408 2462
2409 __ bind(&miss); 2463 __ bind(&miss);
2410 // a2: function name. 2464 // a2: function name.
2411 GenerateMissBranch(); 2465 GenerateMissBranch();
2412 2466
2413 // Return the generated code. 2467 // Return the generated code.
2414 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2468 return GetCode(type, name);
2415 } 2469 }
2416 2470
2417 2471
2418 Handle<Code> CallStubCompiler::CompileMathAbsCall( 2472 Handle<Code> CallStubCompiler::CompileMathAbsCall(
2419 Handle<Object> object, 2473 Handle<Object> object,
2420 Handle<JSObject> holder, 2474 Handle<JSObject> holder,
2421 Handle<Cell> cell, 2475 Handle<Cell> cell,
2422 Handle<JSFunction> function, 2476 Handle<JSFunction> function,
2423 Handle<String> name) { 2477 Handle<String> name,
2478 Code::StubType type) {
2424 // ----------- S t a t e ------------- 2479 // ----------- S t a t e -------------
2425 // -- a2 : function name 2480 // -- a2 : function name
2426 // -- ra : return address 2481 // -- ra : return address
2427 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2482 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2428 // -- ... 2483 // -- ...
2429 // -- sp[argc * 4] : receiver 2484 // -- sp[argc * 4] : receiver
2430 // ----------------------------------- 2485 // -----------------------------------
2431 2486
2432 const int argc = arguments().immediate(); 2487 const int argc = arguments().immediate();
2433 // If the object is not a JSObject or we got an unexpected number of 2488 // If the object is not a JSObject or we got an unexpected number of
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 __ bind(&slow); 2558 __ bind(&slow);
2504 ParameterCount expected(function); 2559 ParameterCount expected(function);
2505 __ InvokeFunction(function, expected, arguments(), 2560 __ InvokeFunction(function, expected, arguments(),
2506 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2561 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2507 2562
2508 __ bind(&miss); 2563 __ bind(&miss);
2509 // a2: function name. 2564 // a2: function name.
2510 GenerateMissBranch(); 2565 GenerateMissBranch();
2511 2566
2512 // Return the generated code. 2567 // Return the generated code.
2513 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2568 return GetCode(type, name);
2514 } 2569 }
2515 2570
2516 2571
2517 Handle<Code> CallStubCompiler::CompileFastApiCall( 2572 Handle<Code> CallStubCompiler::CompileFastApiCall(
2518 const CallOptimization& optimization, 2573 const CallOptimization& optimization,
2519 Handle<Object> object, 2574 Handle<Object> object,
2520 Handle<JSObject> holder, 2575 Handle<JSObject> holder,
2521 Handle<Cell> cell, 2576 Handle<Cell> cell,
2522 Handle<JSFunction> function, 2577 Handle<JSFunction> function,
2523 Handle<String> name) { 2578 Handle<String> name) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 2740
2686 Handle<Code> CallStubCompiler::CompileCallConstant( 2741 Handle<Code> CallStubCompiler::CompileCallConstant(
2687 Handle<Object> object, 2742 Handle<Object> object,
2688 Handle<JSObject> holder, 2743 Handle<JSObject> holder,
2689 Handle<Name> name, 2744 Handle<Name> name,
2690 CheckType check, 2745 CheckType check,
2691 Handle<JSFunction> function) { 2746 Handle<JSFunction> function) {
2692 if (HasCustomCallGenerator(function)) { 2747 if (HasCustomCallGenerator(function)) {
2693 Handle<Code> code = CompileCustomCall(object, holder, 2748 Handle<Code> code = CompileCustomCall(object, holder,
2694 Handle<Cell>::null(), 2749 Handle<Cell>::null(),
2695 function, Handle<String>::cast(name)); 2750 function, Handle<String>::cast(name),
2751 Code::CONSTANT_FUNCTION);
2696 // A null handle means bail out to the regular compiler code below. 2752 // A null handle means bail out to the regular compiler code below.
2697 if (!code.is_null()) return code; 2753 if (!code.is_null()) return code;
2698 } 2754 }
2699 2755
2700 Label success; 2756 Label success;
2701 2757
2702 CompileHandlerFrontend(object, holder, name, check, &success); 2758 CompileHandlerFrontend(object, holder, name, check, &success);
2703 __ bind(&success); 2759 __ bind(&success);
2704 CompileHandlerBackend(function); 2760 CompileHandlerBackend(function);
2705 2761
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 Handle<PropertyCell> cell, 2810 Handle<PropertyCell> cell,
2755 Handle<JSFunction> function, 2811 Handle<JSFunction> function,
2756 Handle<Name> name) { 2812 Handle<Name> name) {
2757 // ----------- S t a t e ------------- 2813 // ----------- S t a t e -------------
2758 // -- a2 : name 2814 // -- a2 : name
2759 // -- ra : return address 2815 // -- ra : return address
2760 // ----------------------------------- 2816 // -----------------------------------
2761 2817
2762 if (HasCustomCallGenerator(function)) { 2818 if (HasCustomCallGenerator(function)) {
2763 Handle<Code> code = CompileCustomCall( 2819 Handle<Code> code = CompileCustomCall(
2764 object, holder, cell, function, Handle<String>::cast(name)); 2820 object, holder, cell, function, Handle<String>::cast(name),
2821 Code::NORMAL);
2765 // A null handle means bail out to the regular compiler code below. 2822 // A null handle means bail out to the regular compiler code below.
2766 if (!code.is_null()) return code; 2823 if (!code.is_null()) return code;
2767 } 2824 }
2768 2825
2769 Label miss; 2826 Label miss;
2770 GenerateNameCheck(name, &miss); 2827 GenerateNameCheck(name, &miss);
2771 2828
2772 // Get the number of arguments. 2829 // Get the number of arguments.
2773 const int argc = arguments().immediate(); 2830 const int argc = arguments().immediate();
2774 GenerateGlobalReceiverCheck(object, holder, name, &miss); 2831 GenerateGlobalReceiverCheck(object, holder, name, &miss);
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
3778 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3835 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3779 } 3836 }
3780 } 3837 }
3781 3838
3782 3839
3783 #undef __ 3840 #undef __
3784 3841
3785 } } // namespace v8::internal 3842 } } // namespace v8::internal
3786 3843
3787 #endif // V8_TARGET_ARCH_MIPS 3844 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698