OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // TODO(dslomov): support pretenuring | 754 // TODO(dslomov): support pretenuring |
755 CHECK(!FLAG_pretenuring_call_new); | 755 CHECK(!FLAG_pretenuring_call_new); |
756 | 756 |
757 { | 757 { |
758 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 758 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
759 | 759 |
760 __ mov(r4, r0); | 760 __ mov(r4, r0); |
761 __ SmiTag(r4); | 761 __ SmiTag(r4); |
762 __ push(r4); // Smi-tagged arguments count. | 762 __ push(r4); // Smi-tagged arguments count. |
763 | 763 |
| 764 // Push new.target. |
| 765 __ push(r3); |
| 766 |
764 // receiver is the hole. | 767 // receiver is the hole. |
765 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 768 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
766 __ push(ip); | 769 __ push(ip); |
767 | 770 |
768 // Set up pointer to last argument. | 771 // Set up pointer to last argument. |
769 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 772 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
770 | 773 |
771 // Copy arguments and receiver to the expression stack. | 774 // Copy arguments and receiver to the expression stack. |
772 // r0: number of arguments | 775 // r0: number of arguments |
773 // r1: constructor function | 776 // r1: constructor function |
774 // r2: address of last argument (caller sp) | 777 // r2: address of last argument (caller sp) |
775 // r4: number of arguments (smi-tagged) | 778 // r4: number of arguments (smi-tagged) |
776 // sp[0]: receiver | 779 // sp[0]: receiver |
777 // sp[1]: number of arguments (smi-tagged) | 780 // sp[1]: new.target |
| 781 // sp[2]: number of arguments (smi-tagged) |
778 Label loop, entry; | 782 Label loop, entry; |
779 __ b(&entry); | 783 __ b(&entry); |
780 __ bind(&loop); | 784 __ bind(&loop); |
781 __ ldr(ip, MemOperand(r2, r4, LSL, kPointerSizeLog2 - 1)); | 785 __ ldr(ip, MemOperand(r2, r4, LSL, kPointerSizeLog2 - 1)); |
782 __ push(ip); | 786 __ push(ip); |
783 __ bind(&entry); | 787 __ bind(&entry); |
784 __ sub(r4, r4, Operand(2), SetCC); | 788 __ sub(r4, r4, Operand(2), SetCC); |
785 __ b(ge, &loop); | 789 __ b(ge, &loop); |
786 | 790 |
787 // Call the function. | 791 // Call the function. |
788 // r0: number of arguments | 792 // r0: number of arguments |
789 // r1: constructor function | 793 // r1: constructor function |
| 794 __ add(r0, r0, Operand(1)); |
790 ParameterCount actual(r0); | 795 ParameterCount actual(r0); |
791 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); | 796 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); |
792 | 797 |
793 // Restore context from the frame. | 798 // Restore context from the frame. |
794 // r0: result | 799 // r0: result |
795 // sp[0]: number of arguments (smi-tagged) | 800 // sp[0]: number of arguments (smi-tagged) |
796 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 801 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
797 __ ldr(r1, MemOperand(sp, 0)); | 802 __ ldr(r1, MemOperand(sp, 0)); |
798 | 803 |
799 // Leave construct frame. | 804 // Leave construct frame. |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 __ bkpt(0); | 1633 __ bkpt(0); |
1629 } | 1634 } |
1630 } | 1635 } |
1631 | 1636 |
1632 | 1637 |
1633 #undef __ | 1638 #undef __ |
1634 | 1639 |
1635 } } // namespace v8::internal | 1640 } } // namespace v8::internal |
1636 | 1641 |
1637 #endif // V8_TARGET_ARCH_ARM | 1642 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |