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

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

Issue 1402943002: [Interpreter] Support for operator new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: One more test. 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/compiler/interpreter-assembler.cc ('k') | src/ia32/interface-descriptors-ia32.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-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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // Drop receiver + arguments and return. 717 // Drop receiver + arguments and return.
718 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, 718 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister,
719 BytecodeArray::kParameterSizeOffset)); 719 BytecodeArray::kParameterSizeOffset));
720 __ pop(ecx); 720 __ pop(ecx);
721 __ add(esp, ebx); 721 __ add(esp, ebx);
722 __ push(ecx); 722 __ push(ecx);
723 __ ret(0); 723 __ ret(0);
724 } 724 }
725 725
726 726
727 static void Generate_InterpreterPushArgs(MacroAssembler* masm) {
728 // ----------- S t a t e -------------
729 // -- ebx : Pointer to the last argument in the args array.
730 // -- ebx : Pointer to one before the first argument in the args array.
731 // -----------------------------------
732 Label loop_header, loop_check;
733 __ jmp(&loop_check);
734 __ bind(&loop_header);
735 __ Push(Operand(ebx, 0));
736 __ sub(ebx, Immediate(kPointerSize));
737 __ bind(&loop_check);
738 __ cmp(ebx, ecx);
739 __ j(greater, &loop_header, Label::kNear);
740 }
741
742
727 // static 743 // static
728 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { 744 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
729 // ----------- S t a t e ------------- 745 // ----------- S t a t e -------------
730 // -- eax : the number of arguments (not including the receiver) 746 // -- eax : the number of arguments (not including the receiver)
731 // -- ebx : the address of the first argument to be pushed. Subsequent 747 // -- ebx : the address of the first argument to be pushed. Subsequent
732 // arguments should be consecutive above this, in the same order as 748 // arguments should be consecutive above this, in the same order as
733 // they are to be pushed onto the stack. 749 // they are to be pushed onto the stack.
734 // -- edi : the target to call (can be any Object). 750 // -- edi : the target to call (can be any Object).
751 // -----------------------------------
735 752
736 // Pop return address to allow tail-call after pushing arguments. 753 // Pop return address to allow tail-call after pushing arguments.
737 __ Pop(edx); 754 __ Pop(edx);
738 755
739 // Find the address of the last argument. 756 // Find the address of the last argument.
740 __ mov(ecx, eax); 757 __ mov(ecx, eax);
741 __ add(ecx, Immediate(1)); // Add one for receiver. 758 __ add(ecx, Immediate(1)); // Add one for receiver.
742 __ shl(ecx, kPointerSizeLog2); 759 __ shl(ecx, kPointerSizeLog2);
743 __ neg(ecx); 760 __ neg(ecx);
744 __ add(ecx, ebx); 761 __ add(ecx, ebx);
745 762
746 // Push the arguments. 763 Generate_InterpreterPushArgs(masm);
747 Label loop_header, loop_check;
748 __ jmp(&loop_check);
749 __ bind(&loop_header);
750 __ Push(Operand(ebx, 0));
751 __ sub(ebx, Immediate(kPointerSize));
752 __ bind(&loop_check);
753 __ cmp(ebx, ecx);
754 __ j(greater, &loop_header, Label::kNear);
755 764
756 // Call the target. 765 // Call the target.
757 __ Push(edx); // Re-push return address. 766 __ Push(edx); // Re-push return address.
758 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 767 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
759 } 768 }
760 769
761 770
771 // static
772 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
773 // ----------- S t a t e -------------
774 // -- eax : the number of arguments (not including the receiver)
775 // -- edx : the original constructor
776 // -- edi : the constructor
777 // -- ebx : the address of the first argument to be pushed. Subsequent
778 // arguments should be consecutive above this, in the same order as
779 // they are to be pushed onto the stack.
780 // -----------------------------------
781
782 // Save number of arguments on the stack below where arguments are pushed.
rmcilroy 2015/10/15 10:30:55 nit - arguments are going to be pushed
oth 2015/10/15 11:16:43 Done.
783 __ mov(ecx, eax);
784 __ neg(ecx);
785 __ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax);
786
787 // Pop return address to allow tail-call after pushing arguments.
788 __ Pop(eax);
789
790 // Find the address of the last argument.
791 __ shl(ecx, kPointerSizeLog2);
792 __ add(ecx, ebx);
793
794 // Push required padding.
795 __ Push(Immediate(0));
796
797 Generate_InterpreterPushArgs(masm);
798
799 // Restore number of arguments from slot on stack.
800 __ xchg(eax, ecx);
rmcilroy 2015/10/15 10:30:55 optional nit - I think you could avoid the xchg if
oth 2015/10/15 11:16:43 Done. Also looked at stashing the stack address in
801 __ mov(eax, Operand(esp, -kPointerSize));
802
803 // Call the target.
804 __ Push(ecx); // Re-push return address.
805 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
806 }
807
808
762 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 809 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
763 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 810 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
764 GenerateTailCallToReturnedCode(masm); 811 GenerateTailCallToReturnedCode(masm);
765 } 812 }
766 813
767 814
768 815
769 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { 816 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
770 FrameScope scope(masm, StackFrame::INTERNAL); 817 FrameScope scope(masm, StackFrame::INTERNAL);
771 // Push a copy of the function. 818 // Push a copy of the function.
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 1905
1859 __ bind(&ok); 1906 __ bind(&ok);
1860 __ ret(0); 1907 __ ret(0);
1861 } 1908 }
1862 1909
1863 #undef __ 1910 #undef __
1864 } // namespace internal 1911 } // namespace internal
1865 } // namespace v8 1912 } // namespace v8
1866 1913
1867 #endif // V8_TARGET_ARCH_IA32 1914 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/compiler/interpreter-assembler.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698