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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 __ movp(rdi, rax); | 1759 __ movp(rdi, rax); |
1760 __ Pop(rax); | 1760 __ Pop(rax); |
1761 __ SmiToInteger32(rax, rax); | 1761 __ SmiToInteger32(rax, rax); |
1762 } | 1762 } |
1763 // The delegate is always a regular function. | 1763 // The delegate is always a regular function. |
1764 __ AssertFunction(rdi); | 1764 __ AssertFunction(rdi); |
1765 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); | 1765 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); |
1766 } | 1766 } |
1767 | 1767 |
1768 | 1768 |
| 1769 // static |
| 1770 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { |
| 1771 // ----------- S t a t e ------------- |
| 1772 // -- rax : the number of arguments (not including the receiver) |
| 1773 // -- rbx : the address of the first argument to be pushed. Subsequent |
| 1774 // arguments should be consecutive above this, in the same order as |
| 1775 // they are to be pushed onto the stack. |
| 1776 // -- rdi : the target to call (can be any Object). |
| 1777 |
| 1778 // Pop return address to allow tail-call after pushing arguments. |
| 1779 __ Pop(rdx); |
| 1780 |
| 1781 // Find the address of the last argument. |
| 1782 __ movp(rcx, rax); |
| 1783 __ addp(rcx, Immediate(1)); // Add one for receiver. |
| 1784 __ shlp(rcx, Immediate(kPointerSizeLog2)); |
| 1785 __ negp(rcx); |
| 1786 __ addp(rcx, rbx); |
| 1787 |
| 1788 // Push the arguments. |
| 1789 Label loop_header, loop_check; |
| 1790 __ j(always, &loop_check); |
| 1791 __ bind(&loop_header); |
| 1792 __ Push(Operand(rbx, 0)); |
| 1793 __ subp(rbx, Immediate(kPointerSize)); |
| 1794 __ bind(&loop_check); |
| 1795 __ cmpp(rbx, rcx); |
| 1796 __ j(greater, &loop_header, Label::kNear); |
| 1797 |
| 1798 // Call the target. |
| 1799 __ Push(rdx); // Re-push return address. |
| 1800 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1801 } |
| 1802 |
| 1803 |
1769 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1804 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1770 // Lookup the function in the JavaScript frame. | 1805 // Lookup the function in the JavaScript frame. |
1771 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1806 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1772 { | 1807 { |
1773 FrameScope scope(masm, StackFrame::INTERNAL); | 1808 FrameScope scope(masm, StackFrame::INTERNAL); |
1774 // Pass function as argument. | 1809 // Pass function as argument. |
1775 __ Push(rax); | 1810 __ Push(rax); |
1776 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1811 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
1777 } | 1812 } |
1778 | 1813 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 __ ret(0); | 1853 __ ret(0); |
1819 } | 1854 } |
1820 | 1855 |
1821 | 1856 |
1822 #undef __ | 1857 #undef __ |
1823 | 1858 |
1824 } // namespace internal | 1859 } // namespace internal |
1825 } // namespace v8 | 1860 } // namespace v8 |
1826 | 1861 |
1827 #endif // V8_TARGET_ARCH_X64 | 1862 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |