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 5159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5170 // ----------------------------------- | 5170 // ----------------------------------- |
5171 | 5171 |
5172 Register callee = rax; | 5172 Register callee = rax; |
5173 Register call_data = rbx; | 5173 Register call_data = rbx; |
5174 Register holder = rcx; | 5174 Register holder = rcx; |
5175 Register api_function_address = rdx; | 5175 Register api_function_address = rdx; |
5176 Register return_address = rdi; | 5176 Register return_address = rdi; |
5177 Register context = rsi; | 5177 Register context = rsi; |
5178 | 5178 |
5179 int argc = ArgumentBits::decode(bit_field_); | 5179 int argc = ArgumentBits::decode(bit_field_); |
5180 bool restore_context = RestoreContextBits::decode(bit_field_); | 5180 bool is_store = IsStoreBits::decode(bit_field_); |
5181 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); | 5181 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); |
5182 | 5182 |
5183 typedef FunctionCallbackArguments FCA; | 5183 typedef FunctionCallbackArguments FCA; |
5184 | 5184 |
5185 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5185 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
5186 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5186 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
5187 STATIC_ASSERT(FCA::kDataIndex == 4); | 5187 STATIC_ASSERT(FCA::kDataIndex == 4); |
5188 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 5188 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
5189 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 5189 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
5190 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 5190 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5246 | 5246 |
5247 // It's okay if api_function_address == callback_arg | 5247 // It's okay if api_function_address == callback_arg |
5248 // but not arguments_arg | 5248 // but not arguments_arg |
5249 ASSERT(!api_function_address.is(arguments_arg)); | 5249 ASSERT(!api_function_address.is(arguments_arg)); |
5250 | 5250 |
5251 // v8::InvocationCallback's argument. | 5251 // v8::InvocationCallback's argument. |
5252 __ lea(arguments_arg, StackSpaceOperand(0)); | 5252 __ lea(arguments_arg, StackSpaceOperand(0)); |
5253 | 5253 |
5254 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 5254 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
5255 | 5255 |
5256 StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength, | 5256 // Accessor for FunctionCallbackInfo and first js arg. |
| 5257 StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength + 1, |
5257 ARGUMENTS_DONT_CONTAIN_RECEIVER); | 5258 ARGUMENTS_DONT_CONTAIN_RECEIVER); |
5258 Operand context_restore_operand = args_from_rbp.GetArgumentOperand( | 5259 Operand context_restore_operand = args_from_rbp.GetArgumentOperand( |
5259 FCA::kArgsLength - 1 - FCA::kContextSaveIndex); | 5260 FCA::kArgsLength - FCA::kContextSaveIndex); |
| 5261 // Stores return the first js argument |
5260 Operand return_value_operand = args_from_rbp.GetArgumentOperand( | 5262 Operand return_value_operand = args_from_rbp.GetArgumentOperand( |
5261 FCA::kArgsLength - 1 - FCA::kReturnValueOffset); | 5263 is_store ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset); |
5262 __ CallApiFunctionAndReturn( | 5264 __ CallApiFunctionAndReturn( |
5263 api_function_address, | 5265 api_function_address, |
5264 thunk_address, | 5266 thunk_address, |
5265 callback_arg, | 5267 callback_arg, |
5266 argc + FCA::kArgsLength + 1, | 5268 argc + FCA::kArgsLength + 1, |
5267 return_value_operand, | 5269 return_value_operand, |
5268 restore_context ? &context_restore_operand : NULL); | 5270 &context_restore_operand); |
5269 } | 5271 } |
5270 | 5272 |
5271 | 5273 |
5272 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5274 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5273 // ----------- S t a t e ------------- | 5275 // ----------- S t a t e ------------- |
5274 // -- rsp[0] : return address | 5276 // -- rsp[0] : return address |
5275 // -- rsp[8] : name | 5277 // -- rsp[8] : name |
5276 // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object | 5278 // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object |
5277 // -- ... | 5279 // -- ... |
5278 // -- r8 : api_function_address | 5280 // -- r8 : api_function_address |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5327 return_value_operand, | 5329 return_value_operand, |
5328 NULL); | 5330 NULL); |
5329 } | 5331 } |
5330 | 5332 |
5331 | 5333 |
5332 #undef __ | 5334 #undef __ |
5333 | 5335 |
5334 } } // namespace v8::internal | 5336 } } // namespace v8::internal |
5335 | 5337 |
5336 #endif // V8_TARGET_ARCH_X64 | 5338 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |