| 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 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 __ Push(Operand(rax, 0)); | 1803 __ Push(Operand(rax, 0)); |
| 1804 __ subp(rax, Immediate(kPointerSize)); | 1804 __ subp(rax, Immediate(kPointerSize)); |
| 1805 __ cmpp(r8, rbx); | 1805 __ cmpp(r8, rbx); |
| 1806 __ j(less, ©); | 1806 __ j(less, ©); |
| 1807 __ jmp(&invoke); | 1807 __ jmp(&invoke); |
| 1808 } | 1808 } |
| 1809 | 1809 |
| 1810 { // Too few parameters: Actual < expected. | 1810 { // Too few parameters: Actual < expected. |
| 1811 __ bind(&too_few); | 1811 __ bind(&too_few); |
| 1812 | 1812 |
| 1813 // If the function is strong we need to throw an error. | |
| 1814 Label no_strong_error; | |
| 1815 __ movp(kScratchRegister, | |
| 1816 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | |
| 1817 __ testb(FieldOperand(kScratchRegister, | |
| 1818 SharedFunctionInfo::kStrongModeByteOffset), | |
| 1819 Immediate(1 << SharedFunctionInfo::kStrongModeBitWithinByte)); | |
| 1820 __ j(equal, &no_strong_error, Label::kNear); | |
| 1821 | |
| 1822 // What we really care about is the required number of arguments. | |
| 1823 | |
| 1824 if (kPointerSize == kInt32Size) { | |
| 1825 __ movp( | |
| 1826 kScratchRegister, | |
| 1827 FieldOperand(kScratchRegister, SharedFunctionInfo::kLengthOffset)); | |
| 1828 __ SmiToInteger32(kScratchRegister, kScratchRegister); | |
| 1829 } else { | |
| 1830 // See comment near kLengthOffset in src/objects.h | |
| 1831 __ movsxlq( | |
| 1832 kScratchRegister, | |
| 1833 FieldOperand(kScratchRegister, SharedFunctionInfo::kLengthOffset)); | |
| 1834 __ shrq(kScratchRegister, Immediate(1)); | |
| 1835 } | |
| 1836 | |
| 1837 __ cmpp(rax, kScratchRegister); | |
| 1838 __ j(greater_equal, &no_strong_error, Label::kNear); | |
| 1839 | |
| 1840 { | |
| 1841 FrameScope frame(masm, StackFrame::MANUAL); | |
| 1842 EnterArgumentsAdaptorFrame(masm); | |
| 1843 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments); | |
| 1844 } | |
| 1845 | |
| 1846 __ bind(&no_strong_error); | |
| 1847 EnterArgumentsAdaptorFrame(masm); | 1813 EnterArgumentsAdaptorFrame(masm); |
| 1848 ArgumentsAdaptorStackCheck(masm, &stack_overflow); | 1814 ArgumentsAdaptorStackCheck(masm, &stack_overflow); |
| 1849 | 1815 |
| 1850 // Copy receiver and all actual arguments. | 1816 // Copy receiver and all actual arguments. |
| 1851 const int offset = StandardFrameConstants::kCallerSPOffset; | 1817 const int offset = StandardFrameConstants::kCallerSPOffset; |
| 1852 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); | 1818 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); |
| 1853 __ Set(r8, -1); // account for receiver | 1819 __ Set(r8, -1); // account for receiver |
| 1854 | 1820 |
| 1855 Label copy; | 1821 Label copy; |
| 1856 __ bind(©); | 1822 __ bind(©); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2743 __ ret(0); | 2709 __ ret(0); |
| 2744 } | 2710 } |
| 2745 | 2711 |
| 2746 | 2712 |
| 2747 #undef __ | 2713 #undef __ |
| 2748 | 2714 |
| 2749 } // namespace internal | 2715 } // namespace internal |
| 2750 } // namespace v8 | 2716 } // namespace v8 |
| 2751 | 2717 |
| 2752 #endif // V8_TARGET_ARCH_X64 | 2718 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |