OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4835 Register callback_arg = rsi; | 4835 Register callback_arg = rsi; |
4836 #endif | 4836 #endif |
4837 | 4837 |
4838 // It's okay if api_function_address == callback_arg | 4838 // It's okay if api_function_address == callback_arg |
4839 // but not arguments_arg | 4839 // but not arguments_arg |
4840 ASSERT(!api_function_address.is(arguments_arg)); | 4840 ASSERT(!api_function_address.is(arguments_arg)); |
4841 | 4841 |
4842 // v8::InvocationCallback's argument. | 4842 // v8::InvocationCallback's argument. |
4843 __ leap(arguments_arg, StackSpaceOperand(0)); | 4843 __ leap(arguments_arg, StackSpaceOperand(0)); |
4844 | 4844 |
4845 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 4845 ExternalReference thunk_ref = |
| 4846 ExternalReference::invoke_function_callback(isolate()); |
4846 | 4847 |
4847 // Accessor for FunctionCallbackInfo and first js arg. | 4848 // Accessor for FunctionCallbackInfo and first js arg. |
4848 StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength + 1, | 4849 StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength + 1, |
4849 ARGUMENTS_DONT_CONTAIN_RECEIVER); | 4850 ARGUMENTS_DONT_CONTAIN_RECEIVER); |
4850 Operand context_restore_operand = args_from_rbp.GetArgumentOperand( | 4851 Operand context_restore_operand = args_from_rbp.GetArgumentOperand( |
4851 FCA::kArgsLength - FCA::kContextSaveIndex); | 4852 FCA::kArgsLength - FCA::kContextSaveIndex); |
4852 // Stores return the first js argument | 4853 // Stores return the first js argument |
4853 Operand return_value_operand = args_from_rbp.GetArgumentOperand( | 4854 Operand return_value_operand = args_from_rbp.GetArgumentOperand( |
4854 is_store ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset); | 4855 is_store ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset); |
4855 __ CallApiFunctionAndReturn( | 4856 __ CallApiFunctionAndReturn( |
4856 api_function_address, | 4857 api_function_address, |
4857 thunk_address, | 4858 thunk_ref, |
4858 callback_arg, | 4859 callback_arg, |
4859 argc + FCA::kArgsLength + 1, | 4860 argc + FCA::kArgsLength + 1, |
4860 return_value_operand, | 4861 return_value_operand, |
4861 &context_restore_operand); | 4862 &context_restore_operand); |
4862 } | 4863 } |
4863 | 4864 |
4864 | 4865 |
4865 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 4866 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
4866 // ----------- S t a t e ------------- | 4867 // ----------- S t a t e ------------- |
4867 // -- rsp[0] : return address | 4868 // -- rsp[0] : return address |
(...skipping 26 matching lines...) Expand all Loading... |
4894 __ PrepareCallApiFunction(kArgStackSpace); | 4895 __ PrepareCallApiFunction(kArgStackSpace); |
4895 __ leap(scratch, Operand(name_arg, 1 * kPointerSize)); | 4896 __ leap(scratch, Operand(name_arg, 1 * kPointerSize)); |
4896 | 4897 |
4897 // v8::PropertyAccessorInfo::args_. | 4898 // v8::PropertyAccessorInfo::args_. |
4898 __ movp(StackSpaceOperand(0), scratch); | 4899 __ movp(StackSpaceOperand(0), scratch); |
4899 | 4900 |
4900 // The context register (rsi) has been saved in PrepareCallApiFunction and | 4901 // The context register (rsi) has been saved in PrepareCallApiFunction and |
4901 // could be used to pass arguments. | 4902 // could be used to pass arguments. |
4902 __ leap(accessor_info_arg, StackSpaceOperand(0)); | 4903 __ leap(accessor_info_arg, StackSpaceOperand(0)); |
4903 | 4904 |
4904 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 4905 ExternalReference thunk_ref = |
| 4906 ExternalReference::invoke_accessor_getter_callback(isolate()); |
4905 | 4907 |
4906 // It's okay if api_function_address == getter_arg | 4908 // It's okay if api_function_address == getter_arg |
4907 // but not accessor_info_arg or name_arg | 4909 // but not accessor_info_arg or name_arg |
4908 ASSERT(!api_function_address.is(accessor_info_arg) && | 4910 ASSERT(!api_function_address.is(accessor_info_arg) && |
4909 !api_function_address.is(name_arg)); | 4911 !api_function_address.is(name_arg)); |
4910 | 4912 |
4911 // The name handler is counted as an argument. | 4913 // The name handler is counted as an argument. |
4912 StackArgumentsAccessor args(rbp, PropertyCallbackArguments::kArgsLength); | 4914 StackArgumentsAccessor args(rbp, PropertyCallbackArguments::kArgsLength); |
4913 Operand return_value_operand = args.GetArgumentOperand( | 4915 Operand return_value_operand = args.GetArgumentOperand( |
4914 PropertyCallbackArguments::kArgsLength - 1 - | 4916 PropertyCallbackArguments::kArgsLength - 1 - |
4915 PropertyCallbackArguments::kReturnValueOffset); | 4917 PropertyCallbackArguments::kReturnValueOffset); |
4916 __ CallApiFunctionAndReturn(api_function_address, | 4918 __ CallApiFunctionAndReturn(api_function_address, |
4917 thunk_address, | 4919 thunk_ref, |
4918 getter_arg, | 4920 getter_arg, |
4919 kStackSpace, | 4921 kStackSpace, |
4920 return_value_operand, | 4922 return_value_operand, |
4921 NULL); | 4923 NULL); |
4922 } | 4924 } |
4923 | 4925 |
4924 | 4926 |
4925 #undef __ | 4927 #undef __ |
4926 | 4928 |
4927 } } // namespace v8::internal | 4929 } } // namespace v8::internal |
4928 | 4930 |
4929 #endif // V8_TARGET_ARCH_X64 | 4931 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |