OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 824 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
825 // ----------- S t a t e ------------- | 825 // ----------- S t a t e ------------- |
826 // -- rcx : name | 826 // -- rcx : name |
827 // -- rsp[0] : return address | 827 // -- rsp[0] : return address |
828 // -- rsp[8] : receiver | 828 // -- rsp[8] : receiver |
829 // ----------------------------------- | 829 // ----------------------------------- |
830 | 830 |
831 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 831 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
832 } | 832 } |
833 | 833 |
| 834 |
834 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 835 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
| 836 // ----------- S t a t e ------------- |
| 837 // -- rcx : name |
| 838 // -- rsp[0] : return address |
| 839 // -- rsp[8] : receiver |
| 840 // ----------------------------------- |
| 841 |
| 842 Label miss, probe, global; |
| 843 |
| 844 __ movq(rax, Operand(rsp, kPointerSize)); |
| 845 |
| 846 // Check that the receiver isn't a smi. |
| 847 __ testl(rax, Immediate(kSmiTagMask)); |
| 848 __ j(zero, &miss); |
| 849 |
| 850 // Check that the receiver is a valid JS object. |
| 851 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rbx); |
| 852 __ j(less, &miss); |
| 853 |
| 854 // If this assert fails, we have to check upper bound too. |
| 855 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
| 856 |
| 857 // Check for access to global object (unlikely). |
| 858 __ CmpInstanceType(rbx, JS_GLOBAL_PROXY_TYPE); |
| 859 __ j(equal, &global); |
| 860 |
| 861 // Check for non-global object that requires access check. |
| 862 __ testl(FieldOperand(rbx, Map::kBitFieldOffset), |
| 863 Immediate(1 << Map::kIsAccessCheckNeeded)); |
| 864 __ j(not_zero, &miss); |
| 865 |
| 866 // Search the dictionary placing the result in eax. |
| 867 __ bind(&probe); |
| 868 GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, rcx); |
| 869 GenerateCheckNonObjectOrLoaded(masm, &miss, rax); |
| 870 __ ret(0); |
| 871 |
| 872 // Global object access: Check access rights. |
| 873 __ bind(&global); |
| 874 __ CheckAccessGlobalProxy(rax, rdx, &miss); |
| 875 __ jmp(&probe); |
| 876 |
| 877 // Cache miss: Restore receiver from stack and jump to runtime. |
| 878 __ bind(&miss); |
| 879 __ movq(rax, Operand(rsp, 1 * kPointerSize)); |
835 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 880 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
836 } | 881 } |
837 | 882 |
838 | 883 |
839 void LoadIC::GenerateStringLength(MacroAssembler* masm) { | 884 void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
840 // ----------- S t a t e ------------- | 885 // ----------- S t a t e ------------- |
841 // -- rcx : name | 886 // -- rcx : name |
842 // -- rsp[0] : return address | 887 // -- rsp[0] : return address |
843 // -- rsp[8] : receiver | 888 // -- rsp[8] : receiver |
844 // ----------------------------------- | 889 // ----------------------------------- |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 979 |
935 // Cache miss: Jump to runtime. | 980 // Cache miss: Jump to runtime. |
936 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); | 981 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
937 } | 982 } |
938 | 983 |
939 | 984 |
940 #undef __ | 985 #undef __ |
941 | 986 |
942 | 987 |
943 } } // namespace v8::internal | 988 } } // namespace v8::internal |
OLD | NEW |