OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5317 // ----------------------------------- | 5317 // ----------------------------------- |
5318 | 5318 |
5319 Register callee = eax; | 5319 Register callee = eax; |
5320 Register call_data = ebx; | 5320 Register call_data = ebx; |
5321 Register holder = ecx; | 5321 Register holder = ecx; |
5322 Register api_function_address = edx; | 5322 Register api_function_address = edx; |
5323 Register return_address = edi; | 5323 Register return_address = edi; |
5324 Register context = esi; | 5324 Register context = esi; |
5325 | 5325 |
5326 int argc = ArgumentBits::decode(bit_field_); | 5326 int argc = ArgumentBits::decode(bit_field_); |
5327 bool restore_context = RestoreContextBits::decode(bit_field_); | 5327 bool is_store = IsStoreBits::decode(bit_field_); |
5328 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); | 5328 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); |
5329 | 5329 |
5330 typedef FunctionCallbackArguments FCA; | 5330 typedef FunctionCallbackArguments FCA; |
5331 | 5331 |
5332 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5332 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
5333 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5333 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
5334 STATIC_ASSERT(FCA::kDataIndex == 4); | 5334 STATIC_ASSERT(FCA::kDataIndex == 4); |
5335 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 5335 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
5336 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 5336 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
5337 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 5337 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5398 __ Set(ApiParameterOperand(5), Immediate(0)); | 5398 __ Set(ApiParameterOperand(5), Immediate(0)); |
5399 | 5399 |
5400 // v8::InvocationCallback's argument. | 5400 // v8::InvocationCallback's argument. |
5401 __ lea(scratch, ApiParameterOperand(2)); | 5401 __ lea(scratch, ApiParameterOperand(2)); |
5402 __ mov(ApiParameterOperand(0), scratch); | 5402 __ mov(ApiParameterOperand(0), scratch); |
5403 | 5403 |
5404 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 5404 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
5405 | 5405 |
5406 Operand context_restore_operand(ebp, | 5406 Operand context_restore_operand(ebp, |
5407 (2 + FCA::kContextSaveIndex) * kPointerSize); | 5407 (2 + FCA::kContextSaveIndex) * kPointerSize); |
5408 Operand return_value_operand(ebp, | 5408 // Stores return the first js argument |
5409 (2 + FCA::kReturnValueOffset) * kPointerSize); | 5409 int return_value_offset = |
| 5410 2 + (is_store ? FCA::kArgsLength : FCA::kReturnValueOffset); |
| 5411 Operand return_value_operand(ebp, return_value_offset * kPointerSize); |
5410 __ CallApiFunctionAndReturn(api_function_address, | 5412 __ CallApiFunctionAndReturn(api_function_address, |
5411 thunk_address, | 5413 thunk_address, |
5412 ApiParameterOperand(1), | 5414 ApiParameterOperand(1), |
5413 argc + FCA::kArgsLength + 1, | 5415 argc + FCA::kArgsLength + 1, |
5414 return_value_operand, | 5416 return_value_operand, |
5415 restore_context ? | 5417 &context_restore_operand); |
5416 &context_restore_operand : NULL); | |
5417 } | 5418 } |
5418 | 5419 |
5419 | 5420 |
5420 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5421 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5421 // ----------- S t a t e ------------- | 5422 // ----------- S t a t e ------------- |
5422 // -- esp[0] : return address | 5423 // -- esp[0] : return address |
5423 // -- esp[4] : name | 5424 // -- esp[4] : name |
5424 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object | 5425 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object |
5425 // -- ... | 5426 // -- ... |
5426 // -- edx : api_function_address | 5427 // -- edx : api_function_address |
(...skipping 26 matching lines...) Expand all Loading... |
5453 Operand(ebp, 7 * kPointerSize), | 5454 Operand(ebp, 7 * kPointerSize), |
5454 NULL); | 5455 NULL); |
5455 } | 5456 } |
5456 | 5457 |
5457 | 5458 |
5458 #undef __ | 5459 #undef __ |
5459 | 5460 |
5460 } } // namespace v8::internal | 5461 } } // namespace v8::internal |
5461 | 5462 |
5462 #endif // V8_TARGET_ARCH_IA32 | 5463 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |