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 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 // -- ebx : call_data | 2741 // -- ebx : call_data |
2742 // -- ecx : holder | 2742 // -- ecx : holder |
2743 // -- edx : api_function_address | 2743 // -- edx : api_function_address |
2744 // -- esi : context | 2744 // -- esi : context |
2745 // -- | 2745 // -- |
2746 // -- esp[0] : return address | 2746 // -- esp[0] : return address |
2747 // -- esp[4] : last argument | 2747 // -- esp[4] : last argument |
2748 // -- ... | 2748 // -- ... |
2749 // -- esp[argc * 4] : first argument | 2749 // -- esp[argc * 4] : first argument |
2750 // -- esp[(argc + 1) * 4] : receiver | 2750 // -- esp[(argc + 1) * 4] : receiver |
| 2751 // -- esp[(argc + 2) * 4] : accessor_holder |
2751 // ----------------------------------- | 2752 // ----------------------------------- |
2752 | 2753 |
2753 Register callee = edi; | 2754 Register callee = edi; |
2754 Register call_data = ebx; | 2755 Register call_data = ebx; |
2755 Register holder = ecx; | 2756 Register holder = ecx; |
2756 Register api_function_address = edx; | 2757 Register api_function_address = edx; |
2757 Register context = esi; | 2758 Register context = esi; |
2758 Register return_address = eax; | 2759 Register return_address = eax; |
2759 | 2760 |
2760 typedef FunctionCallbackArguments FCA; | 2761 typedef FunctionCallbackArguments FCA; |
(...skipping 24 matching lines...) Expand all Loading... |
2785 | 2786 |
2786 // return value | 2787 // return value |
2787 __ push(Immediate(masm->isolate()->factory()->undefined_value())); | 2788 __ push(Immediate(masm->isolate()->factory()->undefined_value())); |
2788 // return value default | 2789 // return value default |
2789 __ push(Immediate(masm->isolate()->factory()->undefined_value())); | 2790 __ push(Immediate(masm->isolate()->factory()->undefined_value())); |
2790 // isolate | 2791 // isolate |
2791 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); | 2792 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); |
2792 // holder | 2793 // holder |
2793 __ push(holder); | 2794 __ push(holder); |
2794 | 2795 |
| 2796 // enter a new context |
2795 Register scratch = call_data; | 2797 Register scratch = call_data; |
| 2798 if (is_lazy()) { |
| 2799 // load context from accessor_holder |
| 2800 Register accessor_holder = context; |
| 2801 __ mov(accessor_holder, |
| 2802 MemOperand(esp, (argc() + FCA::kArgsLength + 1) * kPointerSize)); |
| 2803 __ mov(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset)); |
| 2804 __ GetMapConstructor(scratch, scratch, context); |
| 2805 __ mov(context, FieldOperand(scratch, JSFunction::kContextOffset)); |
| 2806 } else { |
| 2807 // load context from callee |
| 2808 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 2809 } |
| 2810 |
2796 __ mov(scratch, esp); | 2811 __ mov(scratch, esp); |
2797 | 2812 |
2798 // push return address | 2813 // push return address |
2799 __ push(return_address); | 2814 __ push(return_address); |
2800 | 2815 |
2801 if (!is_lazy()) { | |
2802 // load context from callee | |
2803 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); | |
2804 } | |
2805 | |
2806 // API function gets reference to the v8::Arguments. If CPU profiler | 2816 // API function gets reference to the v8::Arguments. If CPU profiler |
2807 // is enabled wrapper function will be called and we need to pass | 2817 // is enabled wrapper function will be called and we need to pass |
2808 // address of the callback as additional parameter, always allocate | 2818 // address of the callback as additional parameter, always allocate |
2809 // space for it. | 2819 // space for it. |
2810 const int kApiArgc = 1 + 1; | 2820 const int kApiArgc = 1 + 1; |
2811 | 2821 |
2812 // Allocate the v8::Arguments structure in the arguments' space since | 2822 // Allocate the v8::Arguments structure in the arguments' space since |
2813 // it's not controlled by GC. | 2823 // it's not controlled by GC. |
2814 const int kApiStackSpace = 3; | 2824 const int kApiStackSpace = 3; |
2815 | 2825 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2922 kStackUnwindSpace, nullptr, return_value_operand, | 2932 kStackUnwindSpace, nullptr, return_value_operand, |
2923 NULL); | 2933 NULL); |
2924 } | 2934 } |
2925 | 2935 |
2926 #undef __ | 2936 #undef __ |
2927 | 2937 |
2928 } // namespace internal | 2938 } // namespace internal |
2929 } // namespace v8 | 2939 } // namespace v8 |
2930 | 2940 |
2931 #endif // V8_TARGET_ARCH_IA32 | 2941 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |