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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 { | 774 { |
775 Label done_loop, loop; | 775 Label done_loop, loop; |
776 __ bind(&loop); | 776 __ bind(&loop); |
777 __ Dsubu(a3, a3, Operand(1)); | 777 __ Dsubu(a3, a3, Operand(1)); |
778 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); | 778 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); |
779 __ PushRoot(Heap::kTheHoleValueRootIndex); | 779 __ PushRoot(Heap::kTheHoleValueRootIndex); |
780 __ Branch(&loop); | 780 __ Branch(&loop); |
781 __ bind(&done_loop); | 781 __ bind(&done_loop); |
782 } | 782 } |
783 | 783 |
784 // Dispatch on the kind of generator object. | 784 // Underlying function needs to have bytecode available. |
785 Label old_generator; | 785 if (FLAG_debug_code) { |
786 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); | 786 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
787 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kFunctionDataOffset)); | 787 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kFunctionDataOffset)); |
788 __ GetObjectType(a3, a3, a3); | 788 __ GetObjectType(a3, a3, a3); |
789 __ Branch(&old_generator, ne, a3, Operand(BYTECODE_ARRAY_TYPE)); | 789 __ Assert(eq, kMissingBytecodeArray, a3, Operand(BYTECODE_ARRAY_TYPE)); |
| 790 } |
790 | 791 |
791 // New-style (ignition/turbofan) generator object. | 792 // Resume (Ignition/TurboFan) generator object. |
792 { | 793 { |
793 __ ld(a0, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); | 794 __ ld(a0, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
794 __ lw(a0, | 795 __ lw(a0, |
795 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); | 796 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); |
796 // We abuse new.target both to indicate that this is a resume call and to | 797 // We abuse new.target both to indicate that this is a resume call and to |
797 // pass in the generator object. In ordinary calls, new.target is always | 798 // pass in the generator object. In ordinary calls, new.target is always |
798 // undefined because generator functions are non-constructable. | 799 // undefined because generator functions are non-constructable. |
799 __ Move(a3, a1); | 800 __ Move(a3, a1); |
800 __ Move(a1, a4); | 801 __ Move(a1, a4); |
801 __ ld(a2, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 802 __ ld(a2, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
802 __ Jump(a2); | 803 __ Jump(a2); |
803 } | 804 } |
804 | 805 |
805 // Old-style (full-codegen) generator object | |
806 __ bind(&old_generator); | |
807 { | |
808 // Enter a new JavaScript frame, and initialize its slots as they were when | |
809 // the generator was suspended. | |
810 FrameScope scope(masm, StackFrame::MANUAL); | |
811 __ Push(ra, fp); | |
812 __ Move(fp, sp); | |
813 __ Push(cp, a4); | |
814 | |
815 // Restore the operand stack. | |
816 __ ld(a0, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); | |
817 __ lw(a3, UntagSmiFieldMemOperand(a0, FixedArray::kLengthOffset)); | |
818 __ Daddu(a0, a0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
819 __ Dlsa(a3, a0, a3, kPointerSizeLog2); | |
820 { | |
821 Label done_loop, loop; | |
822 __ bind(&loop); | |
823 __ Branch(&done_loop, eq, a0, Operand(a3)); | |
824 __ ld(a5, MemOperand(a0)); | |
825 __ Push(a5); | |
826 __ Branch(USE_DELAY_SLOT, &loop); | |
827 __ daddiu(a0, a0, kPointerSize); // In delay slot. | |
828 __ bind(&done_loop); | |
829 } | |
830 | |
831 // Reset operand stack so we don't leak. | |
832 __ LoadRoot(a5, Heap::kEmptyFixedArrayRootIndex); | |
833 __ sd(a5, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); | |
834 | |
835 // Resume the generator function at the continuation. | |
836 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); | |
837 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kCodeOffset)); | |
838 __ Daddu(a3, a3, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
839 __ lw(a2, | |
840 UntagSmiFieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | |
841 __ Daddu(a3, a3, Operand(a2)); | |
842 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | |
843 __ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | |
844 __ Move(v0, a1); // Continuation expects generator object in v0. | |
845 __ Jump(a3); | |
846 } | |
847 | |
848 __ bind(&prepare_step_in_if_stepping); | 806 __ bind(&prepare_step_in_if_stepping); |
849 { | 807 { |
850 FrameScope scope(masm, StackFrame::INTERNAL); | 808 FrameScope scope(masm, StackFrame::INTERNAL); |
851 __ Push(a1, a2, a4); | 809 __ Push(a1, a2, a4); |
852 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 810 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
853 __ Pop(a1, a2); | 811 __ Pop(a1, a2); |
854 } | 812 } |
855 __ Branch(USE_DELAY_SLOT, &stepping_prepared); | 813 __ Branch(USE_DELAY_SLOT, &stepping_prepared); |
856 __ ld(a4, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); | 814 __ ld(a4, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); |
857 | 815 |
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 __ break_(0xCC); | 2970 __ break_(0xCC); |
3013 } | 2971 } |
3014 } | 2972 } |
3015 | 2973 |
3016 #undef __ | 2974 #undef __ |
3017 | 2975 |
3018 } // namespace internal | 2976 } // namespace internal |
3019 } // namespace v8 | 2977 } // namespace v8 |
3020 | 2978 |
3021 #endif // V8_TARGET_ARCH_MIPS64 | 2979 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |