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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3815 void MacroAssembler::DebugBreak() { | 3815 void MacroAssembler::DebugBreak() { |
3816 Set(rax, 0); // No arguments. | 3816 Set(rax, 0); // No arguments. |
3817 LoadAddress(rbx, | 3817 LoadAddress(rbx, |
3818 ExternalReference(Runtime::kHandleDebuggerStatement, isolate())); | 3818 ExternalReference(Runtime::kHandleDebuggerStatement, isolate())); |
3819 CEntryStub ces(isolate(), 1); | 3819 CEntryStub ces(isolate(), 1); |
3820 DCHECK(AllowThisStubCall(&ces)); | 3820 DCHECK(AllowThisStubCall(&ces)); |
3821 Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); | 3821 Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); |
3822 } | 3822 } |
3823 | 3823 |
3824 | 3824 |
| 3825 void MacroAssembler::InvokeFunction(Register function, |
| 3826 const ParameterCount& actual, |
| 3827 InvokeFlag flag, |
| 3828 const CallWrapper& call_wrapper) { |
| 3829 movp(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 3830 LoadSharedFunctionInfoSpecialField( |
| 3831 rbx, rdx, SharedFunctionInfo::kFormalParameterCountOffset); |
| 3832 |
| 3833 ParameterCount expected(rbx); |
| 3834 InvokeFunction(function, expected, actual, flag, call_wrapper); |
| 3835 } |
| 3836 |
| 3837 |
| 3838 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 3839 const ParameterCount& expected, |
| 3840 const ParameterCount& actual, |
| 3841 InvokeFlag flag, |
| 3842 const CallWrapper& call_wrapper) { |
| 3843 Move(rdi, function); |
| 3844 InvokeFunction(rdi, expected, actual, flag, call_wrapper); |
| 3845 } |
| 3846 |
| 3847 |
| 3848 void MacroAssembler::InvokeFunction(Register function, |
| 3849 const ParameterCount& expected, |
| 3850 const ParameterCount& actual, |
| 3851 InvokeFlag flag, |
| 3852 const CallWrapper& call_wrapper) { |
| 3853 DCHECK(function.is(rdi)); |
| 3854 movp(rsi, FieldOperand(function, JSFunction::kContextOffset)); |
| 3855 // Advances rdx to the end of the Code object header, to the start of |
| 3856 // the executable code. |
| 3857 movp(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 3858 InvokeCode(rdx, expected, actual, flag, call_wrapper); |
| 3859 } |
| 3860 |
| 3861 |
3825 void MacroAssembler::InvokeCode(Register code, | 3862 void MacroAssembler::InvokeCode(Register code, |
3826 const ParameterCount& expected, | 3863 const ParameterCount& expected, |
3827 const ParameterCount& actual, | 3864 const ParameterCount& actual, |
3828 InvokeFlag flag, | 3865 InvokeFlag flag, |
3829 const CallWrapper& call_wrapper) { | 3866 const CallWrapper& call_wrapper) { |
3830 // You can't call a function without a valid frame. | 3867 // You can't call a function without a valid frame. |
3831 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 3868 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
3832 | 3869 |
3833 Label done; | 3870 Label done; |
3834 bool definitely_mismatches = false; | 3871 bool definitely_mismatches = false; |
(...skipping 13 matching lines...) Expand all Loading... |
3848 call_wrapper.AfterCall(); | 3885 call_wrapper.AfterCall(); |
3849 } else { | 3886 } else { |
3850 DCHECK(flag == JUMP_FUNCTION); | 3887 DCHECK(flag == JUMP_FUNCTION); |
3851 jmp(code); | 3888 jmp(code); |
3852 } | 3889 } |
3853 bind(&done); | 3890 bind(&done); |
3854 } | 3891 } |
3855 } | 3892 } |
3856 | 3893 |
3857 | 3894 |
3858 void MacroAssembler::InvokeFunction(Register function, | |
3859 const ParameterCount& actual, | |
3860 InvokeFlag flag, | |
3861 const CallWrapper& call_wrapper) { | |
3862 // You can't call a function without a valid frame. | |
3863 DCHECK(flag == JUMP_FUNCTION || has_frame()); | |
3864 | |
3865 DCHECK(function.is(rdi)); | |
3866 movp(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); | |
3867 movp(rsi, FieldOperand(function, JSFunction::kContextOffset)); | |
3868 LoadSharedFunctionInfoSpecialField(rbx, rdx, | |
3869 SharedFunctionInfo::kFormalParameterCountOffset); | |
3870 // Advances rdx to the end of the Code object header, to the start of | |
3871 // the executable code. | |
3872 movp(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | |
3873 | |
3874 ParameterCount expected(rbx); | |
3875 InvokeCode(rdx, expected, actual, flag, call_wrapper); | |
3876 } | |
3877 | |
3878 | |
3879 void MacroAssembler::InvokeFunction(Register function, | |
3880 const ParameterCount& expected, | |
3881 const ParameterCount& actual, | |
3882 InvokeFlag flag, | |
3883 const CallWrapper& call_wrapper) { | |
3884 // You can't call a function without a valid frame. | |
3885 DCHECK(flag == JUMP_FUNCTION || has_frame()); | |
3886 | |
3887 DCHECK(function.is(rdi)); | |
3888 movp(rsi, FieldOperand(function, JSFunction::kContextOffset)); | |
3889 // Advances rdx to the end of the Code object header, to the start of | |
3890 // the executable code. | |
3891 movp(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | |
3892 | |
3893 InvokeCode(rdx, expected, actual, flag, call_wrapper); | |
3894 } | |
3895 | |
3896 | |
3897 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | |
3898 const ParameterCount& expected, | |
3899 const ParameterCount& actual, | |
3900 InvokeFlag flag, | |
3901 const CallWrapper& call_wrapper) { | |
3902 Move(rdi, function); | |
3903 InvokeFunction(rdi, expected, actual, flag, call_wrapper); | |
3904 } | |
3905 | |
3906 | |
3907 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 3895 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
3908 const ParameterCount& actual, | 3896 const ParameterCount& actual, |
3909 Handle<Code> code_constant, | 3897 Handle<Code> code_constant, |
3910 Register code_register, | 3898 Register code_register, |
3911 Label* done, | 3899 Label* done, |
3912 bool* definitely_mismatches, | 3900 bool* definitely_mismatches, |
3913 InvokeFlag flag, | 3901 InvokeFlag flag, |
3914 Label::Distance near_jump, | 3902 Label::Distance near_jump, |
3915 const CallWrapper& call_wrapper) { | 3903 const CallWrapper& call_wrapper) { |
3916 bool definitely_matches = false; | 3904 bool definitely_matches = false; |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5372 movl(rax, dividend); | 5360 movl(rax, dividend); |
5373 shrl(rax, Immediate(31)); | 5361 shrl(rax, Immediate(31)); |
5374 addl(rdx, rax); | 5362 addl(rdx, rax); |
5375 } | 5363 } |
5376 | 5364 |
5377 | 5365 |
5378 } // namespace internal | 5366 } // namespace internal |
5379 } // namespace v8 | 5367 } // namespace v8 |
5380 | 5368 |
5381 #endif // V8_TARGET_ARCH_X64 | 5369 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |