| 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 734 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| 735 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); | 735 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); |
| 736 } | 736 } |
| 737 | 737 |
| 738 | 738 |
| 739 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 739 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 740 Generate_JSConstructStubHelper(masm, true, false); | 740 Generate_JSConstructStubHelper(masm, true, false); |
| 741 } | 741 } |
| 742 | 742 |
| 743 | 743 |
| 744 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 745 // ----------- S t a t e ------------- |
| 746 // -- r0 : number of arguments |
| 747 // -- r1 : constructor function |
| 748 // -- r2 : allocation site or undefined |
| 749 // -- r3 : original constructor |
| 750 // -- lr : return address |
| 751 // -- sp[...]: constructor arguments |
| 752 // ----------------------------------- |
| 753 |
| 754 // TODO(dslomov): support pretenuring |
| 755 CHECK(!FLAG_pretenuring_call_new); |
| 756 |
| 757 { |
| 758 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 759 |
| 760 __ mov(r4, r0); |
| 761 __ SmiTag(r4); |
| 762 __ push(r4); // Smi-tagged arguments count. |
| 763 |
| 764 // receiver is the hole. |
| 765 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 766 __ push(ip); |
| 767 |
| 768 // Set up pointer to last argument. |
| 769 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 770 |
| 771 // Copy arguments and receiver to the expression stack. |
| 772 // r0: number of arguments |
| 773 // r1: constructor function |
| 774 // r2: address of last argument (caller sp) |
| 775 // r4: number of arguments (smi-tagged) |
| 776 // sp[0]: receiver |
| 777 // sp[1]: number of arguments (smi-tagged) |
| 778 Label loop, entry; |
| 779 __ b(&entry); |
| 780 __ bind(&loop); |
| 781 __ ldr(ip, MemOperand(r2, r4, LSL, kPointerSizeLog2 - 1)); |
| 782 __ push(ip); |
| 783 __ bind(&entry); |
| 784 __ sub(r4, r4, Operand(2), SetCC); |
| 785 __ b(ge, &loop); |
| 786 |
| 787 // Call the function. |
| 788 // r0: number of arguments |
| 789 // r1: constructor function |
| 790 ParameterCount actual(r0); |
| 791 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 792 |
| 793 // Restore context from the frame. |
| 794 // r0: result |
| 795 // sp[0]: number of arguments (smi-tagged) |
| 796 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 797 __ ldr(r1, MemOperand(sp, 0)); |
| 798 |
| 799 // Leave construct frame. |
| 800 } |
| 801 |
| 802 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); |
| 803 __ add(sp, sp, Operand(kPointerSize)); |
| 804 __ Jump(lr); |
| 805 } |
| 806 |
| 807 |
| 744 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 808 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 745 bool is_construct) { | 809 bool is_construct) { |
| 746 // Called from Generate_JS_Entry | 810 // Called from Generate_JS_Entry |
| 747 // r0: code entry | 811 // r0: code entry |
| 748 // r1: function | 812 // r1: function |
| 749 // r2: receiver | 813 // r2: receiver |
| 750 // r3: argc | 814 // r3: argc |
| 751 // r4: argv | 815 // r4: argv |
| 752 // r5-r6, r8 (if not FLAG_enable_ool_constant_pool) and cp may be clobbered | 816 // r5-r6, r8 (if not FLAG_enable_ool_constant_pool) and cp may be clobbered |
| 753 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 817 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 __ bkpt(0); | 1628 __ bkpt(0); |
| 1565 } | 1629 } |
| 1566 } | 1630 } |
| 1567 | 1631 |
| 1568 | 1632 |
| 1569 #undef __ | 1633 #undef __ |
| 1570 | 1634 |
| 1571 } } // namespace v8::internal | 1635 } } // namespace v8::internal |
| 1572 | 1636 |
| 1573 #endif // V8_TARGET_ARCH_ARM | 1637 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |