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

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

Issue 2212343002: Revert of [Interpreter] Collect type feedback for 'new' in the bytecode handler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/builtins/mips64/builtins-mips64.cc ('k') | src/code-factory.h » ('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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 __ Push(rdi); 771 __ Push(rdi);
772 __ CallRuntime(Runtime::kCompileBaseline); 772 __ CallRuntime(Runtime::kCompileBaseline);
773 773
774 // Restore return value. 774 // Restore return value.
775 __ Pop(rax); 775 __ Pop(rax);
776 } 776 }
777 __ ret(0); 777 __ ret(0);
778 } 778 }
779 779
780 static void Generate_InterpreterPushArgs(MacroAssembler* masm, 780 static void Generate_InterpreterPushArgs(MacroAssembler* masm,
781 Register num_args, 781 bool push_receiver) {
782 Register start_address,
783 Register scratch, bool push_receiver) {
784 // ----------- S t a t e ------------- 782 // ----------- S t a t e -------------
785 // -- rax : the number of arguments (not including the receiver) 783 // -- rax : the number of arguments (not including the receiver)
786 // -- rbx : the address of the first argument to be pushed. Subsequent 784 // -- rbx : the address of the first argument to be pushed. Subsequent
787 // arguments should be consecutive above this, in the same order as 785 // arguments should be consecutive above this, in the same order as
788 // they are to be pushed onto the stack. 786 // they are to be pushed onto the stack.
789 // ----------------------------------- 787 // -----------------------------------
790 788
791 // Find the address of the last argument. 789 // Find the address of the last argument.
792 __ movp(scratch, num_args); 790 __ movp(rcx, rax);
793 if (push_receiver) { 791 if (push_receiver) {
794 __ addp(scratch, Immediate(1)); // Add one for receiver. 792 __ addp(rcx, Immediate(1)); // Add one for receiver.
795 } 793 }
796 794
797 __ shlp(scratch, Immediate(kPointerSizeLog2)); 795 __ shlp(rcx, Immediate(kPointerSizeLog2));
798 __ negp(scratch); 796 __ negp(rcx);
799 __ addp(scratch, start_address); 797 __ addp(rcx, rbx);
800 798
801 // Push the arguments. 799 // Push the arguments.
802 Label loop_header, loop_check; 800 Label loop_header, loop_check;
803 __ j(always, &loop_check); 801 __ j(always, &loop_check);
804 __ bind(&loop_header); 802 __ bind(&loop_header);
805 __ Push(Operand(start_address, 0)); 803 __ Push(Operand(rbx, 0));
806 __ subp(start_address, Immediate(kPointerSize)); 804 __ subp(rbx, Immediate(kPointerSize));
807 __ bind(&loop_check); 805 __ bind(&loop_check);
808 __ cmpp(start_address, scratch); 806 __ cmpp(rbx, rcx);
809 __ j(greater, &loop_header, Label::kNear); 807 __ j(greater, &loop_header, Label::kNear);
810 } 808 }
811 809
812 // static 810 // static
813 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 811 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
814 MacroAssembler* masm, TailCallMode tail_call_mode, 812 MacroAssembler* masm, TailCallMode tail_call_mode,
815 CallableType function_type) { 813 CallableType function_type) {
816 // ----------- S t a t e ------------- 814 // ----------- S t a t e -------------
817 // -- rax : the number of arguments (not including the receiver) 815 // -- rax : the number of arguments (not including the receiver)
818 // -- rbx : the address of the first argument to be pushed. Subsequent 816 // -- rbx : the address of the first argument to be pushed. Subsequent
819 // arguments should be consecutive above this, in the same order as 817 // arguments should be consecutive above this, in the same order as
820 // they are to be pushed onto the stack. 818 // they are to be pushed onto the stack.
821 // -- rdi : the target to call (can be any Object). 819 // -- rdi : the target to call (can be any Object).
822 // ----------------------------------- 820 // -----------------------------------
823 821
824 // Pop return address to allow tail-call after pushing arguments. 822 // Pop return address to allow tail-call after pushing arguments.
825 __ PopReturnAddressTo(kScratchRegister); 823 __ PopReturnAddressTo(kScratchRegister);
826 824
827 // TODO(mythria): Add a stack check before pushing arguments. 825 Generate_InterpreterPushArgs(masm, true);
828 // rax is readonly rcx and r8 will be modified.
829 Generate_InterpreterPushArgs(masm, rax, rbx, rcx, true);
830 826
831 // Call the target. 827 // Call the target.
832 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. 828 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address.
833 829
834 if (function_type == CallableType::kJSFunction) { 830 if (function_type == CallableType::kJSFunction) {
835 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, 831 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny,
836 tail_call_mode), 832 tail_call_mode),
837 RelocInfo::CODE_TARGET); 833 RelocInfo::CODE_TARGET);
838 } else { 834 } else {
839 DCHECK_EQ(function_type, CallableType::kAny); 835 DCHECK_EQ(function_type, CallableType::kAny);
840 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 836 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
841 tail_call_mode), 837 tail_call_mode),
842 RelocInfo::CODE_TARGET); 838 RelocInfo::CODE_TARGET);
843 } 839 }
844 } 840 }
845 841
846 // static 842 // static
847 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( 843 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
848 MacroAssembler* masm, CallableType construct_type) {
849 // ----------- S t a t e ------------- 844 // ----------- S t a t e -------------
850 // -- rax : the number of arguments (not including the receiver) 845 // -- rax : the number of arguments (not including the receiver)
851 // -- rdx : the new target (either the same as the constructor or 846 // -- rdx : the new target (either the same as the constructor or
852 // the JSFunction on which new was invoked initially) 847 // the JSFunction on which new was invoked initially)
853 // -- rdi : the constructor to call (can be any Object) 848 // -- rdi : the constructor to call (can be any Object)
854 // -- rbx : the allocation site feedback if available, undefined otherwise 849 // -- rbx : the address of the first argument to be pushed. Subsequent
855 // -- rcx : the address of the first argument to be pushed. Subsequent
856 // arguments should be consecutive above this, in the same order as 850 // arguments should be consecutive above this, in the same order as
857 // they are to be pushed onto the stack. 851 // they are to be pushed onto the stack.
858 // ----------------------------------- 852 // -----------------------------------
859 853
860 // Pop return address to allow tail-call after pushing arguments. 854 // Pop return address to allow tail-call after pushing arguments.
861 __ PopReturnAddressTo(kScratchRegister); 855 __ PopReturnAddressTo(kScratchRegister);
862 856
863 // Push slot for the receiver to be constructed. 857 // Push slot for the receiver to be constructed.
864 __ Push(Immediate(0)); 858 __ Push(Immediate(0));
865 859
866 // TODO(mythria): Add a stack check before pushing arguments. 860 Generate_InterpreterPushArgs(masm, false);
867 // rax is readonly rcx and r8 will be modified.
868 Generate_InterpreterPushArgs(masm, rax, rcx, r8, false);
869 861
870 // Push return address in preparation for the tail-call. 862 // Push return address in preparation for the tail-call.
871 __ PushReturnAddressFrom(kScratchRegister); 863 __ PushReturnAddressFrom(kScratchRegister);
872 864
873 __ AssertUndefinedOrAllocationSite(rbx); 865 // Call the constructor (rax, rdx, rdi passed on).
874 if (construct_type == CallableType::kJSFunction) { 866 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
875 // Tail call to the function-specific construct stub (still in the caller
876 // context at this point).
877 __ AssertFunction(rdi);
878
879 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
880 __ movp(rcx, FieldOperand(rcx, SharedFunctionInfo::kConstructStubOffset));
881 __ leap(rcx, FieldOperand(rcx, Code::kHeaderSize));
882 // Jump to the constructor function (rax, rbx, rdx passed on).
883 __ jmp(rcx);
884 } else {
885 DCHECK_EQ(construct_type, CallableType::kAny);
886 // Call the constructor (rax, rdx, rdi passed on).
887 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
888 }
889 } 867 }
890 868
891 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { 869 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
892 // Set the return address to the correct point in the interpreter entry 870 // Set the return address to the correct point in the interpreter entry
893 // trampoline. 871 // trampoline.
894 Smi* interpreter_entry_return_pc_offset( 872 Smi* interpreter_entry_return_pc_offset(
895 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); 873 masm->isolate()->heap()->interpreter_entry_return_pc_offset());
896 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); 874 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0));
897 __ Move(rbx, masm->isolate()->builtins()->InterpreterEntryTrampoline()); 875 __ Move(rbx, masm->isolate()->builtins()->InterpreterEntryTrampoline());
898 __ addp(rbx, Immediate(interpreter_entry_return_pc_offset->value() + 876 __ addp(rbx, Immediate(interpreter_entry_return_pc_offset->value() +
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3068 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3091 Generate_OnStackReplacementHelper(masm, true); 3069 Generate_OnStackReplacementHelper(masm, true);
3092 } 3070 }
3093 3071
3094 #undef __ 3072 #undef __
3095 3073
3096 } // namespace internal 3074 } // namespace internal
3097 } // namespace v8 3075 } // namespace v8
3098 3076
3099 #endif // V8_TARGET_ARCH_X64 3077 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698