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

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1402153004: Revert of [Interpreter] Support for operator new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/ppc/interface-descriptors-ppc.cc ('k') | src/x64/interface-descriptors-x64.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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 // Drop receiver + arguments and return. 778 // Drop receiver + arguments and return.
779 __ movl(rbx, FieldOperand(kInterpreterBytecodeArrayRegister, 779 __ movl(rbx, FieldOperand(kInterpreterBytecodeArrayRegister,
780 BytecodeArray::kParameterSizeOffset)); 780 BytecodeArray::kParameterSizeOffset));
781 __ PopReturnAddressTo(rcx); 781 __ PopReturnAddressTo(rcx);
782 __ addp(rsp, rbx); 782 __ addp(rsp, rbx);
783 __ PushReturnAddressFrom(rcx); 783 __ PushReturnAddressFrom(rcx);
784 __ ret(0); 784 __ ret(0);
785 } 785 }
786 786
787 787
788 static void Generate_InterpreterPushArgs(MacroAssembler* masm, 788 // static
789 bool push_receiver) { 789 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
790 // ----------- S t a t e ------------- 790 // ----------- S t a t e -------------
791 // -- rax : the number of arguments (not including the receiver) 791 // -- rax : the number of arguments (not including the receiver)
792 // -- rbx : the address of the first argument to be pushed. Subsequent 792 // -- rbx : the address of the first argument to be pushed. Subsequent
793 // arguments should be consecutive above this, in the same order as 793 // arguments should be consecutive above this, in the same order as
794 // they are to be pushed onto the stack. 794 // they are to be pushed onto the stack.
795 // ----------------------------------- 795 // -- rdi : the target to call (can be any Object).
796
797 // Pop return address to allow tail-call after pushing arguments.
798 __ Pop(rdx);
796 799
797 // Find the address of the last argument. 800 // Find the address of the last argument.
798 __ movp(rcx, rax); 801 __ movp(rcx, rax);
799 if (push_receiver) { 802 __ addp(rcx, Immediate(1)); // Add one for receiver.
800 __ addp(rcx, Immediate(1)); // Add one for receiver.
801 }
802
803 __ shlp(rcx, Immediate(kPointerSizeLog2)); 803 __ shlp(rcx, Immediate(kPointerSizeLog2));
804 __ negp(rcx); 804 __ negp(rcx);
805 __ addp(rcx, rbx); 805 __ addp(rcx, rbx);
806 806
807 // Push the arguments. 807 // Push the arguments.
808 Label loop_header, loop_check; 808 Label loop_header, loop_check;
809 __ j(always, &loop_check); 809 __ j(always, &loop_check);
810 __ bind(&loop_header); 810 __ bind(&loop_header);
811 __ Push(Operand(rbx, 0)); 811 __ Push(Operand(rbx, 0));
812 __ subp(rbx, Immediate(kPointerSize)); 812 __ subp(rbx, Immediate(kPointerSize));
813 __ bind(&loop_check); 813 __ bind(&loop_check);
814 __ cmpp(rbx, rcx); 814 __ cmpp(rbx, rcx);
815 __ j(greater, &loop_header, Label::kNear); 815 __ j(greater, &loop_header, Label::kNear);
816 }
817
818
819 // static
820 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
821 // ----------- S t a t e -------------
822 // -- rax : the number of arguments (not including the receiver)
823 // -- rbx : the address of the first argument to be pushed. Subsequent
824 // arguments should be consecutive above this, in the same order as
825 // they are to be pushed onto the stack.
826 // -- rdi : the target to call (can be any Object).
827 // -----------------------------------
828
829 // Pop return address to allow tail-call after pushing arguments.
830 __ PopReturnAddressTo(kScratchRegister);
831
832 Generate_InterpreterPushArgs(masm, true);
833 816
834 // Call the target. 817 // Call the target.
835 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. 818 __ Push(rdx); // Re-push return address.
836 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 819 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
837 } 820 }
838 821
839 822
840 // static
841 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
842 // ----------- S t a t e -------------
843 // -- rax : the number of arguments (not including the receiver)
844 // -- rdx : the original constructor (either the same as the constructor or
845 // the JSFunction on which new was invoked initially)
846 // -- rdi : the constructor to call (can be any Object)
847 // -- rbx : the address of the first argument to be pushed. Subsequent
848 // arguments should be consecutive above this, in the same order as
849 // they are to be pushed onto the stack.
850 // -----------------------------------
851
852 // Pop return address to allow tail-call after pushing arguments.
853 __ PopReturnAddressTo(kScratchRegister);
854
855 // Push slot for the receiver to be constructed.
856 __ Push(Immediate(0));
857
858 Generate_InterpreterPushArgs(masm, false);
859
860 // Push return address in preparation for the tail-call.
861 __ PushReturnAddressFrom(kScratchRegister);
862
863 // Call the constructor (rax, rdx, rdi passed on).
864 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
865 }
866
867
868 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 823 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
869 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 824 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
870 GenerateTailCallToReturnedCode(masm); 825 GenerateTailCallToReturnedCode(masm);
871 } 826 }
872 827
873 828
874 static void CallCompileOptimized(MacroAssembler* masm, 829 static void CallCompileOptimized(MacroAssembler* masm,
875 bool concurrent) { 830 bool concurrent) {
876 FrameScope scope(masm, StackFrame::INTERNAL); 831 FrameScope scope(masm, StackFrame::INTERNAL);
877 // Push a copy of the function onto the stack. 832 // Push a copy of the function onto the stack.
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 __ ret(0); 1933 __ ret(0);
1979 } 1934 }
1980 1935
1981 1936
1982 #undef __ 1937 #undef __
1983 1938
1984 } // namespace internal 1939 } // namespace internal
1985 } // namespace v8 1940 } // namespace v8
1986 1941
1987 #endif // V8_TARGET_ARCH_X64 1942 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ppc/interface-descriptors-ppc.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698