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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 { | 751 { |
752 Label done_loop, loop; | 752 Label done_loop, loop; |
753 __ bind(&loop); | 753 __ bind(&loop); |
754 __ Dsubu(a3, a3, Operand(1)); | 754 __ Dsubu(a3, a3, Operand(1)); |
755 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); | 755 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); |
756 __ PushRoot(Heap::kTheHoleValueRootIndex); | 756 __ PushRoot(Heap::kTheHoleValueRootIndex); |
757 __ Branch(&loop); | 757 __ Branch(&loop); |
758 __ bind(&done_loop); | 758 __ bind(&done_loop); |
759 } | 759 } |
760 | 760 |
761 // Enter a new JavaScript frame, and initialize its slots as they were when | 761 // Dispatch on the kind of generator object. |
762 // the generator was suspended. | 762 Label old_generator; |
763 FrameScope scope(masm, StackFrame::MANUAL); | 763 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
764 __ Push(ra, fp); | 764 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kFunctionDataOffset)); |
765 __ Move(fp, sp); | 765 __ GetObjectType(a3, a3, a3); |
766 __ Push(cp, a4); | 766 __ Branch(&old_generator, ne, a3, Operand(BYTECODE_ARRAY_TYPE)); |
767 | 767 |
768 // Restore the operand stack. | 768 // New-style (ignition/turbofan) generator object. |
769 __ ld(a0, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); | |
770 __ ld(a3, FieldMemOperand(a0, FixedArray::kLengthOffset)); | |
771 __ SmiUntag(a3); | |
772 __ Daddu(a0, a0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
773 __ Dlsa(a3, a0, a3, kPointerSizeLog2); | |
774 { | 769 { |
775 Label done_loop, loop; | 770 __ ld(a0, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
776 __ bind(&loop); | 771 __ lw(a0, |
777 __ Branch(&done_loop, eq, a0, Operand(a3)); | 772 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); |
778 __ ld(a5, MemOperand(a0)); | 773 __ SmiUntag(a0); |
779 __ Push(a5); | 774 // We abuse new.target both to indicate that this is a resume call and to |
780 __ Branch(USE_DELAY_SLOT, &loop); | 775 // pass in the generator object. In ordinary calls, new.target is always |
781 __ daddiu(a0, a0, kPointerSize); // In delay slot. | 776 // undefined because generator functions are non-constructable. |
782 __ bind(&done_loop); | 777 __ Move(a3, a1); |
| 778 __ Move(a1, a4); |
| 779 __ ld(a2, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 780 __ Jump(a2); |
783 } | 781 } |
784 | 782 |
785 // Reset operand stack so we don't leak. | 783 // Old-style (full-codegen) generator object |
786 __ LoadRoot(a5, Heap::kEmptyFixedArrayRootIndex); | 784 __ bind(&old_generator); |
787 __ sd(a5, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); | 785 { |
| 786 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 787 // the generator was suspended. |
| 788 FrameScope scope(masm, StackFrame::MANUAL); |
| 789 __ Push(ra, fp); |
| 790 __ Move(fp, sp); |
| 791 __ Push(cp, a4); |
788 | 792 |
789 // Resume the generator function at the continuation. | 793 // Restore the operand stack. |
790 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); | 794 __ ld(a0, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); |
791 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kCodeOffset)); | 795 __ ld(a3, FieldMemOperand(a0, FixedArray::kLengthOffset)); |
792 __ Daddu(a3, a3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 796 __ SmiUntag(a3); |
793 __ ld(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | 797 __ Daddu(a0, a0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
794 __ SmiUntag(a2); | 798 __ Dlsa(a3, a0, a3, kPointerSizeLog2); |
795 __ Daddu(a3, a3, Operand(a2)); | 799 { |
796 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 800 Label done_loop, loop; |
797 __ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | 801 __ bind(&loop); |
798 __ Move(v0, a1); // Continuation expects generator object in v0. | 802 __ Branch(&done_loop, eq, a0, Operand(a3)); |
799 __ Jump(a3); | 803 __ ld(a5, MemOperand(a0)); |
| 804 __ Push(a5); |
| 805 __ Branch(USE_DELAY_SLOT, &loop); |
| 806 __ daddiu(a0, a0, kPointerSize); // In delay slot. |
| 807 __ bind(&done_loop); |
| 808 } |
| 809 |
| 810 // Reset operand stack so we don't leak. |
| 811 __ LoadRoot(a5, Heap::kEmptyFixedArrayRootIndex); |
| 812 __ sd(a5, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); |
| 813 |
| 814 // Resume the generator function at the continuation. |
| 815 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
| 816 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kCodeOffset)); |
| 817 __ Daddu(a3, a3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 818 __ ld(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
| 819 __ SmiUntag(a2); |
| 820 __ Daddu(a3, a3, Operand(a2)); |
| 821 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
| 822 __ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
| 823 __ Move(v0, a1); // Continuation expects generator object in v0. |
| 824 __ Jump(a3); |
| 825 } |
800 } | 826 } |
801 | 827 |
802 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { | 828 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
803 FrameScope scope(masm, StackFrame::INTERNAL); | 829 FrameScope scope(masm, StackFrame::INTERNAL); |
804 __ Push(a1); | 830 __ Push(a1); |
805 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); | 831 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); |
806 } | 832 } |
807 | 833 |
808 | 834 |
809 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; | 835 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; |
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 } | 2860 } |
2835 } | 2861 } |
2836 | 2862 |
2837 | 2863 |
2838 #undef __ | 2864 #undef __ |
2839 | 2865 |
2840 } // namespace internal | 2866 } // namespace internal |
2841 } // namespace v8 | 2867 } // namespace v8 |
2842 | 2868 |
2843 #endif // V8_TARGET_ARCH_MIPS64 | 2869 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |