OLD | NEW |
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 | 5 |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
10 | 10 |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 760 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
761 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); | 761 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); |
762 } | 762 } |
763 | 763 |
764 | 764 |
765 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 765 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
766 Generate_JSConstructStubHelper(masm, true, false); | 766 Generate_JSConstructStubHelper(masm, true, false); |
767 } | 767 } |
768 | 768 |
769 | 769 |
| 770 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 771 // ----------- S t a t e ------------- |
| 772 // -- a0 : number of arguments |
| 773 // -- a1 : constructor function |
| 774 // -- a2 : allocation site or undefined |
| 775 // -- a3 : original constructor |
| 776 // -- ra : return address |
| 777 // -- sp[...]: constructor arguments |
| 778 // ----------------------------------- |
| 779 |
| 780 // TODO(dslomov): support pretenuring |
| 781 CHECK(!FLAG_pretenuring_call_new); |
| 782 |
| 783 { |
| 784 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 785 |
| 786 __ mov(a4, a0); |
| 787 __ SmiTag(a4); |
| 788 __ push(a4); // Smi-tagged arguments count. |
| 789 |
| 790 // receiver is the hole. |
| 791 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 792 __ push(at); |
| 793 |
| 794 // Set up pointer to last argument. |
| 795 __ Daddu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 796 |
| 797 // Copy arguments and receiver to the expression stack. |
| 798 // a0: number of arguments |
| 799 // a1: constructor function |
| 800 // a2: address of last argument (caller sp) |
| 801 // a4: number of arguments (smi-tagged) |
| 802 // sp[0]: receiver |
| 803 // sp[1]: number of arguments (smi-tagged) |
| 804 Label loop, entry; |
| 805 __ SmiUntag(a4); |
| 806 __ jmp(&entry); |
| 807 __ bind(&loop); |
| 808 __ dsll(at, a4, kPointerSizeLog2); |
| 809 __ Daddu(at, a2, Operand(at)); |
| 810 __ ld(at, MemOperand(at)); |
| 811 __ push(at); |
| 812 __ bind(&entry); |
| 813 __ Daddu(a4, a4, Operand(-1)); |
| 814 __ Branch(&loop, ge, a4, Operand(zero_reg)); |
| 815 |
| 816 // Call the function. |
| 817 // a0: number of arguments |
| 818 // a1: constructor function |
| 819 ParameterCount actual(a0); |
| 820 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 821 |
| 822 // Restore context from the frame. |
| 823 // v0: result |
| 824 // sp[0]: number of arguments (smi-tagged) |
| 825 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 826 __ ld(a1, MemOperand(sp, 0)); |
| 827 |
| 828 // Leave construct frame. |
| 829 } |
| 830 |
| 831 __ SmiScale(at, a1, kPointerSizeLog2); |
| 832 __ Daddu(sp, sp, Operand(at)); |
| 833 __ Daddu(sp, sp, Operand(kPointerSize)); |
| 834 __ Jump(ra); |
| 835 } |
| 836 |
| 837 |
770 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 838 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
771 bool is_construct) { | 839 bool is_construct) { |
772 // Called from JSEntryStub::GenerateBody | 840 // Called from JSEntryStub::GenerateBody |
773 | 841 |
774 // ----------- S t a t e ------------- | 842 // ----------- S t a t e ------------- |
775 // -- a0: code entry | 843 // -- a0: code entry |
776 // -- a1: function | 844 // -- a1: function |
777 // -- a2: receiver_pointer | 845 // -- a2: receiver_pointer |
778 // -- a3: argc | 846 // -- a3: argc |
779 // -- s0: argv | 847 // -- s0: argv |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 __ break_(0xCC); | 1664 __ break_(0xCC); |
1597 } | 1665 } |
1598 } | 1666 } |
1599 | 1667 |
1600 | 1668 |
1601 #undef __ | 1669 #undef __ |
1602 | 1670 |
1603 } } // namespace v8::internal | 1671 } } // namespace v8::internal |
1604 | 1672 |
1605 #endif // V8_TARGET_ARCH_MIPS64 | 1673 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |