| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 __ pop(ebx); | 722 __ pop(ebx); |
| 723 __ push(eax); | 723 __ push(eax); |
| 724 __ push(ecx); | 724 __ push(ecx); |
| 725 __ push(ebx); | 725 __ push(ebx); |
| 726 | 726 |
| 727 // Perform tail call to the entry. | 727 // Perform tail call to the entry. |
| 728 __ TailCallRuntime(f, 2); | 728 __ TailCallRuntime(f, 2); |
| 729 } | 729 } |
| 730 | 730 |
| 731 | 731 |
| 732 // One byte opcode for test eax,0xXXXXXXXX. |
| 733 static const byte kTestEaxByte = 0xA9; |
| 734 |
| 735 |
| 736 bool KeyedLoadIC::HasInlinedVersion(Address address) { |
| 737 Address test_instruction_address = address + 4; // 4 = stub address |
| 738 return *test_instruction_address == kTestEaxByte; |
| 739 } |
| 740 |
| 741 |
| 742 void KeyedLoadIC::ClearInlinedVersion(Address address) { |
| 743 // Insert null as the map to check for to make sure the map check fails |
| 744 // sending control flow to the IC instead of the inlined version. |
| 745 PatchInlinedMapCheck(address, Heap::null_value()); |
| 746 } |
| 747 |
| 748 |
| 732 void KeyedLoadIC::PatchInlinedMapCheck(Address address, Object* value) { | 749 void KeyedLoadIC::PatchInlinedMapCheck(Address address, Object* value) { |
| 733 static const byte kTestEaxByte = 0xA9; | |
| 734 Address test_instruction_address = address + 4; // 4 = stub address | 750 Address test_instruction_address = address + 4; // 4 = stub address |
| 735 // The keyed load has a fast inlined case if the IC call instruction | 751 // The keyed load has a fast inlined case if the IC call instruction |
| 736 // is immediately followed by a test instruction. | 752 // is immediately followed by a test instruction. |
| 737 if (*test_instruction_address == kTestEaxByte) { | 753 if (*test_instruction_address == kTestEaxByte) { |
| 738 // Fetch the offset from the test instruction to the map cmp | 754 // Fetch the offset from the test instruction to the map cmp |
| 739 // instruction. This offset is stored in the last 4 bytes of the | 755 // instruction. This offset is stored in the last 4 bytes of the |
| 740 // 5 byte test instruction. | 756 // 5 byte test instruction. |
| 741 Address offset_address = test_instruction_address + 1; | 757 Address offset_address = test_instruction_address + 1; |
| 742 int offset_value = *(reinterpret_cast<int*>(offset_address)); | 758 int offset_value = *(reinterpret_cast<int*>(offset_address)); |
| 743 // Compute the map address. The map address is in the last 4 | 759 // Compute the map address. The map address is in the last 4 |
| 744 // bytes of the 7-byte operand-immediate compare instruction, so | 760 // bytes of the 7-byte operand-immediate compare instruction, so |
| 745 // we add 3 to the offset to get the map address. | 761 // we add 3 to the offset to get the map address. |
| 746 Address map_address = test_instruction_address + offset_value + 3; | 762 Address map_address = test_instruction_address + offset_value + 3; |
| 747 // patch the map check. | 763 // Patch the map check. |
| 748 (*(reinterpret_cast<Object**>(map_address))) = value; | 764 (*(reinterpret_cast<Object**>(map_address))) = value; |
| 749 } | 765 } |
| 750 } | 766 } |
| 751 | 767 |
| 752 | 768 |
| 753 // Defined in ic.cc. | 769 // Defined in ic.cc. |
| 754 Object* KeyedLoadIC_Miss(Arguments args); | 770 Object* KeyedLoadIC_Miss(Arguments args); |
| 755 | 771 |
| 756 | 772 |
| 757 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 773 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 901 |
| 886 // Do tail-call to runtime routine. | 902 // Do tail-call to runtime routine. |
| 887 __ TailCallRuntime( | 903 __ TailCallRuntime( |
| 888 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); | 904 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); |
| 889 } | 905 } |
| 890 | 906 |
| 891 #undef __ | 907 #undef __ |
| 892 | 908 |
| 893 | 909 |
| 894 } } // namespace v8::internal | 910 } } // namespace v8::internal |
| OLD | NEW |