Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1323463005: [Interpreter] Add support for JS calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add VisitCall to bytecode-generator Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 Label loop_header, loop_check;
1779 // Find the address of the last argument.
1780 __ movp(rcx, rax);
1781 __ addp(rcx, Immediate(1)); // Add one for receiver.
1782 __ shlp(rcx, Immediate(kPointerSizeLog2));
1783 __ negp(rcx);
1784 __ addp(rcx, rbx);
1785
1786 __ j(always, &loop_check);
1787 __ bind(&loop_header);
1788 __ Push(Operand(rbx, 0));
1789 __ subp(rbx, Immediate(kPointerSize));
1790 __ bind(&loop_check);
1791 __ cmpp(rbx, rcx);
1792 __ j(greater, &loop_header, Label::kNear);
1793
1794 // Call the target.
1795 __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
Benedikt Meurer 2015/09/10 09:51:34 Hm, I think this should be Jump instead of Call+re
rmcilroy 2015/09/10 14:25:23 As discussed offline, this requires popping and re
1796 __ ret(0);
1797 }
1798
1799
1769 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 1800 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1770 // Lookup the function in the JavaScript frame. 1801 // Lookup the function in the JavaScript frame.
1771 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1802 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1772 { 1803 {
1773 FrameScope scope(masm, StackFrame::INTERNAL); 1804 FrameScope scope(masm, StackFrame::INTERNAL);
1774 // Pass function as argument. 1805 // Pass function as argument.
1775 __ Push(rax); 1806 __ Push(rax);
1776 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 1807 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1777 } 1808 }
1778 1809
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 __ ret(0); 1849 __ ret(0);
1819 } 1850 }
1820 1851
1821 1852
1822 #undef __ 1853 #undef __
1823 1854
1824 } // namespace internal 1855 } // namespace internal
1825 } // namespace v8 1856 } // namespace v8
1826 1857
1827 #endif // V8_TARGET_ARCH_X64 1858 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698