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 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 // memory-to-register move instruction, so we add 2 to get the | 1655 // memory-to-register move instruction, so we add 2 to get the |
1656 // offset to the last 4 bytes. | 1656 // offset to the last 4 bytes. |
1657 Address offset_address = | 1657 Address offset_address = |
1658 test_instruction_address + delta + kOffsetToLoadInstruction + 2; | 1658 test_instruction_address + delta + kOffsetToLoadInstruction + 2; |
1659 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; | 1659 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; |
1660 return true; | 1660 return true; |
1661 } | 1661 } |
1662 | 1662 |
1663 | 1663 |
1664 // One byte opcode for mov ecx,0xXXXXXXXX. | 1664 // One byte opcode for mov ecx,0xXXXXXXXX. |
| 1665 // Marks inlined contextual loads using all kinds of cells. Generated |
| 1666 // code has the hole check: |
| 1667 // mov reg, <cell> |
| 1668 // mov reg, (<cell>, value offset) |
| 1669 // cmp reg, <the hole> |
| 1670 // je slow |
| 1671 // ;; use reg |
1665 static const byte kMovEcxByte = 0xB9; | 1672 static const byte kMovEcxByte = 0xB9; |
1666 | 1673 |
| 1674 // One byte opcode for mov edx,0xXXXXXXXX. |
| 1675 // Marks inlined contextual loads using only "don't delete" |
| 1676 // cells. Generated code doesn't have the hole check: |
| 1677 // mov reg, <cell> |
| 1678 // mov reg, (<cell>, value offset) |
| 1679 // ;; use reg |
| 1680 static const byte kMovEdxByte = 0xBA; |
| 1681 |
1667 bool LoadIC::PatchInlinedContextualLoad(Address address, | 1682 bool LoadIC::PatchInlinedContextualLoad(Address address, |
1668 Object* map, | 1683 Object* map, |
1669 Object* cell) { | 1684 Object* cell, |
| 1685 bool is_dont_delete) { |
1670 // The address of the instruction following the call. | 1686 // The address of the instruction following the call. |
1671 Address mov_instruction_address = | 1687 Address mov_instruction_address = |
1672 address + Assembler::kCallTargetAddressOffset; | 1688 address + Assembler::kCallTargetAddressOffset; |
1673 // If the instruction following the call is not a cmp eax, nothing | 1689 // If the instruction following the call is not a mov ecx/edx, |
1674 // was inlined. | 1690 // nothing was inlined. |
1675 if (*mov_instruction_address != kMovEcxByte) return false; | 1691 byte b = *mov_instruction_address; |
| 1692 if (b != kMovEcxByte && b != kMovEdxByte) return false; |
| 1693 // If we don't have the hole check generated, we can only support |
| 1694 // "don't delete" cells. |
| 1695 if (b == kMovEdxByte && !is_dont_delete) return false; |
1676 | 1696 |
1677 Address delta_address = mov_instruction_address + 1; | 1697 Address delta_address = mov_instruction_address + 1; |
1678 // The delta to the start of the map check instruction. | 1698 // The delta to the start of the map check instruction. |
1679 int delta = *reinterpret_cast<int*>(delta_address); | 1699 int delta = *reinterpret_cast<int*>(delta_address); |
1680 | 1700 |
1681 // The map address is the last 4 bytes of the 7-byte | 1701 // The map address is the last 4 bytes of the 7-byte |
1682 // operand-immediate compare instruction, so we add 3 to get the | 1702 // operand-immediate compare instruction, so we add 3 to get the |
1683 // offset to the last 4 bytes. | 1703 // offset to the last 4 bytes. |
1684 Address map_address = mov_instruction_address + delta + 3; | 1704 Address map_address = mov_instruction_address + delta + 3; |
1685 *(reinterpret_cast<Object**>(map_address)) = map; | 1705 *(reinterpret_cast<Object**>(map_address)) = map; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 2000 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); |
1981 __ TailCallExternalReference(ref, 3, 1); | 2001 __ TailCallExternalReference(ref, 3, 1); |
1982 } | 2002 } |
1983 | 2003 |
1984 #undef __ | 2004 #undef __ |
1985 | 2005 |
1986 | 2006 |
1987 } } // namespace v8::internal | 2007 } } // namespace v8::internal |
1988 | 2008 |
1989 #endif // V8_TARGET_ARCH_IA32 | 2009 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |