| 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/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 // -- ebx : call_data | 2681 // -- ebx : call_data |
| 2682 // -- ecx : holder | 2682 // -- ecx : holder |
| 2683 // -- edx : api_function_address | 2683 // -- edx : api_function_address |
| 2684 // -- esi : context | 2684 // -- esi : context |
| 2685 // -- | 2685 // -- |
| 2686 // -- esp[0] : return address | 2686 // -- esp[0] : return address |
| 2687 // -- esp[4] : last argument | 2687 // -- esp[4] : last argument |
| 2688 // -- ... | 2688 // -- ... |
| 2689 // -- esp[argc * 4] : first argument | 2689 // -- esp[argc * 4] : first argument |
| 2690 // -- esp[(argc + 1) * 4] : receiver | 2690 // -- esp[(argc + 1) * 4] : receiver |
| 2691 // -- esp[(argc + 2) * 4] : accessor_holder | |
| 2692 // ----------------------------------- | 2691 // ----------------------------------- |
| 2693 | 2692 |
| 2694 Register callee = edi; | 2693 Register callee = edi; |
| 2695 Register call_data = ebx; | 2694 Register call_data = ebx; |
| 2696 Register holder = ecx; | 2695 Register holder = ecx; |
| 2697 Register api_function_address = edx; | 2696 Register api_function_address = edx; |
| 2698 Register context = esi; | 2697 Register context = esi; |
| 2699 Register return_address = eax; | 2698 Register return_address = eax; |
| 2700 | 2699 |
| 2701 typedef FunctionCallbackArguments FCA; | 2700 typedef FunctionCallbackArguments FCA; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2726 | 2725 |
| 2727 // return value | 2726 // return value |
| 2728 __ push(Immediate(masm->isolate()->factory()->undefined_value())); | 2727 __ push(Immediate(masm->isolate()->factory()->undefined_value())); |
| 2729 // return value default | 2728 // return value default |
| 2730 __ push(Immediate(masm->isolate()->factory()->undefined_value())); | 2729 __ push(Immediate(masm->isolate()->factory()->undefined_value())); |
| 2731 // isolate | 2730 // isolate |
| 2732 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); | 2731 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); |
| 2733 // holder | 2732 // holder |
| 2734 __ push(holder); | 2733 __ push(holder); |
| 2735 | 2734 |
| 2736 // enter a new context | |
| 2737 Register scratch = call_data; | 2735 Register scratch = call_data; |
| 2738 if (is_lazy()) { | |
| 2739 // load context from accessor_holder | |
| 2740 Register accessor_holder = context; | |
| 2741 __ mov(accessor_holder, | |
| 2742 MemOperand(esp, (argc() + FCA::kArgsLength + 1) * kPointerSize)); | |
| 2743 __ mov(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset)); | |
| 2744 __ GetMapConstructor(scratch, scratch, context); | |
| 2745 __ mov(context, FieldOperand(scratch, JSFunction::kContextOffset)); | |
| 2746 } else { | |
| 2747 // load context from callee | |
| 2748 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); | |
| 2749 } | |
| 2750 | |
| 2751 __ mov(scratch, esp); | 2736 __ mov(scratch, esp); |
| 2752 | 2737 |
| 2753 // push return address | 2738 // push return address |
| 2754 __ push(return_address); | 2739 __ push(return_address); |
| 2755 | 2740 |
| 2741 if (!is_lazy()) { |
| 2742 // load context from callee |
| 2743 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 2744 } |
| 2745 |
| 2756 // API function gets reference to the v8::Arguments. If CPU profiler | 2746 // API function gets reference to the v8::Arguments. If CPU profiler |
| 2757 // is enabled wrapper function will be called and we need to pass | 2747 // is enabled wrapper function will be called and we need to pass |
| 2758 // address of the callback as additional parameter, always allocate | 2748 // address of the callback as additional parameter, always allocate |
| 2759 // space for it. | 2749 // space for it. |
| 2760 const int kApiArgc = 1 + 1; | 2750 const int kApiArgc = 1 + 1; |
| 2761 | 2751 |
| 2762 // Allocate the v8::Arguments structure in the arguments' space since | 2752 // Allocate the v8::Arguments structure in the arguments' space since |
| 2763 // it's not controlled by GC. | 2753 // it's not controlled by GC. |
| 2764 const int kApiStackSpace = 3; | 2754 const int kApiStackSpace = 3; |
| 2765 | 2755 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2783 Operand context_restore_operand(ebp, | 2773 Operand context_restore_operand(ebp, |
| 2784 (2 + FCA::kContextSaveIndex) * kPointerSize); | 2774 (2 + FCA::kContextSaveIndex) * kPointerSize); |
| 2785 // Stores return the first js argument | 2775 // Stores return the first js argument |
| 2786 int return_value_offset = 0; | 2776 int return_value_offset = 0; |
| 2787 if (is_store()) { | 2777 if (is_store()) { |
| 2788 return_value_offset = 2 + FCA::kArgsLength; | 2778 return_value_offset = 2 + FCA::kArgsLength; |
| 2789 } else { | 2779 } else { |
| 2790 return_value_offset = 2 + FCA::kReturnValueOffset; | 2780 return_value_offset = 2 + FCA::kReturnValueOffset; |
| 2791 } | 2781 } |
| 2792 Operand return_value_operand(ebp, return_value_offset * kPointerSize); | 2782 Operand return_value_operand(ebp, return_value_offset * kPointerSize); |
| 2793 const int stack_space = argc() + FCA::kArgsLength + 2; | 2783 int stack_space = 0; |
| 2794 Operand* stack_space_operand = nullptr; | 2784 Operand length_operand = ApiParameterOperand(4); |
| 2785 Operand* stack_space_operand = &length_operand; |
| 2786 stack_space = argc() + FCA::kArgsLength + 1; |
| 2787 stack_space_operand = nullptr; |
| 2795 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 2788 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 2796 ApiParameterOperand(1), stack_space, | 2789 ApiParameterOperand(1), stack_space, |
| 2797 stack_space_operand, return_value_operand, | 2790 stack_space_operand, return_value_operand, |
| 2798 &context_restore_operand); | 2791 &context_restore_operand); |
| 2799 } | 2792 } |
| 2800 | 2793 |
| 2801 | 2794 |
| 2802 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 2795 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 2803 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 2796 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
| 2804 // name below the exit frame to make GC aware of them. | 2797 // name below the exit frame to make GC aware of them. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2869 kStackUnwindSpace, nullptr, return_value_operand, | 2862 kStackUnwindSpace, nullptr, return_value_operand, |
| 2870 NULL); | 2863 NULL); |
| 2871 } | 2864 } |
| 2872 | 2865 |
| 2873 #undef __ | 2866 #undef __ |
| 2874 | 2867 |
| 2875 } // namespace internal | 2868 } // namespace internal |
| 2876 } // namespace v8 | 2869 } // namespace v8 |
| 2877 | 2870 |
| 2878 #endif // V8_TARGET_ARCH_IA32 | 2871 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |