| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 // Push holes for arguments to generator function. Since the parser forced | 782 // Push holes for arguments to generator function. Since the parser forced |
| 783 // context allocation for any variables in generators, the actual argument | 783 // context allocation for any variables in generators, the actual argument |
| 784 // values have already been copied into the context and these dummy values | 784 // values have already been copied into the context and these dummy values |
| 785 // will never be used. | 785 // will never be used. |
| 786 __ Ldr(x10, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); | 786 __ Ldr(x10, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); |
| 787 __ Ldr(w10, | 787 __ Ldr(w10, |
| 788 FieldMemOperand(x10, SharedFunctionInfo::kFormalParameterCountOffset)); | 788 FieldMemOperand(x10, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 789 __ LoadRoot(x11, Heap::kTheHoleValueRootIndex); | 789 __ LoadRoot(x11, Heap::kTheHoleValueRootIndex); |
| 790 __ PushMultipleTimes(x11, w10); | 790 __ PushMultipleTimes(x11, w10); |
| 791 | 791 |
| 792 // Dispatch on the kind of generator object. | 792 // Underlying function needs to have bytecode available. |
| 793 Label old_generator; | 793 if (FLAG_debug_code) { |
| 794 __ Ldr(x3, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); | 794 __ Ldr(x3, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); |
| 795 __ Ldr(x3, FieldMemOperand(x3, SharedFunctionInfo::kFunctionDataOffset)); | 795 __ Ldr(x3, FieldMemOperand(x3, SharedFunctionInfo::kFunctionDataOffset)); |
| 796 __ CompareObjectType(x3, x3, x3, BYTECODE_ARRAY_TYPE); | 796 __ CompareObjectType(x3, x3, x3, BYTECODE_ARRAY_TYPE); |
| 797 __ B(ne, &old_generator); | 797 __ Assert(eq, kMissingBytecodeArray); |
| 798 } |
| 798 | 799 |
| 799 // New-style (ignition/turbofan) generator object | 800 // Resume (Ignition/TurboFan) generator object. |
| 800 { | 801 { |
| 801 __ Ldr(x0, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); | 802 __ Ldr(x0, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); |
| 802 __ Ldr(w0, FieldMemOperand( | 803 __ Ldr(w0, FieldMemOperand( |
| 803 x0, SharedFunctionInfo::kFormalParameterCountOffset)); | 804 x0, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 804 // We abuse new.target both to indicate that this is a resume call and to | 805 // We abuse new.target both to indicate that this is a resume call and to |
| 805 // pass in the generator object. In ordinary calls, new.target is always | 806 // pass in the generator object. In ordinary calls, new.target is always |
| 806 // undefined because generator functions are non-constructable. | 807 // undefined because generator functions are non-constructable. |
| 807 __ Move(x3, x1); | 808 __ Move(x3, x1); |
| 808 __ Move(x1, x4); | 809 __ Move(x1, x4); |
| 809 __ Ldr(x5, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); | 810 __ Ldr(x5, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); |
| 810 __ Jump(x5); | 811 __ Jump(x5); |
| 811 } | 812 } |
| 812 | 813 |
| 813 // Old-style (full-codegen) generator object | |
| 814 __ bind(&old_generator); | |
| 815 { | |
| 816 // Enter a new JavaScript frame, and initialize its slots as they were when | |
| 817 // the generator was suspended. | |
| 818 FrameScope scope(masm, StackFrame::MANUAL); | |
| 819 __ Push(lr, fp); | |
| 820 __ Move(fp, jssp); | |
| 821 __ Push(cp, x4); | |
| 822 | |
| 823 // Restore the operand stack. | |
| 824 __ Ldr(x0, FieldMemOperand(x1, JSGeneratorObject::kOperandStackOffset)); | |
| 825 __ Ldr(w3, UntagSmiFieldMemOperand(x0, FixedArray::kLengthOffset)); | |
| 826 __ Add(x0, x0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 827 __ Add(x3, x0, Operand(x3, LSL, kPointerSizeLog2)); | |
| 828 { | |
| 829 Label done_loop, loop; | |
| 830 __ Bind(&loop); | |
| 831 __ Cmp(x0, x3); | |
| 832 __ B(eq, &done_loop); | |
| 833 __ Ldr(x10, MemOperand(x0, kPointerSize, PostIndex)); | |
| 834 __ Push(x10); | |
| 835 __ B(&loop); | |
| 836 __ Bind(&done_loop); | |
| 837 } | |
| 838 | |
| 839 // Reset operand stack so we don't leak. | |
| 840 __ LoadRoot(x10, Heap::kEmptyFixedArrayRootIndex); | |
| 841 __ Str(x10, FieldMemOperand(x1, JSGeneratorObject::kOperandStackOffset)); | |
| 842 | |
| 843 // Resume the generator function at the continuation. | |
| 844 __ Ldr(x10, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); | |
| 845 __ Ldr(x10, FieldMemOperand(x10, SharedFunctionInfo::kCodeOffset)); | |
| 846 __ Add(x10, x10, Code::kHeaderSize - kHeapObjectTag); | |
| 847 __ Ldrsw(x11, UntagSmiFieldMemOperand( | |
| 848 x1, JSGeneratorObject::kContinuationOffset)); | |
| 849 __ Add(x10, x10, x11); | |
| 850 __ Mov(x12, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | |
| 851 __ Str(x12, FieldMemOperand(x1, JSGeneratorObject::kContinuationOffset)); | |
| 852 __ Move(x0, x1); // Continuation expects generator object in x0. | |
| 853 __ Br(x10); | |
| 854 } | |
| 855 | |
| 856 __ Bind(&prepare_step_in_if_stepping); | 814 __ Bind(&prepare_step_in_if_stepping); |
| 857 { | 815 { |
| 858 FrameScope scope(masm, StackFrame::INTERNAL); | 816 FrameScope scope(masm, StackFrame::INTERNAL); |
| 859 __ Push(x1, x2, x4); | 817 __ Push(x1, x2, x4); |
| 860 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 818 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 861 __ Pop(x2, x1); | 819 __ Pop(x2, x1); |
| 862 __ Ldr(x4, FieldMemOperand(x1, JSGeneratorObject::kFunctionOffset)); | 820 __ Ldr(x4, FieldMemOperand(x1, JSGeneratorObject::kFunctionOffset)); |
| 863 } | 821 } |
| 864 __ B(&stepping_prepared); | 822 __ B(&stepping_prepared); |
| 865 | 823 |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 __ Unreachable(); | 2967 __ Unreachable(); |
| 3010 } | 2968 } |
| 3011 } | 2969 } |
| 3012 | 2970 |
| 3013 #undef __ | 2971 #undef __ |
| 3014 | 2972 |
| 3015 } // namespace internal | 2973 } // namespace internal |
| 3016 } // namespace v8 | 2974 } // namespace v8 |
| 3017 | 2975 |
| 3018 #endif // V8_TARGET_ARCH_ARM | 2976 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |