| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 __ bind(&loop_header); | 815 __ bind(&loop_header); |
| 816 __ Push(Operand(rbx, 0)); | 816 __ Push(Operand(rbx, 0)); |
| 817 __ subp(rbx, Immediate(kPointerSize)); | 817 __ subp(rbx, Immediate(kPointerSize)); |
| 818 __ bind(&loop_check); | 818 __ bind(&loop_check); |
| 819 __ cmpp(rbx, rcx); | 819 __ cmpp(rbx, rcx); |
| 820 __ j(greater, &loop_header, Label::kNear); | 820 __ j(greater, &loop_header, Label::kNear); |
| 821 } | 821 } |
| 822 | 822 |
| 823 // static | 823 // static |
| 824 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 824 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 825 MacroAssembler* masm, TailCallMode tail_call_mode) { | 825 MacroAssembler* masm, TailCallMode tail_call_mode, bool is_js_function) { |
| 826 // ----------- S t a t e ------------- | 826 // ----------- S t a t e ------------- |
| 827 // -- rax : the number of arguments (not including the receiver) | 827 // -- rax : the number of arguments (not including the receiver) |
| 828 // -- rbx : the address of the first argument to be pushed. Subsequent | 828 // -- rbx : the address of the first argument to be pushed. Subsequent |
| 829 // arguments should be consecutive above this, in the same order as | 829 // arguments should be consecutive above this, in the same order as |
| 830 // they are to be pushed onto the stack. | 830 // they are to be pushed onto the stack. |
| 831 // -- rdi : the target to call (can be any Object). | 831 // -- rdi : the target to call (can be any Object). |
| 832 // ----------------------------------- | 832 // ----------------------------------- |
| 833 | 833 |
| 834 // Pop return address to allow tail-call after pushing arguments. | 834 // Pop return address to allow tail-call after pushing arguments. |
| 835 __ PopReturnAddressTo(kScratchRegister); | 835 __ PopReturnAddressTo(kScratchRegister); |
| 836 | 836 |
| 837 Generate_InterpreterPushArgs(masm, true); | 837 Generate_InterpreterPushArgs(masm, true); |
| 838 | 838 |
| 839 // Call the target. | 839 // Call the target. |
| 840 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. | 840 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. |
| 841 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 841 |
| 842 tail_call_mode), | 842 if (is_js_function) { |
| 843 RelocInfo::CODE_TARGET); | 843 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
| 844 tail_call_mode), |
| 845 RelocInfo::CODE_TARGET); |
| 846 } else { |
| 847 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 848 tail_call_mode), |
| 849 RelocInfo::CODE_TARGET); |
| 850 } |
| 844 } | 851 } |
| 845 | 852 |
| 846 // static | 853 // static |
| 847 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 854 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 848 // ----------- S t a t e ------------- | 855 // ----------- S t a t e ------------- |
| 849 // -- rax : the number of arguments (not including the receiver) | 856 // -- rax : the number of arguments (not including the receiver) |
| 850 // -- rdx : the new target (either the same as the constructor or | 857 // -- rdx : the new target (either the same as the constructor or |
| 851 // the JSFunction on which new was invoked initially) | 858 // the JSFunction on which new was invoked initially) |
| 852 // -- rdi : the constructor to call (can be any Object) | 859 // -- rdi : the constructor to call (can be any Object) |
| 853 // -- rbx : the address of the first argument to be pushed. Subsequent | 860 // -- rbx : the address of the first argument to be pushed. Subsequent |
| (...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 __ ret(0); | 3091 __ ret(0); |
| 3085 } | 3092 } |
| 3086 | 3093 |
| 3087 | 3094 |
| 3088 #undef __ | 3095 #undef __ |
| 3089 | 3096 |
| 3090 } // namespace internal | 3097 } // namespace internal |
| 3091 } // namespace v8 | 3098 } // namespace v8 |
| 3092 | 3099 |
| 3093 #endif // V8_TARGET_ARCH_X64 | 3100 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |