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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 { | 724 { |
725 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 725 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
726 __ Mov(x4, x0); | 726 __ Mov(x4, x0); |
727 __ SmiTag(x4); | 727 __ SmiTag(x4); |
728 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); | 728 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); |
729 __ Push(x4, x3, x10); | 729 __ Push(x4, x3, x10); |
730 // sp[0]: number of arguments | 730 // sp[0]: number of arguments |
731 // sp[1]: new.target | 731 // sp[1]: new.target |
732 // sp[2]: receiver (the hole) | 732 // sp[2]: receiver (the hole) |
733 | 733 |
734 | |
735 // Set up pointer to last argument. | 734 // Set up pointer to last argument. |
736 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); | 735 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); |
737 | 736 |
738 // Copy arguments and receiver to the expression stack. | 737 // Copy arguments and receiver to the expression stack. |
739 // Copy 2 values every loop to use ldp/stp. | 738 // Copy 2 values every loop to use ldp/stp. |
740 // x0: number of arguments | 739 // x0: number of arguments |
741 // x1: constructor function | 740 // x1: constructor function |
742 // x2: address of last argument (caller sp) | 741 // x2: address of last argument (caller sp) |
743 // jssp[0]: receiver | 742 // jssp[0]: receiver |
744 // jssp[1]: new.target | 743 // jssp[1]: new.target |
745 // jssp[2]: number of arguments (smi-tagged) | 744 // jssp[2]: number of arguments (smi-tagged) |
746 // Compute the start address of the copy in x4. | 745 // Compute the start address of the copy in x4. |
747 __ Add(x4, x2, Operand(x0, LSL, kPointerSizeLog2)); | 746 __ Add(x4, x2, Operand(x0, LSL, kPointerSizeLog2)); |
748 Label loop, entry, done_copying_arguments; | 747 Label loop, entry, done_copying_arguments; |
749 __ B(&entry); | 748 __ B(&entry); |
750 __ Bind(&loop); | 749 __ Bind(&loop); |
751 __ Ldp(x10, x11, MemOperand(x4, -2 * kPointerSize, PreIndex)); | 750 __ Ldp(x10, x11, MemOperand(x4, -2 * kPointerSize, PreIndex)); |
752 __ Push(x11, x10); | 751 __ Push(x11, x10); |
753 __ Bind(&entry); | 752 __ Bind(&entry); |
754 __ Cmp(x4, x2); | 753 __ Cmp(x4, x2); |
755 __ B(gt, &loop); | 754 __ B(gt, &loop); |
756 // Because we copied values 2 by 2 we may have copied one extra value. | 755 // Because we copied values 2 by 2 we may have copied one extra value. |
757 // Drop it if that is the case. | 756 // Drop it if that is the case. |
758 __ B(eq, &done_copying_arguments); | 757 __ B(eq, &done_copying_arguments); |
759 __ Drop(1); | 758 __ Drop(1); |
760 __ Bind(&done_copying_arguments); | 759 __ Bind(&done_copying_arguments); |
761 | 760 |
762 __ Add(x0, x0, Operand(1)); // new.target | |
763 | |
764 // Handle step in. | 761 // Handle step in. |
765 Label skip_step_in; | 762 Label skip_step_in; |
766 ExternalReference debug_step_in_fp = | 763 ExternalReference debug_step_in_fp = |
767 ExternalReference::debug_step_in_fp_address(masm->isolate()); | 764 ExternalReference::debug_step_in_fp_address(masm->isolate()); |
768 __ Mov(x2, Operand(debug_step_in_fp)); | 765 __ Mov(x2, Operand(debug_step_in_fp)); |
769 __ Ldr(x2, MemOperand(x2)); | 766 __ Ldr(x2, MemOperand(x2)); |
770 __ Cbz(x2, &skip_step_in); | 767 __ Cbz(x2, &skip_step_in); |
771 | 768 |
772 __ Push(x0, x1, x1); | 769 __ Push(x0, x1, x1); |
773 __ CallRuntime(Runtime::kHandleStepInForDerivedConstructors, 1); | 770 __ CallRuntime(Runtime::kHandleStepInForDerivedConstructors, 1); |
774 __ Pop(x1, x0); | 771 __ Pop(x1, x0); |
775 | 772 |
776 __ bind(&skip_step_in); | 773 __ bind(&skip_step_in); |
777 | 774 |
778 // Call the function. | 775 // Call the function. |
779 // x0: number of arguments | 776 // x0: number of arguments |
780 // x1: constructor function | 777 // x1: constructor function |
781 ParameterCount actual(x0); | 778 ParameterCount actual(x0); |
782 __ InvokeFunction(x1, actual, CALL_FUNCTION, NullCallWrapper()); | 779 __ InvokeFunction(x1, actual, CALL_FUNCTION, NullCallWrapper()); |
783 | 780 |
784 | 781 |
785 // Restore the context from the frame. | 782 // Restore the context from the frame. |
786 // x0: result | 783 // x0: result |
787 // jssp[0]: number of arguments (smi-tagged) | 784 // jssp[0]: number of arguments (smi-tagged) |
788 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 785 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
789 | 786 |
790 // Load number of arguments (smi). | 787 // Load number of arguments (smi), skipping over new.target. |
791 __ Peek(x1, 0); | 788 __ Peek(x1, kPointerSize); |
792 | 789 |
793 // Leave construct frame | 790 // Leave construct frame |
794 } | 791 } |
795 | 792 |
796 __ DropBySMI(x1); | 793 __ DropBySMI(x1); |
797 __ Drop(1); | 794 __ Drop(1); |
798 __ Ret(); | 795 __ Ret(); |
799 } | 796 } |
800 | 797 |
801 | 798 |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 } | 1837 } |
1841 } | 1838 } |
1842 | 1839 |
1843 | 1840 |
1844 #undef __ | 1841 #undef __ |
1845 | 1842 |
1846 } // namespace internal | 1843 } // namespace internal |
1847 } // namespace v8 | 1844 } // namespace v8 |
1848 | 1845 |
1849 #endif // V8_TARGET_ARCH_ARM | 1846 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |