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 | |
767 // receiver is the hole. | 764 // receiver is the hole. |
768 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 765 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
769 __ push(ip); | 766 __ push(ip); |
770 | 767 |
771 // Set up pointer to last argument. | 768 // Set up pointer to last argument. |
772 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 769 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
773 | 770 |
774 // Copy arguments and receiver to the expression stack. | 771 // Copy arguments and receiver to the expression stack. |
775 // r0: number of arguments | 772 // r0: number of arguments |
776 // r1: constructor function | 773 // r1: constructor function |
777 // r2: address of last argument (caller sp) | 774 // r2: address of last argument (caller sp) |
778 // r4: number of arguments (smi-tagged) | 775 // r4: number of arguments (smi-tagged) |
779 // sp[0]: receiver | 776 // sp[0]: receiver |
780 // sp[1]: new.target | 777 // sp[1]: number of arguments (smi-tagged) |
781 // sp[2]: number of arguments (smi-tagged) | |
782 Label loop, entry; | 778 Label loop, entry; |
783 __ b(&entry); | 779 __ b(&entry); |
784 __ bind(&loop); | 780 __ bind(&loop); |
785 __ ldr(ip, MemOperand(r2, r4, LSL, kPointerSizeLog2 - 1)); | 781 __ ldr(ip, MemOperand(r2, r4, LSL, kPointerSizeLog2 - 1)); |
786 __ push(ip); | 782 __ push(ip); |
787 __ bind(&entry); | 783 __ bind(&entry); |
788 __ sub(r4, r4, Operand(2), SetCC); | 784 __ sub(r4, r4, Operand(2), SetCC); |
789 __ b(ge, &loop); | 785 __ b(ge, &loop); |
790 | 786 |
791 // Call the function. | 787 // Call the function. |
792 // r0: number of arguments | 788 // r0: number of arguments |
793 // r1: constructor function | 789 // r1: constructor function |
794 __ add(r0, r0, Operand(1)); | |
795 ParameterCount actual(r0); | 790 ParameterCount actual(r0); |
796 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); | 791 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); |
797 | 792 |
798 // Restore context from the frame. | 793 // Restore context from the frame. |
799 // r0: result | 794 // r0: result |
800 // sp[0]: number of arguments (smi-tagged) | 795 // sp[0]: number of arguments (smi-tagged) |
801 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 796 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
802 __ ldr(r1, MemOperand(sp, 0)); | 797 __ ldr(r1, MemOperand(sp, 0)); |
803 | 798 |
804 // Leave construct frame. | 799 // Leave construct frame. |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 __ bkpt(0); | 1628 __ bkpt(0); |
1634 } | 1629 } |
1635 } | 1630 } |
1636 | 1631 |
1637 | 1632 |
1638 #undef __ | 1633 #undef __ |
1639 | 1634 |
1640 } } // namespace v8::internal | 1635 } } // namespace v8::internal |
1641 | 1636 |
1642 #endif // V8_TARGET_ARCH_ARM | 1637 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |