| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 5646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5657 bool is_store = this->is_store(); | 5657 bool is_store = this->is_store(); |
| 5658 int argc = this->argc(); | 5658 int argc = this->argc(); |
| 5659 bool call_data_undefined = this->call_data_undefined(); | 5659 bool call_data_undefined = this->call_data_undefined(); |
| 5660 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5660 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
| 5661 call_data_undefined); | 5661 call_data_undefined); |
| 5662 } | 5662 } |
| 5663 | 5663 |
| 5664 | 5664 |
| 5665 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5665 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5666 // ----------- S t a t e ------------- | 5666 // ----------- S t a t e ------------- |
| 5667 // -- esp[0] : return address | 5667 // -- esp[0] : return address |
| 5668 // -- esp[4] : name | 5668 // -- esp[4] : name |
| 5669 // -- esp[8 .. (8 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ | 5669 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object |
| 5670 // -- ... | 5670 // -- ... |
| 5671 // -- edx : api_function_address | 5671 // -- edx : api_function_address |
| 5672 // ----------------------------------- | 5672 // ----------------------------------- |
| 5673 DCHECK(edx.is(ApiGetterDescriptor::function_address())); | 5673 DCHECK(edx.is(ApiGetterDescriptor::function_address())); |
| 5674 | 5674 |
| 5675 // v8::PropertyCallbackInfo::args_ array and name handle. | 5675 // array for v8::Arguments::values_, handler for name and pointer |
| 5676 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5676 // to the values (it considered as smi in GC). |
| 5677 | 5677 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; |
| 5678 // Allocate v8::PropertyCallbackInfo object, arguments for callback and | 5678 // Allocate space for opional callback address parameter in case |
| 5679 // space for optional callback address parameter (in case CPU profiler is | 5679 // CPU profiler is active. |
| 5680 // active) in non-GCed stack space. | 5680 const int kApiArgc = 2 + 1; |
| 5681 const int kApiArgc = 3 + 1; | |
| 5682 | 5681 |
| 5683 Register api_function_address = edx; | 5682 Register api_function_address = edx; |
| 5684 Register scratch = ebx; | 5683 Register scratch = ebx; |
| 5685 | 5684 |
| 5686 // Load address of v8::PropertyAccessorInfo::args_ array. | 5685 // load address of name |
| 5687 __ lea(scratch, Operand(esp, 2 * kPointerSize)); | 5686 __ lea(scratch, Operand(esp, 1 * kPointerSize)); |
| 5688 | 5687 |
| 5689 PrepareCallApiFunction(masm, kApiArgc); | 5688 PrepareCallApiFunction(masm, kApiArgc); |
| 5690 // Create v8::PropertyCallbackInfo object on the stack and initialize | |
| 5691 // it's args_ field. | |
| 5692 Operand info_object = ApiParameterOperand(3); | |
| 5693 __ mov(info_object, scratch); | |
| 5694 | |
| 5695 __ sub(scratch, Immediate(kPointerSize)); | |
| 5696 __ mov(ApiParameterOperand(0), scratch); // name. | 5689 __ mov(ApiParameterOperand(0), scratch); // name. |
| 5697 __ lea(scratch, info_object); | 5690 __ add(scratch, Immediate(kPointerSize)); |
| 5698 __ mov(ApiParameterOperand(1), scratch); // arguments pointer. | 5691 __ mov(ApiParameterOperand(1), scratch); // arguments pointer. |
| 5699 // Reserve space for optional callback address parameter. | |
| 5700 Operand thunk_last_arg = ApiParameterOperand(2); | |
| 5701 | 5692 |
| 5702 ExternalReference thunk_ref = | 5693 ExternalReference thunk_ref = |
| 5703 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5694 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 5704 | 5695 |
| 5705 // +3 is to skip prolog, return address and name handle. | |
| 5706 Operand return_value_operand( | |
| 5707 ebp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | |
| 5708 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5696 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5709 thunk_last_arg, kStackUnwindSpace, nullptr, | 5697 ApiParameterOperand(2), kStackSpace, nullptr, |
| 5710 return_value_operand, NULL); | 5698 Operand(ebp, 7 * kPointerSize), NULL); |
| 5711 } | 5699 } |
| 5712 | 5700 |
| 5713 | 5701 |
| 5714 #undef __ | 5702 #undef __ |
| 5715 | 5703 |
| 5716 } // namespace internal | 5704 } // namespace internal |
| 5717 } // namespace v8 | 5705 } // namespace v8 |
| 5718 | 5706 |
| 5719 #endif // V8_TARGET_ARCH_IA32 | 5707 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |