| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 return static_cast<int>(offset); | 699 return static_cast<int>(offset); |
| 700 } | 700 } |
| 701 | 701 |
| 702 | 702 |
| 703 void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { | 703 void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { |
| 704 EnterApiExitFrame(arg_stack_space); | 704 EnterApiExitFrame(arg_stack_space); |
| 705 } | 705 } |
| 706 | 706 |
| 707 | 707 |
| 708 void MacroAssembler::CallApiFunctionAndReturn( | 708 void MacroAssembler::CallApiFunctionAndReturn( |
| 709 Register function_address, | 709 Register function_address, ExternalReference thunk_ref, |
| 710 ExternalReference thunk_ref, | 710 Register thunk_last_arg, int stack_space, Operand* stack_space_operand, |
| 711 Register thunk_last_arg, | 711 Operand return_value_operand, Operand* context_restore_operand) { |
| 712 int stack_space, | |
| 713 Operand return_value_operand, | |
| 714 Operand* context_restore_operand) { | |
| 715 Label prologue; | 712 Label prologue; |
| 716 Label promote_scheduled_exception; | 713 Label promote_scheduled_exception; |
| 717 Label exception_handled; | 714 Label exception_handled; |
| 718 Label delete_allocated_handles; | 715 Label delete_allocated_handles; |
| 719 Label leave_exit_frame; | 716 Label leave_exit_frame; |
| 720 Label write_back; | 717 Label write_back; |
| 721 | 718 |
| 722 Factory* factory = isolate()->factory(); | 719 Factory* factory = isolate()->factory(); |
| 723 ExternalReference next_address = | 720 ExternalReference next_address = |
| 724 ExternalReference::handle_scope_next_address(isolate()); | 721 ExternalReference::handle_scope_next_address(isolate()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 828 |
| 832 Abort(kAPICallReturnedInvalidObject); | 829 Abort(kAPICallReturnedInvalidObject); |
| 833 | 830 |
| 834 bind(&ok); | 831 bind(&ok); |
| 835 #endif | 832 #endif |
| 836 | 833 |
| 837 bool restore_context = context_restore_operand != NULL; | 834 bool restore_context = context_restore_operand != NULL; |
| 838 if (restore_context) { | 835 if (restore_context) { |
| 839 movp(rsi, *context_restore_operand); | 836 movp(rsi, *context_restore_operand); |
| 840 } | 837 } |
| 838 if (stack_space_operand != nullptr) { |
| 839 movp(rbx, *stack_space_operand); |
| 840 } |
| 841 LeaveApiExitFrame(!restore_context); | 841 LeaveApiExitFrame(!restore_context); |
| 842 ret(stack_space * kPointerSize); | 842 if (stack_space_operand != nullptr) { |
| 843 DCHECK_EQ(stack_space, 0); |
| 844 PopReturnAddressTo(rcx); |
| 845 addq(rsp, rbx); |
| 846 jmp(rcx); |
| 847 } else { |
| 848 ret(stack_space * kPointerSize); |
| 849 } |
| 843 | 850 |
| 844 bind(&promote_scheduled_exception); | 851 bind(&promote_scheduled_exception); |
| 845 { | 852 { |
| 846 FrameScope frame(this, StackFrame::INTERNAL); | 853 FrameScope frame(this, StackFrame::INTERNAL); |
| 847 CallRuntime(Runtime::kPromoteScheduledException, 0); | 854 CallRuntime(Runtime::kPromoteScheduledException, 0); |
| 848 } | 855 } |
| 849 jmp(&exception_handled); | 856 jmp(&exception_handled); |
| 850 | 857 |
| 851 // HandleScope limit has changed. Delete allocated extensions. | 858 // HandleScope limit has changed. Delete allocated extensions. |
| 852 bind(&delete_allocated_handles); | 859 bind(&delete_allocated_handles); |
| (...skipping 4543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5396 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5403 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
| 5397 movl(rax, dividend); | 5404 movl(rax, dividend); |
| 5398 shrl(rax, Immediate(31)); | 5405 shrl(rax, Immediate(31)); |
| 5399 addl(rdx, rax); | 5406 addl(rdx, rax); |
| 5400 } | 5407 } |
| 5401 | 5408 |
| 5402 | 5409 |
| 5403 } } // namespace v8::internal | 5410 } } // namespace v8::internal |
| 5404 | 5411 |
| 5405 #endif // V8_TARGET_ARCH_X64 | 5412 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |