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

Side by Side Diff: src/x64/code-stubs-x64.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/s390/code-stubs-s390.cc ('k') | src/x87/code-stubs-x87.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/api-arguments.h" 7 #include "src/api-arguments.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 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 // -- rbx : call_data 2643 // -- rbx : call_data
2644 // -- rcx : holder 2644 // -- rcx : holder
2645 // -- rdx : api_function_address 2645 // -- rdx : api_function_address
2646 // -- rsi : context 2646 // -- rsi : context
2647 // -- rax : number of arguments if argc is a register 2647 // -- rax : number of arguments if argc is a register
2648 // -- rsp[0] : return address 2648 // -- rsp[0] : return address
2649 // -- rsp[8] : last argument 2649 // -- rsp[8] : last argument
2650 // -- ... 2650 // -- ...
2651 // -- rsp[argc * 8] : first argument 2651 // -- rsp[argc * 8] : first argument
2652 // -- rsp[(argc + 1) * 8] : receiver 2652 // -- rsp[(argc + 1) * 8] : receiver
2653 // -- rsp[(argc + 2) * 8] : accessor_holder
2653 // ----------------------------------- 2654 // -----------------------------------
2654 2655
2655 Register callee = rdi; 2656 Register callee = rdi;
2656 Register call_data = rbx; 2657 Register call_data = rbx;
2657 Register holder = rcx; 2658 Register holder = rcx;
2658 Register api_function_address = rdx; 2659 Register api_function_address = rdx;
2659 Register context = rsi; 2660 Register context = rsi;
2660 Register return_address = r8; 2661 Register return_address = r8;
2661 2662
2662 typedef FunctionCallbackArguments FCA; 2663 typedef FunctionCallbackArguments FCA;
(...skipping 26 matching lines...) Expand all
2689 __ PushRoot(Heap::kUndefinedValueRootIndex); 2690 __ PushRoot(Heap::kUndefinedValueRootIndex);
2690 // return value default 2691 // return value default
2691 __ PushRoot(Heap::kUndefinedValueRootIndex); 2692 __ PushRoot(Heap::kUndefinedValueRootIndex);
2692 // isolate 2693 // isolate
2693 Register scratch = call_data; 2694 Register scratch = call_data;
2694 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); 2695 __ Move(scratch, ExternalReference::isolate_address(masm->isolate()));
2695 __ Push(scratch); 2696 __ Push(scratch);
2696 // holder 2697 // holder
2697 __ Push(holder); 2698 __ Push(holder);
2698 2699
2700 // enter a new context
2701 int argc = this->argc();
2702 if (this->is_lazy()) {
2703 // load context from accessor_holder
2704 Register accessor_holder = context;
2705 __ movp(accessor_holder,
2706 MemOperand(rsp, (argc + FCA::kArgsLength + 1) * kPointerSize));
2707 __ movp(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset));
2708 __ GetMapConstructor(scratch, scratch, context);
2709 __ movp(context, FieldOperand(scratch, JSFunction::kContextOffset));
2710 } else {
2711 // load context from callee
2712 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
2713 }
2714
2699 __ movp(scratch, rsp); 2715 __ movp(scratch, rsp);
2700 // Push return address back on stack. 2716 // Push return address back on stack.
2701 __ PushReturnAddressFrom(return_address); 2717 __ PushReturnAddressFrom(return_address);
2702 2718
2703 if (!this->is_lazy()) {
2704 // load context from callee
2705 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
2706 }
2707
2708 // Allocate the v8::Arguments structure in the arguments' space since 2719 // Allocate the v8::Arguments structure in the arguments' space since
2709 // it's not controlled by GC. 2720 // it's not controlled by GC.
2710 const int kApiStackSpace = 3; 2721 const int kApiStackSpace = 3;
2711 2722
2712 PrepareCallApiFunction(masm, kApiStackSpace); 2723 PrepareCallApiFunction(masm, kApiStackSpace);
2713 2724
2714 // FunctionCallbackInfo::implicit_args_. 2725 // FunctionCallbackInfo::implicit_args_.
2715 int argc = this->argc();
2716 __ movp(StackSpaceOperand(0), scratch); 2726 __ movp(StackSpaceOperand(0), scratch);
2717 __ addp(scratch, Immediate((argc + FCA::kArgsLength - 1) * kPointerSize)); 2727 __ addp(scratch, Immediate((argc + FCA::kArgsLength - 1) * kPointerSize));
2718 // FunctionCallbackInfo::values_. 2728 // FunctionCallbackInfo::values_.
2719 __ movp(StackSpaceOperand(1), scratch); 2729 __ movp(StackSpaceOperand(1), scratch);
2720 // FunctionCallbackInfo::length_. 2730 // FunctionCallbackInfo::length_.
2721 __ Set(StackSpaceOperand(2), argc); 2731 __ Set(StackSpaceOperand(2), argc);
2722 2732
2723 #if defined(__MINGW64__) || defined(_WIN64) 2733 #if defined(__MINGW64__) || defined(_WIN64)
2724 Register arguments_arg = rcx; 2734 Register arguments_arg = rcx;
2725 Register callback_arg = rdx; 2735 Register callback_arg = rdx;
(...skipping 10 matching lines...) Expand all
2736 __ leap(arguments_arg, StackSpaceOperand(0)); 2746 __ leap(arguments_arg, StackSpaceOperand(0));
2737 2747
2738 ExternalReference thunk_ref = 2748 ExternalReference thunk_ref =
2739 ExternalReference::invoke_function_callback(masm->isolate()); 2749 ExternalReference::invoke_function_callback(masm->isolate());
2740 2750
2741 // Accessor for FunctionCallbackInfo and first js arg. 2751 // Accessor for FunctionCallbackInfo and first js arg.
2742 StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength + 1, 2752 StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength + 1,
2743 ARGUMENTS_DONT_CONTAIN_RECEIVER); 2753 ARGUMENTS_DONT_CONTAIN_RECEIVER);
2744 Operand context_restore_operand = args_from_rbp.GetArgumentOperand( 2754 Operand context_restore_operand = args_from_rbp.GetArgumentOperand(
2745 FCA::kArgsLength - FCA::kContextSaveIndex); 2755 FCA::kArgsLength - FCA::kContextSaveIndex);
2746 Operand length_operand = StackSpaceOperand(2);
2747 Operand return_value_operand = args_from_rbp.GetArgumentOperand( 2756 Operand return_value_operand = args_from_rbp.GetArgumentOperand(
2748 this->is_store() ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset); 2757 this->is_store() ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset);
2749 int stack_space = 0; 2758 const int stack_space = argc + FCA::kArgsLength + 2;
2750 Operand* stack_space_operand = &length_operand; 2759 Operand* stack_space_operand = nullptr;
2751 stack_space = argc + FCA::kArgsLength + 1;
2752 stack_space_operand = nullptr;
2753 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, 2760 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg,
2754 stack_space, stack_space_operand, 2761 stack_space, stack_space_operand,
2755 return_value_operand, &context_restore_operand); 2762 return_value_operand, &context_restore_operand);
2756 } 2763 }
2757 2764
2758 2765
2759 void CallApiGetterStub::Generate(MacroAssembler* masm) { 2766 void CallApiGetterStub::Generate(MacroAssembler* masm) {
2760 #if defined(__MINGW64__) || defined(_WIN64) 2767 #if defined(__MINGW64__) || defined(_WIN64)
2761 Register getter_arg = r8; 2768 Register getter_arg = r8;
2762 Register accessor_info_arg = rdx; 2769 Register accessor_info_arg = rdx;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 kStackUnwindSpace, nullptr, return_value_operand, 2842 kStackUnwindSpace, nullptr, return_value_operand,
2836 NULL); 2843 NULL);
2837 } 2844 }
2838 2845
2839 #undef __ 2846 #undef __
2840 2847
2841 } // namespace internal 2848 } // namespace internal
2842 } // namespace v8 2849 } // namespace v8
2843 2850
2844 #endif // V8_TARGET_ARCH_X64 2851 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/s390/code-stubs-s390.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698