| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 4691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4702 PropertyCallbackArguments::kReturnValueOffset); | 4702 PropertyCallbackArguments::kReturnValueOffset); |
| 4703 __ CallApiFunctionAndReturn(api_function_address, | 4703 __ CallApiFunctionAndReturn(api_function_address, |
| 4704 thunk_ref, | 4704 thunk_ref, |
| 4705 getter_arg, | 4705 getter_arg, |
| 4706 kStackSpace, | 4706 kStackSpace, |
| 4707 return_value_operand, | 4707 return_value_operand, |
| 4708 NULL); | 4708 NULL); |
| 4709 } | 4709 } |
| 4710 | 4710 |
| 4711 | 4711 |
| 4712 void CallFastApiGetterStub::Generate(MacroAssembler* masm) { |
| 4713 // ----------- S t a t e ------------- |
| 4714 // -- rsp[0] : return address |
| 4715 // -- rsp[8] : name |
| 4716 // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object |
| 4717 // -- ... |
| 4718 // -- r8 : api_function_address |
| 4719 // ----------------------------------- |
| 4720 |
| 4721 #if defined(__MINGW64__) || defined(_WIN64) |
| 4722 Register getter_arg = r8; |
| 4723 Register accessor_info_arg = rdx; |
| 4724 Register name_arg = rcx; |
| 4725 #else |
| 4726 Register getter_arg = rdx; |
| 4727 Register accessor_info_arg = rsi; |
| 4728 Register name_arg = rdi; |
| 4729 #endif |
| 4730 Register api_function_address = ApiGetterDescriptor::function_address(); |
| 4731 DCHECK(api_function_address.is(r8)); |
| 4732 |
| 4733 // for retq to restore the esp |
| 4734 // The esp offset = sizeof(PropertyCallbackInfo) |
| 4735 // + addrOf(PropertyCallbackInfo) |
| 4736 // + addrOf(name) |
| 4737 const int kStackSpace = PropertyCallbackInfo<Value>::kArgsLength + 2; |
| 4738 |
| 4739 __ Store(ExternalReference(Isolate::kContextAddress, isolate()), rsi); |
| 4740 |
| 4741 __ leap(name_arg, StackSpaceOperand(1)); |
| 4742 __ leap(accessor_info_arg, StackSpaceOperand(2)); |
| 4743 |
| 4744 |
| 4745 |
| 4746 ExternalReference thunk_ref = |
| 4747 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 4748 |
| 4749 // It's okay if api_function_address == getter_arg |
| 4750 // but not accessor_info_arg or name_arg |
| 4751 DCHECK(!api_function_address.is(accessor_info_arg) && |
| 4752 !api_function_address.is(name_arg)); |
| 4753 |
| 4754 // The name handler is counted as an argument. |
| 4755 StackArgumentsAccessor args(rbp, PropertyCallbackInfo<Value>::kArgsLength); |
| 4756 Operand return_value_operand( |
| 4757 StackSpaceOperand(3 + PropertyCallbackArguments::kReturnValueOffset)); |
| 4758 __ CallFastApiFunctionAndReturn(api_function_address, |
| 4759 thunk_ref, |
| 4760 getter_arg, |
| 4761 kStackSpace, |
| 4762 return_value_operand, |
| 4763 NULL); |
| 4764 } |
| 4765 |
| 4712 #undef __ | 4766 #undef __ |
| 4713 | 4767 |
| 4714 } } // namespace v8::internal | 4768 } } // namespace v8::internal |
| 4715 | 4769 |
| 4716 #endif // V8_TARGET_ARCH_X64 | 4770 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |