| 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 5484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5495 __ mov(eax, Immediate(delete_extensions)); | 5495 __ mov(eax, Immediate(delete_extensions)); |
| 5496 __ call(eax); | 5496 __ call(eax); |
| 5497 __ mov(eax, edi); | 5497 __ mov(eax, edi); |
| 5498 __ jmp(&leave_exit_frame); | 5498 __ jmp(&leave_exit_frame); |
| 5499 } | 5499 } |
| 5500 | 5500 |
| 5501 | 5501 |
| 5502 static void CallApiFunctionStubHelper(MacroAssembler* masm, | 5502 static void CallApiFunctionStubHelper(MacroAssembler* masm, |
| 5503 const ParameterCount& argc, | 5503 const ParameterCount& argc, |
| 5504 bool return_first_arg, | 5504 bool return_first_arg, |
| 5505 bool call_data_undefined) { | 5505 bool call_data_undefined, bool is_lazy) { |
| 5506 // ----------- S t a t e ------------- | 5506 // ----------- S t a t e ------------- |
| 5507 // -- edi : callee | 5507 // -- edi : callee |
| 5508 // -- ebx : call_data | 5508 // -- ebx : call_data |
| 5509 // -- ecx : holder | 5509 // -- ecx : holder |
| 5510 // -- edx : api_function_address | 5510 // -- edx : api_function_address |
| 5511 // -- esi : context | 5511 // -- esi : context |
| 5512 // -- eax : number of arguments if argc is a register | 5512 // -- eax : number of arguments if argc is a register |
| 5513 // -- | 5513 // -- |
| 5514 // -- esp[0] : return address | 5514 // -- esp[0] : return address |
| 5515 // -- esp[4] : last argument | 5515 // -- esp[4] : last argument |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5569 // isolate | 5569 // isolate |
| 5570 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); | 5570 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); |
| 5571 // holder | 5571 // holder |
| 5572 __ push(holder); | 5572 __ push(holder); |
| 5573 | 5573 |
| 5574 __ mov(scratch, esp); | 5574 __ mov(scratch, esp); |
| 5575 | 5575 |
| 5576 // push return address | 5576 // push return address |
| 5577 __ push(return_address); | 5577 __ push(return_address); |
| 5578 | 5578 |
| 5579 // load context from callee | 5579 if (!is_lazy) { |
| 5580 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); | 5580 // load context from callee |
| 5581 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 5582 } |
| 5581 | 5583 |
| 5582 // API function gets reference to the v8::Arguments. If CPU profiler | 5584 // API function gets reference to the v8::Arguments. If CPU profiler |
| 5583 // is enabled wrapper function will be called and we need to pass | 5585 // is enabled wrapper function will be called and we need to pass |
| 5584 // address of the callback as additional parameter, always allocate | 5586 // address of the callback as additional parameter, always allocate |
| 5585 // space for it. | 5587 // space for it. |
| 5586 const int kApiArgc = 1 + 1; | 5588 const int kApiArgc = 1 + 1; |
| 5587 | 5589 |
| 5588 // Allocate the v8::Arguments structure in the arguments' space since | 5590 // Allocate the v8::Arguments structure in the arguments' space since |
| 5589 // it's not controlled by GC. | 5591 // it's not controlled by GC. |
| 5590 const int kApiStackSpace = 4; | 5592 const int kApiStackSpace = 4; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5642 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5644 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5643 ApiParameterOperand(1), stack_space, | 5645 ApiParameterOperand(1), stack_space, |
| 5644 stack_space_operand, return_value_operand, | 5646 stack_space_operand, return_value_operand, |
| 5645 &context_restore_operand); | 5647 &context_restore_operand); |
| 5646 } | 5648 } |
| 5647 | 5649 |
| 5648 | 5650 |
| 5649 void CallApiFunctionStub::Generate(MacroAssembler* masm) { | 5651 void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
| 5650 bool call_data_undefined = this->call_data_undefined(); | 5652 bool call_data_undefined = this->call_data_undefined(); |
| 5651 CallApiFunctionStubHelper(masm, ParameterCount(eax), false, | 5653 CallApiFunctionStubHelper(masm, ParameterCount(eax), false, |
| 5652 call_data_undefined); | 5654 call_data_undefined, false); |
| 5653 } | 5655 } |
| 5654 | 5656 |
| 5655 | 5657 |
| 5656 void CallApiAccessorStub::Generate(MacroAssembler* masm) { | 5658 void CallApiAccessorStub::Generate(MacroAssembler* masm) { |
| 5657 bool is_store = this->is_store(); | 5659 bool is_store = this->is_store(); |
| 5658 int argc = this->argc(); | 5660 int argc = this->argc(); |
| 5659 bool call_data_undefined = this->call_data_undefined(); | 5661 bool call_data_undefined = this->call_data_undefined(); |
| 5662 bool is_lazy = this->is_lazy(); |
| 5660 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5663 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
| 5661 call_data_undefined); | 5664 call_data_undefined, is_lazy); |
| 5662 } | 5665 } |
| 5663 | 5666 |
| 5664 | 5667 |
| 5665 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5668 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5666 // ----------- S t a t e ------------- | 5669 // ----------- S t a t e ------------- |
| 5667 // -- esp[0] : return address | 5670 // -- esp[0] : return address |
| 5668 // -- esp[4] : name | 5671 // -- esp[4] : name |
| 5669 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object | 5672 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object |
| 5670 // -- ... | 5673 // -- ... |
| 5671 // -- edx : api_function_address | 5674 // -- edx : api_function_address |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5698 Operand(ebp, 7 * kPointerSize), NULL); | 5701 Operand(ebp, 7 * kPointerSize), NULL); |
| 5699 } | 5702 } |
| 5700 | 5703 |
| 5701 | 5704 |
| 5702 #undef __ | 5705 #undef __ |
| 5703 | 5706 |
| 5704 } // namespace internal | 5707 } // namespace internal |
| 5705 } // namespace v8 | 5708 } // namespace v8 |
| 5706 | 5709 |
| 5707 #endif // V8_TARGET_ARCH_IA32 | 5710 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |