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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 Generate_JSConstructStubHelper(masm, false, false, true); | 704 Generate_JSConstructStubHelper(masm, false, false, true); |
705 } | 705 } |
706 | 706 |
707 | 707 |
708 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { | 708 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
709 FrameScope scope(masm, StackFrame::INTERNAL); | 709 FrameScope scope(masm, StackFrame::INTERNAL); |
710 __ Push(x1); | 710 __ Push(x1); |
711 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); | 711 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); |
712 } | 712 } |
713 | 713 |
| 714 // static |
| 715 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { |
| 716 // ----------- S t a t e ------------- |
| 717 // -- x0 : the value to pass to the generator |
| 718 // -- x1 : the JSGeneratorObject to resume |
| 719 // -- x2 : the resume mode (tagged) |
| 720 // -- lr : return address |
| 721 // ----------------------------------- |
| 722 __ AssertGeneratorObject(x1); |
| 723 |
| 724 // Store input value into generator object. |
| 725 __ Str(x0, FieldMemOperand(x1, JSGeneratorObject::kInputOffset)); |
| 726 __ RecordWriteField(x1, JSGeneratorObject::kInputOffset, x0, x3, |
| 727 kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 728 |
| 729 // Load suspended function and context. |
| 730 __ Ldr(cp, FieldMemOperand(x1, JSGeneratorObject::kContextOffset)); |
| 731 __ Ldr(x4, FieldMemOperand(x1, JSGeneratorObject::kFunctionOffset)); |
| 732 |
| 733 // Flood function if we are stepping. |
| 734 Label skip_flooding; |
| 735 ExternalReference step_in_enabled = |
| 736 ExternalReference::debug_step_in_enabled_address(masm->isolate()); |
| 737 __ Mov(x10, Operand(step_in_enabled)); |
| 738 __ Ldrb(x10, MemOperand(x10)); |
| 739 __ CompareAndBranch(x10, Operand(0), eq, &skip_flooding); |
| 740 { |
| 741 FrameScope scope(masm, StackFrame::INTERNAL); |
| 742 __ Push(x1, x2, x4); |
| 743 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 744 __ Pop(x2, x1); |
| 745 __ Ldr(x4, FieldMemOperand(x1, JSGeneratorObject::kFunctionOffset)); |
| 746 } |
| 747 __ bind(&skip_flooding); |
| 748 |
| 749 // Push receiver. |
| 750 __ Ldr(x5, FieldMemOperand(x1, JSGeneratorObject::kReceiverOffset)); |
| 751 __ Push(x5); |
| 752 |
| 753 // ----------- S t a t e ------------- |
| 754 // -- x1 : the JSGeneratorObject to resume |
| 755 // -- x2 : the resume mode (tagged) |
| 756 // -- x4 : generator function |
| 757 // -- cp : generator context |
| 758 // -- lr : return address |
| 759 // -- jssp[0] : generator receiver |
| 760 // ----------------------------------- |
| 761 |
| 762 // Push holes for arguments to generator function. Since the parser forced |
| 763 // context allocation for any variables in generators, the actual argument |
| 764 // values have already been copied into the context and these dummy values |
| 765 // will never be used. |
| 766 __ Ldr(x10, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); |
| 767 |
| 768 // Push holes for arguments to generator function. Since the parser forced |
| 769 // context allocation for any variables in generators, the actual argument |
| 770 // values have already been copied into the context and these dummy values |
| 771 // will never be used. |
| 772 __ Ldr(w10, |
| 773 FieldMemOperand(x10, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 774 __ LoadRoot(x11, Heap::kTheHoleValueRootIndex); |
| 775 __ PushMultipleTimes(x11, w10); |
| 776 |
| 777 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 778 // the generator was suspended. |
| 779 FrameScope scope(masm, StackFrame::MANUAL); |
| 780 __ Push(lr, fp); |
| 781 __ Move(fp, jssp); |
| 782 __ Push(cp, x4); |
| 783 |
| 784 // Restore the operand stack. |
| 785 __ Ldr(x0, FieldMemOperand(x1, JSGeneratorObject::kOperandStackOffset)); |
| 786 __ Ldr(w3, UntagSmiFieldMemOperand(x0, FixedArray::kLengthOffset)); |
| 787 __ Add(x0, x0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 788 __ Add(x3, x0, Operand(x3, LSL, kPointerSizeLog2)); |
| 789 { |
| 790 Label done_loop, loop; |
| 791 __ Bind(&loop); |
| 792 __ Cmp(x0, x3); |
| 793 __ B(eq, &done_loop); |
| 794 __ Ldr(x10, MemOperand(x0, kPointerSize, PostIndex)); |
| 795 __ Push(x10); |
| 796 __ B(&loop); |
| 797 __ Bind(&done_loop); |
| 798 } |
| 799 |
| 800 // Push resume mode (consumed in continuation). |
| 801 __ Push(x2); |
| 802 |
| 803 // Reset operand stack so we don't leak. |
| 804 __ LoadRoot(x10, Heap::kEmptyFixedArrayRootIndex); |
| 805 __ Str(x10, FieldMemOperand(x1, JSGeneratorObject::kOperandStackOffset)); |
| 806 |
| 807 // Restore value. |
| 808 __ Ldr(x0, FieldMemOperand(x1, JSGeneratorObject::kInputOffset)); |
| 809 |
| 810 // Resume the generator function at the continuation. |
| 811 __ Ldr(x10, FieldMemOperand(x4, JSFunction::kSharedFunctionInfoOffset)); |
| 812 __ Ldr(x10, FieldMemOperand(x10, SharedFunctionInfo::kCodeOffset)); |
| 813 __ Add(x10, x10, Code::kHeaderSize - kHeapObjectTag); |
| 814 __ Ldrsw(x11, |
| 815 UntagSmiFieldMemOperand(x1, JSGeneratorObject::kContinuationOffset)); |
| 816 __ Add(x10, x10, x11); |
| 817 __ Mov(x12, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); |
| 818 __ Str(x12, FieldMemOperand(x1, JSGeneratorObject::kContinuationOffset)); |
| 819 __ Br(x10); |
| 820 } |
714 | 821 |
715 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; | 822 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; |
716 | 823 |
717 | 824 |
718 // Clobbers x10, x15; preserves all other registers. | 825 // Clobbers x10, x15; preserves all other registers. |
719 static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc, | 826 static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc, |
720 IsTagged argc_is_tagged) { | 827 IsTagged argc_is_tagged) { |
721 // Check the stack for overflow. | 828 // Check the stack for overflow. |
722 // We are not trying to catch interruptions (e.g. debug break and | 829 // We are not trying to catch interruptions (e.g. debug break and |
723 // preemption) here, so the "real stack limit" is checked. | 830 // preemption) here, so the "real stack limit" is checked. |
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 } | 2760 } |
2654 } | 2761 } |
2655 | 2762 |
2656 | 2763 |
2657 #undef __ | 2764 #undef __ |
2658 | 2765 |
2659 } // namespace internal | 2766 } // namespace internal |
2660 } // namespace v8 | 2767 } // namespace v8 |
2661 | 2768 |
2662 #endif // V8_TARGET_ARCH_ARM | 2769 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |