Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 2770003002: Set the current context to the function's context when entering to LAP. (Closed)
Patch Set: Synced. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-native-context-specialization.cc ('k') | src/ic/arm/handler-compiler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
2691 // ----------------------------------- 2692 // -----------------------------------
2692 2693
2693 Register callee = edi; 2694 Register callee = edi;
2694 Register call_data = ebx; 2695 Register call_data = ebx;
2695 Register holder = ecx; 2696 Register holder = ecx;
2696 Register api_function_address = edx; 2697 Register api_function_address = edx;
2697 Register context = esi; 2698 Register context = esi;
2698 Register return_address = eax; 2699 Register return_address = eax;
2699 2700
2700 typedef FunctionCallbackArguments FCA; 2701 typedef FunctionCallbackArguments FCA;
(...skipping 24 matching lines...) Expand all
2725 2726
2726 // return value 2727 // return value
2727 __ push(Immediate(masm->isolate()->factory()->undefined_value())); 2728 __ push(Immediate(masm->isolate()->factory()->undefined_value()));
2728 // return value default 2729 // return value default
2729 __ push(Immediate(masm->isolate()->factory()->undefined_value())); 2730 __ push(Immediate(masm->isolate()->factory()->undefined_value()));
2730 // isolate 2731 // isolate
2731 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); 2732 __ push(Immediate(reinterpret_cast<int>(masm->isolate())));
2732 // holder 2733 // holder
2733 __ push(holder); 2734 __ push(holder);
2734 2735
2736 // enter a new context
2735 Register scratch = call_data; 2737 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
2736 __ mov(scratch, esp); 2751 __ mov(scratch, esp);
2737 2752
2738 // push return address 2753 // push return address
2739 __ push(return_address); 2754 __ push(return_address);
2740 2755
2741 if (!is_lazy()) {
2742 // load context from callee
2743 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
2744 }
2745
2746 // API function gets reference to the v8::Arguments. If CPU profiler 2756 // API function gets reference to the v8::Arguments. If CPU profiler
2747 // is enabled wrapper function will be called and we need to pass 2757 // is enabled wrapper function will be called and we need to pass
2748 // address of the callback as additional parameter, always allocate 2758 // address of the callback as additional parameter, always allocate
2749 // space for it. 2759 // space for it.
2750 const int kApiArgc = 1 + 1; 2760 const int kApiArgc = 1 + 1;
2751 2761
2752 // Allocate the v8::Arguments structure in the arguments' space since 2762 // Allocate the v8::Arguments structure in the arguments' space since
2753 // it's not controlled by GC. 2763 // it's not controlled by GC.
2754 const int kApiStackSpace = 3; 2764 const int kApiStackSpace = 3;
2755 2765
(...skipping 17 matching lines...) Expand all
2773 Operand context_restore_operand(ebp, 2783 Operand context_restore_operand(ebp,
2774 (2 + FCA::kContextSaveIndex) * kPointerSize); 2784 (2 + FCA::kContextSaveIndex) * kPointerSize);
2775 // Stores return the first js argument 2785 // Stores return the first js argument
2776 int return_value_offset = 0; 2786 int return_value_offset = 0;
2777 if (is_store()) { 2787 if (is_store()) {
2778 return_value_offset = 2 + FCA::kArgsLength; 2788 return_value_offset = 2 + FCA::kArgsLength;
2779 } else { 2789 } else {
2780 return_value_offset = 2 + FCA::kReturnValueOffset; 2790 return_value_offset = 2 + FCA::kReturnValueOffset;
2781 } 2791 }
2782 Operand return_value_operand(ebp, return_value_offset * kPointerSize); 2792 Operand return_value_operand(ebp, return_value_offset * kPointerSize);
2783 int stack_space = 0; 2793 const int stack_space = argc() + FCA::kArgsLength + 2;
2784 Operand length_operand = ApiParameterOperand(4); 2794 Operand* stack_space_operand = nullptr;
2785 Operand* stack_space_operand = &length_operand;
2786 stack_space = argc() + FCA::kArgsLength + 1;
2787 stack_space_operand = nullptr;
2788 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 2795 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
2789 ApiParameterOperand(1), stack_space, 2796 ApiParameterOperand(1), stack_space,
2790 stack_space_operand, return_value_operand, 2797 stack_space_operand, return_value_operand,
2791 &context_restore_operand); 2798 &context_restore_operand);
2792 } 2799 }
2793 2800
2794 2801
2795 void CallApiGetterStub::Generate(MacroAssembler* masm) { 2802 void CallApiGetterStub::Generate(MacroAssembler* masm) {
2796 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property 2803 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
2797 // name below the exit frame to make GC aware of them. 2804 // name below the exit frame to make GC aware of them.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 kStackUnwindSpace, nullptr, return_value_operand, 2869 kStackUnwindSpace, nullptr, return_value_operand,
2863 NULL); 2870 NULL);
2864 } 2871 }
2865 2872
2866 #undef __ 2873 #undef __
2867 2874
2868 } // namespace internal 2875 } // namespace internal
2869 } // namespace v8 2876 } // namespace v8
2870 2877
2871 #endif // V8_TARGET_ARCH_IA32 2878 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/compiler/js-native-context-specialization.cc ('k') | src/ic/arm/handler-compiler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698