| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 if (object->IsGlobalObject()) { | 1365 if (object->IsGlobalObject()) { |
| 1366 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1366 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 1367 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1367 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 // Invoke the function. | 1370 // Invoke the function. |
| 1371 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 1371 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
| 1372 | 1372 |
| 1373 // Handle call cache miss. | 1373 // Handle call cache miss. |
| 1374 __ bind(&miss); | 1374 __ bind(&miss); |
| 1375 Object* obj; | 1375 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1376 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1376 if (maybe_result->IsFailure()) return maybe_result; |
| 1377 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1378 } | |
| 1379 | 1377 |
| 1380 // Return the generated code. | 1378 // Return the generated code. |
| 1381 return GetCode(FIELD, name); | 1379 return GetCode(FIELD, name); |
| 1382 } | 1380 } |
| 1383 | 1381 |
| 1384 | 1382 |
| 1385 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, | 1383 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
| 1386 JSObject* holder, | 1384 JSObject* holder, |
| 1387 JSGlobalPropertyCell* cell, | 1385 JSGlobalPropertyCell* cell, |
| 1388 JSFunction* function, | 1386 JSFunction* function, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 __ ret((argc + 1) * kPointerSize); | 1526 __ ret((argc + 1) * kPointerSize); |
| 1529 } | 1527 } |
| 1530 | 1528 |
| 1531 __ bind(&call_builtin); | 1529 __ bind(&call_builtin); |
| 1532 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1530 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
| 1533 argc + 1, | 1531 argc + 1, |
| 1534 1); | 1532 1); |
| 1535 } | 1533 } |
| 1536 | 1534 |
| 1537 __ bind(&miss); | 1535 __ bind(&miss); |
| 1538 Object* obj; | 1536 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1539 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1537 if (maybe_result->IsFailure()) return maybe_result; |
| 1540 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1541 } | |
| 1542 | 1538 |
| 1543 // Return the generated code. | 1539 // Return the generated code. |
| 1544 return GetCode(function); | 1540 return GetCode(function); |
| 1545 } | 1541 } |
| 1546 | 1542 |
| 1547 | 1543 |
| 1548 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, | 1544 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, |
| 1549 JSObject* holder, | 1545 JSObject* holder, |
| 1550 JSGlobalPropertyCell* cell, | 1546 JSGlobalPropertyCell* cell, |
| 1551 JSFunction* function, | 1547 JSFunction* function, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 __ bind(&return_undefined); | 1608 __ bind(&return_undefined); |
| 1613 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 1609 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 1614 __ ret((argc + 1) * kPointerSize); | 1610 __ ret((argc + 1) * kPointerSize); |
| 1615 | 1611 |
| 1616 __ bind(&call_builtin); | 1612 __ bind(&call_builtin); |
| 1617 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1613 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
| 1618 argc + 1, | 1614 argc + 1, |
| 1619 1); | 1615 1); |
| 1620 | 1616 |
| 1621 __ bind(&miss); | 1617 __ bind(&miss); |
| 1622 Object* obj; | 1618 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1623 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1619 if (maybe_result->IsFailure()) return maybe_result; |
| 1624 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1625 } | |
| 1626 | 1620 |
| 1627 // Return the generated code. | 1621 // Return the generated code. |
| 1628 return GetCode(function); | 1622 return GetCode(function); |
| 1629 } | 1623 } |
| 1630 | 1624 |
| 1631 | 1625 |
| 1632 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( | 1626 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
| 1633 Object* object, | 1627 Object* object, |
| 1634 JSObject* holder, | 1628 JSObject* holder, |
| 1635 JSGlobalPropertyCell* cell, | 1629 JSGlobalPropertyCell* cell, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 if (index_out_of_range.is_linked()) { | 1690 if (index_out_of_range.is_linked()) { |
| 1697 __ bind(&index_out_of_range); | 1691 __ bind(&index_out_of_range); |
| 1698 __ LoadRoot(rax, Heap::kNanValueRootIndex); | 1692 __ LoadRoot(rax, Heap::kNanValueRootIndex); |
| 1699 __ ret((argc + 1) * kPointerSize); | 1693 __ ret((argc + 1) * kPointerSize); |
| 1700 } | 1694 } |
| 1701 | 1695 |
| 1702 __ bind(&miss); | 1696 __ bind(&miss); |
| 1703 // Restore function name in rcx. | 1697 // Restore function name in rcx. |
| 1704 __ Move(rcx, Handle<String>(name)); | 1698 __ Move(rcx, Handle<String>(name)); |
| 1705 __ bind(&name_miss); | 1699 __ bind(&name_miss); |
| 1706 Object* obj; | 1700 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1707 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1701 if (maybe_result->IsFailure()) return maybe_result; |
| 1708 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1709 } | |
| 1710 | 1702 |
| 1711 // Return the generated code. | 1703 // Return the generated code. |
| 1712 return GetCode(function); | 1704 return GetCode(function); |
| 1713 } | 1705 } |
| 1714 | 1706 |
| 1715 | 1707 |
| 1716 MaybeObject* CallStubCompiler::CompileStringCharAtCall( | 1708 MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
| 1717 Object* object, | 1709 Object* object, |
| 1718 JSObject* holder, | 1710 JSObject* holder, |
| 1719 JSGlobalPropertyCell* cell, | 1711 JSGlobalPropertyCell* cell, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1782 if (index_out_of_range.is_linked()) { | 1774 if (index_out_of_range.is_linked()) { |
| 1783 __ bind(&index_out_of_range); | 1775 __ bind(&index_out_of_range); |
| 1784 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); | 1776 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); |
| 1785 __ ret((argc + 1) * kPointerSize); | 1777 __ ret((argc + 1) * kPointerSize); |
| 1786 } | 1778 } |
| 1787 | 1779 |
| 1788 __ bind(&miss); | 1780 __ bind(&miss); |
| 1789 // Restore function name in rcx. | 1781 // Restore function name in rcx. |
| 1790 __ Move(rcx, Handle<String>(name)); | 1782 __ Move(rcx, Handle<String>(name)); |
| 1791 __ bind(&name_miss); | 1783 __ bind(&name_miss); |
| 1792 Object* obj; | 1784 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1793 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1785 if (maybe_result->IsFailure()) return maybe_result; |
| 1794 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1795 } | |
| 1796 | 1786 |
| 1797 // Return the generated code. | 1787 // Return the generated code. |
| 1798 return GetCode(function); | 1788 return GetCode(function); |
| 1799 } | 1789 } |
| 1800 | 1790 |
| 1801 | 1791 |
| 1802 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( | 1792 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
| 1803 Object* object, | 1793 Object* object, |
| 1804 JSObject* holder, | 1794 JSObject* holder, |
| 1805 JSGlobalPropertyCell* cell, | 1795 JSGlobalPropertyCell* cell, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 StubRuntimeCallHelper call_helper; | 1843 StubRuntimeCallHelper call_helper; |
| 1854 char_from_code_generator.GenerateSlow(masm(), call_helper); | 1844 char_from_code_generator.GenerateSlow(masm(), call_helper); |
| 1855 | 1845 |
| 1856 // Tail call the full function. We do not have to patch the receiver | 1846 // Tail call the full function. We do not have to patch the receiver |
| 1857 // because the function makes no use of it. | 1847 // because the function makes no use of it. |
| 1858 __ bind(&slow); | 1848 __ bind(&slow); |
| 1859 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1849 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
| 1860 | 1850 |
| 1861 __ bind(&miss); | 1851 __ bind(&miss); |
| 1862 // rcx: function name. | 1852 // rcx: function name. |
| 1863 Object* obj; | 1853 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1864 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1854 if (maybe_result->IsFailure()) return maybe_result; |
| 1865 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1866 } | |
| 1867 | 1855 |
| 1868 // Return the generated code. | 1856 // Return the generated code. |
| 1869 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 1857 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
| 1870 } | 1858 } |
| 1871 | 1859 |
| 1872 | 1860 |
| 1873 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, | 1861 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
| 1874 JSObject* holder, | 1862 JSObject* holder, |
| 1875 JSGlobalPropertyCell* cell, | 1863 JSGlobalPropertyCell* cell, |
| 1876 JSFunction* function, | 1864 JSFunction* function, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); | 1956 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); |
| 1969 __ ret(2 * kPointerSize); | 1957 __ ret(2 * kPointerSize); |
| 1970 | 1958 |
| 1971 // Tail call the full function. We do not have to patch the receiver | 1959 // Tail call the full function. We do not have to patch the receiver |
| 1972 // because the function makes no use of it. | 1960 // because the function makes no use of it. |
| 1973 __ bind(&slow); | 1961 __ bind(&slow); |
| 1974 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1962 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
| 1975 | 1963 |
| 1976 __ bind(&miss); | 1964 __ bind(&miss); |
| 1977 // rcx: function name. | 1965 // rcx: function name. |
| 1978 Object* obj; | 1966 MaybeObject* maybe_result = GenerateMissBranch(); |
| 1979 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1967 if (maybe_result->IsFailure()) return maybe_result; |
| 1980 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 1981 } | |
| 1982 | 1968 |
| 1983 // Return the generated code. | 1969 // Return the generated code. |
| 1984 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 1970 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
| 1985 } | 1971 } |
| 1986 | 1972 |
| 1987 | 1973 |
| 1988 MaybeObject* CallStubCompiler::CompileFastApiCall( | 1974 MaybeObject* CallStubCompiler::CompileFastApiCall( |
| 1989 const CallOptimization& optimization, | 1975 const CallOptimization& optimization, |
| 1990 Object* object, | 1976 Object* object, |
| 1991 JSObject* holder, | 1977 JSObject* holder, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 __ movq(rax, Operand(rsp, 3 * kPointerSize)); | 2013 __ movq(rax, Operand(rsp, 3 * kPointerSize)); |
| 2028 __ movq(Operand(rsp, 0 * kPointerSize), rax); | 2014 __ movq(Operand(rsp, 0 * kPointerSize), rax); |
| 2029 | 2015 |
| 2030 MaybeObject* result = GenerateFastApiCall(masm(), optimization, argc); | 2016 MaybeObject* result = GenerateFastApiCall(masm(), optimization, argc); |
| 2031 if (result->IsFailure()) return result; | 2017 if (result->IsFailure()) return result; |
| 2032 | 2018 |
| 2033 __ bind(&miss); | 2019 __ bind(&miss); |
| 2034 __ addq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); | 2020 __ addq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); |
| 2035 | 2021 |
| 2036 __ bind(&miss_before_stack_reserved); | 2022 __ bind(&miss_before_stack_reserved); |
| 2037 Object* obj; | 2023 MaybeObject* maybe_result = GenerateMissBranch(); |
| 2038 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2024 if (maybe_result->IsFailure()) return maybe_result; |
| 2039 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 2040 } | |
| 2041 | 2025 |
| 2042 // Return the generated code. | 2026 // Return the generated code. |
| 2043 return GetCode(function); | 2027 return GetCode(function); |
| 2044 } | 2028 } |
| 2045 | 2029 |
| 2046 | 2030 |
| 2047 MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, | 2031 MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, |
| 2048 JSObject* holder, | 2032 JSObject* holder, |
| 2049 JSFunction* function, | 2033 JSFunction* function, |
| 2050 String* name, | 2034 String* name, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 } | 2147 } |
| 2164 | 2148 |
| 2165 default: | 2149 default: |
| 2166 UNREACHABLE(); | 2150 UNREACHABLE(); |
| 2167 } | 2151 } |
| 2168 | 2152 |
| 2169 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 2153 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
| 2170 | 2154 |
| 2171 // Handle call cache miss. | 2155 // Handle call cache miss. |
| 2172 __ bind(&miss); | 2156 __ bind(&miss); |
| 2173 Object* obj; | 2157 MaybeObject* maybe_result = GenerateMissBranch(); |
| 2174 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2158 if (maybe_result->IsFailure()) return maybe_result; |
| 2175 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 2176 } | |
| 2177 | 2159 |
| 2178 // Return the generated code. | 2160 // Return the generated code. |
| 2179 return GetCode(function); | 2161 return GetCode(function); |
| 2180 } | 2162 } |
| 2181 | 2163 |
| 2182 | 2164 |
| 2183 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 2165 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
| 2184 JSObject* holder, | 2166 JSObject* holder, |
| 2185 String* name) { | 2167 String* name) { |
| 2186 // ----------- S t a t e ------------- | 2168 // ----------- S t a t e ------------- |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 2214 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 2233 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 2215 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 2234 } | 2216 } |
| 2235 | 2217 |
| 2236 // Invoke the function. | 2218 // Invoke the function. |
| 2237 __ movq(rdi, rax); | 2219 __ movq(rdi, rax); |
| 2238 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 2220 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
| 2239 | 2221 |
| 2240 // Handle load cache miss. | 2222 // Handle load cache miss. |
| 2241 __ bind(&miss); | 2223 __ bind(&miss); |
| 2242 Object* obj; | 2224 MaybeObject* maybe_result = GenerateMissBranch(); |
| 2243 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2225 if (maybe_result->IsFailure()) return maybe_result; |
| 2244 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 2245 } | |
| 2246 | 2226 |
| 2247 // Return the generated code. | 2227 // Return the generated code. |
| 2248 return GetCode(INTERCEPTOR, name); | 2228 return GetCode(INTERCEPTOR, name); |
| 2249 } | 2229 } |
| 2250 | 2230 |
| 2251 | 2231 |
| 2252 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, | 2232 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, |
| 2253 GlobalObject* holder, | 2233 GlobalObject* holder, |
| 2254 JSGlobalPropertyCell* cell, | 2234 JSGlobalPropertyCell* cell, |
| 2255 JSFunction* function, | 2235 JSFunction* function, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 2284 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 2305 __ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION); | 2285 __ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION); |
| 2306 } else { | 2286 } else { |
| 2307 Handle<Code> code(function->code()); | 2287 Handle<Code> code(function->code()); |
| 2308 __ InvokeCode(code, expected, arguments(), | 2288 __ InvokeCode(code, expected, arguments(), |
| 2309 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2289 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 2310 } | 2290 } |
| 2311 // Handle call cache miss. | 2291 // Handle call cache miss. |
| 2312 __ bind(&miss); | 2292 __ bind(&miss); |
| 2313 __ IncrementCounter(COUNTERS->call_global_inline_miss(), 1); | 2293 __ IncrementCounter(COUNTERS->call_global_inline_miss(), 1); |
| 2314 Object* obj; | 2294 MaybeObject* maybe_result = GenerateMissBranch(); |
| 2315 { MaybeObject* maybe_obj = GenerateMissBranch(); | 2295 if (maybe_result->IsFailure()) return maybe_result; |
| 2316 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 2317 } | |
| 2318 | 2296 |
| 2319 // Return the generated code. | 2297 // Return the generated code. |
| 2320 return GetCode(NORMAL, name); | 2298 return GetCode(NORMAL, name); |
| 2321 } | 2299 } |
| 2322 | 2300 |
| 2323 | 2301 |
| 2324 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, | 2302 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, |
| 2325 int index, | 2303 int index, |
| 2326 Map* transition, | 2304 Map* transition, |
| 2327 String* name) { | 2305 String* name) { |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3454 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 3432 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
| 3455 | 3433 |
| 3456 return GetCode(flags); | 3434 return GetCode(flags); |
| 3457 } | 3435 } |
| 3458 | 3436 |
| 3459 #undef __ | 3437 #undef __ |
| 3460 | 3438 |
| 3461 } } // namespace v8::internal | 3439 } } // namespace v8::internal |
| 3462 | 3440 |
| 3463 #endif // V8_TARGET_ARCH_X64 | 3441 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |