OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 __ LoadAndTestP(r2, r2); | 804 __ LoadAndTestP(r2, r2); |
805 __ beq(&done_loop); | 805 __ beq(&done_loop); |
806 #endif | 806 #endif |
807 __ LoadRR(r1, r2); | 807 __ LoadRR(r1, r2); |
808 __ bind(&loop); | 808 __ bind(&loop); |
809 __ push(ip); | 809 __ push(ip); |
810 __ BranchOnCount(r1, &loop); | 810 __ BranchOnCount(r1, &loop); |
811 __ bind(&done_loop); | 811 __ bind(&done_loop); |
812 } | 812 } |
813 | 813 |
814 // Dispatch on the kind of generator object. | 814 // Underlying function needs to have bytecode available. |
815 Label old_generator; | 815 if (FLAG_debug_code) { |
816 __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kFunctionDataOffset)); | 816 __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kFunctionDataOffset)); |
817 __ CompareObjectType(r5, r5, r5, BYTECODE_ARRAY_TYPE); | 817 __ CompareObjectType(r5, r5, r5, BYTECODE_ARRAY_TYPE); |
818 __ bne(&old_generator, Label::kNear); | 818 __ Assert(eq, kMissingBytecodeArray); |
| 819 } |
819 | 820 |
820 // New-style (ignition/turbofan) generator object | 821 // Resume (Ignition/TurboFan) generator object. |
821 { | 822 { |
822 // We abuse new.target both to indicate that this is a resume call and to | 823 // We abuse new.target both to indicate that this is a resume call and to |
823 // pass in the generator object. In ordinary calls, new.target is always | 824 // pass in the generator object. In ordinary calls, new.target is always |
824 // undefined because generator functions are non-constructable. | 825 // undefined because generator functions are non-constructable. |
825 __ LoadRR(r5, r3); | 826 __ LoadRR(r5, r3); |
826 __ LoadRR(r3, r6); | 827 __ LoadRR(r3, r6); |
827 __ LoadP(ip, FieldMemOperand(r3, JSFunction::kCodeEntryOffset)); | 828 __ LoadP(ip, FieldMemOperand(r3, JSFunction::kCodeEntryOffset)); |
828 __ JumpToJSEntry(ip); | 829 __ JumpToJSEntry(ip); |
829 } | 830 } |
830 // Old-style (full-codegen) generator object | |
831 __ bind(&old_generator); | |
832 { | |
833 // Enter a new JavaScript frame, and initialize its slots as they were when | |
834 // the generator was suspended. | |
835 FrameScope scope(masm, StackFrame::MANUAL); | |
836 __ PushStandardFrame(r6); | |
837 | |
838 // Restore the operand stack. | |
839 __ LoadP(r2, FieldMemOperand(r3, JSGeneratorObject::kOperandStackOffset)); | |
840 __ LoadP(r5, FieldMemOperand(r2, FixedArray::kLengthOffset)); | |
841 __ AddP(r2, r2, | |
842 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | |
843 { | |
844 Label loop, done_loop; | |
845 __ SmiUntag(r5); | |
846 __ LoadAndTestP(r5, r5); | |
847 __ beq(&done_loop); | |
848 __ LoadRR(r1, r5); | |
849 __ bind(&loop); | |
850 __ LoadP(ip, MemOperand(r2, kPointerSize)); | |
851 __ la(r2, MemOperand(r2, kPointerSize)); | |
852 __ Push(ip); | |
853 __ BranchOnCount(r1, &loop); | |
854 __ bind(&done_loop); | |
855 } | |
856 | |
857 // Reset operand stack so we don't leak. | |
858 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); | |
859 __ StoreP(ip, FieldMemOperand(r3, JSGeneratorObject::kOperandStackOffset), | |
860 r0); | |
861 | |
862 // Resume the generator function at the continuation. | |
863 __ LoadP(r5, FieldMemOperand(r6, JSFunction::kSharedFunctionInfoOffset)); | |
864 __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kCodeOffset)); | |
865 __ AddP(r5, r5, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
866 { | |
867 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | |
868 __ LoadP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset)); | |
869 __ SmiUntag(r4); | |
870 __ AddP(r5, r5, r4); | |
871 __ LoadSmiLiteral(r4, | |
872 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | |
873 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), | |
874 r0); | |
875 __ LoadRR(r2, r3); // Continuation expects generator object in r2. | |
876 __ Jump(r5); | |
877 } | |
878 } | |
879 | 831 |
880 __ bind(&prepare_step_in_if_stepping); | 832 __ bind(&prepare_step_in_if_stepping); |
881 { | 833 { |
882 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 834 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
883 __ Push(r3, r4, r6); | 835 __ Push(r3, r4, r6); |
884 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 836 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
885 __ Pop(r3, r4); | 837 __ Pop(r3, r4); |
886 __ LoadP(r6, FieldMemOperand(r3, JSGeneratorObject::kFunctionOffset)); | 838 __ LoadP(r6, FieldMemOperand(r3, JSGeneratorObject::kFunctionOffset)); |
887 } | 839 } |
888 __ b(&stepping_prepared); | 840 __ b(&stepping_prepared); |
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 __ bkpt(0); | 2964 __ bkpt(0); |
3013 } | 2965 } |
3014 } | 2966 } |
3015 | 2967 |
3016 #undef __ | 2968 #undef __ |
3017 | 2969 |
3018 } // namespace internal | 2970 } // namespace internal |
3019 } // namespace v8 | 2971 } // namespace v8 |
3020 | 2972 |
3021 #endif // V8_TARGET_ARCH_S390 | 2973 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |