OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 GenerateLoadCallback(object, holder, rax, rcx, rdx, rbx, rdi, r8, callback, | 2812 GenerateLoadCallback(object, holder, rax, rcx, rdx, rbx, rdi, r8, callback, |
2813 name, &miss); | 2813 name, &miss); |
2814 __ bind(&miss); | 2814 __ bind(&miss); |
2815 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2815 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2816 | 2816 |
2817 // Return the generated code. | 2817 // Return the generated code. |
2818 return GetCode(Code::CALLBACKS, name); | 2818 return GetCode(Code::CALLBACKS, name); |
2819 } | 2819 } |
2820 | 2820 |
2821 | 2821 |
| 2822 #undef __ |
| 2823 #define __ ACCESS_MASM(masm) |
| 2824 |
| 2825 |
| 2826 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
| 2827 Handle<JSFunction> getter) { |
| 2828 // ----------- S t a t e ------------- |
| 2829 // -- rax : receiver |
| 2830 // -- rcx : name |
| 2831 // -- rsp[0] : return address |
| 2832 // ----------------------------------- |
| 2833 { |
| 2834 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2835 |
| 2836 if (!getter.is_null()) { |
| 2837 // Call the JavaScript getter with the receiver on the stack. |
| 2838 __ push(rax); |
| 2839 ParameterCount actual(0); |
| 2840 __ InvokeFunction(getter, actual, CALL_FUNCTION, NullCallWrapper(), |
| 2841 CALL_AS_METHOD); |
| 2842 } else { |
| 2843 // If we generate a global code snippet for deoptimization only, remember |
| 2844 // the place to continue after deoptimization. |
| 2845 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 2846 } |
| 2847 |
| 2848 // Restore context register. |
| 2849 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 2850 } |
| 2851 __ ret(0); |
| 2852 } |
| 2853 |
| 2854 |
| 2855 #undef __ |
| 2856 #define __ ACCESS_MASM(masm()) |
| 2857 |
| 2858 |
2822 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( | 2859 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( |
2823 Handle<String> name, | 2860 Handle<String> name, |
2824 Handle<JSObject> receiver, | 2861 Handle<JSObject> receiver, |
2825 Handle<JSObject> holder, | 2862 Handle<JSObject> holder, |
2826 Handle<JSFunction> getter) { | 2863 Handle<JSFunction> getter) { |
2827 // ----------- S t a t e ------------- | 2864 // ----------- S t a t e ------------- |
2828 // -- rax : receiver | 2865 // -- rax : receiver |
2829 // -- rcx : name | 2866 // -- rcx : name |
2830 // -- rsp[0] : return address | 2867 // -- rsp[0] : return address |
2831 // ----------------------------------- | 2868 // ----------------------------------- |
2832 Label miss; | 2869 Label miss; |
2833 | 2870 |
2834 // Check that the maps haven't changed. | 2871 // Check that the maps haven't changed. |
2835 __ JumpIfSmi(rax, &miss); | 2872 __ JumpIfSmi(rax, &miss); |
2836 CheckPrototypes(receiver, rax, holder, rbx, rdx, rdi, name, &miss); | 2873 CheckPrototypes(receiver, rax, holder, rbx, rdx, rdi, name, &miss); |
2837 | 2874 |
2838 { | 2875 GenerateLoadViaGetter(masm(), getter), |
2839 FrameScope scope(masm(), StackFrame::INTERNAL); | |
2840 | |
2841 // Call the JavaScript getter with the receiver on the stack. | |
2842 __ push(rax); | |
2843 ParameterCount actual(0); | |
2844 __ InvokeFunction(getter, actual, CALL_FUNCTION, NullCallWrapper(), | |
2845 CALL_AS_METHOD); | |
2846 | |
2847 // Restore context register. | |
2848 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | |
2849 } | |
2850 __ ret(0); | |
2851 | 2876 |
2852 __ bind(&miss); | 2877 __ bind(&miss); |
2853 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2878 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2854 | 2879 |
2855 // Return the generated code. | 2880 // Return the generated code. |
2856 return GetCode(Code::CALLBACKS, name); | 2881 return GetCode(Code::CALLBACKS, name); |
2857 } | 2882 } |
2858 | 2883 |
2859 | 2884 |
2860 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, | 2885 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4071 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 4096 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
4072 } | 4097 } |
4073 } | 4098 } |
4074 | 4099 |
4075 | 4100 |
4076 #undef __ | 4101 #undef __ |
4077 | 4102 |
4078 } } // namespace v8::internal | 4103 } } // namespace v8::internal |
4079 | 4104 |
4080 #endif // V8_TARGET_ARCH_X64 | 4105 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |