| 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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 | 1280 |
| 1281 | 1281 |
| 1282 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { | 1282 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { |
| 1283 if (kind_ == Code::KEYED_CALL_IC) { | 1283 if (kind_ == Code::KEYED_CALL_IC) { |
| 1284 __ cmp(Operand(ecx), Immediate(Handle<String>(name))); | 1284 __ cmp(Operand(ecx), Immediate(Handle<String>(name))); |
| 1285 __ j(not_equal, miss, not_taken); | 1285 __ j(not_equal, miss, not_taken); |
| 1286 } | 1286 } |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 | 1289 |
| 1290 Object* CallStubCompiler::GenerateMissBranch() { | 1290 void CallStubCompiler::GenerateMissBranch() { |
| 1291 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); | 1291 Handle<Code> ic = ComputeCallMiss(arguments().immediate(), kind_); |
| 1292 if (obj->IsFailure()) return obj; | 1292 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 1293 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); | |
| 1294 return obj; | |
| 1295 } | 1293 } |
| 1296 | 1294 |
| 1297 | 1295 |
| 1298 Object* CallStubCompiler::CompileCallField(JSObject* object, | 1296 Object* CallStubCompiler::CompileCallField(JSObject* object, |
| 1299 JSObject* holder, | 1297 JSObject* holder, |
| 1300 int index, | 1298 int index, |
| 1301 String* name) { | 1299 String* name) { |
| 1302 // ----------- S t a t e ------------- | 1300 // ----------- S t a t e ------------- |
| 1303 // -- ecx : name | 1301 // -- ecx : name |
| 1304 // -- esp[0] : return address | 1302 // -- esp[0] : return address |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1335 if (object->IsGlobalObject()) { | 1333 if (object->IsGlobalObject()) { |
| 1336 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 1334 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
| 1337 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 1335 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
| 1338 } | 1336 } |
| 1339 | 1337 |
| 1340 // Invoke the function. | 1338 // Invoke the function. |
| 1341 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); | 1339 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); |
| 1342 | 1340 |
| 1343 // Handle call cache miss. | 1341 // Handle call cache miss. |
| 1344 __ bind(&miss); | 1342 __ bind(&miss); |
| 1345 Object* obj = GenerateMissBranch(); | 1343 GenerateMissBranch(); |
| 1346 if (obj->IsFailure()) return obj; | |
| 1347 | 1344 |
| 1348 // Return the generated code. | 1345 // Return the generated code. |
| 1349 return GetCode(FIELD, name); | 1346 return GetCode(FIELD, name); |
| 1350 } | 1347 } |
| 1351 | 1348 |
| 1352 | 1349 |
| 1353 Object* CallStubCompiler::CompileArrayPushCall(Object* object, | 1350 Object* CallStubCompiler::CompileArrayPushCall(Object* object, |
| 1354 JSObject* holder, | 1351 JSObject* holder, |
| 1355 JSFunction* function, | 1352 JSFunction* function, |
| 1356 String* name, | 1353 String* name, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1480 |
| 1484 __ bind(&call_builtin); | 1481 __ bind(&call_builtin); |
| 1485 } | 1482 } |
| 1486 | 1483 |
| 1487 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1484 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
| 1488 argc + 1, | 1485 argc + 1, |
| 1489 1); | 1486 1); |
| 1490 } | 1487 } |
| 1491 | 1488 |
| 1492 __ bind(&miss); | 1489 __ bind(&miss); |
| 1493 Object* obj = GenerateMissBranch(); | 1490 GenerateMissBranch(); |
| 1494 if (obj->IsFailure()) return obj; | |
| 1495 | 1491 |
| 1496 // Return the generated code. | 1492 // Return the generated code. |
| 1497 return GetCode(function); | 1493 return GetCode(function); |
| 1498 } | 1494 } |
| 1499 | 1495 |
| 1500 | 1496 |
| 1501 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1497 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
| 1502 JSObject* holder, | 1498 JSObject* holder, |
| 1503 JSFunction* function, | 1499 JSFunction* function, |
| 1504 String* name, | 1500 String* name, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 __ bind(&return_undefined); | 1563 __ bind(&return_undefined); |
| 1568 __ mov(eax, Immediate(Factory::undefined_value())); | 1564 __ mov(eax, Immediate(Factory::undefined_value())); |
| 1569 __ ret((argc + 1) * kPointerSize); | 1565 __ ret((argc + 1) * kPointerSize); |
| 1570 | 1566 |
| 1571 __ bind(&call_builtin); | 1567 __ bind(&call_builtin); |
| 1572 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1568 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
| 1573 argc + 1, | 1569 argc + 1, |
| 1574 1); | 1570 1); |
| 1575 | 1571 |
| 1576 __ bind(&miss); | 1572 __ bind(&miss); |
| 1577 Object* obj = GenerateMissBranch(); | 1573 GenerateMissBranch(); |
| 1578 if (obj->IsFailure()) return obj; | |
| 1579 | 1574 |
| 1580 // Return the generated code. | 1575 // Return the generated code. |
| 1581 return GetCode(function); | 1576 return GetCode(function); |
| 1582 } | 1577 } |
| 1583 | 1578 |
| 1584 | 1579 |
| 1585 Object* CallStubCompiler::CompileStringCharCodeAtCall(Object* object, | 1580 Object* CallStubCompiler::CompileStringCharCodeAtCall(Object* object, |
| 1586 JSObject* holder, | 1581 JSObject* holder, |
| 1587 JSFunction* function, | 1582 JSFunction* function, |
| 1588 String* name, | 1583 String* name, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 __ ret((argc + 1) * kPointerSize); | 1626 __ ret((argc + 1) * kPointerSize); |
| 1632 | 1627 |
| 1633 ICRuntimeCallHelper call_helper; | 1628 ICRuntimeCallHelper call_helper; |
| 1634 char_code_at_generator.GenerateSlow(masm(), call_helper); | 1629 char_code_at_generator.GenerateSlow(masm(), call_helper); |
| 1635 | 1630 |
| 1636 __ bind(&index_out_of_range); | 1631 __ bind(&index_out_of_range); |
| 1637 __ Set(eax, Immediate(Factory::nan_value())); | 1632 __ Set(eax, Immediate(Factory::nan_value())); |
| 1638 __ ret((argc + 1) * kPointerSize); | 1633 __ ret((argc + 1) * kPointerSize); |
| 1639 | 1634 |
| 1640 __ bind(&miss); | 1635 __ bind(&miss); |
| 1641 Object* obj = GenerateMissBranch(); | 1636 |
| 1642 if (obj->IsFailure()) return obj; | 1637 GenerateMissBranch(); |
| 1643 | 1638 |
| 1644 // Return the generated code. | 1639 // Return the generated code. |
| 1645 return GetCode(function); | 1640 return GetCode(function); |
| 1646 } | 1641 } |
| 1647 | 1642 |
| 1648 | 1643 |
| 1649 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, | 1644 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, |
| 1650 JSObject* holder, | 1645 JSObject* holder, |
| 1651 JSFunction* function, | 1646 JSFunction* function, |
| 1652 String* name, | 1647 String* name, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 __ ret((argc + 1) * kPointerSize); | 1693 __ ret((argc + 1) * kPointerSize); |
| 1699 | 1694 |
| 1700 ICRuntimeCallHelper call_helper; | 1695 ICRuntimeCallHelper call_helper; |
| 1701 char_at_generator.GenerateSlow(masm(), call_helper); | 1696 char_at_generator.GenerateSlow(masm(), call_helper); |
| 1702 | 1697 |
| 1703 __ bind(&index_out_of_range); | 1698 __ bind(&index_out_of_range); |
| 1704 __ Set(eax, Immediate(Factory::empty_string())); | 1699 __ Set(eax, Immediate(Factory::empty_string())); |
| 1705 __ ret((argc + 1) * kPointerSize); | 1700 __ ret((argc + 1) * kPointerSize); |
| 1706 | 1701 |
| 1707 __ bind(&miss); | 1702 __ bind(&miss); |
| 1708 Object* obj = GenerateMissBranch(); | 1703 // Restore function name in ecx. |
| 1709 if (obj->IsFailure()) return obj; | 1704 |
| 1705 GenerateMissBranch(); |
| 1710 | 1706 |
| 1711 // Return the generated code. | 1707 // Return the generated code. |
| 1712 return GetCode(function); | 1708 return GetCode(function); |
| 1713 } | 1709 } |
| 1714 | 1710 |
| 1715 | 1711 |
| 1716 Object* CallStubCompiler::CompileCallConstant(Object* object, | 1712 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 1717 JSObject* holder, | 1713 JSObject* holder, |
| 1718 JSFunction* function, | 1714 JSFunction* function, |
| 1719 String* name, | 1715 String* name, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 } else { | 1849 } else { |
| 1854 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1850 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
| 1855 } | 1851 } |
| 1856 | 1852 |
| 1857 // Handle call cache miss. | 1853 // Handle call cache miss. |
| 1858 __ bind(&miss); | 1854 __ bind(&miss); |
| 1859 if (depth != kInvalidProtoDepth) { | 1855 if (depth != kInvalidProtoDepth) { |
| 1860 FreeSpaceForFastApiCall(masm(), eax); | 1856 FreeSpaceForFastApiCall(masm(), eax); |
| 1861 } | 1857 } |
| 1862 __ bind(&miss_in_smi_check); | 1858 __ bind(&miss_in_smi_check); |
| 1863 Object* obj = GenerateMissBranch(); | 1859 GenerateMissBranch(); |
| 1864 if (obj->IsFailure()) return obj; | |
| 1865 | 1860 |
| 1866 // Return the generated code. | 1861 // Return the generated code. |
| 1867 return GetCode(function); | 1862 return GetCode(function); |
| 1868 } | 1863 } |
| 1869 | 1864 |
| 1870 | 1865 |
| 1871 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 1866 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
| 1872 JSObject* holder, | 1867 JSObject* holder, |
| 1873 String* name) { | 1868 String* name) { |
| 1874 // ----------- S t a t e ------------- | 1869 // ----------- S t a t e ------------- |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 1913 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
| 1919 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 1914 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
| 1920 } | 1915 } |
| 1921 | 1916 |
| 1922 // Invoke the function. | 1917 // Invoke the function. |
| 1923 __ mov(edi, eax); | 1918 __ mov(edi, eax); |
| 1924 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); | 1919 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); |
| 1925 | 1920 |
| 1926 // Handle load cache miss. | 1921 // Handle load cache miss. |
| 1927 __ bind(&miss); | 1922 __ bind(&miss); |
| 1928 Object* obj = GenerateMissBranch(); | 1923 GenerateMissBranch(); |
| 1929 if (obj->IsFailure()) return obj; | |
| 1930 | 1924 |
| 1931 // Return the generated code. | 1925 // Return the generated code. |
| 1932 return GetCode(INTERCEPTOR, name); | 1926 return GetCode(INTERCEPTOR, name); |
| 1933 } | 1927 } |
| 1934 | 1928 |
| 1935 | 1929 |
| 1936 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, | 1930 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, |
| 1937 GlobalObject* holder, | 1931 GlobalObject* holder, |
| 1938 JSGlobalPropertyCell* cell, | 1932 JSGlobalPropertyCell* cell, |
| 1939 JSFunction* function, | 1933 JSFunction* function, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 __ IncrementCounter(&Counters::call_global_inline, 1); | 1998 __ IncrementCounter(&Counters::call_global_inline, 1); |
| 2005 ASSERT(function->is_compiled()); | 1999 ASSERT(function->is_compiled()); |
| 2006 Handle<Code> code(function->code()); | 2000 Handle<Code> code(function->code()); |
| 2007 ParameterCount expected(function->shared()->formal_parameter_count()); | 2001 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 2008 __ InvokeCode(code, expected, arguments(), | 2002 __ InvokeCode(code, expected, arguments(), |
| 2009 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2003 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 2010 | 2004 |
| 2011 // Handle call cache miss. | 2005 // Handle call cache miss. |
| 2012 __ bind(&miss); | 2006 __ bind(&miss); |
| 2013 __ IncrementCounter(&Counters::call_global_inline_miss, 1); | 2007 __ IncrementCounter(&Counters::call_global_inline_miss, 1); |
| 2014 Object* obj = GenerateMissBranch(); | 2008 GenerateMissBranch(); |
| 2015 if (obj->IsFailure()) return obj; | |
| 2016 | 2009 |
| 2017 // Return the generated code. | 2010 // Return the generated code. |
| 2018 return GetCode(NORMAL, name); | 2011 return GetCode(NORMAL, name); |
| 2019 } | 2012 } |
| 2020 | 2013 |
| 2021 | 2014 |
| 2022 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 2015 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
| 2023 int index, | 2016 int index, |
| 2024 Map* transition, | 2017 Map* transition, |
| 2025 String* name) { | 2018 String* name) { |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2747 // Return the generated code. | 2740 // Return the generated code. |
| 2748 return GetCode(); | 2741 return GetCode(); |
| 2749 } | 2742 } |
| 2750 | 2743 |
| 2751 | 2744 |
| 2752 #undef __ | 2745 #undef __ |
| 2753 | 2746 |
| 2754 } } // namespace v8::internal | 2747 } } // namespace v8::internal |
| 2755 | 2748 |
| 2756 #endif // V8_TARGET_ARCH_IA32 | 2749 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |