| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived"); | 718 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived"); |
| 719 | 719 |
| 720 // TODO(dslomov): support pretenuring | 720 // TODO(dslomov): support pretenuring |
| 721 CHECK(!FLAG_pretenuring_call_new); | 721 CHECK(!FLAG_pretenuring_call_new); |
| 722 | 722 |
| 723 { | 723 { |
| 724 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 724 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 725 __ Mov(x4, x0); | 725 __ Mov(x4, x0); |
| 726 __ SmiTag(x4); | 726 __ SmiTag(x4); |
| 727 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); | 727 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); |
| 728 __ Push(x4, x3, x10); | 728 __ Push(x4, x10); |
| 729 // sp[0]: number of arguments | 729 // sp[0]: number of arguments |
| 730 // sp[1]: new.target | 730 // sp[1]: receiver (the hole) |
| 731 // sp[2]: receiver (the hole) | |
| 732 | 731 |
| 733 | 732 |
| 734 // Set up pointer to last argument. | 733 // Set up pointer to last argument. |
| 735 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); | 734 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); |
| 736 | 735 |
| 737 // Copy arguments and receiver to the expression stack. | 736 // Copy arguments and receiver to the expression stack. |
| 738 // Copy 2 values every loop to use ldp/stp. | 737 // Copy 2 values every loop to use ldp/stp. |
| 739 // x0: number of arguments | 738 // x0: number of arguments |
| 740 // x1: constructor function | 739 // x1: constructor function |
| 741 // x2: address of last argument (caller sp) | 740 // x2: address of last argument (caller sp) |
| 742 // jssp[0]: receiver | 741 // jssp[0]: receiver |
| 743 // jssp[1]: new.target | 742 // jssp[1]: number of arguments (smi-tagged) |
| 744 // jssp[2]: number of arguments (smi-tagged) | |
| 745 // Compute the start address of the copy in x4. | 743 // Compute the start address of the copy in x4. |
| 746 __ Add(x4, x2, Operand(x0, LSL, kPointerSizeLog2)); | 744 __ Add(x4, x2, Operand(x0, LSL, kPointerSizeLog2)); |
| 747 Label loop, entry, done_copying_arguments; | 745 Label loop, entry, done_copying_arguments; |
| 748 __ B(&entry); | 746 __ B(&entry); |
| 749 __ Bind(&loop); | 747 __ Bind(&loop); |
| 750 __ Ldp(x10, x11, MemOperand(x4, -2 * kPointerSize, PreIndex)); | 748 __ Ldp(x10, x11, MemOperand(x4, -2 * kPointerSize, PreIndex)); |
| 751 __ Push(x11, x10); | 749 __ Push(x11, x10); |
| 752 __ Bind(&entry); | 750 __ Bind(&entry); |
| 753 __ Cmp(x4, x2); | 751 __ Cmp(x4, x2); |
| 754 __ B(gt, &loop); | 752 __ B(gt, &loop); |
| 755 // Because we copied values 2 by 2 we may have copied one extra value. | 753 // Because we copied values 2 by 2 we may have copied one extra value. |
| 756 // Drop it if that is the case. | 754 // Drop it if that is the case. |
| 757 __ B(eq, &done_copying_arguments); | 755 __ B(eq, &done_copying_arguments); |
| 758 __ Drop(1); | 756 __ Drop(1); |
| 759 __ Bind(&done_copying_arguments); | 757 __ Bind(&done_copying_arguments); |
| 760 | 758 |
| 761 // Call the function. | 759 // Call the function. |
| 762 // x0: number of arguments | 760 // x0: number of arguments |
| 763 // x1: constructor function | 761 // x1: constructor function |
| 764 __ Add(x0, x0, Operand(1)); // new.target | |
| 765 ParameterCount actual(x0); | 762 ParameterCount actual(x0); |
| 766 __ InvokeFunction(x1, actual, CALL_FUNCTION, NullCallWrapper()); | 763 __ InvokeFunction(x1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 767 | 764 |
| 768 | 765 |
| 769 // Restore the context from the frame. | 766 // Restore the context from the frame. |
| 770 // x0: result | 767 // x0: result |
| 771 // jssp[0]: number of arguments (smi-tagged) | 768 // jssp[0]: number of arguments (smi-tagged) |
| 772 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 769 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 773 | 770 |
| 774 // Load number of arguments (smi). | 771 // Load number of arguments (smi). |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 __ Unreachable(); | 1650 __ Unreachable(); |
| 1654 } | 1651 } |
| 1655 } | 1652 } |
| 1656 | 1653 |
| 1657 | 1654 |
| 1658 #undef __ | 1655 #undef __ |
| 1659 | 1656 |
| 1660 } } // namespace v8::internal | 1657 } } // namespace v8::internal |
| 1661 | 1658 |
| 1662 #endif // V8_TARGET_ARCH_ARM | 1659 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |