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_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
10 | 10 |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 751 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
752 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); | 752 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); |
753 } | 753 } |
754 | 754 |
755 | 755 |
756 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 756 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
757 Generate_JSConstructStubHelper(masm, true, false); | 757 Generate_JSConstructStubHelper(masm, true, false); |
758 } | 758 } |
759 | 759 |
760 | 760 |
| 761 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 762 // ----------- S t a t e ------------- |
| 763 // -- a0 : number of arguments |
| 764 // -- a1 : constructor function |
| 765 // -- a2 : allocation site or undefined |
| 766 // -- a3 : original constructor |
| 767 // -- ra : return address |
| 768 // -- sp[...]: constructor arguments |
| 769 // ----------------------------------- |
| 770 |
| 771 // TODO(dslomov): support pretenuring |
| 772 CHECK(!FLAG_pretenuring_call_new); |
| 773 |
| 774 { |
| 775 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 776 |
| 777 __ mov(t0, a0); |
| 778 __ SmiTag(t0); |
| 779 __ push(t0); // Smi-tagged arguments count. |
| 780 |
| 781 // receiver is the hole. |
| 782 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 783 __ push(at); |
| 784 |
| 785 // Set up pointer to last argument. |
| 786 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 787 |
| 788 // Copy arguments and receiver to the expression stack. |
| 789 // a0: number of arguments |
| 790 // a1: constructor function |
| 791 // a2: address of last argument (caller sp) |
| 792 // t0: number of arguments (smi-tagged) |
| 793 // sp[0]: receiver |
| 794 // sp[1]: number of arguments (smi-tagged) |
| 795 Label loop, entry; |
| 796 __ Branch(&entry); |
| 797 __ bind(&loop); |
| 798 __ sll(at, t0, kPointerSizeLog2 - 1); |
| 799 __ Addu(at, a2, Operand(at)); |
| 800 __ lw(at, MemOperand(at)); |
| 801 __ push(at); |
| 802 __ bind(&entry); |
| 803 __ Subu(t0, t0, Operand(2)); |
| 804 __ Branch(&loop, ge, t0, Operand(zero_reg)); |
| 805 |
| 806 // Call the function. |
| 807 // a0: number of arguments |
| 808 // a1: constructor function |
| 809 ParameterCount actual(a0); |
| 810 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 811 |
| 812 // Restore context from the frame. |
| 813 // v0: result |
| 814 // sp[0]: number of arguments (smi-tagged) |
| 815 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 816 __ lw(a1, MemOperand(sp, 0)); |
| 817 |
| 818 // Leave construct frame. |
| 819 } |
| 820 |
| 821 __ sll(at, a1, kPointerSizeLog2 - 1); |
| 822 __ Addu(sp, sp, Operand(at)); |
| 823 __ Addu(sp, sp, Operand(kPointerSize)); |
| 824 __ Jump(ra); |
| 825 } |
| 826 |
| 827 |
761 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 828 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
762 bool is_construct) { | 829 bool is_construct) { |
763 // Called from JSEntryStub::GenerateBody | 830 // Called from JSEntryStub::GenerateBody |
764 | 831 |
765 // ----------- S t a t e ------------- | 832 // ----------- S t a t e ------------- |
766 // -- a0: code entry | 833 // -- a0: code entry |
767 // -- a1: function | 834 // -- a1: function |
768 // -- a2: receiver_pointer | 835 // -- a2: receiver_pointer |
769 // -- a3: argc | 836 // -- a3: argc |
770 // -- s0: argv | 837 // -- s0: argv |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 __ break_(0xCC); | 1656 __ break_(0xCC); |
1590 } | 1657 } |
1591 } | 1658 } |
1592 | 1659 |
1593 | 1660 |
1594 #undef __ | 1661 #undef __ |
1595 | 1662 |
1596 } } // namespace v8::internal | 1663 } } // namespace v8::internal |
1597 | 1664 |
1598 #endif // V8_TARGET_ARCH_MIPS | 1665 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |