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

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

Issue 17155010: Use type feedback for Array (non-constructor) call sites. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Nit fixin' 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 | src/bootstrapper.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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 1691
1692 // Handle call cache miss. 1692 // Handle call cache miss.
1693 __ bind(&miss); 1693 __ bind(&miss);
1694 GenerateMissBranch(); 1694 GenerateMissBranch();
1695 1695
1696 // Return the generated code. 1696 // Return the generated code.
1697 return GetCode(Code::FIELD, name); 1697 return GetCode(Code::FIELD, name);
1698 } 1698 }
1699 1699
1700 1700
1701 Handle<Code> CallStubCompiler::CompileArrayCodeCall(
1702 Handle<Object> object,
1703 Handle<JSObject> holder,
1704 Handle<Cell> cell,
1705 Handle<JSFunction> function,
1706 Handle<String> name,
1707 Code::StubType type) {
1708 Label miss;
1709
1710 // Check that function is still array
1711 const int argc = arguments().immediate();
1712 GenerateNameCheck(name, &miss);
1713 Register receiver = r1;
1714
1715 if (cell.is_null()) {
1716 __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
1717
1718 // Check that the receiver isn't a smi.
1719 __ JumpIfSmi(receiver, &miss);
1720
1721 // Check that the maps haven't changed.
1722 CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, r3, r0,
1723 r4, name, &miss);
1724 } else {
1725 ASSERT(cell->value() == *function);
1726 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
1727 &miss);
1728 GenerateLoadFunctionFromCell(cell, function, &miss);
1729 }
1730
1731 Handle<Smi> kind(Smi::FromInt(GetInitialFastElementsKind()), isolate());
1732 Handle<Cell> kind_feedback_cell =
1733 isolate()->factory()->NewCell(kind);
1734 __ mov(r0, Operand(argc));
1735 __ mov(r2, Operand(kind_feedback_cell));
1736 __ mov(r1, Operand(function));
1737
1738 ArrayConstructorStub stub(isolate());
1739 __ TailCallStub(&stub);
1740
1741 __ bind(&miss);
1742 GenerateMissBranch();
1743
1744 // Return the generated code.
1745 return GetCode(type, name);
1746 }
1747
1748
1701 Handle<Code> CallStubCompiler::CompileArrayPushCall( 1749 Handle<Code> CallStubCompiler::CompileArrayPushCall(
1702 Handle<Object> object, 1750 Handle<Object> object,
1703 Handle<JSObject> holder, 1751 Handle<JSObject> holder,
1704 Handle<Cell> cell, 1752 Handle<Cell> cell,
1705 Handle<JSFunction> function, 1753 Handle<JSFunction> function,
1706 Handle<String> name) { 1754 Handle<String> name,
1755 Code::StubType type) {
1707 // ----------- S t a t e ------------- 1756 // ----------- S t a t e -------------
1708 // -- r2 : name 1757 // -- r2 : name
1709 // -- lr : return address 1758 // -- lr : return address
1710 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 1759 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1711 // -- ... 1760 // -- ...
1712 // -- sp[argc * 4] : receiver 1761 // -- sp[argc * 4] : receiver
1713 // ----------------------------------- 1762 // -----------------------------------
1714 1763
1715 // If object is not an array, bail out to regular call. 1764 // If object is not an array, bail out to regular call.
1716 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); 1765 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 __ bind(&call_builtin); 1989 __ bind(&call_builtin);
1941 __ TailCallExternalReference( 1990 __ TailCallExternalReference(
1942 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); 1991 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1);
1943 } 1992 }
1944 1993
1945 // Handle call cache miss. 1994 // Handle call cache miss.
1946 __ bind(&miss); 1995 __ bind(&miss);
1947 GenerateMissBranch(); 1996 GenerateMissBranch();
1948 1997
1949 // Return the generated code. 1998 // Return the generated code.
1950 return GetCode(function); 1999 return GetCode(type, name);
1951 } 2000 }
1952 2001
1953 2002
1954 Handle<Code> CallStubCompiler::CompileArrayPopCall( 2003 Handle<Code> CallStubCompiler::CompileArrayPopCall(
1955 Handle<Object> object, 2004 Handle<Object> object,
1956 Handle<JSObject> holder, 2005 Handle<JSObject> holder,
1957 Handle<Cell> cell, 2006 Handle<Cell> cell,
1958 Handle<JSFunction> function, 2007 Handle<JSFunction> function,
1959 Handle<String> name) { 2008 Handle<String> name,
2009 Code::StubType type) {
1960 // ----------- S t a t e ------------- 2010 // ----------- S t a t e -------------
1961 // -- r2 : name 2011 // -- r2 : name
1962 // -- lr : return address 2012 // -- lr : return address
1963 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2013 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1964 // -- ... 2014 // -- ...
1965 // -- sp[argc * 4] : receiver 2015 // -- sp[argc * 4] : receiver
1966 // ----------------------------------- 2016 // -----------------------------------
1967 2017
1968 // If object is not an array, bail out to regular call. 2018 // If object is not an array, bail out to regular call.
1969 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); 2019 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 2072
2023 __ bind(&call_builtin); 2073 __ bind(&call_builtin);
2024 __ TailCallExternalReference( 2074 __ TailCallExternalReference(
2025 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); 2075 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1);
2026 2076
2027 // Handle call cache miss. 2077 // Handle call cache miss.
2028 __ bind(&miss); 2078 __ bind(&miss);
2029 GenerateMissBranch(); 2079 GenerateMissBranch();
2030 2080
2031 // Return the generated code. 2081 // Return the generated code.
2032 return GetCode(function); 2082 return GetCode(type, name);
2033 } 2083 }
2034 2084
2035 2085
2036 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( 2086 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
2037 Handle<Object> object, 2087 Handle<Object> object,
2038 Handle<JSObject> holder, 2088 Handle<JSObject> holder,
2039 Handle<Cell> cell, 2089 Handle<Cell> cell,
2040 Handle<JSFunction> function, 2090 Handle<JSFunction> function,
2041 Handle<String> name) { 2091 Handle<String> name,
2092 Code::StubType type) {
2042 // ----------- S t a t e ------------- 2093 // ----------- S t a t e -------------
2043 // -- r2 : function name 2094 // -- r2 : function name
2044 // -- lr : return address 2095 // -- lr : return address
2045 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2096 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2046 // -- ... 2097 // -- ...
2047 // -- sp[argc * 4] : receiver 2098 // -- sp[argc * 4] : receiver
2048 // ----------------------------------- 2099 // -----------------------------------
2049 2100
2050 // If object is not a string, bail out to regular call. 2101 // If object is not a string, bail out to regular call.
2051 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); 2102 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 __ Ret(); 2155 __ Ret();
2105 } 2156 }
2106 2157
2107 __ bind(&miss); 2158 __ bind(&miss);
2108 // Restore function name in r2. 2159 // Restore function name in r2.
2109 __ Move(r2, name); 2160 __ Move(r2, name);
2110 __ bind(&name_miss); 2161 __ bind(&name_miss);
2111 GenerateMissBranch(); 2162 GenerateMissBranch();
2112 2163
2113 // Return the generated code. 2164 // Return the generated code.
2114 return GetCode(function); 2165 return GetCode(type, name);
2115 } 2166 }
2116 2167
2117 2168
2118 Handle<Code> CallStubCompiler::CompileStringCharAtCall( 2169 Handle<Code> CallStubCompiler::CompileStringCharAtCall(
2119 Handle<Object> object, 2170 Handle<Object> object,
2120 Handle<JSObject> holder, 2171 Handle<JSObject> holder,
2121 Handle<Cell> cell, 2172 Handle<Cell> cell,
2122 Handle<JSFunction> function, 2173 Handle<JSFunction> function,
2123 Handle<String> name) { 2174 Handle<String> name,
2175 Code::StubType type) {
2124 // ----------- S t a t e ------------- 2176 // ----------- S t a t e -------------
2125 // -- r2 : function name 2177 // -- r2 : function name
2126 // -- lr : return address 2178 // -- lr : return address
2127 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2179 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2128 // -- ... 2180 // -- ...
2129 // -- sp[argc * 4] : receiver 2181 // -- sp[argc * 4] : receiver
2130 // ----------------------------------- 2182 // -----------------------------------
2131 2183
2132 // If object is not a string, bail out to regular call. 2184 // If object is not a string, bail out to regular call.
2133 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); 2185 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 __ Ret(); 2239 __ Ret();
2188 } 2240 }
2189 2241
2190 __ bind(&miss); 2242 __ bind(&miss);
2191 // Restore function name in r2. 2243 // Restore function name in r2.
2192 __ Move(r2, name); 2244 __ Move(r2, name);
2193 __ bind(&name_miss); 2245 __ bind(&name_miss);
2194 GenerateMissBranch(); 2246 GenerateMissBranch();
2195 2247
2196 // Return the generated code. 2248 // Return the generated code.
2197 return GetCode(function); 2249 return GetCode(type, name);
2198 } 2250 }
2199 2251
2200 2252
2201 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( 2253 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
2202 Handle<Object> object, 2254 Handle<Object> object,
2203 Handle<JSObject> holder, 2255 Handle<JSObject> holder,
2204 Handle<Cell> cell, 2256 Handle<Cell> cell,
2205 Handle<JSFunction> function, 2257 Handle<JSFunction> function,
2206 Handle<String> name) { 2258 Handle<String> name,
2259 Code::StubType type) {
2207 // ----------- S t a t e ------------- 2260 // ----------- S t a t e -------------
2208 // -- r2 : function name 2261 // -- r2 : function name
2209 // -- lr : return address 2262 // -- lr : return address
2210 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2263 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2211 // -- ... 2264 // -- ...
2212 // -- sp[argc * 4] : receiver 2265 // -- sp[argc * 4] : receiver
2213 // ----------------------------------- 2266 // -----------------------------------
2214 2267
2215 const int argc = arguments().immediate(); 2268 const int argc = arguments().immediate();
2216 2269
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 __ bind(&slow); 2312 __ bind(&slow);
2260 ParameterCount expected(function); 2313 ParameterCount expected(function);
2261 __ InvokeFunction(function, expected, arguments(), 2314 __ InvokeFunction(function, expected, arguments(),
2262 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2315 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2263 2316
2264 __ bind(&miss); 2317 __ bind(&miss);
2265 // r2: function name. 2318 // r2: function name.
2266 GenerateMissBranch(); 2319 GenerateMissBranch();
2267 2320
2268 // Return the generated code. 2321 // Return the generated code.
2269 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2322 return GetCode(type, name);
2270 } 2323 }
2271 2324
2272 2325
2273 Handle<Code> CallStubCompiler::CompileMathFloorCall( 2326 Handle<Code> CallStubCompiler::CompileMathFloorCall(
2274 Handle<Object> object, 2327 Handle<Object> object,
2275 Handle<JSObject> holder, 2328 Handle<JSObject> holder,
2276 Handle<Cell> cell, 2329 Handle<Cell> cell,
2277 Handle<JSFunction> function, 2330 Handle<JSFunction> function,
2278 Handle<String> name) { 2331 Handle<String> name,
2332 Code::StubType type) {
2279 // ----------- S t a t e ------------- 2333 // ----------- S t a t e -------------
2280 // -- r2 : function name 2334 // -- r2 : function name
2281 // -- lr : return address 2335 // -- lr : return address
2282 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2336 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2283 // -- ... 2337 // -- ...
2284 // -- sp[argc * 4] : receiver 2338 // -- sp[argc * 4] : receiver
2285 // ----------------------------------- 2339 // -----------------------------------
2286 2340
2287 const int argc = arguments().immediate(); 2341 const int argc = arguments().immediate();
2288 // If the object is not a JSObject or we got an unexpected number of 2342 // If the object is not a JSObject or we got an unexpected number of
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 // because the function makes no use of it. 2421 // because the function makes no use of it.
2368 ParameterCount expected(function); 2422 ParameterCount expected(function);
2369 __ InvokeFunction(function, expected, arguments(), 2423 __ InvokeFunction(function, expected, arguments(),
2370 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2424 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2371 2425
2372 __ bind(&miss); 2426 __ bind(&miss);
2373 // r2: function name. 2427 // r2: function name.
2374 GenerateMissBranch(); 2428 GenerateMissBranch();
2375 2429
2376 // Return the generated code. 2430 // Return the generated code.
2377 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2431 return GetCode(type, name);
2378 } 2432 }
2379 2433
2380 2434
2381 Handle<Code> CallStubCompiler::CompileMathAbsCall( 2435 Handle<Code> CallStubCompiler::CompileMathAbsCall(
2382 Handle<Object> object, 2436 Handle<Object> object,
2383 Handle<JSObject> holder, 2437 Handle<JSObject> holder,
2384 Handle<Cell> cell, 2438 Handle<Cell> cell,
2385 Handle<JSFunction> function, 2439 Handle<JSFunction> function,
2386 Handle<String> name) { 2440 Handle<String> name,
2441 Code::StubType type) {
2387 // ----------- S t a t e ------------- 2442 // ----------- S t a t e -------------
2388 // -- r2 : function name 2443 // -- r2 : function name
2389 // -- lr : return address 2444 // -- lr : return address
2390 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2445 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2391 // -- ... 2446 // -- ...
2392 // -- sp[argc * 4] : receiver 2447 // -- sp[argc * 4] : receiver
2393 // ----------------------------------- 2448 // -----------------------------------
2394 2449
2395 const int argc = arguments().immediate(); 2450 const int argc = arguments().immediate();
2396 // If the object is not a JSObject or we got an unexpected number of 2451 // If the object is not a JSObject or we got an unexpected number of
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 __ bind(&slow); 2520 __ bind(&slow);
2466 ParameterCount expected(function); 2521 ParameterCount expected(function);
2467 __ InvokeFunction(function, expected, arguments(), 2522 __ InvokeFunction(function, expected, arguments(),
2468 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2523 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2469 2524
2470 __ bind(&miss); 2525 __ bind(&miss);
2471 // r2: function name. 2526 // r2: function name.
2472 GenerateMissBranch(); 2527 GenerateMissBranch();
2473 2528
2474 // Return the generated code. 2529 // Return the generated code.
2475 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); 2530 return GetCode(type, name);
2476 } 2531 }
2477 2532
2478 2533
2479 Handle<Code> CallStubCompiler::CompileFastApiCall( 2534 Handle<Code> CallStubCompiler::CompileFastApiCall(
2480 const CallOptimization& optimization, 2535 const CallOptimization& optimization,
2481 Handle<Object> object, 2536 Handle<Object> object,
2482 Handle<JSObject> holder, 2537 Handle<JSObject> holder,
2483 Handle<Cell> cell, 2538 Handle<Cell> cell,
2484 Handle<JSFunction> function, 2539 Handle<JSFunction> function,
2485 Handle<String> name) { 2540 Handle<String> name) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 2701
2647 Handle<Code> CallStubCompiler::CompileCallConstant( 2702 Handle<Code> CallStubCompiler::CompileCallConstant(
2648 Handle<Object> object, 2703 Handle<Object> object,
2649 Handle<JSObject> holder, 2704 Handle<JSObject> holder,
2650 Handle<Name> name, 2705 Handle<Name> name,
2651 CheckType check, 2706 CheckType check,
2652 Handle<JSFunction> function) { 2707 Handle<JSFunction> function) {
2653 if (HasCustomCallGenerator(function)) { 2708 if (HasCustomCallGenerator(function)) {
2654 Handle<Code> code = CompileCustomCall(object, holder, 2709 Handle<Code> code = CompileCustomCall(object, holder,
2655 Handle<Cell>::null(), 2710 Handle<Cell>::null(),
2656 function, Handle<String>::cast(name)); 2711 function, Handle<String>::cast(name),
2712 Code::CONSTANT_FUNCTION);
2657 // A null handle means bail out to the regular compiler code below. 2713 // A null handle means bail out to the regular compiler code below.
2658 if (!code.is_null()) return code; 2714 if (!code.is_null()) return code;
2659 } 2715 }
2660 2716
2661 Label success; 2717 Label success;
2662 2718
2663 CompileHandlerFrontend(object, holder, name, check, &success); 2719 CompileHandlerFrontend(object, holder, name, check, &success);
2664 __ bind(&success); 2720 __ bind(&success);
2665 CompileHandlerBackend(function); 2721 CompileHandlerBackend(function);
2666 2722
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 Handle<GlobalObject> holder, 2768 Handle<GlobalObject> holder,
2713 Handle<PropertyCell> cell, 2769 Handle<PropertyCell> cell,
2714 Handle<JSFunction> function, 2770 Handle<JSFunction> function,
2715 Handle<Name> name) { 2771 Handle<Name> name) {
2716 // ----------- S t a t e ------------- 2772 // ----------- S t a t e -------------
2717 // -- r2 : name 2773 // -- r2 : name
2718 // -- lr : return address 2774 // -- lr : return address
2719 // ----------------------------------- 2775 // -----------------------------------
2720 if (HasCustomCallGenerator(function)) { 2776 if (HasCustomCallGenerator(function)) {
2721 Handle<Code> code = CompileCustomCall( 2777 Handle<Code> code = CompileCustomCall(
2722 object, holder, cell, function, Handle<String>::cast(name)); 2778 object, holder, cell, function, Handle<String>::cast(name),
2779 Code::NORMAL);
2723 // A null handle means bail out to the regular compiler code below. 2780 // A null handle means bail out to the regular compiler code below.
2724 if (!code.is_null()) return code; 2781 if (!code.is_null()) return code;
2725 } 2782 }
2726 2783
2727 Label miss; 2784 Label miss;
2728 GenerateNameCheck(name, &miss); 2785 GenerateNameCheck(name, &miss);
2729 2786
2730 // Get the number of arguments. 2787 // Get the number of arguments.
2731 const int argc = arguments().immediate(); 2788 const int argc = arguments().immediate();
2732 GenerateGlobalReceiverCheck(object, holder, name, &miss); 2789 GenerateGlobalReceiverCheck(object, holder, name, &miss);
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3735 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3679 } 3736 }
3680 } 3737 }
3681 3738
3682 3739
3683 #undef __ 3740 #undef __
3684 3741
3685 } } // namespace v8::internal 3742 } } // namespace v8::internal
3686 3743
3687 #endif // V8_TARGET_ARCH_ARM 3744 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698