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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // TODO(dslomov): support pretenuring | 771 // TODO(dslomov): support pretenuring |
772 CHECK(!FLAG_pretenuring_call_new); | 772 CHECK(!FLAG_pretenuring_call_new); |
773 | 773 |
774 { | 774 { |
775 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 775 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
776 | 776 |
777 __ mov(t0, a0); | 777 __ mov(t0, a0); |
778 __ SmiTag(t0); | 778 __ SmiTag(t0); |
779 __ push(t0); // Smi-tagged arguments count. | 779 __ push(t0); // Smi-tagged arguments count. |
780 | 780 |
| 781 // Push new.target. |
| 782 __ push(a3); |
| 783 |
781 // receiver is the hole. | 784 // receiver is the hole. |
782 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 785 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
783 __ push(at); | 786 __ push(at); |
784 | 787 |
785 // Set up pointer to last argument. | 788 // Set up pointer to last argument. |
786 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 789 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
787 | 790 |
788 // Copy arguments and receiver to the expression stack. | 791 // Copy arguments and receiver to the expression stack. |
789 // a0: number of arguments | 792 // a0: number of arguments |
790 // a1: constructor function | 793 // a1: constructor function |
791 // a2: address of last argument (caller sp) | 794 // a2: address of last argument (caller sp) |
792 // t0: number of arguments (smi-tagged) | 795 // t0: number of arguments (smi-tagged) |
793 // sp[0]: receiver | 796 // sp[0]: receiver |
794 // sp[1]: number of arguments (smi-tagged) | 797 // sp[1]: new.target |
| 798 // sp[2]: number of arguments (smi-tagged) |
795 Label loop, entry; | 799 Label loop, entry; |
796 __ Branch(&entry); | 800 __ Branch(&entry); |
797 __ bind(&loop); | 801 __ bind(&loop); |
798 __ sll(at, t0, kPointerSizeLog2 - 1); | 802 __ sll(at, t0, kPointerSizeLog2 - 1); |
799 __ Addu(at, a2, Operand(at)); | 803 __ Addu(at, a2, Operand(at)); |
800 __ lw(at, MemOperand(at)); | 804 __ lw(at, MemOperand(at)); |
801 __ push(at); | 805 __ push(at); |
802 __ bind(&entry); | 806 __ bind(&entry); |
803 __ Subu(t0, t0, Operand(2)); | 807 __ Subu(t0, t0, Operand(2)); |
804 __ Branch(&loop, ge, t0, Operand(zero_reg)); | 808 __ Branch(&loop, ge, t0, Operand(zero_reg)); |
805 | 809 |
806 // Call the function. | 810 // Call the function. |
807 // a0: number of arguments | 811 // a0: number of arguments |
808 // a1: constructor function | 812 // a1: constructor function |
| 813 __ Addu(a0, a0, Operand(1)); |
809 ParameterCount actual(a0); | 814 ParameterCount actual(a0); |
810 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); | 815 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); |
811 | 816 |
812 // Restore context from the frame. | 817 // Restore context from the frame. |
813 // v0: result | 818 // v0: result |
814 // sp[0]: number of arguments (smi-tagged) | 819 // sp[0]: number of arguments (smi-tagged) |
815 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 820 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
816 __ lw(a1, MemOperand(sp, 0)); | 821 __ lw(a1, MemOperand(sp, 0)); |
817 | 822 |
818 // Leave construct frame. | 823 // Leave construct frame. |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 __ break_(0xCC); | 1661 __ break_(0xCC); |
1657 } | 1662 } |
1658 } | 1663 } |
1659 | 1664 |
1660 | 1665 |
1661 #undef __ | 1666 #undef __ |
1662 | 1667 |
1663 } } // namespace v8::internal | 1668 } } // namespace v8::internal |
1664 | 1669 |
1665 #endif // V8_TARGET_ARCH_MIPS | 1670 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |