OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 // Return the generated code. | 1498 // Return the generated code. |
1499 return GetCode(NORMAL, name); | 1499 return GetCode(NORMAL, name); |
1500 } | 1500 } |
1501 | 1501 |
1502 | 1502 |
1503 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 1503 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, |
1504 JSObject* receiver, | 1504 JSObject* receiver, |
1505 JSObject* holder, | 1505 JSObject* holder, |
1506 AccessorInfo* callback) { | 1506 AccessorInfo* callback) { |
1507 // ----------- S t a t e ------------- | 1507 // ----------- S t a t e ------------- |
| 1508 // -- rax : key |
| 1509 // -- rdx : receiver |
1508 // -- rsp[0] : return address | 1510 // -- rsp[0] : return address |
1509 // -- rsp[8] : name | |
1510 // -- rsp[16] : receiver | |
1511 // ----------------------------------- | 1511 // ----------------------------------- |
1512 Label miss; | 1512 Label miss; |
1513 | 1513 |
1514 __ movq(rax, Operand(rsp, kPointerSize)); | |
1515 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1516 __ IncrementCounter(&Counters::keyed_load_callback, 1); | 1514 __ IncrementCounter(&Counters::keyed_load_callback, 1); |
1517 | 1515 |
1518 // Check that the name has not changed. | 1516 // Check that the name has not changed. |
1519 __ Cmp(rax, Handle<String>(name)); | 1517 __ Cmp(rax, Handle<String>(name)); |
1520 __ j(not_equal, &miss); | 1518 __ j(not_equal, &miss); |
1521 | 1519 |
1522 Failure* failure = Failure::InternalError(); | 1520 Failure* failure = Failure::InternalError(); |
1523 bool success = GenerateLoadCallback(receiver, holder, rcx, rax, rbx, rdx, | 1521 bool success = GenerateLoadCallback(receiver, holder, rdx, rax, rbx, rcx, |
1524 callback, name, &miss, &failure); | 1522 callback, name, &miss, &failure); |
1525 if (!success) return failure; | 1523 if (!success) return failure; |
1526 | 1524 |
1527 __ bind(&miss); | 1525 __ bind(&miss); |
1528 __ DecrementCounter(&Counters::keyed_load_callback, 1); | 1526 __ DecrementCounter(&Counters::keyed_load_callback, 1); |
1529 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1527 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1530 | 1528 |
1531 // Return the generated code. | 1529 // Return the generated code. |
1532 return GetCode(CALLBACKS, name); | 1530 return GetCode(CALLBACKS, name); |
1533 } | 1531 } |
1534 | 1532 |
1535 | 1533 |
1536 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 1534 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
1537 // ----------- S t a t e ------------- | 1535 // ----------- S t a t e ------------- |
| 1536 // -- rax : key |
| 1537 // -- rdx : receiver |
1538 // -- rsp[0] : return address | 1538 // -- rsp[0] : return address |
1539 // -- rsp[8] : name | |
1540 // -- rsp[16] : receiver | |
1541 // ----------------------------------- | 1539 // ----------------------------------- |
1542 Label miss; | 1540 Label miss; |
1543 | 1541 |
1544 __ movq(rax, Operand(rsp, kPointerSize)); | |
1545 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1546 __ IncrementCounter(&Counters::keyed_load_array_length, 1); | 1542 __ IncrementCounter(&Counters::keyed_load_array_length, 1); |
1547 | 1543 |
1548 // Check that the name has not changed. | 1544 // Check that the name has not changed. |
1549 __ Cmp(rax, Handle<String>(name)); | 1545 __ Cmp(rax, Handle<String>(name)); |
1550 __ j(not_equal, &miss); | 1546 __ j(not_equal, &miss); |
1551 | 1547 |
1552 GenerateLoadArrayLength(masm(), rcx, rdx, &miss); | 1548 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); |
1553 __ bind(&miss); | 1549 __ bind(&miss); |
1554 __ DecrementCounter(&Counters::keyed_load_array_length, 1); | 1550 __ DecrementCounter(&Counters::keyed_load_array_length, 1); |
1555 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1551 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1556 | 1552 |
1557 // Return the generated code. | 1553 // Return the generated code. |
1558 return GetCode(CALLBACKS, name); | 1554 return GetCode(CALLBACKS, name); |
1559 } | 1555 } |
1560 | 1556 |
1561 | 1557 |
1562 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 1558 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
1563 JSObject* receiver, | 1559 JSObject* receiver, |
1564 JSObject* holder, | 1560 JSObject* holder, |
1565 Object* value) { | 1561 Object* value) { |
1566 // ----------- S t a t e ------------- | 1562 // ----------- S t a t e ------------- |
| 1563 // -- rax : key |
| 1564 // -- rdx : receiver |
1567 // -- rsp[0] : return address | 1565 // -- rsp[0] : return address |
1568 // -- rsp[8] : name | |
1569 // -- rsp[16] : receiver | |
1570 // ----------------------------------- | 1566 // ----------------------------------- |
1571 Label miss; | 1567 Label miss; |
1572 | 1568 |
1573 __ movq(rax, Operand(rsp, kPointerSize)); | |
1574 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1575 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); | 1569 __ IncrementCounter(&Counters::keyed_load_constant_function, 1); |
1576 | 1570 |
1577 // Check that the name has not changed. | 1571 // Check that the name has not changed. |
1578 __ Cmp(rax, Handle<String>(name)); | 1572 __ Cmp(rax, Handle<String>(name)); |
1579 __ j(not_equal, &miss); | 1573 __ j(not_equal, &miss); |
1580 | 1574 |
1581 GenerateLoadConstant(receiver, holder, rcx, rbx, rdx, | 1575 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, |
1582 value, name, &miss); | 1576 value, name, &miss); |
1583 __ bind(&miss); | 1577 __ bind(&miss); |
1584 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); | 1578 __ DecrementCounter(&Counters::keyed_load_constant_function, 1); |
1585 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1579 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1586 | 1580 |
1587 // Return the generated code. | 1581 // Return the generated code. |
1588 return GetCode(CONSTANT_FUNCTION, name); | 1582 return GetCode(CONSTANT_FUNCTION, name); |
1589 } | 1583 } |
1590 | 1584 |
1591 | 1585 |
1592 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 1586 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
1593 // ----------- S t a t e ------------- | 1587 // ----------- S t a t e ------------- |
| 1588 // -- rax : key |
| 1589 // -- rdx : receiver |
1594 // -- rsp[0] : return address | 1590 // -- rsp[0] : return address |
1595 // -- rsp[8] : name | |
1596 // -- rsp[16] : receiver | |
1597 // ----------------------------------- | 1591 // ----------------------------------- |
1598 Label miss; | 1592 Label miss; |
1599 | 1593 |
1600 __ movq(rax, Operand(rsp, kPointerSize)); | |
1601 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1602 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); | 1594 __ IncrementCounter(&Counters::keyed_load_function_prototype, 1); |
1603 | 1595 |
1604 // Check that the name has not changed. | 1596 // Check that the name has not changed. |
1605 __ Cmp(rax, Handle<String>(name)); | 1597 __ Cmp(rax, Handle<String>(name)); |
1606 __ j(not_equal, &miss); | 1598 __ j(not_equal, &miss); |
1607 | 1599 |
1608 GenerateLoadFunctionPrototype(masm(), rcx, rdx, rbx, &miss); | 1600 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); |
1609 __ bind(&miss); | 1601 __ bind(&miss); |
1610 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); | 1602 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); |
1611 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1603 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1612 | 1604 |
1613 // Return the generated code. | 1605 // Return the generated code. |
1614 return GetCode(CALLBACKS, name); | 1606 return GetCode(CALLBACKS, name); |
1615 } | 1607 } |
1616 | 1608 |
1617 | 1609 |
1618 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 1610 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
1619 JSObject* holder, | 1611 JSObject* holder, |
1620 String* name) { | 1612 String* name) { |
1621 // ----------- S t a t e ------------- | 1613 // ----------- S t a t e ------------- |
| 1614 // -- rax : key |
| 1615 // -- rdx : receiver |
1622 // -- rsp[0] : return address | 1616 // -- rsp[0] : return address |
1623 // -- rsp[8] : name | |
1624 // -- rsp[16] : receiver | |
1625 // ----------------------------------- | 1617 // ----------------------------------- |
1626 Label miss; | 1618 Label miss; |
1627 | 1619 |
1628 __ movq(rax, Operand(rsp, kPointerSize)); | |
1629 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1630 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); | 1620 __ IncrementCounter(&Counters::keyed_load_interceptor, 1); |
1631 | 1621 |
1632 // Check that the name has not changed. | 1622 // Check that the name has not changed. |
1633 __ Cmp(rax, Handle<String>(name)); | 1623 __ Cmp(rax, Handle<String>(name)); |
1634 __ j(not_equal, &miss); | 1624 __ j(not_equal, &miss); |
1635 | 1625 |
1636 LookupResult lookup; | 1626 LookupResult lookup; |
1637 LookupPostInterceptor(holder, name, &lookup); | 1627 LookupPostInterceptor(holder, name, &lookup); |
1638 GenerateLoadInterceptor(receiver, | 1628 GenerateLoadInterceptor(receiver, |
1639 holder, | 1629 holder, |
1640 &lookup, | 1630 &lookup, |
| 1631 rdx, |
| 1632 rax, |
1641 rcx, | 1633 rcx, |
1642 rax, | |
1643 rdx, | |
1644 rbx, | 1634 rbx, |
1645 name, | 1635 name, |
1646 &miss); | 1636 &miss); |
1647 __ bind(&miss); | 1637 __ bind(&miss); |
1648 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); | 1638 __ DecrementCounter(&Counters::keyed_load_interceptor, 1); |
1649 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1639 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1650 | 1640 |
1651 // Return the generated code. | 1641 // Return the generated code. |
1652 return GetCode(INTERCEPTOR, name); | 1642 return GetCode(INTERCEPTOR, name); |
1653 } | 1643 } |
1654 | 1644 |
1655 | 1645 |
1656 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 1646 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
1657 // ----------- S t a t e ------------- | 1647 // ----------- S t a t e ------------- |
1658 // -- rsp[0] : return address | 1648 // -- rax : key |
1659 // -- rsp[8] : name | 1649 // -- rdx : receiver |
1660 // -- rsp[16] : receiver | 1650 // -- rsp[0] : return address |
1661 // ----------------------------------- | 1651 // ----------------------------------- |
1662 Label miss; | 1652 Label miss; |
1663 | 1653 |
1664 __ movq(rax, Operand(rsp, kPointerSize)); | |
1665 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1666 __ IncrementCounter(&Counters::keyed_load_string_length, 1); | 1654 __ IncrementCounter(&Counters::keyed_load_string_length, 1); |
1667 | 1655 |
1668 // Check that the name has not changed. | 1656 // Check that the name has not changed. |
1669 __ Cmp(rax, Handle<String>(name)); | 1657 __ Cmp(rax, Handle<String>(name)); |
1670 __ j(not_equal, &miss); | 1658 __ j(not_equal, &miss); |
1671 | 1659 |
1672 GenerateLoadStringLength(masm(), rcx, rdx, rbx, &miss); | 1660 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss); |
1673 __ bind(&miss); | 1661 __ bind(&miss); |
1674 __ DecrementCounter(&Counters::keyed_load_string_length, 1); | 1662 __ DecrementCounter(&Counters::keyed_load_string_length, 1); |
1675 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1663 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1676 | 1664 |
1677 // Return the generated code. | 1665 // Return the generated code. |
1678 return GetCode(CALLBACKS, name); | 1666 return GetCode(CALLBACKS, name); |
1679 } | 1667 } |
1680 | 1668 |
1681 | 1669 |
1682 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 1670 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 // Return the generated code. | 1828 // Return the generated code. |
1841 return GetCode(NORMAL, name); | 1829 return GetCode(NORMAL, name); |
1842 } | 1830 } |
1843 | 1831 |
1844 | 1832 |
1845 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 1833 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
1846 JSObject* receiver, | 1834 JSObject* receiver, |
1847 JSObject* holder, | 1835 JSObject* holder, |
1848 int index) { | 1836 int index) { |
1849 // ----------- S t a t e ------------- | 1837 // ----------- S t a t e ------------- |
1850 // -- rsp[0] : return address | 1838 // -- rax : key |
1851 // -- rsp[8] : name | 1839 // -- rdx : receiver |
1852 // -- rsp[16] : receiver | 1840 // -- rsp[0] : return address |
1853 // ----------------------------------- | 1841 // ----------------------------------- |
1854 Label miss; | 1842 Label miss; |
1855 | 1843 |
1856 __ movq(rax, Operand(rsp, kPointerSize)); | |
1857 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | |
1858 __ IncrementCounter(&Counters::keyed_load_field, 1); | 1844 __ IncrementCounter(&Counters::keyed_load_field, 1); |
1859 | 1845 |
1860 // Check that the name has not changed. | 1846 // Check that the name has not changed. |
1861 __ Cmp(rax, Handle<String>(name)); | 1847 __ Cmp(rax, Handle<String>(name)); |
1862 __ j(not_equal, &miss); | 1848 __ j(not_equal, &miss); |
1863 | 1849 |
1864 GenerateLoadField(receiver, holder, rcx, rbx, rdx, index, name, &miss); | 1850 GenerateLoadField(receiver, holder, rdx, rbx, rcx, index, name, &miss); |
1865 | 1851 |
1866 __ bind(&miss); | 1852 __ bind(&miss); |
1867 __ DecrementCounter(&Counters::keyed_load_field, 1); | 1853 __ DecrementCounter(&Counters::keyed_load_field, 1); |
1868 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1854 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1869 | 1855 |
1870 // Return the generated code. | 1856 // Return the generated code. |
1871 return GetCode(FIELD, name); | 1857 return GetCode(FIELD, name); |
1872 } | 1858 } |
1873 | 1859 |
1874 | 1860 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 // Return the generated code. | 2303 // Return the generated code. |
2318 return GetCode(); | 2304 return GetCode(); |
2319 } | 2305 } |
2320 | 2306 |
2321 | 2307 |
2322 #undef __ | 2308 #undef __ |
2323 | 2309 |
2324 } } // namespace v8::internal | 2310 } } // namespace v8::internal |
2325 | 2311 |
2326 #endif // V8_TARGET_ARCH_X64 | 2312 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |