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