| 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, |
| 826 CallableType function_type) { |
| 826 // ----------- S t a t e ------------- | 827 // ----------- S t a t e ------------- |
| 827 // -- rax : the number of arguments (not including the receiver) | 828 // -- rax : the number of arguments (not including the receiver) |
| 828 // -- rbx : the address of the first argument to be pushed. Subsequent | 829 // -- rbx : the address of the first argument to be pushed. Subsequent |
| 829 // arguments should be consecutive above this, in the same order as | 830 // arguments should be consecutive above this, in the same order as |
| 830 // they are to be pushed onto the stack. | 831 // they are to be pushed onto the stack. |
| 831 // -- rdi : the target to call (can be any Object). | 832 // -- rdi : the target to call (can be any Object). |
| 832 // ----------------------------------- | 833 // ----------------------------------- |
| 833 | 834 |
| 834 // Pop return address to allow tail-call after pushing arguments. | 835 // Pop return address to allow tail-call after pushing arguments. |
| 835 __ PopReturnAddressTo(kScratchRegister); | 836 __ PopReturnAddressTo(kScratchRegister); |
| 836 | 837 |
| 837 Generate_InterpreterPushArgs(masm, true); | 838 Generate_InterpreterPushArgs(masm, true); |
| 838 | 839 |
| 839 // Call the target. | 840 // Call the target. |
| 840 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. | 841 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. |
| 841 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 842 |
| 842 tail_call_mode), | 843 if (function_type == CallableType::kJSFunction) { |
| 843 RelocInfo::CODE_TARGET); | 844 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
| 845 tail_call_mode), |
| 846 RelocInfo::CODE_TARGET); |
| 847 } else { |
| 848 DCHECK_EQ(function_type, CallableType::kAny); |
| 849 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 850 tail_call_mode), |
| 851 RelocInfo::CODE_TARGET); |
| 852 } |
| 844 } | 853 } |
| 845 | 854 |
| 846 // static | 855 // static |
| 847 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 856 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 848 // ----------- S t a t e ------------- | 857 // ----------- S t a t e ------------- |
| 849 // -- rax : the number of arguments (not including the receiver) | 858 // -- rax : the number of arguments (not including the receiver) |
| 850 // -- rdx : the new target (either the same as the constructor or | 859 // -- rdx : the new target (either the same as the constructor or |
| 851 // the JSFunction on which new was invoked initially) | 860 // the JSFunction on which new was invoked initially) |
| 852 // -- rdi : the constructor to call (can be any Object) | 861 // -- rdi : the constructor to call (can be any Object) |
| 853 // -- rbx : the address of the first argument to be pushed. Subsequent | 862 // -- 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); | 3093 __ ret(0); |
| 3085 } | 3094 } |
| 3086 | 3095 |
| 3087 | 3096 |
| 3088 #undef __ | 3097 #undef __ |
| 3089 | 3098 |
| 3090 } // namespace internal | 3099 } // namespace internal |
| 3091 } // namespace v8 | 3100 } // namespace v8 |
| 3092 | 3101 |
| 3093 #endif // V8_TARGET_ARCH_X64 | 3102 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |