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

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

Issue 1423733002: X87: [Interpreter] Support for operator new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | src/x87/interface-descriptors-x87.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_X87 5 #if V8_TARGET_ARCH_X87
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // Drop receiver + arguments and return. 706 // Drop receiver + arguments and return.
707 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, 707 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister,
708 BytecodeArray::kParameterSizeOffset)); 708 BytecodeArray::kParameterSizeOffset));
709 __ pop(ecx); 709 __ pop(ecx);
710 __ add(esp, ebx); 710 __ add(esp, ebx);
711 __ push(ecx); 711 __ push(ecx);
712 __ ret(0); 712 __ ret(0);
713 } 713 }
714 714
715 715
716 static void Generate_InterpreterPushArgs(MacroAssembler* masm,
717 Register array_limit) {
718 // ----------- S t a t e -------------
719 // -- ebx : Pointer to the last argument in the args array.
720 // -- array_limit : Pointer to one before the first argument in the
721 // args array.
722 // -----------------------------------
723 Label loop_header, loop_check;
724 __ jmp(&loop_check);
725 __ bind(&loop_header);
726 __ Push(Operand(ebx, 0));
727 __ sub(ebx, Immediate(kPointerSize));
728 __ bind(&loop_check);
729 __ cmp(ebx, array_limit);
730 __ j(greater, &loop_header, Label::kNear);
731 }
732
733
716 // static 734 // static
717 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { 735 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
718 // ----------- S t a t e ------------- 736 // ----------- S t a t e -------------
719 // -- eax : the number of arguments (not including the receiver) 737 // -- eax : the number of arguments (not including the receiver)
720 // -- ebx : the address of the first argument to be pushed. Subsequent 738 // -- ebx : the address of the first argument to be pushed. Subsequent
721 // arguments should be consecutive above this, in the same order as 739 // arguments should be consecutive above this, in the same order as
722 // they are to be pushed onto the stack. 740 // they are to be pushed onto the stack.
723 // -- edi : the target to call (can be any Object). 741 // -- edi : the target to call (can be any Object).
742 // -----------------------------------
724 743
725 // Pop return address to allow tail-call after pushing arguments. 744 // Pop return address to allow tail-call after pushing arguments.
726 __ Pop(edx); 745 __ Pop(edx);
727 746
728 // Find the address of the last argument. 747 // Find the address of the last argument.
729 __ mov(ecx, eax); 748 __ mov(ecx, eax);
730 __ add(ecx, Immediate(1)); // Add one for receiver. 749 __ add(ecx, Immediate(1)); // Add one for receiver.
731 __ shl(ecx, kPointerSizeLog2); 750 __ shl(ecx, kPointerSizeLog2);
732 __ neg(ecx); 751 __ neg(ecx);
733 __ add(ecx, ebx); 752 __ add(ecx, ebx);
734 753
735 // Push the arguments. 754 Generate_InterpreterPushArgs(masm, ecx);
736 Label loop_header, loop_check;
737 __ jmp(&loop_check);
738 __ bind(&loop_header);
739 __ Push(Operand(ebx, 0));
740 __ sub(ebx, Immediate(kPointerSize));
741 __ bind(&loop_check);
742 __ cmp(ebx, ecx);
743 __ j(greater, &loop_header, Label::kNear);
744 755
745 // Call the target. 756 // Call the target.
746 __ Push(edx); // Re-push return address. 757 __ Push(edx); // Re-push return address.
747 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 758 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
748 } 759 }
749 760
750 761
762 // static
763 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
764 // ----------- S t a t e -------------
765 // -- eax : the number of arguments (not including the receiver)
766 // -- edx : the original constructor
767 // -- edi : the constructor
768 // -- ebx : the address of the first argument to be pushed. Subsequent
769 // arguments should be consecutive above this, in the same order as
770 // they are to be pushed onto the stack.
771 // -----------------------------------
772
773 // Save number of arguments on the stack below where arguments are going
774 // to be pushed.
775 __ mov(ecx, eax);
776 __ neg(ecx);
777 __ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax);
778 __ mov(eax, ecx);
779
780 // Pop return address to allow tail-call after pushing arguments.
781 __ Pop(ecx);
782
783 // Find the address of the last argument.
784 __ shl(eax, kPointerSizeLog2);
785 __ add(eax, ebx);
786
787 // Push padding for receiver.
788 __ Push(Immediate(0));
789
790 Generate_InterpreterPushArgs(masm, eax);
791
792 // Restore number of arguments from slot on stack.
793 __ mov(eax, Operand(esp, -kPointerSize));
794
795 // Re-push return address.
796 __ Push(ecx);
797
798 // Call the constructor with unmodified eax, edi, ebi values.
799 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
800 }
801
802
751 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 803 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
752 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 804 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
753 GenerateTailCallToReturnedCode(masm); 805 GenerateTailCallToReturnedCode(masm);
754 } 806 }
755 807
756 808
757
758 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { 809 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
759 FrameScope scope(masm, StackFrame::INTERNAL); 810 FrameScope scope(masm, StackFrame::INTERNAL);
760 // Push a copy of the function. 811 // Push a copy of the function.
761 __ push(edi); 812 __ push(edi);
762 // Function is also the parameter to the runtime call. 813 // Function is also the parameter to the runtime call.
763 __ push(edi); 814 __ push(edi);
764 // Whether to compile in a background thread. 815 // Whether to compile in a background thread.
765 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); 816 __ Push(masm->isolate()->factory()->ToBoolean(concurrent));
766 817
767 __ CallRuntime(Runtime::kCompileOptimized, 2); 818 __ CallRuntime(Runtime::kCompileOptimized, 2);
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 1898
1848 __ bind(&ok); 1899 __ bind(&ok);
1849 __ ret(0); 1900 __ ret(0);
1850 } 1901 }
1851 1902
1852 #undef __ 1903 #undef __
1853 } // namespace internal 1904 } // namespace internal
1854 } // namespace v8 1905 } // namespace v8
1855 1906
1856 #endif // V8_TARGET_ARCH_X87 1907 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698