| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 378 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 379 Generate_JSConstructStubHelper(masm, true, true); | 379 Generate_JSConstructStubHelper(masm, true, true); |
| 380 } | 380 } |
| 381 | 381 |
| 382 | 382 |
| 383 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 383 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
| 384 Generate_JSConstructStubHelper(masm, false, false); | 384 Generate_JSConstructStubHelper(masm, false, false); |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
| 389 FrameScope scope(masm, StackFrame::INTERNAL); |
| 390 __ Push(rdi); |
| 391 __ CallRuntime(Runtime::kThrowConstructedNonConstructable, 1); |
| 392 } |
| 393 |
| 394 |
| 388 enum IsTagged { kRaxIsSmiTagged, kRaxIsUntaggedInt }; | 395 enum IsTagged { kRaxIsSmiTagged, kRaxIsUntaggedInt }; |
| 389 | 396 |
| 390 | 397 |
| 391 // Clobbers rcx, r11, kScratchRegister; preserves all other registers. | 398 // Clobbers rcx, r11, kScratchRegister; preserves all other registers. |
| 392 static void Generate_CheckStackOverflow(MacroAssembler* masm, | 399 static void Generate_CheckStackOverflow(MacroAssembler* masm, |
| 393 IsTagged rax_is_tagged) { | 400 IsTagged rax_is_tagged) { |
| 394 // rax : the number of items to be pushed to the stack | 401 // rax : the number of items to be pushed to the stack |
| 395 // | 402 // |
| 396 // Check the stack for overflow. We are not trying to catch | 403 // Check the stack for overflow. We are not trying to catch |
| 397 // interruptions (e.g. debug break and preemption) here, so the "real stack | 404 // interruptions (e.g. debug break and preemption) here, so the "real stack |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1710 rbx, rdx, SharedFunctionInfo::kFormalParameterCountOffset); | 1717 rbx, rdx, SharedFunctionInfo::kFormalParameterCountOffset); |
| 1711 __ movp(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 1718 __ movp(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 1712 ParameterCount actual(rax); | 1719 ParameterCount actual(rax); |
| 1713 ParameterCount expected(rbx); | 1720 ParameterCount expected(rbx); |
| 1714 __ InvokeCode(rdx, expected, actual, JUMP_FUNCTION, NullCallWrapper()); | 1721 __ InvokeCode(rdx, expected, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 1715 | 1722 |
| 1716 // The function is a "classConstructor", need to raise an exception. | 1723 // The function is a "classConstructor", need to raise an exception. |
| 1717 __ bind(&class_constructor); | 1724 __ bind(&class_constructor); |
| 1718 { | 1725 { |
| 1719 FrameScope frame(masm, StackFrame::INTERNAL); | 1726 FrameScope frame(masm, StackFrame::INTERNAL); |
| 1720 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); | 1727 __ Push(rdi); |
| 1728 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 1); |
| 1721 } | 1729 } |
| 1722 } | 1730 } |
| 1723 | 1731 |
| 1724 | 1732 |
| 1725 // static | 1733 // static |
| 1726 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { | 1734 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { |
| 1727 // ----------- S t a t e ------------- | 1735 // ----------- S t a t e ------------- |
| 1728 // -- rax : the number of arguments (not including the receiver) | 1736 // -- rax : the number of arguments (not including the receiver) |
| 1729 // -- rdi : the target to call (can be any Object) | 1737 // -- rdi : the target to call (can be any Object) |
| 1730 // ----------------------------------- | 1738 // ----------------------------------- |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 __ movp(args.GetReceiverOperand(), rdi); | 1848 __ movp(args.GetReceiverOperand(), rdi); |
| 1841 // Let the "call_as_constructor_delegate" take care of the rest. | 1849 // Let the "call_as_constructor_delegate" take care of the rest. |
| 1842 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, rdi); | 1850 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, rdi); |
| 1843 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1851 __ Jump(masm->isolate()->builtins()->CallFunction(), |
| 1844 RelocInfo::CODE_TARGET); | 1852 RelocInfo::CODE_TARGET); |
| 1845 } | 1853 } |
| 1846 | 1854 |
| 1847 // Called Construct on an Object that doesn't have a [[Construct]] internal | 1855 // Called Construct on an Object that doesn't have a [[Construct]] internal |
| 1848 // method. | 1856 // method. |
| 1849 __ bind(&non_constructor); | 1857 __ bind(&non_constructor); |
| 1850 { | 1858 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
| 1851 FrameScope scope(masm, StackFrame::INTERNAL); | 1859 RelocInfo::CODE_TARGET); |
| 1852 __ Push(rdi); | |
| 1853 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | |
| 1854 } | |
| 1855 } | 1860 } |
| 1856 | 1861 |
| 1857 | 1862 |
| 1858 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1863 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1859 // Lookup the function in the JavaScript frame. | 1864 // Lookup the function in the JavaScript frame. |
| 1860 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1865 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1861 { | 1866 { |
| 1862 FrameScope scope(masm, StackFrame::INTERNAL); | 1867 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1863 // Pass function as argument. | 1868 // Pass function as argument. |
| 1864 __ Push(rax); | 1869 __ Push(rax); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1907 __ ret(0); | 1912 __ ret(0); |
| 1908 } | 1913 } |
| 1909 | 1914 |
| 1910 | 1915 |
| 1911 #undef __ | 1916 #undef __ |
| 1912 | 1917 |
| 1913 } // namespace internal | 1918 } // namespace internal |
| 1914 } // namespace v8 | 1919 } // namespace v8 |
| 1915 | 1920 |
| 1916 #endif // V8_TARGET_ARCH_X64 | 1921 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |