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

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: Fix missing receiver slot. 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 Register array_limit) {
729 // ----------- S t a t e -------------
730 // -- ebx : Pointer to the last argument in the args array.
731 // -- array_limit : Pointer to one before the first argument in the
732 // args array.
733 // -----------------------------------
734 Label loop_header, loop_check;
735 __ jmp(&loop_check);
736 __ bind(&loop_header);
737 __ Push(Operand(ebx, 0));
738 __ sub(ebx, Immediate(kPointerSize));
739 __ bind(&loop_check);
740 __ cmp(ebx, array_limit);
741 __ j(greater, &loop_header, Label::kNear);
742 }
743
744
727 // static 745 // static
728 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { 746 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
729 // ----------- S t a t e ------------- 747 // ----------- S t a t e -------------
730 // -- eax : the number of arguments (not including the receiver) 748 // -- eax : the number of arguments (not including the receiver)
731 // -- ebx : the address of the first argument to be pushed. Subsequent 749 // -- ebx : the address of the first argument to be pushed. Subsequent
732 // arguments should be consecutive above this, in the same order as 750 // arguments should be consecutive above this, in the same order as
733 // they are to be pushed onto the stack. 751 // they are to be pushed onto the stack.
734 // -- edi : the target to call (can be any Object). 752 // -- edi : the target to call (can be any Object).
753 // -----------------------------------
735 754
736 // Pop return address to allow tail-call after pushing arguments. 755 // Pop return address to allow tail-call after pushing arguments.
737 __ Pop(edx); 756 __ Pop(edx);
738 757
739 // Find the address of the last argument. 758 // Find the address of the last argument.
740 __ mov(ecx, eax); 759 __ mov(ecx, eax);
741 __ add(ecx, Immediate(1)); // Add one for receiver. 760 __ add(ecx, Immediate(1)); // Add one for receiver.
742 __ shl(ecx, kPointerSizeLog2); 761 __ shl(ecx, kPointerSizeLog2);
743 __ neg(ecx); 762 __ neg(ecx);
744 __ add(ecx, ebx); 763 __ add(ecx, ebx);
745 764
746 // Push the arguments. 765 Generate_InterpreterPushArgs(masm, ecx);
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 766
756 // Call the target. 767 // Call the target.
757 __ Push(edx); // Re-push return address. 768 __ Push(edx); // Re-push return address.
758 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 769 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
759 } 770 }
760 771
761 772
773 // static
774 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
775 // ----------- S t a t e -------------
776 // -- eax : the number of arguments (not including the receiver)
777 // -- edx : the original constructor
778 // -- edi : the constructor
779 // -- ebx : the address of the first argument to be pushed. Subsequent
780 // arguments should be consecutive above this, in the same order as
781 // they are to be pushed onto the stack.
782 // -----------------------------------
783
784 // Save number of arguments on the stack below where arguments are going
785 // to be pushed.
786 __ mov(ecx, eax);
787 __ neg(ecx);
788 __ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax);
789 __ mov(eax, ecx);
790
791 // Pop return address to allow tail-call after pushing arguments.
792 __ Pop(ecx);
793
794 // Find the address of the last argument.
795 __ shl(eax, kPointerSizeLog2);
796 __ add(eax, ebx);
797
798 // Push padding for receiver.
799 __ Push(Immediate(0));
800
801 Generate_InterpreterPushArgs(masm, eax);
802
803 // Restore number of arguments from slot on stack.
804 __ mov(eax, Operand(esp, -kPointerSize));
805
806 // Re-push return address.
807 __ Push(ecx);
808
809 // Call the constructor with unmodified eax, edi, ebi values.
810 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
811 }
812
813
762 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 814 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
763 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 815 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
764 GenerateTailCallToReturnedCode(masm); 816 GenerateTailCallToReturnedCode(masm);
765 } 817 }
766 818
767 819
768
769 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { 820 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
770 FrameScope scope(masm, StackFrame::INTERNAL); 821 FrameScope scope(masm, StackFrame::INTERNAL);
771 // Push a copy of the function. 822 // Push a copy of the function.
772 __ push(edi); 823 __ push(edi);
773 // Function is also the parameter to the runtime call. 824 // Function is also the parameter to the runtime call.
774 __ push(edi); 825 __ push(edi);
775 // Whether to compile in a background thread. 826 // Whether to compile in a background thread.
776 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); 827 __ Push(masm->isolate()->factory()->ToBoolean(concurrent));
777 828
778 __ CallRuntime(Runtime::kCompileOptimized, 2); 829 __ CallRuntime(Runtime::kCompileOptimized, 2);
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 1909
1859 __ bind(&ok); 1910 __ bind(&ok);
1860 __ ret(0); 1911 __ ret(0);
1861 } 1912 }
1862 1913
1863 #undef __ 1914 #undef __
1864 } // namespace internal 1915 } // namespace internal
1865 } // namespace v8 1916 } // namespace v8
1866 1917
1867 #endif // V8_TARGET_ARCH_IA32 1918 #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