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

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: Crashing at cctest test-accessors/AccessorIC Created 3 years, 6 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
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 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 // -- rbx : call_data 2704 // -- rbx : call_data
2705 // -- rcx : holder 2705 // -- rcx : holder
2706 // -- rdx : api_function_address 2706 // -- rdx : api_function_address
2707 // -- rsi : context 2707 // -- rsi : context
2708 // -- rax : number of arguments if argc is a register 2708 // -- rax : number of arguments if argc is a register
2709 // -- rsp[0] : return address 2709 // -- rsp[0] : return address
2710 // -- rsp[8] : last argument 2710 // -- rsp[8] : last argument
2711 // -- ... 2711 // -- ...
2712 // -- rsp[argc * 8] : first argument 2712 // -- rsp[argc * 8] : first argument
2713 // -- rsp[(argc + 1) * 8] : receiver 2713 // -- rsp[(argc + 1) * 8] : receiver
2714 // -- rsp[(argc + 2) * 8] : accessor_holder
2714 // ----------------------------------- 2715 // -----------------------------------
2715 2716
2716 Register callee = rdi; 2717 Register callee = rdi;
2717 Register call_data = rbx; 2718 Register call_data = rbx;
2718 Register holder = rcx; 2719 Register holder = rcx;
2719 Register api_function_address = rdx; 2720 Register api_function_address = rdx;
2720 Register context = rsi; 2721 Register context = rsi;
2721 Register return_address = r8; 2722 Register return_address = r8;
2722 2723
2723 typedef FunctionCallbackArguments FCA; 2724 typedef FunctionCallbackArguments FCA;
(...skipping 26 matching lines...) Expand all
2750 __ PushRoot(Heap::kUndefinedValueRootIndex); 2751 __ PushRoot(Heap::kUndefinedValueRootIndex);
2751 // return value default 2752 // return value default
2752 __ PushRoot(Heap::kUndefinedValueRootIndex); 2753 __ PushRoot(Heap::kUndefinedValueRootIndex);
2753 // isolate 2754 // isolate
2754 Register scratch = call_data; 2755 Register scratch = call_data;
2755 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); 2756 __ Move(scratch, ExternalReference::isolate_address(masm->isolate()));
2756 __ Push(scratch); 2757 __ Push(scratch);
2757 // holder 2758 // holder
2758 __ Push(holder); 2759 __ Push(holder);
2759 2760
2761 // enter a new context
2762 int argc = this->argc();
2763 if (this->is_lazy()) {
2764 // load context from accessor_holder
2765 Register accessor_holder = context;
2766 __ movp(accessor_holder,
2767 MemOperand(rsp, (argc + FCA::kArgsLength + 1) * kPointerSize));
2768 __ movp(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset));
2769 __ GetMapConstructor(scratch, scratch, context);
2770 __ movp(context, FieldOperand(scratch, JSFunction::kContextOffset));
2771 } else {
2772 // load context from callee
2773 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
2774 }
2775
2760 __ movp(scratch, rsp); 2776 __ movp(scratch, rsp);
2761 // Push return address back on stack. 2777 // Push return address back on stack.
2762 __ PushReturnAddressFrom(return_address); 2778 __ PushReturnAddressFrom(return_address);
2763 2779
2764 if (!this->is_lazy()) {
2765 // load context from callee
2766 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
2767 }
2768
2769 // Allocate the v8::Arguments structure in the arguments' space since 2780 // Allocate the v8::Arguments structure in the arguments' space since
2770 // it's not controlled by GC. 2781 // it's not controlled by GC.
2771 const int kApiStackSpace = 3; 2782 const int kApiStackSpace = 3;
2772 2783
2773 PrepareCallApiFunction(masm, kApiStackSpace); 2784 PrepareCallApiFunction(masm, kApiStackSpace);
2774 2785
2775 // FunctionCallbackInfo::implicit_args_. 2786 // FunctionCallbackInfo::implicit_args_.
2776 int argc = this->argc();
2777 __ movp(StackSpaceOperand(0), scratch); 2787 __ movp(StackSpaceOperand(0), scratch);
2778 __ addp(scratch, Immediate((argc + FCA::kArgsLength - 1) * kPointerSize)); 2788 __ addp(scratch, Immediate((argc + FCA::kArgsLength - 1) * kPointerSize));
2779 // FunctionCallbackInfo::values_. 2789 // FunctionCallbackInfo::values_.
2780 __ movp(StackSpaceOperand(1), scratch); 2790 __ movp(StackSpaceOperand(1), scratch);
2781 // FunctionCallbackInfo::length_. 2791 // FunctionCallbackInfo::length_.
2782 __ Set(StackSpaceOperand(2), argc); 2792 __ Set(StackSpaceOperand(2), argc);
2783 2793
2784 #if defined(__MINGW64__) || defined(_WIN64) 2794 #if defined(__MINGW64__) || defined(_WIN64)
2785 Register arguments_arg = rcx; 2795 Register arguments_arg = rcx;
2786 Register callback_arg = rdx; 2796 Register callback_arg = rdx;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 kStackUnwindSpace, nullptr, return_value_operand, 2906 kStackUnwindSpace, nullptr, return_value_operand,
2897 NULL); 2907 NULL);
2898 } 2908 }
2899 2909
2900 #undef __ 2910 #undef __
2901 2911
2902 } // namespace internal 2912 } // namespace internal
2903 } // namespace v8 2913 } // namespace v8
2904 2914
2905 #endif // V8_TARGET_ARCH_X64 2915 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698