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 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5267 __ CallApiFunctionAndReturn( | 5267 __ CallApiFunctionAndReturn( |
5268 api_function_address, | 5268 api_function_address, |
5269 thunk_address, | 5269 thunk_address, |
5270 callback_arg, | 5270 callback_arg, |
5271 argc + FCA::kArgsLength + 1, | 5271 argc + FCA::kArgsLength + 1, |
5272 return_value_operand, | 5272 return_value_operand, |
5273 restore_context ? &context_restore_operand : NULL); | 5273 restore_context ? &context_restore_operand : NULL); |
5274 } | 5274 } |
5275 | 5275 |
5276 | 5276 |
| 5277 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5278 // ----------- S t a t e ------------- |
| 5279 // -- rsp[0] : return address |
| 5280 // -- rsp[8] : name |
| 5281 // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object |
| 5282 // -- ... |
| 5283 // -- r8 : api_function_address |
| 5284 // ----------------------------------- |
| 5285 |
| 5286 #if defined(__MINGW64__) || defined(_WIN64) |
| 5287 Register getter_arg = r8; |
| 5288 Register accessor_info_arg = rdx; |
| 5289 Register name_arg = rcx; |
| 5290 #else |
| 5291 Register getter_arg = rdx; |
| 5292 Register accessor_info_arg = rsi; |
| 5293 Register name_arg = rdi; |
| 5294 #endif |
| 5295 Register api_function_address = r8; |
| 5296 Register scratch = rax; |
| 5297 |
| 5298 // v8::Arguments::values_ and handler for name. |
| 5299 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5300 |
| 5301 // Allocate v8::AccessorInfo in non-GCed stack space. |
| 5302 const int kArgStackSpace = 1; |
| 5303 |
| 5304 __ lea(name_arg, Operand(rsp, 1 * kPointerSize)); |
| 5305 |
| 5306 __ PrepareCallApiFunction(kArgStackSpace); |
| 5307 __ lea(scratch, Operand(name_arg, 1 * kPointerSize)); |
| 5308 |
| 5309 // v8::PropertyAccessorInfo::args_. |
| 5310 __ movp(StackSpaceOperand(0), scratch); |
| 5311 |
| 5312 // The context register (rsi) has been saved in PrepareCallApiFunction and |
| 5313 // could be used to pass arguments. |
| 5314 __ lea(accessor_info_arg, StackSpaceOperand(0)); |
| 5315 |
| 5316 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
| 5317 |
| 5318 // It's okay if api_function_address == getter_arg |
| 5319 // but not accessor_info_arg or name_arg |
| 5320 ASSERT(!api_function_address.is(accessor_info_arg) && |
| 5321 !api_function_address.is(name_arg)); |
| 5322 |
| 5323 // The name handler is counted as an argument. |
| 5324 StackArgumentsAccessor args(rbp, PropertyCallbackArguments::kArgsLength); |
| 5325 Operand return_value_operand = args.GetArgumentOperand( |
| 5326 PropertyCallbackArguments::kArgsLength - 1 - |
| 5327 PropertyCallbackArguments::kReturnValueOffset); |
| 5328 __ CallApiFunctionAndReturn(api_function_address, |
| 5329 thunk_address, |
| 5330 getter_arg, |
| 5331 kStackSpace, |
| 5332 return_value_operand, |
| 5333 NULL); |
| 5334 } |
| 5335 |
| 5336 |
5277 #undef __ | 5337 #undef __ |
5278 | 5338 |
5279 } } // namespace v8::internal | 5339 } } // namespace v8::internal |
5280 | 5340 |
5281 #endif // V8_TARGET_ARCH_X64 | 5341 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |