Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 125044: Fix debugger after inlined keyed store change.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } 740 }
741 741
742 742
743 void KeyedLoadIC::ClearInlinedVersion(Address address) { 743 void KeyedLoadIC::ClearInlinedVersion(Address address) {
744 // Insert null as the map to check for to make sure the map check fails 744 // Insert null as the map to check for to make sure the map check fails
745 // sending control flow to the IC instead of the inlined version. 745 // sending control flow to the IC instead of the inlined version.
746 PatchInlinedLoad(address, Heap::null_value()); 746 PatchInlinedLoad(address, Heap::null_value());
747 } 747 }
748 748
749 749
750 void KeyedStoreIC::ClearInlinedVersion(Address address) {
751 // Insert null as the elements map to check for. This will make
752 // sure that the elements fast-case map check fails so that control
753 // flows to the IC instead of the inlined version.
754 PatchInlinedStore(address, Heap::null_value());
755 }
756
757
758 void KeyedStoreIC::RestoreInlinedVersion(Address address) {
759 // Restore the fast-case elements map check so that the inlined
760 // version can be used again.
761 PatchInlinedStore(address, Heap::fixed_array_map());
762 }
763
764
750 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { 765 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) {
751 // The address of the instruction following the call. 766 // The address of the instruction following the call.
752 Address test_instruction_address = address + 4; 767 Address test_instruction_address = address + 4;
753 // If the instruction following the call is not a test eax, nothing 768 // If the instruction following the call is not a test eax, nothing
754 // was inlined. 769 // was inlined.
755 if (*test_instruction_address != kTestEaxByte) return false; 770 if (*test_instruction_address != kTestEaxByte) return false;
756 771
757 Address delta_address = test_instruction_address + 1; 772 Address delta_address = test_instruction_address + 1;
758 // The delta to the start of the map check instruction. 773 // The delta to the start of the map check instruction.
759 int delta = *reinterpret_cast<int*>(delta_address); 774 int delta = *reinterpret_cast<int*>(delta_address);
760 775
761 // The map address is the last 4 bytes of the 7-byte 776 // The map address is the last 4 bytes of the 7-byte
762 // operand-immediate compare instruction, so we add 3 to get the 777 // operand-immediate compare instruction, so we add 3 to get the
763 // offset to the last 4 bytes. 778 // offset to the last 4 bytes.
764 Address map_address = test_instruction_address + delta + 3; 779 Address map_address = test_instruction_address + delta + 3;
765 *(reinterpret_cast<Object**>(map_address)) = map; 780 *(reinterpret_cast<Object**>(map_address)) = map;
766 781
767 // The offset is in the last 4 bytes of a six byte 782 // The offset is in the last 4 bytes of a six byte
768 // memory-to-register move instruction, so we add 2 to get the 783 // memory-to-register move instruction, so we add 2 to get the
769 // offset to the last 4 bytes. 784 // offset to the last 4 bytes.
770 Address offset_address = 785 Address offset_address =
771 test_instruction_address + delta + kOffsetToLoadInstruction + 2; 786 test_instruction_address + delta + kOffsetToLoadInstruction + 2;
772 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; 787 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag;
773 return true; 788 return true;
774 } 789 }
775 790
776 791
777 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { 792 static bool PatchInlinedMapCheck(Address address, Object* map) {
778 Address test_instruction_address = address + 4; // 4 = stub address 793 Address test_instruction_address = address + 4; // 4 = stub address
779 // The keyed load has a fast inlined case if the IC call instruction 794 // The keyed load has a fast inlined case if the IC call instruction
780 // is immediately followed by a test instruction. 795 // is immediately followed by a test instruction.
781 if (*test_instruction_address != kTestEaxByte) return false; 796 if (*test_instruction_address != kTestEaxByte) return false;
782 797
783 // Fetch the offset from the test instruction to the map cmp 798 // Fetch the offset from the test instruction to the map cmp
784 // instruction. This offset is stored in the last 4 bytes of the 5 799 // instruction. This offset is stored in the last 4 bytes of the 5
785 // byte test instruction. 800 // byte test instruction.
786 Address delta_address = test_instruction_address + 1; 801 Address delta_address = test_instruction_address + 1;
787 int delta = *reinterpret_cast<int*>(delta_address); 802 int delta = *reinterpret_cast<int*>(delta_address);
788 // Compute the map address. The map address is in the last 4 bytes 803 // Compute the map address. The map address is in the last 4 bytes
789 // of the 7-byte operand-immediate compare instruction, so we add 3 804 // of the 7-byte operand-immediate compare instruction, so we add 3
790 // to the offset to get the map address. 805 // to the offset to get the map address.
791 Address map_address = test_instruction_address + delta + 3; 806 Address map_address = test_instruction_address + delta + 3;
792 // Patch the map check. 807 // Patch the map check.
793 *(reinterpret_cast<Object**>(map_address)) = map; 808 *(reinterpret_cast<Object**>(map_address)) = map;
794 return true; 809 return true;
795 } 810 }
796 811
797 812
813 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) {
814 return PatchInlinedMapCheck(address, map);
815 }
816
817
818 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) {
819 return PatchInlinedMapCheck(address, map);
820 }
821
822
798 // Defined in ic.cc. 823 // Defined in ic.cc.
799 Object* KeyedLoadIC_Miss(Arguments args); 824 Object* KeyedLoadIC_Miss(Arguments args);
800 825
801 826
802 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 827 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
803 // ----------- S t a t e ------------- 828 // ----------- S t a t e -------------
804 // -- esp[0] : return address 829 // -- esp[0] : return address
805 // -- esp[4] : name 830 // -- esp[4] : name
806 // -- esp[8] : receiver 831 // -- esp[8] : receiver
807 // ----------------------------------- 832 // -----------------------------------
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 957
933 // Do tail-call to runtime routine. 958 // Do tail-call to runtime routine.
934 __ TailCallRuntime( 959 __ TailCallRuntime(
935 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); 960 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3);
936 } 961 }
937 962
938 #undef __ 963 #undef __
939 964
940 965
941 } } // namespace v8::internal 966 } } // namespace v8::internal
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/ia32/codegen-ia32.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698