OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 __ b(eq, &miss); | 1519 __ b(eq, &miss); |
1520 | 1520 |
1521 // Do the right check and compute the holder register. | 1521 // Do the right check and compute the holder register. |
1522 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); | 1522 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); |
1523 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); | 1523 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); |
1524 | 1524 |
1525 GenerateCallFunction(masm(), object, arguments(), &miss); | 1525 GenerateCallFunction(masm(), object, arguments(), &miss); |
1526 | 1526 |
1527 // Handle call cache miss. | 1527 // Handle call cache miss. |
1528 __ bind(&miss); | 1528 __ bind(&miss); |
1529 Object* obj; | 1529 MaybeObject* maybe_result = GenerateMissBranch(); |
1530 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1530 if (maybe_result->IsFailure()) return maybe_result; |
1531 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
1532 } | |
1533 | 1531 |
1534 // Return the generated code. | 1532 // Return the generated code. |
1535 return GetCode(FIELD, name); | 1533 return GetCode(FIELD, name); |
1536 } | 1534 } |
1537 | 1535 |
1538 | 1536 |
1539 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, | 1537 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
1540 JSObject* holder, | 1538 JSObject* holder, |
1541 JSGlobalPropertyCell* cell, | 1539 JSGlobalPropertyCell* cell, |
1542 JSFunction* function, | 1540 JSFunction* function, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 __ Ret(); | 1677 __ Ret(); |
1680 } | 1678 } |
1681 __ bind(&call_builtin); | 1679 __ bind(&call_builtin); |
1682 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1680 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
1683 argc + 1, | 1681 argc + 1, |
1684 1); | 1682 1); |
1685 } | 1683 } |
1686 | 1684 |
1687 // Handle call cache miss. | 1685 // Handle call cache miss. |
1688 __ bind(&miss); | 1686 __ bind(&miss); |
1689 Object* obj; | 1687 MaybeObject* maybe_result = GenerateMissBranch(); |
1690 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1688 if (maybe_result->IsFailure()) return maybe_result; |
1691 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
1692 } | |
1693 | 1689 |
1694 // Return the generated code. | 1690 // Return the generated code. |
1695 return GetCode(function); | 1691 return GetCode(function); |
1696 } | 1692 } |
1697 | 1693 |
1698 | 1694 |
1699 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, | 1695 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, |
1700 JSObject* holder, | 1696 JSObject* holder, |
1701 JSGlobalPropertyCell* cell, | 1697 JSGlobalPropertyCell* cell, |
1702 JSFunction* function, | 1698 JSFunction* function, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 __ Drop(argc + 1); | 1761 __ Drop(argc + 1); |
1766 __ Ret(); | 1762 __ Ret(); |
1767 | 1763 |
1768 __ bind(&call_builtin); | 1764 __ bind(&call_builtin); |
1769 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1765 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1770 argc + 1, | 1766 argc + 1, |
1771 1); | 1767 1); |
1772 | 1768 |
1773 // Handle call cache miss. | 1769 // Handle call cache miss. |
1774 __ bind(&miss); | 1770 __ bind(&miss); |
1775 Object* obj; | 1771 MaybeObject* maybe_result = GenerateMissBranch(); |
1776 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1772 if (maybe_result->IsFailure()) return maybe_result; |
1777 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
1778 } | |
1779 | 1773 |
1780 // Return the generated code. | 1774 // Return the generated code. |
1781 return GetCode(function); | 1775 return GetCode(function); |
1782 } | 1776 } |
1783 | 1777 |
1784 | 1778 |
1785 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( | 1779 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
1786 Object* object, | 1780 Object* object, |
1787 JSObject* holder, | 1781 JSObject* holder, |
1788 JSGlobalPropertyCell* cell, | 1782 JSGlobalPropertyCell* cell, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 __ bind(&index_out_of_range); | 1845 __ bind(&index_out_of_range); |
1852 __ LoadRoot(r0, Heap::kNanValueRootIndex); | 1846 __ LoadRoot(r0, Heap::kNanValueRootIndex); |
1853 __ Drop(argc + 1); | 1847 __ Drop(argc + 1); |
1854 __ Ret(); | 1848 __ Ret(); |
1855 } | 1849 } |
1856 | 1850 |
1857 __ bind(&miss); | 1851 __ bind(&miss); |
1858 // Restore function name in r2. | 1852 // Restore function name in r2. |
1859 __ Move(r2, Handle<String>(name)); | 1853 __ Move(r2, Handle<String>(name)); |
1860 __ bind(&name_miss); | 1854 __ bind(&name_miss); |
1861 Object* obj; | 1855 MaybeObject* maybe_result = GenerateMissBranch(); |
1862 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1856 if (maybe_result->IsFailure()) return maybe_result; |
1863 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
1864 } | |
1865 | 1857 |
1866 // Return the generated code. | 1858 // Return the generated code. |
1867 return GetCode(function); | 1859 return GetCode(function); |
1868 } | 1860 } |
1869 | 1861 |
1870 | 1862 |
1871 MaybeObject* CallStubCompiler::CompileStringCharAtCall( | 1863 MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
1872 Object* object, | 1864 Object* object, |
1873 JSObject* holder, | 1865 JSObject* holder, |
1874 JSGlobalPropertyCell* cell, | 1866 JSGlobalPropertyCell* cell, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1939 __ bind(&index_out_of_range); | 1931 __ bind(&index_out_of_range); |
1940 __ LoadRoot(r0, Heap::kEmptyStringRootIndex); | 1932 __ LoadRoot(r0, Heap::kEmptyStringRootIndex); |
1941 __ Drop(argc + 1); | 1933 __ Drop(argc + 1); |
1942 __ Ret(); | 1934 __ Ret(); |
1943 } | 1935 } |
1944 | 1936 |
1945 __ bind(&miss); | 1937 __ bind(&miss); |
1946 // Restore function name in r2. | 1938 // Restore function name in r2. |
1947 __ Move(r2, Handle<String>(name)); | 1939 __ Move(r2, Handle<String>(name)); |
1948 __ bind(&name_miss); | 1940 __ bind(&name_miss); |
1949 Object* obj; | 1941 MaybeObject* maybe_result = GenerateMissBranch(); |
1950 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1942 if (maybe_result->IsFailure()) return maybe_result; |
1951 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
1952 } | |
1953 | 1943 |
1954 // Return the generated code. | 1944 // Return the generated code. |
1955 return GetCode(function); | 1945 return GetCode(function); |
1956 } | 1946 } |
1957 | 1947 |
1958 | 1948 |
1959 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( | 1949 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
1960 Object* object, | 1950 Object* object, |
1961 JSObject* holder, | 1951 JSObject* holder, |
1962 JSGlobalPropertyCell* cell, | 1952 JSGlobalPropertyCell* cell, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 StubRuntimeCallHelper call_helper; | 2005 StubRuntimeCallHelper call_helper; |
2016 char_from_code_generator.GenerateSlow(masm(), call_helper); | 2006 char_from_code_generator.GenerateSlow(masm(), call_helper); |
2017 | 2007 |
2018 // Tail call the full function. We do not have to patch the receiver | 2008 // Tail call the full function. We do not have to patch the receiver |
2019 // because the function makes no use of it. | 2009 // because the function makes no use of it. |
2020 __ bind(&slow); | 2010 __ bind(&slow); |
2021 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 2011 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
2022 | 2012 |
2023 __ bind(&miss); | 2013 __ bind(&miss); |
2024 // r2: function name. | 2014 // r2: function name. |
2025 Object* obj; | 2015 MaybeObject* maybe_result = GenerateMissBranch(); |
2026 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2016 if (maybe_result->IsFailure()) return maybe_result; |
2027 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2028 } | |
2029 | 2017 |
2030 // Return the generated code. | 2018 // Return the generated code. |
2031 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 2019 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
2032 } | 2020 } |
2033 | 2021 |
2034 | 2022 |
2035 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, | 2023 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
2036 JSObject* holder, | 2024 JSObject* holder, |
2037 JSGlobalPropertyCell* cell, | 2025 JSGlobalPropertyCell* cell, |
2038 JSFunction* function, | 2026 JSFunction* function, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 // Restore FPCSR and fall to slow case. | 2152 // Restore FPCSR and fall to slow case. |
2165 __ vmsr(r3); | 2153 __ vmsr(r3); |
2166 | 2154 |
2167 __ bind(&slow); | 2155 __ bind(&slow); |
2168 // Tail call the full function. We do not have to patch the receiver | 2156 // Tail call the full function. We do not have to patch the receiver |
2169 // because the function makes no use of it. | 2157 // because the function makes no use of it. |
2170 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 2158 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
2171 | 2159 |
2172 __ bind(&miss); | 2160 __ bind(&miss); |
2173 // r2: function name. | 2161 // r2: function name. |
2174 MaybeObject* obj = GenerateMissBranch(); | 2162 MaybeObject* maybe_result = GenerateMissBranch(); |
2175 if (obj->IsFailure()) return obj; | 2163 if (maybe_result->IsFailure()) return maybe_result; |
2176 | 2164 |
2177 // Return the generated code. | 2165 // Return the generated code. |
2178 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 2166 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
2179 } | 2167 } |
2180 | 2168 |
2181 | 2169 |
2182 MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, | 2170 MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, |
2183 JSObject* holder, | 2171 JSObject* holder, |
2184 JSGlobalPropertyCell* cell, | 2172 JSGlobalPropertyCell* cell, |
2185 JSFunction* function, | 2173 JSFunction* function, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 __ Drop(argc + 1); | 2254 __ Drop(argc + 1); |
2267 __ Ret(); | 2255 __ Ret(); |
2268 | 2256 |
2269 // Tail call the full function. We do not have to patch the receiver | 2257 // Tail call the full function. We do not have to patch the receiver |
2270 // because the function makes no use of it. | 2258 // because the function makes no use of it. |
2271 __ bind(&slow); | 2259 __ bind(&slow); |
2272 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 2260 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
2273 | 2261 |
2274 __ bind(&miss); | 2262 __ bind(&miss); |
2275 // r2: function name. | 2263 // r2: function name. |
2276 Object* obj; | 2264 MaybeObject* maybe_result = GenerateMissBranch(); |
2277 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2265 if (maybe_result->IsFailure()) return maybe_result; |
2278 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2279 } | |
2280 | 2266 |
2281 // Return the generated code. | 2267 // Return the generated code. |
2282 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 2268 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
2283 } | 2269 } |
2284 | 2270 |
2285 | 2271 |
2286 MaybeObject* CallStubCompiler::CompileFastApiCall( | 2272 MaybeObject* CallStubCompiler::CompileFastApiCall( |
2287 const CallOptimization& optimization, | 2273 const CallOptimization& optimization, |
2288 Object* object, | 2274 Object* object, |
2289 JSObject* holder, | 2275 JSObject* holder, |
(...skipping 30 matching lines...) Expand all Loading... |
2320 CheckPrototypes(JSObject::cast(object), r1, holder, r0, r3, r4, name, | 2306 CheckPrototypes(JSObject::cast(object), r1, holder, r0, r3, r4, name, |
2321 depth, &miss); | 2307 depth, &miss); |
2322 | 2308 |
2323 MaybeObject* result = GenerateFastApiDirectCall(masm(), optimization, argc); | 2309 MaybeObject* result = GenerateFastApiDirectCall(masm(), optimization, argc); |
2324 if (result->IsFailure()) return result; | 2310 if (result->IsFailure()) return result; |
2325 | 2311 |
2326 __ bind(&miss); | 2312 __ bind(&miss); |
2327 FreeSpaceForFastApiCall(masm()); | 2313 FreeSpaceForFastApiCall(masm()); |
2328 | 2314 |
2329 __ bind(&miss_before_stack_reserved); | 2315 __ bind(&miss_before_stack_reserved); |
2330 Object* obj; | 2316 MaybeObject* maybe_result = GenerateMissBranch(); |
2331 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2317 if (maybe_result->IsFailure()) return maybe_result; |
2332 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2333 } | |
2334 | 2318 |
2335 // Return the generated code. | 2319 // Return the generated code. |
2336 return GetCode(function); | 2320 return GetCode(function); |
2337 } | 2321 } |
2338 | 2322 |
2339 | 2323 |
2340 MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, | 2324 MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, |
2341 JSObject* holder, | 2325 JSObject* holder, |
2342 JSFunction* function, | 2326 JSFunction* function, |
2343 String* name, | 2327 String* name, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 } | 2438 } |
2455 | 2439 |
2456 default: | 2440 default: |
2457 UNREACHABLE(); | 2441 UNREACHABLE(); |
2458 } | 2442 } |
2459 | 2443 |
2460 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 2444 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
2461 | 2445 |
2462 // Handle call cache miss. | 2446 // Handle call cache miss. |
2463 __ bind(&miss); | 2447 __ bind(&miss); |
2464 Object* obj; | 2448 MaybeObject* maybe_result = GenerateMissBranch(); |
2465 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2449 if (maybe_result->IsFailure()) return maybe_result; |
2466 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2467 } | |
2468 | 2450 |
2469 // Return the generated code. | 2451 // Return the generated code. |
2470 return GetCode(function); | 2452 return GetCode(function); |
2471 } | 2453 } |
2472 | 2454 |
2473 | 2455 |
2474 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 2456 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
2475 JSObject* holder, | 2457 JSObject* holder, |
2476 String* name) { | 2458 String* name) { |
2477 // ----------- S t a t e ------------- | 2459 // ----------- S t a t e ------------- |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 | 2491 |
2510 // Move returned value, the function to call, to r1. | 2492 // Move returned value, the function to call, to r1. |
2511 __ mov(r1, r0); | 2493 __ mov(r1, r0); |
2512 // Restore receiver. | 2494 // Restore receiver. |
2513 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); | 2495 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
2514 | 2496 |
2515 GenerateCallFunction(masm(), object, arguments(), &miss); | 2497 GenerateCallFunction(masm(), object, arguments(), &miss); |
2516 | 2498 |
2517 // Handle call cache miss. | 2499 // Handle call cache miss. |
2518 __ bind(&miss); | 2500 __ bind(&miss); |
2519 Object* obj; | 2501 MaybeObject* maybe_result = GenerateMissBranch(); |
2520 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2502 if (maybe_result->IsFailure()) return maybe_result; |
2521 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2522 } | |
2523 | 2503 |
2524 // Return the generated code. | 2504 // Return the generated code. |
2525 return GetCode(INTERCEPTOR, name); | 2505 return GetCode(INTERCEPTOR, name); |
2526 } | 2506 } |
2527 | 2507 |
2528 | 2508 |
2529 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, | 2509 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, |
2530 GlobalObject* holder, | 2510 GlobalObject* holder, |
2531 JSGlobalPropertyCell* cell, | 2511 JSGlobalPropertyCell* cell, |
2532 JSFunction* function, | 2512 JSFunction* function, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 2558 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
2579 __ InvokeCode(r3, expected, arguments(), JUMP_FUNCTION); | 2559 __ InvokeCode(r3, expected, arguments(), JUMP_FUNCTION); |
2580 } else { | 2560 } else { |
2581 __ InvokeCode(code, expected, arguments(), | 2561 __ InvokeCode(code, expected, arguments(), |
2582 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2562 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
2583 } | 2563 } |
2584 | 2564 |
2585 // Handle call cache miss. | 2565 // Handle call cache miss. |
2586 __ bind(&miss); | 2566 __ bind(&miss); |
2587 __ IncrementCounter(COUNTERS->call_global_inline_miss(), 1, r1, r3); | 2567 __ IncrementCounter(COUNTERS->call_global_inline_miss(), 1, r1, r3); |
2588 Object* obj; | 2568 MaybeObject* maybe_result = GenerateMissBranch(); |
2589 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2569 if (maybe_result->IsFailure()) return maybe_result; |
2590 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2591 } | |
2592 | 2570 |
2593 // Return the generated code. | 2571 // Return the generated code. |
2594 return GetCode(NORMAL, name); | 2572 return GetCode(NORMAL, name); |
2595 } | 2573 } |
2596 | 2574 |
2597 | 2575 |
2598 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, | 2576 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, |
2599 int index, | 2577 int index, |
2600 Map* transition, | 2578 Map* transition, |
2601 String* name) { | 2579 String* name) { |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 | 4004 |
4027 return GetCode(flags); | 4005 return GetCode(flags); |
4028 } | 4006 } |
4029 | 4007 |
4030 | 4008 |
4031 #undef __ | 4009 #undef __ |
4032 | 4010 |
4033 } } // namespace v8::internal | 4011 } } // namespace v8::internal |
4034 | 4012 |
4035 #endif // V8_TARGET_ARCH_ARM | 4013 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |